/* Local destinations for the public Fandango navigation, captured September 4, 2026. */ let navState={cart:[],library:[],theaters:[]}; let storeSlide=0,streamSlide=0,newsCount=8; const navProducts=NAV_DATA.store.products; function localAnchor(href,label,cls='',accessible=''){return `${label}`;} function navSvg(name){ const paths={search:'',account:'',cart:'',heart:'',play:''}; return ``; } function bindNavigationChrome(){ root.querySelectorAll('[data-home-notice]').forEach(b=>b.onclick=()=>homeDialog(`

${b.dataset.homeNotice==='privacy'?'Your Privacy Choices':'Feedback'}

This is a local recreation. No information is sent to Fandango.

`)); } async function navUpdate(action){navState=await api('/api/navigation/state',{method:'POST',body:JSON.stringify(action)});return navState;} function navNotice(title,message){homeDialog(`

${esc(title)}

${esc(message)}

`);} function storeHref(href){ const u=new URL(href,'https://store.fandango.com'); if(u.pathname.startsWith('/products/')||u.pathname.startsWith('/collections/')||u.pathname.startsWith('/pages/'))return '/fanstore'+u.pathname; if(u.pathname==='/account')return '/account'; return '/fanstore'; } function storeHeader(){ return `
${NAV_DATA.store.brands.map((b,i)=>localAnchor(i===0?'/movies':`/fanstore/collections/all?brand=${encodeURIComponent(b.title)}`,`${esc(b.title)}`)).join('')}
Sign up for the Fandango FanStore newsletter and save 15% on your first order!
${localAnchor('/fanstore',`Fandango FanStore`,'store-logo')}
${localAnchor('/account',navSvg('account'),'store-account','Account')}${localAnchor('/fanstore/cart',`${navSvg('cart')}${navState.cart.reduce((n,l)=>n+l.quantity,0)||''}`,'store-cart','Shopping bag')}
`; } function storeFooter(){ return `

15% OFF FOR OUR SUPER FANS

Sign up for the Fandango FanStore newsletter and SAVE 15% on your first order!

Local preview only. No subscription or email will be sent.

${NAV_DATA.store.footer.map(c=>`

${esc(c.title)}

${c.links.length?c.links.map(l=>localAnchor(l.href.startsWith('http')?'/help':storeHref(l.href),esc(l.title))).join(''):`

${esc(c.text.replace(c.title,''))}

`}
`).join('')}
`; } function storeLayout(content){ document.body.className='fanstore-page';root.innerHTML=storeHeader()+`
${content}
`+storeFooter();bindGlobal(); root.querySelector('[data-store-search]').onclick=()=>{const d=homeDialog('

Search FanStore

');d.querySelector('form').onsubmit=e=>{e.preventDefault();const q=new FormData(e.currentTarget).get('q');d.close();go(`/fanstore/collections/all?q=${encodeURIComponent(q)}`);};d.querySelector('input').focus();}; root.querySelector('[data-newsletter]').onsubmit=e=>{e.preventDefault();navNotice('Newsletter preview','This local recreation does not subscribe you or send your email to a mailing list.');}; } function productCard(p){return `
${localAnchor('/fanstore/products/'+p.id,`
${esc(p.title)}${!p.available?'Sold Out':p.tags.includes('New')?'New':''}

${esc(p.title)}

${money(p.price)}

`)}
`;} function bindProductCards(){root.querySelectorAll('[data-quick]').forEach(b=>b.onclick=()=>{const p=navProducts.find(p=>p.id===b.dataset.quick);const d=homeDialog(`
${esc(p.title)}

${esc(p.title)}

${money(p.price)}

${esc(p.description.slice(0,250))}

${localAnchor('/fanstore/products/'+p.id,'View full details','primary')}
`);d.querySelector('[data-link]').onclick=e=>{e.preventDefault();d.close();go('/fanstore/products/'+p.id);};});} function storeHero(){const s=NAV_DATA.store.slides[storeSlide];return `
${esc(s.title)}

NEW!

${esc(s.title)}

${localAnchor(storeHref(s.href),esc(s.cta),'store-buy')}
`;} function storeHome(){ const tiles=NAV_DATA.store.tiles; storeLayout(storeHero()+`
${tiles.slice(0,2).map(t=>localAnchor(storeHref(t.href),`${esc(t.title)}${esc(t.title)}`)).join('')}

FAN FAVORITES

${tiles.slice(2).map(t=>localAnchor(storeHref(t.href),`${esc(t.title)}${esc(t.title)}`)).join('')}

TRENDING

`); root.querySelectorAll('[data-store-slide]').forEach(b=>b.onclick=()=>{storeSlide=(storeSlide+Number(b.dataset.storeSlide)+2)%2;storeHome();});root.querySelectorAll('[data-store-dot]').forEach(b=>b.onclick=()=>{storeSlide=Number(b.dataset.storeDot);storeHome();});bindRows();bindProductCards(); } function storeCollection(handle){ const q=new URLSearchParams(location.search),search=q.get('q')||'',type=q.get('type')||'',brand=q.get('brand')||'',sort=q.get('sort')||'featured';let rows=[...navProducts]; const terms={'mando-grogu-glass-set':'Mandalorian','jaws':'Jaws','golf-1':'golf','fandango-we-love-free':'We Love Free','movie-bundles':'bundle','practical-magic-2':'Practical Magic 2'}; const term=(search||terms[handle]||'').toLowerCase();if(term)rows=rows.filter(p=>(p.title+' '+p.type+' '+p.tags.join(' ')).toLowerCase().includes(term));if(type)rows=rows.filter(p=>p.type===type);if(brand)rows=rows.filter(p=>p.brand.toLowerCase()===brand.toLowerCase());if(q.has('sale'))rows=rows.filter(p=>p.tags.some(t=>/sale/i.test(t))); if(q.get('available'))rows=rows.filter(p=>p.available);if(q.get('max'))rows=rows.filter(p=>p.price<=Number(q.get('max'))); if(sort==='price-ascending')rows.sort((a,b)=>a.price-b.price);else if(sort==='price-descending')rows.sort((a,b)=>b.price-a.price);else if(sort==='title')rows.sort((a,b)=>a.title.localeCompare(b.title));else if(sort==='featured')rows.sort((a,b)=>{const ai=NAV_DATA.store.featuredOrder.indexOf(a.id),bi=NAV_DATA.store.featuredOrder.indexOf(b.id);return (ai<0?999:ai)-(bi<0?999:bi);}); const page=Math.max(1,Math.min(Number(q.get('page'))||1,Math.ceil(rows.length/24)||1)); storeLayout(`

${search?`Search results for “${esc(search)}”`:esc(terms[handle]||'All')}

${rows.length} products
${rows.slice((page-1)*24,page*24).map(productCard).join('')||'

No products found. Try another search or clear the filters.

'}
`); root.querySelector('.store-filters').onsubmit=e=>{e.preventDefault();go(`/fanstore/collections/${handle}?${new URLSearchParams(new FormData(e.currentTarget))}`);};bindProductCards(); } function storeProduct(id){ const p=navProducts.find(p=>p.id===id);if(!p){notFound();return;} const selected=new URLSearchParams(location.search).get('variant');let variant=p.variants.find(v=>v.id===selected)||p.variants.find(v=>v.available)||p.variants[0];const pictures=[...new Set([p.image,...p.images])]; storeLayout(`

${esc(p.brand)}

${esc(p.title)}

${money(variant?.price??p.price)}

${p.options.filter(o=>o.name!=='Title').map((o,i)=>``).join('')}

Local shopping bag preview. No order or payment is placed.

Product Details

${esc(p.description||'Product specifications were not returned by the source during this capture. The displayed title, image and price are from the verified catalog.')}

`); root.querySelectorAll('[data-product-image]').forEach(b=>b.onclick=()=>root.querySelector('.store-detail-image').src=b.dataset.productImage); root.querySelectorAll('[data-variant-option]').forEach(s=>s.onchange=()=>{const values=[...root.querySelectorAll('[data-variant-option]')].map(s=>s.value);variant=p.variants.find(v=>v.options.every((o,i)=>o===values[i]));const button=root.querySelector('.store-add');button.disabled=!variant?.available;button.textContent=variant?(variant.available?'Add to cart':'Sold out'):'Option unavailable in this preview';if(variant?.image)root.querySelector('.store-detail-image').src=variant.image;root.querySelector('.store-price').textContent=money(variant?.price??p.price);if(variant)history.replaceState({},'',`/fanstore/products/${id}?variant=${variant.id}`);}); root.querySelector('[data-add-cart]').onsubmit=async e=>{e.preventDefault();if(!variant?.available)return;try{const existing=navState.cart.find(l=>l.variant===variant.id)?.quantity||0;await navUpdate({kind:'cart',product:id,variant:variant.id,quantity:existing+Number(new FormData(e.currentTarget).get('quantity'))});go('/fanstore/cart');}catch(err){notify(err.message);}}; } function storeCart(){ storeLayout(`

Your cart

${navState.cart.length?`
${navState.cart.map(l=>`
${localAnchor('/fanstore/products/'+l.product,`${esc(l.title)}`)}
${localAnchor('/fanstore/products/'+l.product,esc(l.title))}

${l.option==='Default Title'?'':esc(l.option)}

${money(l.price)}

${money(l.price*l.quantity)}
`).join('')}

Subtotal ${money(navState.subtotal)}

Shipping and taxes are not calculated in this local preview.

Shopping bag saved locally. Real checkout is not connected.

${localAnchor('/fanstore/collections/all','Continue shopping','primary')}
`:`

Your cart is empty

${localAnchor('/fanstore/collections/all','Continue shopping','primary')}`}
`); const update=async(id,quantity)=>{const l=navState.cart.find(l=>l.variant===id);try{await navUpdate({kind:'cart',product:l.product,variant:id,quantity});storeCart();}catch(e){notify(e.message);}}; root.querySelectorAll('[data-cart-quantity]').forEach(input=>input.onchange=()=>update(input.dataset.cartQuantity,Number(input.value)));root.querySelectorAll('[data-remove]').forEach(b=>b.onclick=()=>update(b.dataset.remove,0)); } function bindRows(){root.querySelectorAll('[data-scroll-row]').forEach(row=>{const track=row.firstElementChild;const buttons=row.querySelectorAll('[data-row-step]');const update=()=>buttons.forEach(b=>b.disabled=Number(b.dataset.rowStep)<0?track.scrollLeft<1:track.scrollLeft>=track.scrollWidth-track.clientWidth-2);buttons.forEach(b=>b.onclick=()=>track.scrollBy({left:Number(b.dataset.rowStep)*track.clientWidth*.85,behavior:'smooth'}));track.onscroll=update;update();});} function streamHeader(){return `
${localAnchor('/streaming',`Fandango Stream`,'stream-logo')}
${localAnchor('/account',homeIcon('fanclub')+'FanClub')}${localAnchor('/movies',homeIcon('movies')+'Buy Tickets')}${localAnchor('/help#gift-cards',homeIcon('gift')+'Gift Cards')}${localAnchor('/fanstore',homeIcon('fanstore')+'FanStore')}${localAnchor('/account',homeIcon('account')+'Sign In')}
`;} function streamLayout(content){document.body.className='streaming-page';root.innerHTML=streamHeader()+`
${content}
${[['Watch',[['Movies','/streaming?category=movies'],['TV','/streaming?category=tv'],['Free','/streaming']]],['My Account',[['My Library','/streaming/library'],['Account','/account'],['Sign In','/account/login']]],['Features',[['FanClub','/account'],['Gift Cards','/help#gift-cards']]],['Help',[['Support','/help'],['Privacy Policy','/policies/privacy-policy'],['Terms of Use','/policies/terms-of-use']]]].map(([h,links])=>`

${h}

${links.map(([t,h])=>localAnchor(h,t)).join('')}
`).join('')}

WebsiteBench offline recreation. Not the official streaming service. Full-length films are not included.

`;bindGlobal();root.querySelector('[data-stream-search]').onclick=()=>{const d=homeDialog('

Search movies and TV

');d.querySelector('form').onsubmit=e=>{e.preventDefault();const q=new FormData(e.currentTarget).get('q');d.close();go('/streaming?q='+encodeURIComponent(q));};};} function streamMovies(){const rows=[...NAV_DATA.streaming.rows.flatMap(r=>r.movies),...HOME_DATA.free.map(m=>({...m,id:m.href.split('/').pop()}))];return [...new Map(rows.map(m=>[m.id,m])).values()];} function streamRow(title,rows,wide=false){return `

${esc(title)}

${rows.map(m=>localAnchor('/streaming/movies/'+m.id,`
${esc(m.title)}Free to Watch
`)).join('')}
`;} function streamHero(s,detail=false){return `
${s.logo?`${esc(s.title)}`:`

${esc(s.title)}

`}

${esc(s.metadata||'')}

${esc(s.description||'')}

${detail?``:localAnchor('/streaming/movies/'+s.id,'Details')}
${!detail?``:''}
`;} function bindStreaming(){bindRows();root.querySelectorAll('[data-stream-slide]').forEach(b=>b.onclick=()=>{streamSlide=(streamSlide+Number(b.dataset.streamSlide)+NAV_DATA.streaming.slides.length)%NAV_DATA.streaming.slides.length;streamHome();});root.querySelectorAll('[data-stream-dot]').forEach(b=>b.onclick=()=>{streamSlide=Number(b.dataset.streamDot);streamHome();});root.querySelectorAll('[data-watch]').forEach(b=>b.onclick=()=>navNotice('Watch preview','This local recreation does not include the licensed full-length movie. No streaming purchase, rental or subscription will be started.'));root.querySelectorAll('[data-library]').forEach(b=>b.onclick=async()=>{try{await navUpdate({kind:'library',id:b.dataset.library});b.textContent=navState.library.includes(b.dataset.library)?'✓ In My Library':'+ Add to My Library';}catch(e){notify(e.message);}});} function streamHome(){const q=new URLSearchParams(location.search),term=q.get('q'),category=q.get('category');let rows=streamMovies();if(term)rows=rows.filter(m=>m.title.toLowerCase().includes(term.toLowerCase()));if(category==='tv')rows=rows.filter(m=>/season/i.test(m.title));if(category==='movies')rows=rows.filter(m=>!/season/i.test(m.title));if(term||category){streamLayout(`

${term?`Search: ${esc(term)}`:category==='tv'?'TV':category==='rent'?'Rent & Buy':'Movies'}

${category==='rent'?'

The captured source opened the free catalog. Rental offers and prices were not available in this snapshot.

':''}${streamRow(term?'Search results':'Browse titles',rows)}${!rows.length?'

No matching titles.

':''}
`);}else streamLayout(streamHero(NAV_DATA.streaming.slides[streamSlide])+NAV_DATA.streaming.rows.map(r=>streamRow(r.title,r.movies,r.wide)).join(''));bindStreaming();} function streamDetail(id){const hero=NAV_DATA.streaming.slides.find(m=>m.id===id),movie=streamMovies().find(m=>m.id===id);if(!hero&&!movie){notFound();return;}streamLayout(hero?streamHero(hero,true):`
${esc(movie.title)}

${esc(movie.title)}

Free to Watch

`);bindStreaming();} let newsResizeObserver; function bindNewsGrid(){const grid=root.querySelector('.news-grid');const align=()=>{const css=getComputedStyle(grid),gap=parseFloat(css.rowGap),step=parseFloat(css.gridAutoRows)+gap;grid.querySelectorAll('article').forEach(card=>card.style.gridRowEnd='span '+Math.ceil((card.getBoundingClientRect().height+gap)/step));};grid.querySelectorAll('img').forEach(img=>img.addEventListener('load',align));newsResizeObserver?.disconnect();newsResizeObserver=new ResizeObserver(align);newsResizeObserver.observe(grid);document.fonts.ready.then(align);align();} function newsPage(){layout(`

Movie News

${homeCarousel('news-now','Now Playing',HOME_DATA.now)}${homeCarousel('news-features','Features',NAV_DATA.news.features,'',true)}

Latest News

${NAV_DATA.news.articles.slice(0,newsCount).map(a=>`
${localAnchor(homeHref(a.href),`

${esc(a.title)}

`)}
`).join('')}
${newsCountLoad More Features':''}
${newsBottom()}`);bindHomeCarousel();bindNewsGrid();root.querySelector('[data-news-more]')?.addEventListener('click',()=>{const y=scrollY;newsCount+=8;newsPage();window.scrollTo(0,y);});} function newsBottom(){return `

NEW & COMING SOON

${HOME_DATA.newSoon.map(m=>homeLink(m.href,`${esc(m.title)}`)).join('')}
`;} function newsDetail(path){const items=[...NAV_DATA.news.articles,...NAV_DATA.news.features,...HOME_DATA.features];const item=items.find(a=>new URL(a.href,HOME_DATA.source).pathname===path);if(!item){notFound();return;}const detail=NAV_DATA.news.details?.[path];layout(`

${localAnchor('/movie-news','Movie News')}

${esc(item.title)}

${detail?``:''}${esc(item.title)}${detail?detail.paragraphs.map(p=>`

${esc(p)}

`).join(''):`

${esc(item.description||'')}

`}${path.startsWith('/movie-trailer')?'':''}${!detail?'

This preview includes the captured cover and headline. The full article or licensed video was not available in the source capture.

':''}
${newsBottom()}`);root.querySelector('[data-news-video]')?.addEventListener('click',()=>navNotice('Video preview','The original video media was not available for local playback. This page will not redirect you to the official site.'));} function localTheaters(id){ const q=new URLSearchParams(location.search),onlySaved=q.get('filter')==='my-theaters',selected=q.get('theater')||id||'',chain=q.get('chain')||'',date=q.get('date')||NAV_DATA.theaters.date;let rows=NAV_DATA.theaters.rows; if(selected)rows=rows.filter(t=>t.id===selected);if(chain)rows=rows.filter(t=>t.name.startsWith(chain));if(onlySaved)rows=rows.filter(t=>navState.theaters.includes(t.id)); layout(`

${id?esc(rows[0]?.name||'Theaters'): 'Movie times + Tickets near 90001'}

${localAnchor('/theaters?zip=90001','Fandango Ticketing Theaters',!onlySaved?'selected':'')}${localAnchor('/theaters?zip=90001&filter=my-theaters','My theaters',onlySaved?'selected':'')}
${NAV_DATA.theaters.dates.map(d=>d.date).map(d=>localAnchor(`/theaters?zip=90001&date=${d}`,`${longDate(d)}`,date===d?'selected':'')).join('')}
${rows.map(t=>{const dated=date===NAV_DATA.theaters.date?t.movies:NAV_DATA.theaters.otherDates?.[date]?.find(r=>r.id===t.id)?.movies||[];return `

${localAnchor('/theaters/local/'+t.id,esc(t.name))}

${esc(t.address)} ${esc(t.distance)}

·
${dated.map(m=>`
${homeLink(m.href,`${esc(m.title)}`)}

${homeLink(m.href,esc(m.title))}

${esc(m.metadata)}

${m.groups.map(g=>`

${esc(g.format)}

${esc(g.amenities)}

${g.times.map(v=>``).join('')}
`).join('')}
`).join('')||'

No showtimes were returned for this theater in the selected date capture.

'}
`;}).join('')||'

No theaters match the selected filters.

'}
`); root.querySelector('[data-location]').onclick=()=>homeLocationDialog(zip=>go('/theaters?zip='+zip));const change=()=>{const query=new URLSearchParams({zip:'90001',date,theater:root.querySelector('[data-theater-filter]').value,chain:root.querySelector('[data-chain-filter]').value});go('/theaters?'+query);};root.querySelector('[data-theater-filter]').onchange=change;root.querySelector('[data-chain-filter]').onchange=change; root.querySelectorAll('[data-amenities]').forEach(b=>b.onclick=()=>{const t=NAV_DATA.theaters.rows.find(t=>t.id===b.dataset.amenities);navNotice(t.name+' — Amenities',t.amenities.join(' · '));});root.querySelectorAll('[data-map]').forEach(b=>b.onclick=()=>{const t=NAV_DATA.theaters.rows.find(t=>t.id===b.dataset.map);navNotice(t.name,t.address+' · '+t.distance+' from 90001. An external map is not loaded in this offline preview.');});root.querySelectorAll('[data-save-theater]').forEach(b=>b.onclick=async()=>{try{await navUpdate({kind:'theaters',id:b.dataset.saveTheater});localTheaters(id);}catch(e){notify(e.message);}}); root.querySelectorAll('[data-local-showtime]').forEach(b=>b.onclick=()=>navNotice(b.dataset.movie,`${longDate(date)} · ${b.dataset.time}. This captured Los Angeles showtime has no verified ticket-price or seat inventory in the local preview. No real booking will be made.`)); } function referenceMovie(id){const m=[...HOME_DATA.now,...HOME_DATA.soon,...HOME_DATA.newSoon].find(m=>new URL(m.href,HOME_DATA.source).pathname.includes('/'+id+'/'));if(!m){notFound();return;}layout(`
${esc(m.title)}

${esc(m.title)}

${localAnchor('/theaters?zip='+homeZip,'See nearby theater showtimes','primary')}

The poster and title match the captured homepage. Additional movie details were not included in this source snapshot.

`);} async function navigationRoute(path){ if(path==='/theaters'){const zip=new URLSearchParams(location.search).get('zip')||'10003';if(['90001','10003'].includes(zip)){homeZip=zip;localStorage.setItem('fandango-home-zip',zip);}} if(!(/^(\/fanstore|\/streaming|\/movie-news|\/movie-photos|\/movie-trailer|\/theaters\/local|\/movies\/reference)/.test(path)||(path==='/theaters'&&new URLSearchParams(location.search).get('zip')==='90001')))return false; navState=await api('/api/navigation/state'); if(path==='/fanstore')storeHome();else if(path==='/fanstore/cart')storeCart();else if(path.startsWith('/fanstore/products/'))storeProduct(path.split('/')[3]);else if(path.startsWith('/fanstore/collections/'))storeCollection(path.split('/')[3]);else if(path.startsWith('/fanstore/pages/')){storeLayout(`

${esc(path.split('/').pop().replaceAll('-',' '))}

Real store policies do not apply to this offline shopping preview.

${localAnchor('/help','Local help and information')}
`);}else if(path==='/streaming')streamHome();else if(path==='/streaming/library'){streamLayout(`

My Library

${streamRow('Saved titles',streamMovies().filter(m=>navState.library.includes(m.id)))}${!navState.library.length?'

Your library is empty. Add a title from its details page.

':''}
`);bindStreaming();}else if(path.startsWith('/streaming/movies/'))streamDetail(path.split('/')[3]);else if(path==='/movie-news')newsPage();else if(/^\/movie-(news|photos|trailer)\//.test(path))newsDetail(path);else if(path.startsWith('/movies/reference/'))referenceMovie(path.split('/')[3]);else localTheaters(path.startsWith('/theaters/local/')?path.split('/')[3]:null); return true; }