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.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.51.2.\n * Original file: /gh/ShopBestest/bestest-web@d326c33/js/zip-pill.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function(){if(document.getElementById('bst-zip-pill-styles'))return;var s=document.createElement('style');s.id='bst-zip-pill-styles';s.textContent=\"/* Shared zip pill styles \\u2014 homepage hero + SRP filter bar */\\n\\n.bst-zip-pill {\\n  display: inline-flex;\\n  align-items: center;\\n  gap: 4px;\\n  font-size: 12px;\\n  color: #217b49;\\n  font-weight: 600;\\n  cursor: pointer;\\n  user-select: none;\\n  line-height: 1;\\n  padding: 5px 11px;\\n  white-space: nowrap;\\n  position: relative;\\n  border-radius: 14px;\\n  background: transparent;\\n  border: none;\\n  font-family: inherit;\\n  outline: none;\\n}\\n.bst-zip-pill:hover .bst-zip-display,\\n.bst-zip-pill:hover .bst-zip-pin { opacity: 0.75; transition: opacity 0.15s; }\\n.bst-zip-pill:focus-visible { outline: 2px solid #217b49; outline-offset: 2px; }\\n.bst-zip-pill svg.bst-zip-pin { width: 11px; height: 11px; flex-shrink: 0; }\\n.bst-zip-pill .bst-zip-display { font-variant-numeric: tabular-nums; }\\n\\n@media (max-width: 767px) {\\n  #bst-srp-zip-pill-desktop { display: none !important; }\\n  #bst-srp-zip-pill-mobile { display: inline-flex; padding: 0; }\\n}\\n@media (min-width: 768px) {\\n  #bst-srp-zip-pill-mobile { display: none !important; }\\n}\\n\\n.bst-zip-flyout {\\n  position: fixed;\\n  background: #fff;\\n  border: 1px solid #e0e0e0;\\n  border-radius: 12px;\\n  box-shadow: 0 8px 24px rgba(0,0,0,0.10);\\n  padding: 14px;\\n  min-width: 220px;\\n  z-index: 99999;\\n  display: none;\\n  cursor: default;\\n  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;\\n}\\n.bst-zip-flyout.bst-zip-flyout-open { display: block; }\\n.bst-zip-flyout-label {\\n  display: block;\\n  font-size: 11px;\\n  font-weight: 700;\\n  text-transform: uppercase;\\n  letter-spacing: 0.06em;\\n  color: #6b7280;\\n  margin-bottom: 8px;\\n}\\n.bst-zip-flyout input[type=\\\"text\\\"] {\\n  width: 100%;\\n  padding: 9px 12px;\\n  border: 1px solid #d0d0d0;\\n  border-radius: 8px;\\n  font-size: 14px;\\n  font-family: inherit;\\n  color: #1a1a1a;\\n  box-sizing: border-box;\\n  font-variant-numeric: tabular-nums;\\n  outline: none;\\n  transition: border-color 0.15s;\\n}\\n.bst-zip-flyout input[type=\\\"text\\\"]:focus { border-color: #217b49; }\\n.bst-zip-flyout input[type=\\\"text\\\"].bst-zip-error { border-color: #c0392b; }\\n.bst-zip-flyout .bst-zip-error-msg {\\n  font-size: 11px;\\n  color: #c0392b;\\n  margin-top: 4px;\\n  min-height: 14px;\\n}\\n.bst-zip-save {\\n  display: block;\\n  width: 100%;\\n  margin-top: 6px;\\n  padding: 9px 12px;\\n  background: #217b49;\\n  color: #fff;\\n  border: none;\\n  border-radius: 8px;\\n  font-size: 13px;\\n  font-weight: 600;\\n  font-family: inherit;\\n  cursor: pointer;\\n  transition: background 0.15s;\\n}\\n.bst-zip-save:hover { background: #155539; }\\n.bst-zip-divider {\\n  display: flex;\\n  align-items: center;\\n  text-align: center;\\n  margin: 10px 0 8px;\\n  color: #6b7280;\\n  font-size: 11px;\\n  letter-spacing: 0.04em;\\n}\\n.bst-zip-divider::before,\\n.bst-zip-divider::after {\\n  content: \\\"\\\";\\n  flex: 1;\\n  border-top: 1px solid #eee;\\n}\\n.bst-zip-divider span { padding: 0 10px; }\\n.bst-zip-detect {\\n  display: flex;\\n  align-items: center;\\n  justify-content: center;\\n  gap: 6px;\\n  width: 100%;\\n  padding: 8px 12px;\\n  background: transparent;\\n  color: #1a1a1a;\\n  border: 1px solid #e0e0e0;\\n  border-radius: 8px;\\n  font-size: 13px;\\n  font-weight: 500;\\n  font-family: inherit;\\n  cursor: pointer;\\n  transition: background 0.15s, border-color 0.15s;\\n}\\n.bst-zip-detect:hover { background: #f5f5f5; border-color: #c0c0c0; }\\n.bst-zip-detect:disabled { opacity: 0.6; cursor: not-allowed; }\\n.bst-zip-detect svg { width: 13px; height: 13px; flex-shrink: 0; }\\n.bst-zip-detect.bst-zip-detect-loading svg { animation: bst-zip-spin 0.8s linear infinite; }\\n@keyframes bst-zip-spin { to { transform: rotate(360deg); } }\\n\\n@media (max-width: 767px) {\\n  .bst-zip-flyout {\\n    min-width: 240px;\\n    max-width: calc(100vw - 32px);\\n  }\\n}\\n\";(document.head||document.documentElement).appendChild(s);})();\n(function() {\n  (function() {\n    if (document.getElementById('bst-zip-modal-styles')) return;\n    var ms = document.createElement('style');\n    ms.id = 'bst-zip-modal-styles';\n    ms.textContent =\n      '.bst-zip-backdrop{position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:99998;display:none;align-items:center;justify-content:center;padding:16px;}' +\n      '.bst-zip-backdrop.bst-zip-backdrop-open{display:flex;}' +\n      '.bst-zip-flyout{position:static !important;transform:none !important;top:auto !important;left:auto !important;right:auto !important;bottom:auto !important;width:100% !important;max-width:320px !important;min-width:0 !important;margin:0 !important;}' +\n      '.bst-zip-flyout-close{position:absolute;top:6px;right:8px;width:28px;height:28px;border:none;background:transparent;color:#999;font-size:20px;line-height:1;cursor:pointer;padding:0;}';\n    (document.head || document.documentElement).appendChild(ms);\n  })();\n  var DEFAULT_ZIP = '92868';\n  var DEFAULT_LAT = 33.7875;\n  var DEFAULT_LNG = -117.8776;\n  var DEFAULT_CITY = 'Orange';\n  var STORAGE_ZIP = 'bst_user_zip';\n  var STORAGE_ZIP_LATLNG_PREFIX = 'bst_zip_latlng_';\n  var STORAGE_ZIP_CITY_PREFIX = 'bst_zip_city_v2_';\n  var STORAGE_COVERAGE_SEEN = 'bst_coverage_notice_seen';\n  // GA4 audience band, written whenever the visitor's location resolves and read by the\n  // site-head gtag config on every later page load (user property `audience`). Bands are\n  // distance from Newport Coast: local <=50 mi, socal <=150 mi, us, or non_us (Worker ?geo\n  // said the country is not US). Defines \"locals vs the rest\" from what the site itself\n  // knows about the visitor instead of GA4's own IP city, which disagrees with Cloudflare's.\n  var STORAGE_AUDIENCE = 'bst_audience';\n  var IPAPI_URL = 'https://ipapi.co/json/';\n  var ZIPPOPOTAMUS_URL = 'https://api.zippopotam.us/us/';\n  // Geo lookups go to the feed Worker first (GeoNames zip table + Cloudflare's request.cf);\n  // ipapi / zippopotam / bigdatacloud stay as the fallback when the Worker call fails.\n  var FEED_URL = (typeof window.BS_FEED_URL === 'string' && window.BS_FEED_URL) || 'https://bestest-inventory-feed.sweet-paper-5a21.workers.dev/';\n\n  // Coverage area: within COVERAGE_RADIUS_MI of 92657 (Newport Coast). Used only to show\n  // an informational \"outside coverage\" note — it never filters inventory. 50 mi (was 30)\n  // because carrier IPs for OC phones geolocate to the gateway city, often Los Angeles at\n  // ~38 mi, which tripped the overlay for in-area visitors on cellular (10/28).\n  var COVERAGE_CENTER_LAT = 33.5943, COVERAGE_CENTER_LNG = -117.8334, COVERAGE_RADIUS_MI = 50;\n\n  var PIN_SVG = '<svg class=\"bst-zip-pin\" width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\"></path><circle cx=\"12\" cy=\"10\" r=\"3\"></circle></svg>';\n  var DETECT_PIN_SVG = '<svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\"></path><circle cx=\"12\" cy=\"10\" r=\"3\"></circle></svg>';\n  var SPINNER_SVG = '<svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"><path d=\"M21 12a9 9 0 1 1-6.219-8.56\"></path></svg>';\n  var COV_PIN_SVG = '<svg width=\"26\" height=\"26\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#217b49\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\"></path><circle cx=\"12\" cy=\"10\" r=\"3\"></circle></svg>';\n\n  function getCurrentZip() { return localStorage.getItem(STORAGE_ZIP) || DEFAULT_ZIP; }\n\n  // Crawlers render from Google/Bing IPs (often far outside our coverage), so without this\n  // their renderer could IP-detect out-of-range and paint the overlay into the DOM Google\n  // evaluates — an on-load modal reads as an \"intrusive interstitial\". Suppressing a popup\n  // by bot UA is not cloaking (page content is identical); we also skip IP-detect for bots.\n  function isCrawler() {\n    var ua = (navigator && navigator.userAgent) || '';\n    return /bot|crawl|spider|slurp|google-inspectiontool|googleother|storebot|adsbot|mediapartners|bingpreview|duckduckbot|baiduspider|yandex|facebookexternalhit|twitterbot|slackbot|whatsapp|linkedinbot|embedly|pinterest|lighthouse|headlesschrome|pagespeed/i.test(ua);\n  }\n\n  // The zip module renders as a centered modal (always front-and-center wherever the pill\n  // sits) over a shared dimming backdrop, instead of a popover anchored to the pill.\n  function bstHideBackdrop() { var b = document.getElementById('bst-zip-backdrop'); if (b) b.classList.remove('bst-zip-backdrop-open'); }\n  function bstCloseAllFlyouts() {\n    document.querySelectorAll('.bst-zip-flyout.bst-zip-flyout-open').forEach(function(f) { f.classList.remove('bst-zip-flyout-open'); });\n    bstHideBackdrop();\n  }\n  function bstGetBackdrop() {\n    var b = document.getElementById('bst-zip-backdrop');\n    if (!b) {\n      b = document.createElement('div');\n      b.id = 'bst-zip-backdrop';\n      b.className = 'bst-zip-backdrop';\n      (document.body || document.documentElement).appendChild(b);\n      b.addEventListener('click', bstCloseAllFlyouts);\n    }\n    return b;\n  }\n\n  // The pill shows a place name, not a raw zip, everywhere. We cache each zip's city\n  // name as we resolve it (default, IP, manual entry, geolocation) and look it up lazily\n  // for any zip we don't have yet.\n  function saveZipCity(zip, city) { if (city) localStorage.setItem(STORAGE_ZIP_CITY_PREFIX + zip, city); }\n  function getZipCity(zip) { return localStorage.getItem(STORAGE_ZIP_CITY_PREFIX + zip); }\n  function getCurrentCity() {\n    var zip = getCurrentZip();\n    return getZipCity(zip) || (zip === DEFAULT_ZIP ? DEFAULT_CITY : null);\n  }\n  var cityInFlight = {};\n  function ensureCity(zip) {\n    var have = getZipCity(zip);\n    if (have) return Promise.resolve(have);\n    if (zip === DEFAULT_ZIP) { saveZipCity(zip, DEFAULT_CITY); return Promise.resolve(DEFAULT_CITY); }\n    if (cityInFlight[zip]) return cityInFlight[zip];\n    var p = lookupZipPlace(zip)\n      .then(function(place) {\n        var c = place ? place.city : null;\n        if (c) saveZipCity(zip, c);\n        return c;\n      })\n      .catch(function() { return null; });\n    cityInFlight[zip] = p;\n    return p;\n  }\n  // Resolve the current zip's city (if unknown) then repaint the pills.\n  function refreshCityLabel() {\n    if (getCityMode()) return;\n    ensureCity(getCurrentZip()).then(function() { refreshAllPills(); });\n  }\n\n  function getCachedLatLng(zip) {\n    var raw = localStorage.getItem(STORAGE_ZIP_LATLNG_PREFIX + zip);\n    if (!raw) return null;\n    var p = raw.split(','); var lat = parseFloat(p[0]), lng = parseFloat(p[1]);\n    return (isNaN(lat) || isNaN(lng)) ? null : { lat: lat, lng: lng };\n  }\n  function getCurrentLatLng() { return getCachedLatLng(getCurrentZip()); }\n  function haversineMiles(lat1, lng1, lat2, lng2) {\n    var R = 3958.8, toRad = Math.PI / 180;\n    var dLat = (lat2 - lat1) * toRad, dLng = (lng2 - lng1) * toRad;\n    var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n      Math.cos(lat1 * toRad) * Math.cos(lat2 * toRad) * Math.sin(dLng / 2) * Math.sin(dLng / 2);\n    return R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n  }\n  function isOutOfCoverage(lat, lng) {\n    if (typeof lat !== 'number' || typeof lng !== 'number' || isNaN(lat) || isNaN(lng)) return false;\n    return haversineMiles(lat, lng, COVERAGE_CENTER_LAT, COVERAGE_CENTER_LNG) > COVERAGE_RADIUS_MI;\n  }\n\n  var BROAD_PATH = '/used-cars';\n  // On city/combo pages Webflow sets window.BS_CITY = { name, lat, lng }. When present,\n  // the pill shows the city name and changing location navigates to the broad SRP, so the\n  // canonical city page stays city-anchored and is never personalized to the visitor.\n  function getCityMode() {\n    var c = window.BS_CITY;\n    if (c && typeof c.lat === 'number' && typeof c.lng === 'number' && c.name) return c;\n    return null;\n  }\n  function goToBroadWithZip(zip, lat, lng) {\n    if (lat != null && lng != null) saveZipAndLatLng(zip, lat, lng);\n    // Carry the city/combo page's active filters to the broad SRP so changing location\n    // keeps the user's filters. User-applied filters + sort already live in the current\n    // query string (the engine keeps it in sync); a combo page's defining facets live in\n    // window.BS_PREFILTER and are kept out of the URL, so merge them back in.\n    var params = new URLSearchParams(window.location.search);\n    var pf = window.BS_PREFILTER;\n    if (pf) {\n      ['make', 'model', 'body_style', 'powertrain', 'price', 'miles', 'year'].forEach(function(k) {\n        if (!params.get(k) && Array.isArray(pf[k]) && pf[k].length) params.set(k, pf[k].join(','));\n      });\n    }\n    // City pages default to nearest-first; preserve that intent at the destination.\n    if (getCityMode() && !params.get('sort')) params.set('sort', 'distance-asc');\n    params.set('zip', zip);\n    window.location.href = BROAD_PATH + '?' + params.toString();\n  }\n  function isValidZipFormat(z) { return /^\\d{5}$/.test(z); }\n  function saveZipAndLatLng(zip, lat, lng) {\n    localStorage.setItem(STORAGE_ZIP, zip);\n    if (lat != null && lng != null) {\n      localStorage.setItem(STORAGE_ZIP_LATLNG_PREFIX + zip, lat + ',' + lng);\n      setAudience(audienceBand(lat, lng));\n    }\n  }\n  function audienceBand(lat, lng) {\n    var mi = haversineMiles(lat, lng, COVERAGE_CENTER_LAT, COVERAGE_CENTER_LNG);\n    if (isNaN(mi)) return null;\n    return mi <= COVERAGE_RADIUS_MI ? 'local' : (mi <= 150 ? 'socal' : 'us');\n  }\n  function setAudience(band) {\n    if (!band) return;\n    try {\n      if (localStorage.getItem(STORAGE_AUDIENCE) === band) return;\n      localStorage.setItem(STORAGE_AUDIENCE, band);\n      // The head already applied the stored value at config time; only a change needs a live set.\n      // 2026-11-25: plus one event, so the band reaches GA4 in this session. Without it a one-page\n      // visit (most first-touch research readers) sent only the head's page_view, banded \"unknown\".\n      // Fires once per browser (and on a real band change); not a key event, so engagement is untouched.\n      // 2026-11-27: the band also rides on the event itself. The head passes\n      // user_properties {audience:'unknown'} inside gtag('config'), and config-level values\n      // beat a later gtag('set'), so from 11/26 every audience_set landed as \"unknown\".\n      // Event-level parameters beat config, so this one carries the real band.\n      if (typeof window.gtag === 'function') {\n        window.gtag('set', 'user_properties', { audience: band });\n        window.gtag('event', 'audience_set', { band: band, user_properties: { audience: band } });\n      }\n    } catch (e) {}\n  }\n  function notifyDistanceModule(zip) {\n    if (window.BestestDistance && typeof window.BestestDistance.setUserZip === 'function') window.BestestDistance.setUserZip(zip);\n  }\n\n  // Feed Worker GET: resolves the JSON, or null on a 404 (a definitive \"no such zip / not in\n  // the US\"); rejects on network errors, 5xx and non-geo bodies so the caller falls back.\n  function feedGeo(query) {\n    return fetch(FEED_URL + query).then(function(r) {\n      if (r.status === 404) return null;\n      if (!r.ok) throw new Error('Feed geo ' + r.status);\n      return r.json();\n    }).then(function(data) {\n      if (data && !('zip' in data)) throw new Error('Feed geo: not a geo answer');\n      return data;\n    });\n  }\n\n  // Zip -> { lat, lng, city } (null for an unknown zip). Worker first, zippopotam on failure.\n  function lookupZipPlace(zip) {\n    return feedGeo('?zip=' + zip).catch(function() {\n      return fetch(ZIPPOPOTAMUS_URL + zip)\n        .then(function(r) { return r.ok ? r.json() : null; })\n        .then(function(data) {\n          var pl = (data && data.places && data.places[0]) || null;\n          return pl ? { lat: parseFloat(pl.latitude), lng: parseFloat(pl.longitude), city: pl['place name'] } : null;\n        });\n    });\n  }\n\n  function lookupZipCoords(zip) {\n    var cached = localStorage.getItem(STORAGE_ZIP_LATLNG_PREFIX + zip);\n    if (cached) { var p = cached.split(','); return Promise.resolve({ lat: parseFloat(p[0]), lng: parseFloat(p[1]) }); }\n    return lookupZipPlace(zip).then(function(place) {\n      if (!place) throw new Error('Invalid zip');\n      saveZipCity(zip, place.city);\n      return { lat: place.lat, lng: place.lng };\n    });\n  }\n\n  // First-visit zip from the visitor's IP: the Worker's ?geo (request.cf, US only, zip-center\n  // lat/lng and the GeoNames place name), or ipapi.co when the Worker call fails.\n  function ipAutoDetect() {\n    return fetch(FEED_URL + '?geo')\n      .then(function(r) { if (!r.ok) throw new Error('Feed geo ' + r.status); return r.json(); })\n      .then(function(data) { if (!data || !('country' in data)) throw new Error('Feed geo: not a geo answer'); return data; })\n      .catch(function() { return null; })\n      .then(function(data) {\n        if (!data) return ipapiDetect();\n        if (data.country !== 'US') throw new Error('Non-US visitor');\n        if (!data.zip || !isValidZipFormat(data.zip)) throw new Error('No valid postal code');\n        saveZipCity(data.zip, data.city);\n        return { zip: data.zip, lat: data.lat, lng: data.lng, city: data.city };\n      });\n  }\n\n  function ipapiDetect() {\n    return fetch(IPAPI_URL).then(function(r) { return r.json(); }).then(function(data) {\n      if (data.error) throw new Error(data.reason || 'IP lookup failed');\n      if (data.country_code !== 'US') throw new Error('Non-US visitor');\n      if (!data.postal || !isValidZipFormat(data.postal)) throw new Error('No valid postal code');\n      return { zip: data.postal, lat: data.latitude, lng: data.longitude, city: data.city };\n    });\n  }\n\n  function browserGeolocate() {\n    return new Promise(function(resolve, reject) {\n      if (!navigator.geolocation) { reject(new Error('Geolocation not supported')); return; }\n      navigator.geolocation.getCurrentPosition(function(pos) {\n        var lat = pos.coords.latitude, lng = pos.coords.longitude;\n        // Nearest zip from the Worker's table (404 = no US zip near the point); bigdatacloud\n        // only when the Worker call fails.\n        feedGeo('?ll=' + lat.toFixed(4) + ',' + lng.toFixed(4))\n          .then(function(data) {\n            if (!data || !isValidZipFormat(data.zip)) { reject(new Error('Not in US')); return; }\n            saveZipCity(data.zip, data.city);\n            resolve({ zip: data.zip, lat: lat, lng: lng, city: data.city });\n          }, function() {\n            fetch('https://api.bigdatacloud.net/data/reverse-geocode-client?latitude=' + lat + '&longitude=' + lng + '&localityLanguage=en')\n              .then(function(r) { return r.json(); })\n              .then(function(data) {\n                var zip = data.postcode;\n                if (!isValidZipFormat(zip)) { reject(new Error('Could not determine zip from location')); return; }\n                if (data.countryCode !== 'US') { reject(new Error('Not in US')); return; }\n                resolve({ zip: zip, lat: lat, lng: lng, city: data.city || data.locality });\n              })\n              .catch(function(err) { reject(err); });\n          });\n      }, function(err) { reject(new Error(err.message || 'Geolocation denied')); },\n      { timeout: 10000, maximumAge: 600000, enableHighAccuracy: false });\n    });\n  }\n\n  function refreshAllPills() {\n    // City pages keep the pill showing the page city name, never the zip.\n    if (getCityMode()) return;\n    var zip = getCurrentZip();\n    // Everywhere else, show the place name (falling back to the zip until it resolves).\n    var label = getCurrentCity() || zip;\n    document.querySelectorAll('.bst-zip-pill .bst-zip-display').forEach(function(el) { el.textContent = label; var p = el.closest('.bst-zip-pill'); if (p) p.setAttribute('aria-label', 'Change location, currently ' + label); });\n    document.querySelectorAll('.bst-zip-flyout input.bst-zip-input').forEach(function(input) { input.value = zip; });\n  }\n\n  function applyZip(zip, lat, lng, city) {\n    if (!isValidZipFormat(zip)) return Promise.reject(new Error('Invalid zip format'));\n    // NOTE: `city` (from ipapi/bigdatacloud) is intentionally ignored for the display label —\n    // those return imprecise/regional names (e.g. a Costa Mesa IP mislabeled \"Central Coast\").\n    // The GeoNames place name (Worker ?zip/?geo/?ll, or zippopotam on fallback) is the\n    // authoritative zip->place name; those paths save it via saveZipCity before we get here.\n    var coordsPromise;\n    if (lat != null && lng != null) { saveZipAndLatLng(zip, lat, lng); coordsPromise = Promise.resolve({ lat: lat, lng: lng }); }\n    else { coordsPromise = lookupZipCoords(zip).then(function(coords) { saveZipAndLatLng(zip, coords.lat, coords.lng); return coords; }); }\n    return coordsPromise.then(function() { refreshAllPills(); refreshCityLabel(); notifyDistanceModule(zip); });\n  }\n\n  function buildFlyout(zip, cityMode) {\n    var label = cityMode ? 'Shop all cars near you' : 'Zip code';\n    var saveText = cityMode ? 'See all cars' : 'Save';\n    return '<button type=\"button\" class=\"bst-zip-flyout-close\" aria-label=\"Close\">×</button>' +\n      '<span class=\"bst-zip-flyout-label\">' + label + '</span>' +\n      '<input type=\"text\" class=\"bst-zip-input\" maxlength=\"5\" inputmode=\"numeric\" aria-label=\"Zip code\" placeholder=\"' + (cityMode ? 'Enter your zip' : '') + '\" value=\"' + (cityMode ? '' : zip) + '\">' +\n      '<div class=\"bst-zip-error-msg\"></div>' +\n      '<button type=\"button\" class=\"bst-zip-save\">' + saveText + '</button>' +\n      '<div class=\"bst-zip-divider\"><span>or</span></div>' +\n      '<button type=\"button\" class=\"bst-zip-detect\">' + DETECT_PIN_SVG + 'Use my location</button>';\n  }\n\n  function wirePill(pill) {\n    if (pill.dataset.bstZipWired) return;\n    pill.dataset.bstZipWired = '1';\n    var zip = getCurrentZip();\n    var cityMode = getCityMode();\n    var displayText = cityMode ? cityMode.name : (getCurrentCity() || zip);\n    pill.setAttribute('aria-label', cityMode ? 'Change location, currently ' + cityMode.name + ' — shop all cars near you' : 'Change location, currently ' + displayText);\n    if (!pill.querySelector('.bst-zip-display')) {\n      var displaySpan = document.createElement('span');\n      displaySpan.className = 'bst-zip-display';\n      displaySpan.textContent = displayText;\n      pill.innerHTML = PIN_SVG;\n      pill.appendChild(displaySpan);\n    } else {\n      pill.querySelector('.bst-zip-display').textContent = displayText;\n    }\n    // Put the card INSIDE the shared backdrop and let the backdrop flex-center it. As a child\n    // it always paints above its own dim layer (never dimmed) and centers via flexbox, which\n    // sidesteps the position:fixed containing-block trap when an ancestor is transformed.\n    var flyout = document.createElement('div');\n    flyout.className = 'bst-zip-flyout';\n    flyout.innerHTML = buildFlyout(zip, cityMode);\n    bstGetBackdrop().appendChild(flyout);\n    var input = flyout.querySelector('.bst-zip-input');\n    var saveBtn = flyout.querySelector('.bst-zip-save');\n    var detectBtn = flyout.querySelector('.bst-zip-detect');\n    var errorMsg = flyout.querySelector('.bst-zip-error-msg');\n\n    function showError(msg) { input.classList.add('bst-zip-error'); errorMsg.textContent = msg; }\n    function clearError() { input.classList.remove('bst-zip-error'); errorMsg.textContent = ''; }\n    function closeFlyout() { flyout.classList.remove('bst-zip-flyout-open'); clearError(); bstHideBackdrop(); }\n    function openFlyout() {\n      document.querySelectorAll('.bst-zip-flyout.bst-zip-flyout-open').forEach(function(f) { if (f !== flyout) f.classList.remove('bst-zip-flyout-open'); });\n      input.value = cityMode ? '' : getCurrentZip();\n      bstGetBackdrop().classList.add('bst-zip-backdrop-open');\n      flyout.classList.add('bst-zip-flyout-open');\n      setTimeout(function() { input.focus(); input.select(); }, 50);\n    }\n\n    pill.addEventListener('click', function(e) {\n      if (flyout.contains(e.target)) return;\n      e.stopPropagation();\n      if (flyout.classList.contains('bst-zip-flyout-open')) closeFlyout(); else openFlyout();\n    });\n    pill.addEventListener('keydown', function(e) {\n      if ((e.key === 'Enter' || e.key === ' ') && !flyout.contains(e.target)) { e.preventDefault(); openFlyout(); }\n    });\n    flyout.addEventListener('click', function(e) { e.stopPropagation(); });\n    var flyoutClose = flyout.querySelector('.bst-zip-flyout-close');\n    if (flyoutClose) flyoutClose.addEventListener('click', function(e) { e.preventDefault(); closeFlyout(); });\n    input.addEventListener('input', function() {\n      clearError();\n      var val = input.value.replace(/\\D/g, '').substring(0, 5);\n      if (val !== input.value) input.value = val;\n    });\n\n    function submitInput() {\n      var val = input.value.trim();\n      if (!isValidZipFormat(val)) { showError('Enter a 5-digit zip code'); return; }\n      if (cityMode) {\n        // City pages stay city-anchored; a chosen zip sends the visitor to the\n        // broad /used-cars SRP personalized to that zip.\n        lookupZipCoords(val)\n          .then(function(coords) { goToBroadWithZip(val, coords.lat, coords.lng); })\n          .catch(function() { showError('Could not find that zip code'); });\n        return;\n      }\n      if (val === getCurrentZip()) { closeFlyout(); return; }\n      applyZip(val).then(function() {\n        closeFlyout();\n        // An out-of-area zip fires the one-time overlay (no-ops if already seen).\n        maybeShowCoverageOverlay();\n      }).catch(function() { showError('Could not find that zip code'); });\n    }\n\n    saveBtn.addEventListener('click', function(e) { e.preventDefault(); submitInput(); });\n    input.addEventListener('keydown', function(e) {\n      if (e.key === 'Enter') { e.preventDefault(); submitInput(); }\n      else if (e.key === 'Escape') { closeFlyout(); }\n    });\n\n    detectBtn.addEventListener('click', function(e) {\n      e.preventDefault();\n      detectBtn.disabled = true;\n      detectBtn.classList.add('bst-zip-detect-loading');\n      detectBtn.innerHTML = SPINNER_SVG + 'Locating...';\n      clearError();\n      browserGeolocate()\n        .then(function(loc) {\n          if (cityMode) { goToBroadWithZip(loc.zip, loc.lat, loc.lng); return; }\n          return applyZip(loc.zip, loc.lat, loc.lng, loc.city).then(function() { closeFlyout(); maybeShowCoverageOverlay(); });\n        })\n        .catch(function(err) { showError(err.message || 'Could not detect location'); })\n        .then(function() {\n          detectBtn.disabled = false;\n          detectBtn.classList.remove('bst-zip-detect-loading');\n          detectBtn.innerHTML = DETECT_PIN_SVG + 'Use my location';\n        });\n    });\n\n  }\n\n  document.addEventListener('click', function() { bstCloseAllFlyouts(); });\n  document.addEventListener('keydown', function(e) { if (e.key === 'Escape') bstCloseAllFlyouts(); });\n\n  function wireAllPills() {\n    document.querySelectorAll('.bst-zip-pill').forEach(wirePill);\n    refreshCityLabel();\n  }\n\n  function injectSrpPills() {\n    var sortPill = document.getElementById('bsp-sort');\n    var meta = document.querySelector('.bs-meta');\n    if (!sortPill || !meta) return false;\n    var sortWrap = sortPill.closest('.bs-pw');\n    if (!sortWrap) return false;\n    if (!document.getElementById('bst-srp-zip-pill-desktop')) {\n      var pd = document.createElement('button');\n      pd.id = 'bst-srp-zip-pill-desktop';\n      pd.className = 'bst-zip-pill';\n      pd.type = 'button';\n      pd.setAttribute('aria-label', 'Change location');\n      sortWrap.parentNode.insertBefore(pd, sortWrap.nextSibling);\n    }\n    if (!document.getElementById('bst-srp-zip-pill-mobile')) {\n      var pm = document.createElement('button');\n      pm.id = 'bst-srp-zip-pill-mobile';\n      pm.className = 'bst-zip-pill';\n      pm.type = 'button';\n      pm.setAttribute('aria-label', 'Change location');\n      meta.appendChild(pm);\n    }\n    return true;\n  }\n\n  function waitForSrpAndInject() {\n    if (!document.getElementById('bs-bar')) {\n      var attempts = 0;\n      var iv = setInterval(function() {\n        attempts++;\n        if (document.getElementById('bs-bar')) { clearInterval(iv); injectSrpPills(); wireAllPills(); }\n        else if (attempts > 50) clearInterval(iv);\n      }, 200);\n      return;\n    }\n    injectSrpPills();\n    wireAllPills();\n  }\n\n  // One-time \"outside coverage\" overlay. Shown once per visitor (localStorage flag) when\n  // their detected/entered location is out of range. Never on city pages; client-only so\n  // it never touches server-rendered/indexed content.\n  function buildCoverageOverlay() {\n    var existing = document.getElementById('bst-cov-overlay');\n    if (existing) return existing;\n    var ov = document.createElement('div');\n    ov.id = 'bst-cov-overlay';\n    ov.setAttribute('role', 'dialog');\n    ov.setAttribute('aria-modal', 'true');\n    ov.setAttribute('aria-labelledby', 'bst-cov-title');\n    ov.style.cssText = \"position:fixed;inset:0;z-index:100000;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,0.45);padding:20px;font-family:'Montserrat',-apple-system,BlinkMacSystemFont,'Helvetica Neue',Arial,sans-serif;\";\n    ov.innerHTML =\n      '<div style=\"background:#fff;border-radius:14px;max-width:380px;width:100%;padding:28px 24px;text-align:center;position:relative;box-shadow:0 16px 48px rgba(0,0,0,0.18);\">' +\n        '<button type=\"button\" class=\"bst-cov-close\" aria-label=\"Close\" style=\"position:absolute;top:8px;right:12px;width:30px;height:30px;border:none;background:transparent;color:#999;font-size:22px;line-height:1;cursor:pointer;padding:0;\">×</button>' +\n        '<div style=\"width:52px;height:52px;border-radius:50%;background:#e3f1e9;display:flex;align-items:center;justify-content:center;margin:0 auto 16px;\">' + COV_PIN_SVG + '</div>' +\n        '<h2 id=\"bst-cov-title\" style=\"font-size:19px;font-weight:700;margin:0 0 10px;color:#1a1a1a;line-height:1.3;\">Not from the area?</h2>' +\n        '<p style=\"font-size:14px;line-height:1.6;color:#555;margin:0 0 20px;\">Bestest is live in our home market of Orange County as we prep our national rollout.</p>' +\n        '<button type=\"button\" class=\"bst-cov-cta\" style=\"width:100%;background:#217b49;color:#fff;border:none;border-radius:8px;padding:12px 14px;font-size:14px;font-weight:600;cursor:pointer;\">Check us out</button>' +\n      '</div>';\n    (document.body || document.documentElement).appendChild(ov);\n    function dismiss() {\n      ov.style.display = 'none';\n      try { localStorage.setItem(STORAGE_COVERAGE_SEEN, '1'); } catch (e) {}\n      document.removeEventListener('keydown', onKey);\n    }\n    function onKey(e) { if (e.key === 'Escape') dismiss(); }\n    ov._bstOnKey = onKey;\n    ov.querySelector('.bst-cov-close').addEventListener('click', dismiss);\n    ov.querySelector('.bst-cov-cta').addEventListener('click', dismiss);\n    ov.addEventListener('click', function(e) { if (e.target === ov) dismiss(); });\n    return ov;\n  }\n  function maybeShowCoverageOverlay() {\n    if (getCityMode() || isCrawler()) return;\n    try { if (localStorage.getItem(STORAGE_COVERAGE_SEEN)) return; } catch (e) {}\n    var ll = getCurrentLatLng();\n    if (!ll || !isOutOfCoverage(ll.lat, ll.lng)) return;\n    var ov = buildCoverageOverlay();\n    ov.style.display = 'flex';\n    document.addEventListener('keydown', ov._bstOnKey);\n    // GA4: how often the overlay fires and where those visitors resolve to, so false\n    // positives (in-area phones on carrier IPs) can be measured.\n    try {\n      if (typeof window.gtag === 'function') window.gtag('event', 'coverage_overlay_shown', {\n        zip: getCurrentZip(),\n        city: getCurrentCity() || '',\n        distance_mi: Math.round(haversineMiles(ll.lat, ll.lng, COVERAGE_CENTER_LAT, COVERAGE_CENTER_LNG))\n      });\n    } catch (e) {}\n  }\n\n  function init() {\n    if (!localStorage.getItem(STORAGE_ZIP_LATLNG_PREFIX + DEFAULT_ZIP)) {\n      localStorage.setItem(STORAGE_ZIP_LATLNG_PREFIX + DEFAULT_ZIP, DEFAULT_LAT + ',' + DEFAULT_LNG);\n    }\n    saveZipCity(DEFAULT_ZIP, DEFAULT_CITY);\n    // Non-city pages: IP-detect whenever we still have no stored zip, so a previously\n    // failed/blocked attempt self-heals on the next load (applyZip persists only on\n    // success). City pages stay city-anchored and never IP-personalize.\n    if (!getCityMode() && !isCrawler() && !localStorage.getItem(STORAGE_ZIP)) {\n      ipAutoDetect()\n        .then(function(loc) { return applyZip(loc.zip, loc.lat, loc.lng, loc.city); })\n        .then(function() { maybeShowCoverageOverlay(); })\n        .catch(function(err) { if (err && err.message === 'Non-US visitor') setAudience('non_us'); });\n    } else {\n      // Visitors who stored a zip before the audience band existed: derive it from the cached coords.\n      try { if (!localStorage.getItem(STORAGE_AUDIENCE)) { var ll0 = getCurrentLatLng(); if (ll0) setAudience(audienceBand(ll0.lat, ll0.lng)); } } catch (e) {}\n      maybeShowCoverageOverlay();\n    }\n    wireAllPills();\n    waitForSrpAndInject();\n  }\n\n  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);\n  else init();\n\n  window.BestestZipPill = { setZip: applyZip, getZip: getCurrentZip };\n})();\n"]}