class DistilleryGeofence{constructor(){this.distilleryLocation={lat:41.566345,lng:-83.653526};this.radius=4828.03;this.isInside=false;this.notificationSent=false;this.visitorData=this.loadVisitorData();this.reminderSent=false;this.consentGiven=this.checkConsentStatus();this.initWithConsent()}checkConsentStatus(){const e=localStorage.getItem("flatrockGeofenceConsent");return e==="true"}saveConsentStatus(e){localStorage.setItem("flatrockGeofenceConsent",e.toString());this.consentGiven=e}initWithConsent(){if(this.consentGiven){this.init();return}this.showPrivacyNotice()}showPrivacyNotice(){const e=document.createElement("div");e.style.position="fixed";e.style.left="0";e.style.top="0";e.style.width="100%";e.style.height="100%";e.style.backgroundColor="rgba(0,0,0,0.7)";e.style.zIndex="10000";e.style.display="flex";e.style.justifyContent="center";e.style.alignItems="center";const t=document.createElement("div");t.style.backgroundColor="#fff";t.style.padding="30px";t.style.borderRadius="8px";t.style.maxWidth="500px";t.style.boxShadow="0 4px 8px rgba(0,0,0,0.2)";const i=document.createElement("div");i.style.textAlign="center";i.style.marginBottom="20px";i.innerHTML='Flatrock Distilling Company';t.appendChild(i);const s=document.createElement("h2");s.textContent="Location-Based Notifications";s.style.fontSize="20px";s.style.marginBottom="15px";t.appendChild(s);const n=document.createElement("p");n.innerHTML=`
We'd like to send you notifications when you're within 3 miles of our distillery.
How it works:
• We'll check your location only when our website is open in your browser
• You'll receive notifications about special events, featured menu items, and promotions
• Your location data is only stored locally on your device
• We never share your location data with third parties
You can disable this feature at any time by clearing your browser data or by clicking "Disable" in our footer.
`;n.style.lineHeight="1.5";n.style.marginBottom="25px";t.appendChild(n);const a=document.createElement("div");a.style.display="flex";a.style.justifyContent="space-between";const o=document.createElement("button");o.textContent="No Thanks";o.style.padding="10px 20px";o.style.border="1px solid #ccc";o.style.borderRadius="4px";o.style.backgroundColor="#f2f2f2";o.style.cursor="pointer";const r=document.createElement("button");r.textContent="Enable Notifications";r.style.padding="10px 20px";r.style.border="none";r.style.borderRadius="4px";r.style.backgroundColor="#4A7C59";r.style.color="#fff";r.style.fontWeight="bold";r.style.cursor="pointer";a.appendChild(o);a.appendChild(r);t.appendChild(a);e.appendChild(t);document.body.appendChild(e);o.addEventListener("click",()=>{this.saveConsentStatus(false);document.body.removeChild(e);console.log("Geolocation tracking declined")});r.addEventListener("click",()=>{this.saveConsentStatus(true);document.body.removeChild(e);this.init()})}init(){if(!navigator.geolocation){console.error("Geolocation is not supported by this browser");return}this.watchId=navigator.geolocation.watchPosition(this.handlePositionUpdate.bind(this),this.handleError.bind(this),{enableHighAccuracy:true,maximumAge:3e4,timeout:27e3});console.log("Distillery geofence monitoring initialized");this.addOptOutOption()}addOptOutOption(){if(document.getElementById("flatrock-geofence-opt-out")){return}let e=document.querySelector("footer");if(!e){e=document.querySelector(".footer")||document.querySelector("#footer")||document.body}const t=document.createElement("div");t.id="flatrock-geofence-opt-out";t.style.fontSize="12px";t.style.margin="10px 0";t.style.textAlign="center";const i=document.createElement("button");i.textContent="Disable Location Notifications";i.style.fontSize="12px";i.style.padding="4px 8px";i.style.border="1px solid #ccc";i.style.borderRadius="4px";i.style.backgroundColor="transparent";i.style.cursor="pointer";i.addEventListener("click",()=>{this.disableGeofencing();t.innerHTML="