1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{72415:function(e,t,r){Promise.resolve().then(r.t.bind(r,47960,23)),Promise.resolve().then(r.bind(r,90215)),Promise.resolve().then(r.bind(r,95450)),Promise.resolve().then(r.bind(r,18755)),Promise.resolve().then(r.bind(r,11125)),Promise.resolve().then(r.bind(r,26256)),Promise.resolve().then(r.bind(r,74168)),Promise.resolve().then(r.bind(r,93442)),Promise.resolve().then(r.bind(r,10965)),Promise.resolve().then(r.bind(r,55698)),Promise.resolve().then(r.bind(r,63616)),Promise.resolve().then(r.bind(r,93583)),Promise.resolve().then(r.bind(r,17803)),Promise.resolve().then(r.bind(r,1072)),Promise.resolve().then(r.t.bind(r,88925,23))},90215:function(e,t,r){"use strict";r.d(t,{AdSenseOverlayGuard:function(){return o}});var n=r(2265),a=r(99376),i=r(66332);function o(){let e=(0,a.usePathname)();return(0,n.useEffect)(()=>{if("undefined"==typeof document)return;let e=!1,t=()=>{e||(e=!0,queueMicrotask(()=>{e=!1,(0,i.On)()}))};t();let r=new MutationObserver(e=>{for(let r of e)for(let e of r.addedNodes)if(function(e){if(!(e instanceof Element))return!1;for(let t of i.iG)if(e.matches(t)||e.querySelector(t))return!0;return!!e.matches("ins.adsbygoogle")&&!e.closest(".google-ad-slot-wrapper")}(e)){t();return}});return r.observe(document.documentElement,{childList:!0,subtree:!0}),()=>r.disconnect()},[e]),null}},95450:function(e,t,r){"use strict";r.d(t,{AppShell:function(){return ey}});var n,a=r(57437),i=r(2265),o=r(99376),s=r(91472),l=r(20644),d=r(27648),c=r(33145),u=r(79179),m=r(99204);async function h(e){if("undefined"==typeof navigator)return;let t=navigator;try{if(e>0&&"function"==typeof t.setAppBadge){await t.setAppBadge(e);return}e<=0&&"function"==typeof t.clearAppBadge&&await t.clearAppBadge()}catch(e){}}function f(e,t){let[r,n]=(0,i.useState)(0),a=(0,i.useCallback)(()=>{if(!e||!t){n(0),h(0);return}m.x1.getNotificationsUnreadCount().then(e=>{var t;let r=null!==(t=e.count)&&void 0!==t?t:0;n(r),h(r)}).catch(()=>{n(0),h(0)})},[e,t]);return(0,i.useEffect)(()=>{var t,r;if(!e)return;a();let n=setInterval(a,6e4),i=()=>a(),o=()=>a(),s=()=>{"visible"===document.visibilityState&&a()},l=e=>{var t;(null===(t=e.data)||void 0===t?void 0:t.type)==="notifications-refresh"&&a()};return window.addEventListener(m.CZ,i),window.addEventListener("focus",o),document.addEventListener("visibilitychange",s),null===(r=navigator.serviceWorker)||void 0===r||null===(t=r.addEventListener)||void 0===t||t.call(r,"message",l),()=>{var e,t;clearInterval(n),window.removeEventListener(m.CZ,i),window.removeEventListener("focus",o),document.removeEventListener("visibilitychange",s),null===(t=navigator.serviceWorker)||void 0===t||null===(e=t.removeEventListener)||void 0===e||e.call(t,"message",l)}},[e,a]),r}var p=r(64502),x=r(41346),g=r(93439);let v=[{href:"/map",label:"Map"},{href:"/postboxes",label:"Browse postboxes"},{href:"/discussions",label:"Discussions"},{href:"/add",label:"Add Missing Postbox"},{href:"/identification-guide",label:"How To Identify"}],b=[{href:"/dashboard",label:"Dashboard"},{href:"/map",label:"Map"},{href:"/postboxes",label:"Browse postboxes"}],y={href:"/discussions",label:"Discussions"};function w(e){return(0,p.cn)("px-3 py-2 rounded-md text-sm font-medium text-gray-600 hover:text-primary hover:bg-gray-100/50 transition-colors",g.kN,e&&"text-primary")}function j(e){let{image:t,displayName:r,name:n,email:i,className:o="w-8 h-8"}=e,s=(r||n||i||"?")[0].toUpperCase(),l=o.trim(),d=t?(0,m.gz)(t):"";return d?(0,a.jsx)("span",{className:"inline-block shrink-0 overflow-hidden rounded-full ".concat(l),style:{aspectRatio:"1"},children:(0,a.jsx)(c.default,{src:d,alt:"",width:32,height:32,className:"block h-full w-full object-cover",unoptimized:!0})}):(0,a.jsx)("span",{className:"inline-flex items-center justify-center shrink-0 overflow-hidden rounded-full bg-primary/20 text-sm font-medium text-primary ".concat(l),style:{aspectRatio:"1"},"aria-hidden":!0,children:s})}function k(){return(0,a.jsxs)("div",{className:"flex items-center gap-2","aria-hidden":!0,children:[(0,a.jsx)("div",{className:"h-9 w-[5.5rem] rounded-md bg-gray-100 dark:bg-gray-800"}),(0,a.jsx)("div",{className:"h-9 w-16 rounded-md bg-gray-100 dark:bg-gray-800"})]})}function N(){var e,t,r,n;let{user:s,loading:l,logout:c}=(0,u.aC)(),h=(0,o.usePathname)(),[p,g]=(0,i.useState)(!1),[N,S]=(0,i.useState)(!1),[E,C]=(0,i.useState)(!1),[_,L]=(0,i.useState)(0);(0,i.useEffect)(()=>S(!0),[]),(0,i.useEffect)(()=>
1{if(!N||!s||"owner"===s.role){C(!1);return}m.x1.getOwnerCanRestoreOwner().then(e=>C(e.allowed)).catch(()=>C(!1))},[N,s]);let P=!N||l,M=N&&s?b:v,[I,A]=(0,i.useState)(!0);(0,i.useEffect)(()=>{N&&m.x1.getSiteConfig().then(e=>{A(!1!==e.discussions_enabled)}).catch(()=>{A(!0)})},[N]);let D=M.filter(e=>"/discussions"!==e.href||!!I),B=I&&N&&s?function(e){let t=e.filter(e=>"/discussions"!==e.href),r=t.findIndex(e=>"/postboxes"===e.href);return -1===r?[...t,y]:[...t.slice(0,r+1),y,...t.slice(r+1)]}(b):D,z=(null==s?void 0:s.role)==="owner"||E,T=(null==s?void 0:s.role)==="owner"?"/owner":"/restore-owner",H=f(N,null==s?void 0:s.id),W=function(e,t){let[r,n]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(!e||!t){n(0);return}let r=()=>{m.x1.getDiscussionUnreadSummary().then(e=>{var t;return n(null!==(t=e.unread_count)&&void 0!==t?t:0)}).catch(()=>n(0))};r();let a=setInterval(r,6e4),i=()=>r(),o=()=>r(),s=()=>{"visible"===document.visibilityState&&r()};return window.addEventListener(m.CZ,i),window.addEventListener("focus",o),document.addEventListener("visibilitychange",s),()=>{clearInterval(a),window.removeEventListener(m.CZ,i),window.removeEventListener("focus",o),document.removeEventListener("visibilitychange",s)}},[e,t]),r}(N,null==s?void 0:s.id),R=!!(s&&("owner"===s.role||"admin"===s.role||"number"==typeof s.moderator_level&&s.moderator_level>=1)),[F,V]=(0,i.useState)(!1),O=(0,i.useRef)(null);return(0,i.useEffect)(()=>{if(!F)return;let e=e=>{"Escape"===e.key&&V(!1)},t=e=>{O.current&&!O.current.contains(e.target)&&V(!1)};return window.addEventListener("keydown",e),document.addEventListener("click",t),()=>{window.removeEventListener("keydown",e),document.removeEventListener("click",t)}},[F]),(0,i.useEffect)(()=>{if(!N||!R){L(0);return}let e=!1,t=()=>{m.x1.getModeratorModerationQueueCount().then(t=>{e||L(t.count||0)}).catch(()=>{e||L(0)})};t();let r=setInterval(t,6e4),n=()=>t(),a=()=>{"visible"===document.visibilityState&&t()};return window.addEventListener("focus",n),document.addEventListener("visibilitychange",a),()=>{e=!0,clearInterval(r),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",a)}},[N,R,null==s?void 0:s.id]),(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("header",{className:"sticky top-0 z-[1100] w-full border-b border-gray-200 dark:border-gray-800 bg-white/95 dark:bg-gray-900/95 backdrop-blur supports-[backdrop-filter]:bg-white/80 dark:supports-[backdrop-filter]:bg-gray-900/80 nav-safe-top",children:[(0,a.jsx)("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:(0,a.jsxs)("div",{className:"flex h-16 items-center justify-between gap-4",children:[(0,a.jsxs)(d.default,{href:"/",className:"flex shrink-0 items-center gap-2 font-bold text-gray-900 dark:text-white hover:text-primary dark:hover:text-primary-light transition-colors min-h-[44px]",children:[(0,a.jsx)("span",{className:"text-xl tracking-tight",children:"PostboxMap"}),(0,a.jsx)("span",{className:"hidden sm:inline text-sm font-normal text-gray-500 dark:text-gray-400",children:".co.uk"})]}),(0,a.jsx)("nav",{className:"hidden md:flex items-center gap-1","aria-label":"Main",children:D.map(e=>{let{href:t,label:r}=e,n=h===t||"/dashboard"!==t&&(null==h?void 0:h.startsWith(t));return(0,a.jsx)(d.default,{href:t,className:w(n),children:r},t)})}),(0,a.jsx)("div",{className:"hidden md:flex items-center gap-2 ml-2 min-w-[11rem] justify-end shrink-0",children:P?(0,a.jsx)(k,{}):s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.default,{href:"/my-submissions",className:w("/my-submissions"===h),children:"My Submissions"}),I&&(0,a.jsxs)(d.default,{href:"/discussions",className:"".concat(w(null!==(e=null==h?void 0:h.startsWith("/discussions"))&&void 0!==e&&e)," relative"),"aria-label":W>0?"Discussions, ".concat(W," unread"):"Discussions",children:["Discussions",W>0&&(0,a.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-red-500","aria-hidden":!0})]}),R&&(0,a.jsxs)(d.default,{href:"/moderator",className:"".concat(w(null!==(t=null==h?void 0:h.startsWith("/moderator"))&&void 0!==t&&t)," relative"),"aria-label":_>0?"Moderator, ".concat(_," pending"):"Moderator",children:["Moderator",_>0&&(0,a.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-red-500","aria-hidden":!0})]}),z&&(0,a.jsx)(d.default,{href:T,className:w(null!==(r=null==h?void 0:h.startsWith("/owner"))&&void 0!==r&&r),children:"Owner"}),(0,a.jsx)("span",{className:"w-px h-5 bg-gray-200 dark:bg-gray-700 mx-1","aria-hidden":!0}),(0,a.jsxs)("div",{className:"relative",ref:O,children:[(0,a.jsxs)("button",{type:"button",onClick:()=>V(e=>!e),className:"".concat(w("/profile"===h||null!==(n=null==h?void 0:h.startsWith("/profile/"))&&void 0!==n&&n)," relative flex items-center justify-center w-9 h-9 rounded-md p-0"),"aria-label":H>0?"Profile menu (".concat(H," unread notifications)"):"Profile menu","aria-expanded":F,"aria-haspopup":"true",children:[(0,a.jsx)(j,{image:s.image,displayName:s.display_name,name:s.name,email:s.email,className:"w-8 h-8"}),H>0&&(0,a.jsx)("span",{className:"absolute top-0 right-0 w-2.5 h-2.5 rounded-full bg-red-500 border-2 border-white dark:border-gray-900","aria-hidden":!0})]}),F&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-1 w-56 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-lg py-1 z-[1200]",role:"menu","aria-label":"Profile menu",children:[I&&(0,a.jsxs)(d.default,{href:"/discussions",role:"menuitem",onClick:()=>V(!1),className:"flex w-full items-center gap-3 px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800","aria-label":W>0?"Discussions, ".concat(W," unread"):"Discussions",children:[(0,a.jsxs)("span",{className:"relative shrink-0",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,
1children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 8h2a2 2 0 012 2v6a2 2 0 01-2 2h-2v4l-4-4H9a1.994 1.994 0 01-1.414-.586m0 0L11 14h4a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h-3l-4 4z"})}),W>0&&(0,a.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500","aria-hidden":!0})]}),"Discussions"]}),(0,a.jsxs)(d.default,{href:"/notifications",role:"menuitem",onClick:()=>V(!1),className:"flex w-full items-center gap-3 px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),"Notifications",H>0&&(0,a.jsx)("span",{className:"ml-auto min-w-[20px] h-5 px-1.5 flex items-center justify-center rounded-full bg-red-500 text-white text-xs font-medium",children:H>99?"99+":H})]}),(0,a.jsxs)(d.default,{href:"/profile",role:"menuitem",onClick:()=>V(!1),className:"flex w-full items-center gap-3 px-4 py-3 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800",children:[(0,a.jsx)(j,{image:s.image,displayName:s.display_name,name:s.name,email:s.email,className:"w-5 h-5"}),"Profile"]}),(0,a.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{V(!1),m.x1.clearAuthCache(),c()},className:"flex w-full items-center gap-3 px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 border-t border-gray-100 dark:border-gray-800",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})}),"Sign out"]})]})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.zx,{href:"/register",size:"sm",children:"Join free"}),(0,a.jsx)(d.default,{href:"/login",className:w("/login"===h),children:"Log in"})]})}),(0,a.jsx)("button",{type:"button",className:"md:hidden tap-target min-h-[44px] min-w-[44px] -mr-2 flex items-center justify-center rounded-lg text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white",onClick:()=>g(!p),"aria-label":p?"Close menu":"Open menu","aria-expanded":p,children:p?(0,a.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):(0,a.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]})}),p&&(0,a.jsx)("div",{className:"md:hidden border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50",children:(0,a.jsxs)("nav",{className:"mx-auto max-w-7xl px-4 py-4","aria-label":"Main",children:[(0,a.jsx)("div",{className:"space-y-1",children:B.map(e=>{let{href:t,label:r}=e;return(0,a.jsxs)(d.default,{href:t,className:"flex items-center px-4 py-3 rounded-xl text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-white dark:hover:bg-gray-800 hover:text-primary dark:hover:text-primary-light min-h-[48px] active:bg-white/80 dark:active:bg-gray-800/80",onClick:()=>g(!1),"aria-label":"/discussions"===t&&W>0?"Discussions, ".concat(W," unread"):void 0,children:[r,"/discussions"===t&&W>0&&(0,a.jsx)("span",{className:"ml-auto w-2.5 h-2.5 rounded-full bg-red-500 shrink-0","aria-hidden":!0})]},t)})}),P?(0,a.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-800 py-3 text-gray-400 dark:text-gray-500 text-sm",children:"Loadingâ¦"}):s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700"}),(0,a.jsxs)(d.default,{href:"/profile",onClick:()=>g(!1),className:"rounded-xl bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 p-4 mb-3 flex items-center gap-3 active:bg-gray-50 dark:active:bg-gray-700/50 transition-colors min-h-[48px]","aria-label":"Profile",children:[(0,a.jsx)(j,{image:s.image,displayName:s.display_name,name:s.name,email:s.email,className:"w-12 h-12 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 text-left",children:[(0,a.jsx)("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:s.display_name||s.name||"Signed in"}),s.email&&(0,a.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:s.email})]}),(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,
1children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]}),(0,a.jsx)("p",{className:"px-3 mb-2 text-xs font-medium text-gray-500 dark:text-gray-400",children:"You"}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(d.default,{href:"/my-submissions",className:"flex items-center gap-3 w-full px-4 py-3 rounded-xl text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-white dark:hover:bg-gray-800 min-h-[48px] active:bg-white/80 dark:active:bg-gray-800/80",onClick:()=>g(!1),children:[(0,a.jsx)("span",{className:"flex items-center justify-center w-9 h-9 rounded-lg bg-gray-100 dark:bg-gray-700 shrink-0",children:(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-600 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),"My Submissions"]}),(0,a.jsxs)(d.default,{href:"/notifications",onClick:()=>g(!1),className:"flex items-center gap-3 w-full px-4 py-3 rounded-xl text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-white dark:hover:bg-gray-800 min-h-[48px] active:bg-white/80 dark:active:bg-gray-800/80 text-left","aria-label":H>0?"Notifications (".concat(H," unread)"):"Notifications",children:[(0,a.jsxs)("span",{className:"flex items-center justify-center w-9 h-9 rounded-lg bg-gray-100 dark:bg-gray-700 shrink-0 relative",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-600 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),H>0&&(0,a.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[18px] h-[18px] px-1 flex items-center justify-center rounded-full bg-red-500 text-white text-xs font-medium",children:H>99?"99+":H})]}),"Notifications"]})]}),(R||z)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mt-4 pt-3 border-t border-gray-200 dark:border-gray-700"}),(0,a.jsx)("p",{className:"px-3 mb-2 text-xs font-medium text-gray-500 dark:text-gray-400",children:"Tools"}),(0,a.jsxs)("div",{className:"space-y-1",children:[R&&(0,a.jsxs)(d.default,{href:"/moderator",className:"flex items-center gap-3 w-full px-4 py-3 rounded-xl text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-white dark:hover:bg-gray-800 min-h-[48px] active:bg-white/80 dark:active:bg-gray-800/80",onClick:()=>g(!1),"aria-label":_>0?"Moderator, ".concat(_," pending"):"Moderator",children:[(0,a.jsx)("span",{className:"flex items-center justify-center w-9 h-9 rounded-lg bg-gray-100 dark:bg-gray-700 shrink-0",children:(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-600 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})}),"Moderator",_>0&&(0,a.jsx)("span",{className:"ml-auto min-w-[22px] h-6 px-2 flex items-center justify-center rounded-full bg-red-500 text-white text-xs font-medium",children:_})]}),z&&(0,a.jsxs)(d.default,{href:T,className:"flex items-center gap-3 w-full px-4 py-3 rounded-xl text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-white dark:hover:bg-gray-800 min-h-[48px] active:bg-white/80 dark:active:bg-gray-800/80",onClick:()=>g(!1),children:[(0,a.jsx)("span",{className:"flex items-center justify-center w-9 h-9 rounded-lg bg-gray-100 dark:bg-gray-700 shrink-0",children:(0,a.jsxs)("svg",{className:"w-5 h-5 text-gray-600 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),"Owner"]}
1)]})]}),(0,a.jsx)("div",{className:"mt-4 pt-3 border-t border-gray-200 dark:border-gray-700",children:(0,a.jsxs)("button",{type:"button",className:"flex items-center gap-3 w-full px-4 py-3 rounded-xl text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-white dark:hover:bg-gray-800 hover:text-red-600 dark:hover:text-red-400 min-h-[48px] active:bg-white/80 dark:active:bg-gray-800/80",onClick:()=>{g(!1),m.x1.clearAuthCache(),c()},children:[(0,a.jsx)("span",{className:"flex items-center justify-center w-9 h-9 rounded-lg bg-gray-100 dark:bg-gray-700 shrink-0",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}),"Sign out"]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(x.zx,{href:"/register",className:"w-full",onClick:()=>g(!1),children:"Join free"}),(0,a.jsx)(x.zx,{href:"/login",variant:"secondary",className:"w-full",onClick:()=>g(!1),children:"Log in"})]})]})]})})]})})}var S=r(15721),E=r(63921);let C="inline-flex h-10 items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 rounded";function _(){let e=(0,S.a_)(),t=(0,S.Im)(),r=(0,a.jsx)(c.default,{src:"/assets/img/store-badges/app-store-badge.svg",alt:"Download on the App Store",width:120,height:40,unoptimized:!0,className:"h-10 w-auto"});return(0,a.jsx)("footer",{className:"relative z-10 bg-gray-100 border-t border-gray-200 mt-auto",children:(0,a.jsxs)("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-10",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-8",children:[(0,a.jsxs)("div",{className:"min-w-0 max-w-md",children:[(0,a.jsx)(d.default,{href:"/",className:"font-bold text-primary hover:text-primary-hover text-lg transition-colors",children:"PostboxMap.co.uk"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"For postbox spotters, enthusiasts, historians and contributors: pin and log ones you've visited. Discover, contribute, explore."})]}),(0,a.jsxs)("nav",{className:"flex flex-wrap gap-x-8 gap-y-4 text-sm sm:gap-x-10","aria-label":"Footer",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",children:"Explore"}),(0,a.jsxs)("ul",{className:"space-y-1.5",children:[(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/about",variant:"muted",touch:!0,children:"About"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/postboxes",variant:"muted",touch:!0,children:"Postboxes"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/postboxes/near-me",variant:"muted",touch:!0,children:"Near me"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/learn",variant:"muted",touch:!0,children:"Learn"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/identification-guide",variant:"muted",touch:!0,children:"Identification guide"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/discussions",variant:"muted",touch:!0,children:"Discussions"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/stories",variant:"muted",touch:!0,children:"Member stories"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/help",variant:"muted",touch:!0,children:"Help"})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",children:"Support"}),(0,a.jsxs)("ul",{className:"space-y-1.5",children:[(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/app",variant:"muted",touch:!0,children:"Get the app"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/help",variant:"muted",touch:!0,children:"Help"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/contact",variant:"muted",touch:!0,children:"Contact"})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",children:"Legal"}),(0,a.jsxs)("ul",{className:"space-y-1.5",children:[(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/terms",variant:"muted",touch:!0,children:"Terms"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/privacy",variant:"muted",touch:!0,children:"Privacy"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/cookies",variant:"muted",touch:!0,children:"Cookies"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/accessibility",variant:"muted",touch:!0,children:"Accessibility"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/community-guidelines",variant:"muted",touch:!0,children:"Guidelines"})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",children:"More"}),(0,a.jsxs)("ul",{className:"space-y-1.5",children:[(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/scoring",variant:"muted",touch:!0,children:"Scoring & ranks"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/statistics",variant:"muted",touch:!0,children:"Statistics"})}),(0,a.jsx)("li",{children:(0,a.jsx)(x.hh,{href:"/credits",variant:"muted",touch:!0,children:"Credits"})})]})]})]})]}),(0,a.jsxs)("div",{className:"pt-4 border-t border-gray-200 flex flex-wrap items-center gap-4",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide w-full sm:w-auto mb-1 sm:mb-0 sm:mr-2",children:"Follow & support"}),(0,a.jsx)("a",{href:S.Cb,target:"_blank",rel:"noopener noreferrer",className:C,title:"Get PostboxMap on Google Play",children:(0,a.jsx)(c.default,{src:"/assets/img/store-badges/google-play-badge.png?v=2",alt:"Get it on Google Play",width:134,height:40,unoptimized:!0,className:"h-10 w-auto"})}),t?(0,a.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:C,title:"Download PostboxMap on the App Store",children:r}):(0,a.jsx)(d.default,{href:e,className:C,title:"Install PostboxMap on iPhone (App Store coming soon)",children:r}),(0,a.jsxs)("a",{href:E._v,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 px-3 rounded-lg border border-gray-300 bg-white text-gray-700 hover:border-primary hover:text-primary transition-colors",title:"Follow PostboxMap on Instagram","aria-label":"Follow PostboxMap on Instagram",children:[(0,a.jsx)(c.default,{src:"/instagram.svg",alt:"",width:22,height:22,"aria-hidden":!0}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Instagram"})]}),(0,a.jsx)("a",{href:E.NA,target:"_blank",rel:"noopener noreferrer",title:"Buy Me A Coffee",className:C,children:(0,a.jsx)(c.default,{src:"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png",alt:"Support PostboxMap on Buy Me a Coffee",width:145,height:40,unoptimized:!0,className:"h-10 w-auto"})})]})]}),(0,a.jsxs)("p",{className:"text-xs text-gray-600 mt-6 pt-4 border-t border-gray-200",children:["\xa9 ",new Date().getFullYear()," PostboxMap.co.uk. Community postbox mapping project."," \xb7 ",(0,a.jsx)("span",{className:"text-[10px] text-gray-500",children:"Independent project. Not affiliated with Royal Mail."})," \xb7 ",(0,a.jsx)(x.hh,{href:"/sitemap.xml",variant:"muted",className:"text-gray-500 hover:text-gray-700",children:"Sitemap"})]})]})})}let L=[{href:"/dashboard",label:"Home",icon:function(e){let{active:t}=e;return(0,a.jsx)("svg",{className:"w-6 h-6 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,
1children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t?2.5:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})})}},{href:"/postboxes/near-me",label:"Near me",icon:function(e){let{active:t}=e;return(0,a.jsx)("svg",{className:"w-6 h-6 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t?2.5:2,d:"M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7"})})}}],P=[{href:"/leaderboard",label:"Leaderboard",icon:function(e){let{active:t}=e;return(0,a.jsx)("svg",{className:"w-6 h-6 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t?2.5:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}}];function M(e){let{active:t}=e;return(0,a.jsx)("svg",{className:"w-6 h-6 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t?2.5:2,d:"M12 4v16m8-8H4"})})}function I(e){let{active:t}=e;return(0,a.jsx)("svg",{className:"w-6 h-6 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t?2.5:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}function A(){let e=(0,o.usePathname)(),{user:t}=(0,u.aC)(),[r,n]=(0,i.useState)(!1);(0,i.useEffect)(()=>n(!0),[]);let s=r&&t?"/profile":"/login",l=r&&t?"Profile":"Log in",c=t=>{var r;return e===t||null!==(r=null==e?void 0:e.startsWith(t+"/"))&&void 0!==r&&r},m="flex flex-col items-center justify-center gap-0.5 py-2 px-3 min-h-[56px] flex-1 max-w-[80px] rounded-lg text-gray-600 dark:text-gray-400 hover:text-primary dark:hover:text-primary-light hover:bg-gray-100/80 dark:hover:bg-gray-800/80 transition-colors tap-target";return(0,a.jsxs)("nav",{className:"relative z-50 flex w-full items-end justify-between border-t border-gray-200 bg-white/95 pt-1 backdrop-blur dark:border-gray-800 dark:bg-gray-900/95 supports-[backdrop-filter]:bg-white/80 dark:supports-[backdrop-filter]:bg-gray-900/80 pwa-nav-safe-bottom","aria-label":"App navigation",style:{paddingBottom:"calc(0.5rem + env(safe-area-inset-bottom, 0px))"},children:[(0,a.jsx)("div",{className:"flex flex-1 items-end justify-evenly min-h-[56px]",children:L.map(e=>{let{href:t,label:r,icon:n}=e,i=c(t);return(0,a.jsxs)(d.default,{href:t,className:"".concat(m," max-w-none"),"aria-current":i?"page":void 0,children:[(0,a.jsx)(n,{active:i}),(0,a.jsx)("span",{className:"text-[10px] font-medium ".concat(i?"text-primary dark:text-primary-light":""),children:r})]},t)})}),(0,a.jsx)("div",{className:"flex flex-shrink-0 flex-col items-center justify-end px-2 -mt-4 pb-1",children:(0,a.jsxs)(d.default,{href:"/add",className:"flex flex-col items-center justify-center gap-0.5 tap-target group","aria-current":c("/add")?"page":void 0,"aria-label":"Add a postbox",children:[(0,a.jsx)("span",{className:"flex flex-col items-center justify-center w-14 h-14 rounded-full bg-primary group-hover:bg-primary-hover text-white shadow-lg shadow-primary/30 group-hover:shadow-xl group-hover:shadow-primary/40 group-hover:scale-105 active:scale-100 transition-all",children:(0,a.jsx)(M,{active:!0})}),(0,a.jsx)("span",{className:"text-[10px] font-semibold text-primary dark:text-primary-light whitespace-nowrap",children:"Add postbox"})]})}),(0,a.jsxs)("div",{className:"flex flex-1 items-end justify-evenly min-h-[56px]",children:[P.map(e=>{let{href:t,label:r,icon:n}=e,i=c(t);return(0,a.jsxs)(d.default,{href:t,className:"".concat(m," max-w-none"),"aria-current":i?"page":void 0,children:[(0,a.jsx)(n,{active:i}),(0,a.jsx)("span",{className:"text-[10px] font-medium ".concat(i?"text-primary dark:text-primary-light":""),children:r})]},t)}),(0,a.jsxs)(d.default,{href:s,className:"".concat(m," max-w-none"),"aria-current":c(s)?"page":void 0,"aria-label":"Profile",children:[(0,a.jsx)(I,{active:c(s)}),(0,a.jsx)("span",{className:"text-[10px] font-medium ".concat(c(s)?"text-primary dark:text-primary-light":""),children:l})]})]})]})}function D(){let{user:e,status:t}=(0,u.aC)(),r=(0,o.usePathname)(),[n,s]=(0,i.useState)(!1),c=f(n,null==e?void 0:e.id);(0,i.useEffect)(()=>s(!0),[]);let m="authenticated"===t&&e&&!(0,l._J)(r),h=(0,l._J)(r);return(0,a.jsx)("header",{className:"pwa-app-header sticky top-0 z-40 w-full max-w-none bg-primary shadow-sm nav-safe-top",children:(0,a.jsx)("div",{className:"w-full border-b border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:(0,a.jsxs)("div",{className:"pwa-app-header-bar flex h-12 w-full items-center justify-between gap-2 sm:h-14",children:[(0,a.jsx)(d.default,{href:h?"/login":"/map",className:"flex min-h-[44px] shrink-0 items-center font-bold text-gray-900 transition-colors hover:text-primary dark:text-white dark:hover:text-primary-light",children:(0,a.jsx)("span",{className:"text-lg tracking-tight",children:"PostboxMap"})}),m?(0,a.jsxs)(d.default,{href:"/notifications",className:"tap-target relative flex h-10 w-10 items-center justify-center rounded-full text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white","aria-label":c>0?"Notifications (".concat(c," unread)"):"Notifications",children:[(0,a.jsx)("svg",{className:"h-6 w-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,
1children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),c>0?(0,a.jsx)("span",{className:"absolute -right-0.5 -top-0.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-red-500 px-1 text-xs font-medium text-white",children:c>99?"99+":c}):null]}):null]})})})}var B=r(36680),z=r(56520),T=r(79074);async function H(e,t){var r;e.mark_as_visited&&(null===(r=e.visit_date_ymd)||void 0===r?void 0:r.trim())&&await (0,z.v)(t,e.visit_date_ymd)}let W={submitPostbox:m.x1.submitPostbox.bind(m.x1),getRecaptchaToken:()=>(0,T.U)("submit_postbox"),stageSubmitPostboxImages:e=>m.x1.stageSubmitPostboxImages(e),abortSubmitPostboxStaging:e=>m.x1.abortSubmitPostboxStaging(e),onSubmissionSuccess:H};function R(){let[e,t]=(0,i.useState)(0),[r,n]=(0,i.useState)(!1),o=(0,i.useCallback)(()=>{(0,B.wo)().then(e=>t(e.length))},[]);(0,i.useEffect)(()=>(o(),(0,B.Br)(o)),[o]),(0,i.useEffect)(()=>{let e=()=>{("undefined"==typeof navigator||navigator.onLine)&&(0,B.DO)(W).then(()=>o()).catch(()=>{})};return e(),window.addEventListener("online",e),()=>window.removeEventListener("online",e)},[o]);let s=(0,i.useCallback)(()=>{r||0===e||(n(!0),(0,B.DO)(W).then(()=>o()).finally(()=>n(!1)))},[r,e,o]),l=(0,i.useCallback)(()=>{!r&&0!==e&&window.confirm("Discard the oldest queued postbox from this device? It will not be submitted. This cannot be undone.")&&(n(!0),(0,B.fn)().then(()=>o()).then(()=>(0,B.DO)(W)).then(()=>o()).catch(()=>void 0).finally(()=>n(!1)))},[r,e,o]);return 0===e?null:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 px-3 py-2 text-sm bg-amber-50 dark:bg-amber-900/20 border-b border-amber-200 dark:border-amber-800 text-amber-900 dark:text-amber-200",role:"status","aria-live":"polite",children:[(0,a.jsxs)("span",{children:[1===e?"1 postbox":"".concat(e," postboxes")," waiting to be sent."]}),(0,a.jsx)("button",{type:"button",onClick:s,disabled:r||"undefined"!=typeof navigator&&!navigator.onLine,className:"underline font-medium hover:no-underline focus:outline-none focus:ring-2 focus:ring-amber-500 rounded disabled:opacity-50",children:r?"Sendingâ¦":"Retry now"}),(0,a.jsx)("button",{type:"button",onClick:l,disabled:r,className:"underline font-medium hover:no-underline focus:outline-none focus:ring-2 focus:ring-amber-500 rounded disabled:opacity-50","aria-label":"Discard the oldest queued postbox from this device",children:"Discard oldest"}),(0,a.jsx)(d.default,{href:"/add",className:"underline font-medium hover:no-underline focus:outline-none focus:ring-2 focus:ring-amber-500 rounded",children:"Add postbox"})]})}var F=r(60974),V=r(11233);let O="postboxmap_held_drafts_expanded";function G(){let[e,t]=(0,i.useState)([]),[r,n]=(0,i.useState)(null),[o,s]=(0,i.useState)(null),[l,d]=(0,i.useState)(!0),[c,u]=(0,i.useState)(null),h=(0,i.useCallback)(()=>{(0,F.uQ)().then(t).catch(()=>t([]))},[]);(0,i.useEffect)(()=>(d(function(){try{let e=sessionStorage.getItem(O);if("0"===e)return!1}catch(e){}return!0}()),h(),(0,F.n$)(h)),[h]),(0,i.useEffect)(()=>{if(e.length>0)try{null==sessionStorage.getItem(O)&&d(!0)}catch(e){d(!0)}},[e.length]);let f=(0,i.useCallback)(()=>{d(e=>{let t=!e;try{sessionStorage.setItem(O,t?"1":"0")}catch(e){}return t})},[]),p=(0,i.useCallback)(async e=>{if(!r){u(null),n(e.id),s("checking");try{var t,a,i;let r=await (0,V.J2)(e.payload.images);if(!r.ok){window.alert(r.message);return}let n=r.images,o=r.files,l={...e.payload,images:n},d=function(e){let t=e.split(",").map(e=>Number(e.trim()));return 2===t.length&&Number.isFinite(t[0])&&Number.isFinite(t[1])?{lat:t[0],lng:t[1]}:null}(e.payload.location);if(d)try{let e=await m.x1.getPostboxesNearby(d.lat,d.lng,.05,{includeMarkers:!0});if(e.count>0){let r=(null===(t=e.nearest)||void 0===t?void 0:t.name)?" (".concat(e.nearest.name,")"):"";if(!window.confirm("Already a box nearby".concat(r,". Please check this is not a duplicate before submitting.")))return}}catch(e){}let c=await (0,T.U)("submit_postbox"),f=null;if(s("uploading"),u("Uploading photos first for a more reliable submitâ¦"),o.length>0){let e=await (0,V.TJ)(o,(e,t)=>m.x1.stageSubmitPostboxImages(e,t),{onAttempt:(e,t)=>
1{u(t>1&&e>1?"Uploading photos (try ".concat(e," of ").concat(t,")â¦"):"Uploading photos first for a more reliable submitâ¦")}});if(e.ok)f=e.stagingId;else{let t=e.error&&"object"==typeof e.error&&"response"in e.error?null===(a=e.error.response)||void 0===a?void 0:a.status:void 0;if(401===t||403===t||429===t||413===t){window.alert((0,V.a8)(e.error));return}u(e.timedOut?"Upload timed out; trying full submit insteadâ¦":"Photo upload failed; trying full submit insteadâ¦")}}s("submitting"),u(f?"Finishing submitâ¦":"Submitting with photosâ¦");let p=(0,B.uR)(l,c,{stagingId:f||void 0,omitImages:!!f});try{let t=await m.x1.submitPostbox(p,e.payload.countryCode,e.id);await (0,F.bi)(e.id),e.payload.mark_as_visited&&e.payload.visit_date_ymd&&await (0,z.v)(t,e.payload.visit_date_ymd),h(),u(null),window.alert((null==t?void 0:t.autoApproved)?"Published.":"Submitted and pending moderation.")}catch(n){if(f&&m.x1.abortSubmitPostboxStaging(f).catch(()=>void 0),(0,V.t2)(n)){window.alert(V.gM);return}let e=n&&"object"==typeof n&&"response"in n?null===(i=n.response)||void 0===i?void 0:i.data:void 0,t=Array.isArray(null==e?void 0:e.details)?e.details.map(e=>(null==e?void 0:e.msg)||(null==e?void 0:e.message)).filter(e=>"string"==typeof e&&e.trim().length>0):[],r=t.length>0?t.join(" "):(0,V.a8)(n,(0,m.iC)(n,"Could not submit. Try again."));window.alert(r)}}finally{n(null),s(null),u(null)}}},[r,h]);return 0===e.length?null:(0,a.jsxs)("div",{className:"border-b border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-950/40 text-slate-900 dark:text-slate-100",role:"status","aria-live":"polite",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 px-3 py-2 text-sm",children:[(0,a.jsxs)("span",{children:[1===e.length?"1 draft":"".concat(e.length," drafts")," saved on this device to submit later (up to 48 hours)."]}),(0,a.jsx)("button",{type:"button",onClick:f,className:"underline font-medium hover:no-underline focus:outline-none focus:ring-2 focus:ring-primary rounded","aria-expanded":l,children:l?"Hide":"Show drafts"}),(0,a.jsx)(x.hh,{href:"/add",variant:"inline",children:"Add postbox"})]}),c&&r?(0,a.jsx)("p",{className:"px-3 pb-2 text-center text-xs opacity-90",role:"status",children:c}):null,l?(0,a.jsx)("ul",{className:"mx-auto max-w-3xl px-3 pb-3 space-y-2",children:e.map(e=>{let t=(0,F.dY)(e.createdAt),n=r===e.id;return(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded border border-slate-200 dark:border-slate-700 bg-white/80 dark:bg-gray-950/50 px-3 py-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"font-medium truncate",children:e.payload.name||"Untitled draft"}),(0,a.jsxs)("p",{className:"text-xs opacity-80",children:[t<=0?"Expired":1===t?"Expires in 1 hour":"Expires in ".concat(t," hours"),e.payload.images.length?" \xb7 ".concat(e.payload.images.length," photo").concat(1===e.payload.images.length?"":"s"):" \xb7 no photos"]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(x.zx,{type:"button",size:"sm",disabled:!!r,onClick:()=>void p(e),"aria-busy":n,children:n?"checking"===o?"Checking photosâ¦":"uploading"===o?"Uploading photosâ¦":"submitting"===o?"Submittingâ¦":"Submit":"Submit"}),(0,a.jsx)(x.zx,{type:"button",size:"sm",variant:"secondary",disabled:!!r,onClick:()=>{window.confirm("Delete this draft from this device? It will not be submitted.")&&(0,F.bi)(e.id).then(h)},children:"Delete"})]})]},e.id)})}):null]})}let U=(0,i.createContext)(null);function q(e){let{children:t}=e,[r,n]=(0,i.useState)(!1),o=(0,i.useCallback)(e=>{n(e)},[]),s=(0,i.useMemo)(()=>({downtimeActive:r,setDowntimeActive:o}),[r,o]);return(0,a.jsx)(U.Provider,{value:s,children:t})}function Y(){return(0,i.useContext)(U)||{downtimeActive:!1,setDowntimeActive:()=>{}}}function X(){let[e,t]=(0,i.useState)(!1),[r,n]=(0,i.useState)(!1),{setDowntimeActive:o}=Y(),l=(0,s.mK)(),d=(0,i.useCallback)(async()=>{let e=await (0,m.Rt)();n(!0===e.unreachable),t(!0===e.downtime||!0===e.unreachable)},[]);return((0,i.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener(m.VP,e),()=>window.removeEventListener(m.VP,e)},[]),(0,i.useEffect)(()=>{d();let e=setInterval(d,r?9e4:3e4);return()=>clearInterval(e)},[e,r,d]),(0,i.useEffect)(()=>(o(e),()=>o(!1)),[e,o]),!e||l)?null:(0,a.jsx)("div",{className:"w-full bg-amber-600 text-white text-center py-3 px-4 text-sm font-medium nav-safe-top",role:"alert","aria-live":"assertive","data-downtime-banner":"true",children:(0,a.jsx)("p",{className:"max-w-2xl mx-auto",children:"It looks like things are taking longer than expected. We may be experiencing some technical difficulties. Please try again."})})}var J=r(17803),Z=r(1996);let $=(null===(n=r(40257).env.NEXT_PUBLIC_APP_EXPERIENCE_POPUP_EMAIL)||void 0===n?void 0:n.trim().toLowerCase())||null;function K(){var e;let t=(0,Z.d)(),r=(0,s.wB)(),{downtimeActive:n}=Y(),{status:o,user:l}=(0,u.aC)(),{preferAppExperience:d,setPreferAppExperience:c,popupDismissed:h,setPo
1pupDismissed:f}=(0,J.l)(),[p,g]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=setTimeout(()=>g(!0),1e4);return()=>clearTimeout(e)},[]);let v=!$||(null==l?void 0:null===(e=l.email)||void 0===e?void 0:e.trim().toLowerCase())===$,b=()=>{f(!0)};return(0,a.jsx)(x.Vq,{open:p&&!n&&t&&!r&&"authenticated"===o&&!!l&&v&&!d&&!h,onClose:b,zIndex:100,className:"items-end sm:items-center pb-[calc(1rem+env(safe-area-inset-bottom))]",children:(0,a.jsxs)(x.EM,{labelledBy:"app-experience-title",describedBy:"app-experience-desc",className:"max-w-sm",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(x.$N,{id:"app-experience-title",children:"Use app-style layout?"}),(0,a.jsx)(x.Be,{id:"app-experience-desc",children:"Switch to the same compact layout as the installed webapp: bottom navigation and a simpler header. You can change this in Settings at any time."}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row-reverse sm:gap-3",children:[(0,a.jsx)(x.zx,{type:"button",onClick:()=>{c(!0),f(!0),m.x1.putAppStylePreference(!0).catch(()=>{})},className:"w-full sm:w-auto",children:"Use app experience"}),(0,a.jsx)(x.zx,{type:"button",variant:"secondary",onClick:b,className:"w-full sm:w-auto",children:"No thanks"})]})]})})}function Q(e,t,r){return"soft-prompt:".concat(t,":").concat(e,":").concat(r)}function ee(e){return"soft-prompt:any:".concat(e,":shown-day")}function et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now(),t=new Date(e),r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return"".concat(r,"-").concat(n,"-").concat(a)}function er(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();try{localStorage.setItem(ee(e),"".concat(et(r),"|").concat(t))}catch(e){}}var en=r(3548);let ea={profile:{title:"Add a photo and bio?",body:"A short bio and profile photo help other members recognise you on the map and in comments. Takes a minute.",cta:"Complete profile",href:"/profile"},moderator:{title:"Help with moderation?",body:"Sorry to bother you. PostboxMap is a project I built myself, and moderating it alone is getting hard as it grows.\n\nPenny is our automated helper. She reviews most submissions and catches a lot, but she does not get them all, so human eyes still matter.\n\nYou do not need to be an expert. A lot of the time it is as simple as checking the location on Street View and confirming the basics: is it a pillar, wall, or lamp box? If you know more, you can correct that too, but those basics are a big help.\n\nIf you have a bit of time and fancy lending a hand, applying would mean a lot. No pressure.\n\nThanks,\nLuke",cta:"Apply to moderate",href:"/moderator/apply"},testimonial:{title:"Share a short quote?",body:"Sorry to bother you. PostboxMap is a project I built myself, and I've put a lot of time into creating it. I'd love to see it grow and reach more people who might enjoy using it.\n\nA short homepage testimonial from you, up to ".concat(m.pN," characters, helps new visitors understand what PostboxMap is about. Published testimonials also earn 500 points on your account.\n\nIf you're happy to share the project with others, whether that's in Facebook groups, with friends and family, or even just mentioning it to someone over a pint, I'd really appreciate it.\n\nOf course, there's absolutely no pressure.\n\nThanks,\nLuke"),cta:"Leave a testimonial",href:"/profile/testimonials"}};function ei(){let{status:e,user:t}=(0,u.aC)(),{downtimeActive:r}=Y(),n=(0,Z.d)(),o=(0,s.mK)(),{preferAppExperience:l,popupDismissed:d}=(0,J.l)(),[c,h]=(0,i.useState)(!1),[f,p]=(0,i.useState)(null),g=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=setTimeout(()=>h(!0),15e3);return()=>clearTimeout(e)},[]),(0,i.useEffect)(()=>{var a,i,s,u,h,f;if(!c||r||"authenticated"!==e||!(null==t?void 0:t.id)||t.needs_signup_source||n&&!o&&!l&&!d){g.current=null,p(null);return}let x=function(e){var t,r,n,a;let i=function(e){var t,r,n;let a=null!==(t=e.role)&&void 0!==t?t:null;if("owner"===a||"admin"===a||(null!==(r=e.moderatorLevel)&&void 0!==r?r:0)>=1)return!1;let i=null!==(n=e.moderatorApplicationStatus)&&void 0!==n?n:null;return"pending"!==i&&"approved"!==i&&!(e.uploadsApproved<10)&&!(e.correctionsApproved<10)}(e),o=(!e.hasProfilePhoto||!e.hasBio)&&(t=e.uploadsApproved,r=e.loginCount,t>=3||r>=5);return i&&e.hasProfilePhoto&&e.hasBio?"moderator":o?"profile":i?"moderator":!e.hasTestimonial&&(n=e.uploadsApproved,a=e.loginCount,n>=20||a>=20)?"testimonial":null}({uploadsApproved:null!==(s=t.uploads_approved)&&void 0!==s?s:0,correctionsApproved:null!==(u=t.corrections_approved)&&void 0!==u?u:0,loginCount:null!==(h=t.login_count)&&void 0!==h?h:0,hasProfilePhoto:!!(null===(a=t.image)||void 0===a?void 0:a.trim()),hasBio:!!(null===(i=t.bio)||void 0===i?void 0:i.trim()),hasTestimonial:!0===t.has_testimonial,role:t.role,moderatorLevel:t.moderator_level,moderatorApplicationStatus:null!==(f=t.moderator_application_status)&&void 0!==f?f:null});if(!x||function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();try{if("1"===localStorage.getItem(Q(e,t,"dismissed"))||Number(localStorage.getItem(Q(e,t,"snooze"))||0)>r)return!0}catch(e){}return!1}(t.id,x)||function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();try{let r=localStorage.getItem(ee(e));if(!r)return null;let[n,a]=r.split("|");if(n!==et(t))return null;if("profile"===a||"moderator"===a||"testimonial"===a)return a}catch(e){}return null}(e,r);return null!=n&&n!==t}(t.id,x)){g.current=null,p(null);return}
1g.current!==x&&(g.current=x,er(t.id,x),en.MR.softPromptShown(x),m.x1.recordSoftPromptEvent({prompt_kind:x,event:"shown"}).catch(()=>{})),p(x)},[c,r,e,t,n,o,l,d]);let v=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"backdrop";(null==t?void 0:t.id)&&f&&(en.MR.softPromptSnooze(f,e),m.x1.recordSoftPromptEvent({prompt_kind:f,event:"snooze",snooze_action:e}).catch(()=>{}),function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();try{localStorage.setItem(Q(e,t,"snooze"),String(r+18144e5)),er(e,t,r)}catch(e){}}(t.id,f),g.current=null,p(null))};if(!f)return null;let b=ea[f];return(0,a.jsx)(x.Vq,{open:!0,onClose:()=>v("backdrop"),zIndex:90,className:"items-end sm:items-center pb-[calc(1rem+env(safe-area-inset-bottom))]",children:(0,a.jsxs)(x.EM,{labelledBy:"soft-engagement-title",describedBy:"soft-engagement-desc",className:"max-w-sm",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(x.$N,{id:"soft-engagement-title",children:b.title}),(0,a.jsx)(x.Be,{id:"soft-engagement-desc",className:"whitespace-pre-line",children:b.body}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row-reverse sm:gap-3",children:[(0,a.jsx)(x.zx,{href:b.href,onClick:()=>v("cta_navigate"),className:"w-full sm:w-auto min-h-[44px]",children:b.cta}),(0,a.jsx)(x.zx,{type:"button",variant:"secondary",onClick:()=>v("not_now"),className:"w-full sm:w-auto min-h-[44px]",children:"Not now"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>{(null==t?void 0:t.id)&&f&&(en.MR.softPromptDismissForever(f),m.x1.recordSoftPromptEvent({prompt_kind:f,event:"dismiss_forever"}).catch(()=>{}),function(e,t){try{localStorage.setItem(Q(e,t,"dismissed"),"1"),localStorage.removeItem(Q(e,t,"snooze")),er(e,t)}catch(e){}}(t.id,f),g.current=null,p(null))},className:"mt-3 min-h-[44px] w-full sm:w-auto text-sm text-gray-500 dark:text-gray-400 underline underline-offset-2 hover:text-gray-700 dark:hover:text-gray-200 touch-manipulation",children:"Don't ask again"})]})})}function eo(){let{status:e,user:t}=(0,u.aC)(),{preferAppExperience:r}=(0,J.l)(),n=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{!n.current&&"authenticated"===e&&t&&r&&(n.current=!0,m.x1.putAppStylePreference(!0).catch(()=>{}))},[e,t,r]),null}var es=r(52145),el=r(83125),ed=r(44954);function ec(){let e=(0,o.usePathname)(),t=(0,o.useRouter)(),r=(0,o.useSearchParams)();return(0,i.useEffect)(()=>{let n=r.get("nid");n&&m.x1.markNotificationRead(n).then(()=>(0,m.mE)()).catch(()=>{}).finally(()=>{let n=new URLSearchParams(r.toString());n.delete("nid");let a=n.toString();t.replace(a?"".concat(e,"?").concat(a):e,{scroll:!1})})},[e,t,r]),null}function eu(){let{status:e,user:t}=(0,u.aC)(),r=(0,o.useRouter)();return(0,i.useEffect)(()=>{"authenticated"===e&&((0,el.cz)()||m.x1.getPushStatus().then(async e=>{if(!e.configured||!(0,ed.Hd)()||(0,ed.we)())return;if("granted"===Notification.permission){await (0,ed.YV)().catch(()=>!1)&&e.subscribed||await (0,ed.id)().catch(()=>{});return}if("default"!==Notification.permission||!(null==t?void 0:t.id))return;let r="".concat("push-auto-prompted-v1",":").concat(t.id);"1"!==window.localStorage.getItem(r)&&(window.localStorage.setItem(r,"1"),await (0,ed.id)().catch(()=>{}))}).catch(()=>{}))},[e,null==t?void 0:t.id]),(0,i.useEffect)(()=>{var e,t;if((0,el.cz)())return;let n=e=>{var t,n;(null===(t=e.data)||void 0===t?void 0:t.type)==="notifications-refresh"&&(0,m.mE)(),(null===(n=e.data)||void 0===n?void 0:n.type)==="navigate"&&"string"==typeof e.data.url&&r.push(e.data.url)};return null===(t=navigator.serviceWorker)||void 0===t||null===(e=t.addEventListener)||void 0===e||e.call(t,"message",n),()=>{var e,t;return null===(t=navigator.serviceWorker)||void 0===t?void 0:null===(e=t.removeEventListener)||void 0===e?void 0:e.call(t,"message",n)}},[r]),(0,a.jsx)(i.Suspense,{fallback:null,children:(0,a.jsx)(ec,{})})}function em(){return(0,a.jsx)(i.Suspense,{fallback:null,children:(0,a.jsx)(eu,{})})}var eh=r(84584);let ef=null,ep="";async function ex(){if("undefined"==typeof navigator||navigator.onLine)return ef||(ef=(async()=>{try{var e;let t=await (0,eh.tj)(),r="".concat(t.pendingCount,":").concat(null!==(e=t.oldestUpdatedAt)&&void 0!==e?e:"");if(r===ep)return;await m.x1.putFieldModePendingStatus({pendingCount:t.pendingCount,oldestUpdatedAt:t.oldestUpdatedAt}),ep=r}catch(e){}finally{ef=null}})())}function eg(){let{status:e,user:t}=(0,u.aC)(),r=(0,i.useRef)(null),n="authenticated"===e&&(null==t?void 0:t.field_mode_enabled)===!0;return(0,i.useEffect)(()=>
1{if(!n){ep="";return}let e=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{ex()},800)};e();let t=(0,eh.t0)(e),a=()=>{ep="",e()};return window.addEventListener("online",a),()=>{t(),window.removeEventListener("online",a),r.current&&clearTimeout(r.current)}},[n,null==t?void 0:t.id]),null}function ev(e){let{pullDistance:t,refreshing:r}=e;if(!r&&t<8)return null;let n=Math.min(1,t/72),i=r||n>=1;return(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-30 flex justify-center",style:{height:r?40:Math.max(24,.85*t)},"aria-live":"polite","aria-busy":r||void 0,children:(0,a.jsxs)("div",{className:"mt-2 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md ring-1 ring-gray-200 ".concat(r?"animate-spin":""),style:r?void 0:{opacity:.35+.65*n,transform:"scale(".concat(.75+.25*n,")")},role:"status",children:[(0,a.jsx)("span",{className:"sr-only",children:i?"Refreshing":"Pull to refresh"}),(0,a.jsx)("svg",{className:"h-4 w-4 ".concat(i?"text-primary":"text-gray-500"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M4 12a8 8 0 018-8V2.5L15 5.5 12 8.5V7a5 5 0 105 5"})})]})})}var eb=r(49347);function ey(e){let{children:t}=e,r=(0,s.Hk)(),n=(0,s.mK)(),d=(0,o.usePathname)(),c=r&&(0,l._J)(d),u=(0,i.useRef)(null),{pullDistance:m,refreshing:h}=function(e,t){let[r,n]=(0,i.useState)(0),[a,o]=(0,i.useState)(!1),s=(0,i.useRef)(0),l=(0,i.useRef)(!1),d=(0,i.useRef)(0);return(0,i.useEffect)(()=>{if(!t)return;let r=e.current;if(!r)return;let i=()=>{l.current=!1,d.current=0,n(0)},c=e=>{var t,n;if(!a){if(r.scrollTop>1){l.current=!1;return}s.current=null!==(n=null===(t=e.touches[0])||void 0===t?void 0:t.clientY)&&void 0!==n?n:0,l.current=!0,d.current=0}},u=e=>{var t,o;if(!l.current||a)return;if(r.scrollTop>1){i();return}let c=(null!==(o=null===(t=e.touches[0])||void 0===t?void 0:t.clientY)&&void 0!==o?o:0)-s.current;if(c<=0){d.current=0,n(0);return}let u=Math.min(112,.5*c);d.current=u,n(u),u>10&&e.cancelable&&e.preventDefault()},m=()=>{if(!l.current)return;let e=d.current>=72&&!a;l.current=!1,d.current=0,n(0),e&&(o(!0),window.location.reload())};return r.addEventListener("touchstart",c,{passive:!0}),r.addEventListener("touchmove",u,{passive:!1}),r.addEventListener("touchend",m),r.addEventListener("touchcancel",m),()=>{r.removeEventListener("touchstart",c),r.removeEventListener("touchmove",u),r.removeEventListener("touchend",m),r.removeEventListener("touchcancel",m)}},[t,a,e]),{pullDistance:r,refreshing:a}}(u,n);(0,i.useEffect)(()=>{if("undefined"!=typeof document)return r?document.documentElement.classList.add("pwa-mode"):document.documentElement.classList.remove("pwa-mode"),n?document.documentElement.classList.add("native-app"):document.documentElement.classList.remove("native-app"),()=>{document.documentElement.classList.remove("pwa-mode"),document.documentElement.classList.remove("native-app")}},[r,n]);let f=(0,a.jsx)("a",{href:"#main-content",className:"sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[100] focus:!m-0 focus:!block focus:!w-auto focus:!h-auto focus:!p-4 focus:overflow-visible focus:!whitespace-normal focus:bg-primary focus:text-white focus:rounded-lg focus:outline-none focus:ring-2 focus:ring-offset-2",children:"Skip to main content"});return r?(0,a.jsx)(q,{children:(0,a.jsxs)("div",{className:"app-shell-pwa flex h-[100dvh] max-h-[100dvh] w-full min-h-0 flex-1 flex-col overflow-hidden",children:[f,(0,a.jsx)(es.Y,{}),(0,a.jsx)(em,{}),(0,a.jsx)(eg,{}),(0,a.jsx)(eo,{}),(0,a.jsxs)("div",{className:"shrink-0",children:[(0,a.jsx)(X,{}),(0,a.jsx)(R,{}),(0,a.jsx)(G,{})]}),(0,a.jsx)(K,{}),(0,a.jsx)(ei,{}),(0,a.jsx)("div",{className:"shrink-0",children:(0,a.jsx)(D,{})}),(0,a.jsxs)("div",{id:"main-content",ref:u,tabIndex:-1,className:"pwa-main-content relative flex min-h-0 flex-1 flex-col overflow-y-auto bg-gray-50 outline-none ".concat(n?"overscroll-y-auto":"overscroll-y-contain"),style:c?void 0:{paddingBottom:eb.Su,scrollPaddingBottom:eb.Su},children:[n?(0,a.jsx)(ev,{pullDistance:m,refreshing:h}):null,t]}
1),c?null:(0,a.jsx)("div",{className:"relative z-50 w-full shrink-0",children:(0,a.jsx)(A,{})})]})}):(0,a.jsxs)(q,{children:[f,(0,a.jsx)(es.Y,{}),(0,a.jsx)(em,{}),(0,a.jsx)(eg,{}),(0,a.jsx)(eo,{}),(0,a.jsx)(X,{}),(0,a.jsx)(R,{}),(0,a.jsx)(G,{}),(0,a.jsx)(K,{}),(0,a.jsx)(ei,{}),(0,a.jsx)(N,{}),(0,a.jsx)("div",{id:"main-content",tabIndex:-1,className:"flex min-w-0 flex-1 flex-col overflow-x-hidden outline-none",children:t}),(0,a.jsx)(_,{})]})}},52145:function(e,t,r){"use strict";r.d(t,{X:function(){return c},Y:function(){return m}});var n=r(57437),a=r(2265),i=r(91472),o=r(1996),s=r(99204),l=r(79179),d=r(93583);let c="postboxmap:auto-visited";function u(){let e=(0,i.Hk)(),t=(0,o.d)(),{showToast:r}=(0,d.p)(),[n,u]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!1;return s.x1.getSiteConfig().then(t=>{e||u(!0===t.auto_mark_visited_nearby_allowed)}).catch(()=>{e||u(!1)}),()=>{e=!0}},[]),!function(e,t){let{user:r}=(0,l.aC)(),[n,i]=(0,a.useState)(!1),o=(0,a.useRef)(new Set),d=(0,a.useRef)(0),c=(0,a.useRef)(null==t?void 0:t.onVisited);c.current=null==t?void 0:t.onVisited,(0,a.useEffect)(()=>{if(!e||!(null==r?void 0:r.id))return;let t=!1;return s.x1.getLocationPreferences().then(e=>{t||i(!0===e.auto_mark_visited_nearby)}).catch(()=>{}),()=>{t=!0}},[e,null==r?void 0:r.id]),(0,a.useEffect)(()=>{if(!e||!(null==r?void 0:r.id)||!n||"undefined"==typeof navigator||!navigator.geolocation)return;let t=navigator.geolocation.watchPosition(e=>{let t=Date.now();if(t-d.current<8e3)return;d.current=t;let r=e.coords.latitude,n=e.coords.longitude;s.x1.getPostboxesNearMe(r,n,{radius_km:.025,limit:50}).then(e=>{var t;for(let r of null!==(t=e.postboxes)&&void 0!==t?t:[]){let e=r.distance_km;if(null==e||e>.003)continue;let t=String(r.id);o.current.has(t)||(o.current.add(t),s.x1.addVisited(t).then(()=>{var e;null===(e=c.current)||void 0===e||e.call(c,t)}).catch(()=>{o.current.delete(t)}))}}).catch(()=>{})},()=>{},{enableHighAccuracy:!0,maximumAge:15e3,timeout:1e4});return()=>{navigator.geolocation.clearWatch(t)}},[e,null==r?void 0:r.id,n])}(n&&(e||t),{onVisited:(0,a.useCallback)(e=>{if(r("Marked as visited","success"),"Notification"in window){if("granted"===Notification.permission)try{new Notification("PostboxMap",{body:"A postbox was marked as visited.",tag:"auto-visited-".concat(e),requireInteraction:!1})}catch(e){}else Notification.permission}window.dispatchEvent(new CustomEvent(c,{detail:{postboxId:e}}))},[r])}),null}function m(){return(0,n.jsx)(u,{})}},18755:function(e,t,r){"use strict";r.d(t,{ChunkLoadRecovery:function(){return s}});var n=r(2265);function a(e){if(!e)return!1;let t=e instanceof Error?e.name:"",r=e instanceof Error?e.message:String(e),n="".concat(t," ").concat(r);return"ChunkLoadError"===t||/Loading chunk [\d]+ failed/i.test(n)||/ChunkLoadError/i.test(n)||/Failed to fetch dynamically imported module/i.test(n)}let i="pmb-chunk-reload";function o(){try{let e=Number(sessionStorage.getItem(i)||"0");if(e<2){sessionStorage.setItem(i,String(e+1)),window.location.reload();return}sessionStorage.removeItem(i)}catch(e){window.location.reload()}}function s(){return(0,n.useEffect)(()=>{let e=window.setTimeout(()=>(function(){try{sessionStorage.removeItem(i)}catch(e){}})(),6e4),t=e=>{var t;a(null!==(t=e.error)&&void 0!==t?t:e.message)&&(e.preventDefault(),o())},r=e=>{a(e.reason)&&(e.preventDefault(),o())};return window.addEventListener("error",t),window.addEventListener("unhandledrejection",r),()=>{window.clearTimeout(e),window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",r)}},[]),null}},11125:function(e,t,r){"use strict";r.d(t,{CountryProvider:function(){return l}});var n=r(57437),a=r(2265),i=r(70312),o=r(99204);let s=(0,a.createContext)(void 0);function l(e){let{children:t}=e,{country:r,loading:l,error:d}=(0,i.Dj)(),[c,u]=(0,a.useState)([]),[m,h]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{(async function(){try{let e=await o.x1.getCountries(!0);u(e)}catch(e){console.error("Failed to load countries:",e)}finally{h(!1)}})()},[]),(0,n.jsx)(s.Provider,{value:{country:r,loading:l,error:d,changeCountry:e=>{(0,i.mY)(e)},availableCountries:c,loadingCountries:m},children:t})}},26256:function(e,t,r){"use strict";r.d(t,{DeferredLayoutClient:function(){return c}});var n=r(57437),a=r(2265),i=r(30166),o=r(37836);let s=(0,i.default)(()=>r.e(19).then(r.bind(r,10019)).then(e=>({default:e.WebMcpTools})),{loadableGenerated:{webpack:()=>[10019]},ssr:!1}),l=(0,i.default)(()=>r.e(9384).then(r.bind(r,99384)).then(e=>({default:e.PwaInstallPromptCapture})),{loadableGenerated:{webpack:()=>[99384]},ssr:!1}),d=(0,i.default)(()=>Promise.all([r.e(3855),r.e(8502)]).then(r.bind(r,18502)).then(e=>({default:e.SubtypeDisplayHydrator})),{loadableGenerated:{webpack:()=>[18502]},ssr:!1});function c(){let[e,t]=(0,a.useState)(!1);return((0,a.useEffect)(()=>(0,o.T)(()=>t(!0),5e3),[]),e)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d,{}),(0,n.jsx)(s,{}),(0,n.jsx)(l,{})]}):null}},74168:function(e,t,r){"use strict";r.d(t,{De:function(){return d},GoogleAdSense:function(){return h},bz:function(){return u},fn:function(){return c}});var n=r(2265),a=r(99376),i=r(79266),o=r(66332),s=r(37836);let l="ca-pub-3907468540135854",d="adsbygoogle-loaded",c="adsbygoogle-failed",u="adsbygoogle-request";function m(){if(!l||"undefined"==typeof document)return;let e="adsbygoogle-script";
1if(document.getElementById(e))return;let t=document.createElement("script");t.id=e,t.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=".concat(l),t.crossOrigin="anonymous",t.async=!0,t.onload=()=>{window.dispatchEvent(new CustomEvent(d))},t.onerror=()=>{window.dispatchEvent(new CustomEvent(c))},document.head.appendChild(t)}function h(){let e=(0,a.usePathname)();return(0,n.useEffect)(()=>{if(!l||"undefined"==typeof document||!(0,o.eH)()||!(0,i.P)(e))return;let t=()=>m();window.addEventListener(u,t);let r=(0,s.T)(m,8e3);return()=>{window.removeEventListener(u,t),r()}},[e]),null}},93442:function(e,t,r){"use strict";r.d(t,{GoogleAnalytics:function(){return f}});var n=r(57437),a=r(48667),i=r(99376),o=r(2265),s=r(3548),l=r(37836);let d="G-5CH9HN08M6",c="__ga_initial_page_sent";function u(){return window.location.search.includes("ga_debug=1")}function m(){var e,t,r,n,a,i,o;let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onLoad";if(u()&&console.log("[GA] initial page_view check",{source:l,gtag:typeof(null===(e=window)||void 0===e?void 0:e.gtag)}),!d||!window.gtag)return;let m=window;if(m[c])return;m[c]=!0;let h=(null===(t=window.location)||void 0===t?void 0:t.pathname)||"/",f="string"==typeof(null===(r=document)||void 0===r?void 0:r.title)?document.title:void 0;null===(n=(a=window).gtag)||void 0===n||n.call(a,"config",d,{send_page_view:!1}),null===(i=(o=window).gtag)||void 0===i||i.call(o,"event","page_view",{page_path:h,page_title:f,...(0,s.Y6)()}),u()&&console.log("[GA] sent initial page_view (".concat(l,")"),{path:h,title:null!=f?f:"(none)"})}function h(){let e=(0,i.usePathname)(),t=(0,o.useRef)(null);return(0,o.useEffect)(()=>{var r,n,a;if(!d)return;let i=null!==(n=null!=e?e:null===(r=window.location)||void 0===r?void 0:r.pathname)&&void 0!==n?n:"/";if(i){if(null===t.current){let e=window;(null==e?void 0:e[c])||(m("effect"),u()&&console.log("[GA] sent initial page_view (effect)",{path:i})),t.current=i;return}t.current!==i&&((0,s.L9)("user_flow",{from_path:null!==(a=t.current)&&void 0!==a?a:void 0,to_path:i}),(0,s.Z0)(i),u()&&console.log("[GA] sent page_view (navigation)",{path:i}),t.current=i)}},[e]),(0,o.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{!window[c]&&(window.gtag?m("2.5s fallback"):u()&&console.warn("[GA] 2.5s fallback: gtag not available (script blocked or not loaded?)"))},2500);return()=>clearTimeout(e)},[]),null}function f(){let[e,t]=(0,o.useState)(!1);return((0,o.useEffect)(()=>{if(d)return(0,l.k)(()=>t(!0),1e4)},[]),d)?(u()&&e&&console.log("[GA] loaded",{measurementId:d,gtag:typeof window.gtag}),e)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.default,{id:"gtag-src",src:"https://www.googletagmanager.com/gtag/js?id=".concat(d),strategy:"afterInteractive",onLoad:()=>m("onLoad")}),(0,n.jsx)(h,{})]}):null:(window.location.search.includes("ga_debug=1")&&console.warn("[GA] NEXT_PUBLIC_GA_MEASUREMENT_ID not set â no tracking. Set it to your Front End stream ID (G-xxx) and rebuild."),null)}},10965:function(e,t,r){"use strict";r.d(t,{MicrosoftClarity:function(){return s}});var n=r(2265),a=r(37836),i=r(83125);let o=r(40257).env.NEXT_PUBLIC_CLARITY_PROJECT_ID;function s(){return(0,n.useEffect)(()=>{if(!(!o||"undefined"==typeof document||(0,i.cz)()))return(0,a.k)(()=>{if(document.getElementById("clarity-script"))return;let e=document.createElement("script");e.id="clarity-script",e.async=!0,e.src="https://www.clarity.ms/tag/".concat(o,"?ref=bwt"),document.head.appendChild(e)},1e4)},[]),null}},63616:function(e,t,r){"use strict";r.d(t,{PwaRegistration:function(){return i}});var n=r(2265),a=r(83125);function i(){return(0,n.useEffect)(()=>{let e;if(!("serviceWorker"in navigator)||(0,a.cz)())return;navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(t=>{e=t}).catch(e=>{});let t=()=>{var t;null==e||null===(t=e.update)||void 0===t||t.call(e)};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[]),null}},93583:function(e,t,r){"use strict";r.d(t,{ToastProvider:function(){return l},p:function(){return s}});var n=r(57437),a=r(2265);let i=(0,a.createContext)(null),o="postboxmap:toast";function s(){return(0,a.useContext)(i)||{showToast:e=>{console.warn("Toast used without ToastProvider:",e)}}}function l(e){let{children:t}=e,[r,s]=(0,a.useState)([]),l=(0,a.useCallback)(e=>{s(t=>t.filter(t=>t.id!==e))},[]),c=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success",r="toast-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,9)),n=Date.now()+5e3;s(a=>[...a,{id:r,message:e,type:t,expiresAt:n}]),setTimeout(()=>l(r),5e3)},[l]);return(0,a.useEffect)(()=>{let e=e=>{var t;c(e.detail.message,null!==(t=e.detail.type)&&void 0!==t?t:"info")};return window.addEventListener(o,e),()=>window.removeEventListener(o,e)},[c]),(0,n.jsxs)(i.Provider,{value:{showToast:c},children:[t,(0,n.jsxs)("div",{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2 max-w-sm w-full sm:max-w-md pointer-events-none",role:"region","aria-labelledby":"toast-region-heading",children:[(0,n.jsx)("h2",{id:"toast-region-heading",className:"sr-only",children:"Notifications"}),r.map(e=>(0,n.jsx)(d,{item:e,onDismiss:()=>l(e.id)},e.id))]})]})}function d(e){let{item:t,onDismiss:r}=e,a="error"===t.type,i="info"===t.type;return(0,n.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-auto px-4 py-3 rounded-xl border shadow-lg text-sm font-medium ".concat(a?"bg-red-100 dark:bg-red-900/90 text-red-800 dark:text-red-200 border-red-200 dark:border-red-800":i?"bg-blue-100 dar
1k:bg-blue-900/90 text-blue-800 dark:text-blue-200 border-blue-200 dark:border-blue-800":"bg-green-100 dark:bg-green-900/90 text-green-800 dark:text-green-200 border-green-200 dark:border-green-800"),children:(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsx)("p",{className:"flex-1",children:t.message}),(0,n.jsx)("button",{type:"button",onClick:r,className:"shrink-0 p-0.5 rounded hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1","aria-label":"Dismiss",children:(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}},55698:function(e,t,r){"use strict";r.d(t,{SessionProvider:function(){return w}});var n=r(57437),a=r(2265),i=r(79179),o=r(3548);function s(){let{user:e,loading:t}=(0,i.aC)();return(0,a.useEffect)(()=>{t||(0,o.tM)(e)},[e,t]),null}var l=r(99204);let d=[{value:"search_engine",label:"Google or another search engine"},{value:"facebook",label:"Facebook"},{value:"bluesky",label:"Bluesky"},{value:"mastodon",label:"Mastodon"},{value:"social_media",label:"Other social media (Instagram, X, etc.)"},{value:"reddit_or_forum",label:"Reddit or forum"},{value:"friend_or_family",label:"Friend or family"},{value:"newsletter_or_email",label:"Email or newsletter"},{value:"press_or_blog",label:"Article, blog or press"},{value:"event",label:"Event or talk"},{value:"postal_history_museum",label:"The Postal Museum"},{value:"openstreetmap",label:"OpenStreetMap (OSM)"},{value:"lbsg",label:"Letter Box Study Group (LBSG)"},{value:"cvphm",label:"Colne Valley Postal History Museum (CVPHM)"},{value:"other",label:"Other"}],c="other";function u(e){let{source:t,sourceDetail:r,onSourceChange:a,onSourceDetailChange:i,idPrefix:o="signup",required:s=!0}=e,l="".concat(o,"-source"),u="".concat(o,"-source-detail");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:l,className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"How did you hear about us?"}),(0,n.jsxs)("select",{id:l,value:t,onChange:e=>{a(e.target.value),e.target.value!==c&&i("")},required:s,className:"w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-xl bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-primary focus:border-transparent",style:{minHeight:"44px"},children:[(0,n.jsx)("option",{value:"",children:"Please selectâ¦"}),d.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))]})]}),t===c&&(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:u,className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Please tell us where"}),(0,n.jsx)("input",{id:u,type:"text",value:r,onChange:e=>i(e.target.value),maxLength:200,required:s,placeholder:"e.g. local newspaper, podcast, word of mouth at an event",className:"w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-xl bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-primary focus:border-transparent placeholder-gray-500 dark:placeholder-gray-400",style:{minHeight:"44px"}})]})]})}var m=r(41346);function h(e){let{onComplete:t,modal:r=!1}=e,[i,o]=(0,a.useState)(""),[s,d]=(0,a.useState)(""),[h,f]=(0,a.useState)(null),[p,x]=(0,a.useState)(!1),[g,v]=(0,a.useState)(!1),b=async e=>{e.preventDefault();let r=i?i!==c||s.trim()?null:"Please tell us where you heard about us.":"Please select how you heard about us.";if(r){f(r);return}f(null),x(!0);try{await l.x1.setSignupSource(function(e,t){let r={signup_source:e};return e===c&&t.trim()&&(r.signup_source_detail=t.trim()),r}(i,s)),t()}catch(e){f((0,l.i)(e,"Could not save your answer. Please try again."))}finally{x(!1)}},y=async()=>{f(null),v(!0);try{await l.x1.dismissSignupSource(),t()}catch(e){f((0,l.i)(e,"Could not skip for now. Please try again."))}finally{v(!1)}},w=p||g,j=(0,n.jsxs)(n.Fragment,{children:[h&&(0,n.jsx)("div",{className:"mb-4 p-3 rounded-lg bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 text-sm",role:"alert",children:h}),(0,n.jsxs)("form",{onSubmit:b,className:"space-y-4",children:[(0,n.jsx)(u,{source:i,sourceDetail
1:s,onSourceChange:o,onSourceDetailChange:d,idPrefix:"welcome-signup"}),(0,n.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3",children:[(0,n.jsx)(m.zx,{type:"submit",disabled:w,className:"w-full sm:w-auto min-h-[44px]",children:p?"Savingâ¦":"Continue"}),(0,n.jsx)(m.zx,{type:"button",variant:"secondary",disabled:w,onClick:()=>void y(),className:"w-full sm:w-auto min-h-[44px]",children:g?"Skippingâ¦":"No thanks"})]})]})]});return r?(0,n.jsx)(m.Vq,{open:!0,onClose:()=>void y(),zIndex:100,closeOnOverlayClick:!w,className:"items-end sm:items-center pb-[calc(1rem+env(safe-area-inset-bottom))]",children:(0,n.jsxs)(m.EM,{labelledBy:"signup-source-prompt-heading",describedBy:"signup-source-prompt-desc",className:"max-w-md",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(m.$N,{id:"signup-source-prompt-heading",children:"One quick question"}),(0,n.jsx)(m.Be,{id:"signup-source-prompt-desc",children:"Help us understand where people find PostboxMap. Optional, and you can skip anytime."}),j]})}):(0,n.jsxs)("div",{className:"mb-6 p-5 rounded-xl bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800",role:"region","aria-labelledby":"signup-source-prompt-heading",children:[(0,n.jsx)("h2",{id:"signup-source-prompt-heading",className:"text-lg font-semibold text-gray-900 dark:text-white mb-1",children:"One quick question"}),(0,n.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Help us understand where people find PostboxMap. Optional, and you can skip anytime."}),j]})}function f(){let{status:e,user:t,refreshUser:r}=(0,i.aC)();return"authenticated"===e&&(null==t?void 0:t.needs_signup_source)?(0,n.jsx)(h,{modal:!0,onComplete:()=>{r()}}):null}var p=r(18229),x=r(99376),g=r(91472);let v="21673549823-79taj49q2d70k2hq2q7bs9okfv59o217.apps.googleusercontent.com",b=["/login","/register","/profile/security"];function y(e){let{children:t}=e,r=(0,x.usePathname)(),a=(0,g.mK)(),i=(0,g.DE)();return v&&r&&b.some(e=>r===e||r.startsWith("".concat(e,"/")))&&i&&!a?(0,n.jsx)(p.rg,{clientId:v,children:t}):t}function w(e){let{children:t}=e,r=(0,g.Hk)();return(0,n.jsx)(y,{children:(0,n.jsxs)(i.Ho,{isPwa:r,children:[(0,n.jsx)(s,{}),(0,n.jsx)(f,{}),t]})})}},79266:function(e,t,r){"use strict";r.d(t,{P:function(){return a}});let n=["/moderator","/moderator_new","/owner","/dashboard","/add","/field-mode","/login","/register","/verify-email","/forgot-password","/reset-password","/profile","/api-keys","/my-submissions","/my-corrections","/notifications","/sorting-office","/restore-owner","/offline"];function a(e){return!e||!n.some(t=>e===t||e.startsWith("".concat(t,"/")))}},66332:function(e,t,r){"use strict";r.d(t,{On:function(){return s},eH:function(){return i},iG:function(){return a}});var n=r(83125);let a=[".google-auto-placed","ins.adsbygoogle-noablate","ins.adsbygoogle[data-anchor-status]","ins.adsbygoogle[data-vignette-loaded]"];function i(){return!(0,n.xP)()}function o(e){return!!e.closest(".google-ad-slot-wrapper, .google-ad-slot")}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=0;for(let r of a)e.querySelectorAll(r).forEach(e=>{var r;if(!(e instanceof Element)||o(e))return;let n=e.classList.contains("google-auto-placed")?e:null!==(r=e.closest(".google-auto-placed"))&&void 0!==r?r:e;n.isConnected&&(n.remove(),t+=1)});return"undefined"!=typeof document&&e===document&&document.querySelectorAll("ins.adsbygoogle").forEach(e=>{if(!(e instanceof HTMLElement)||o(e))return;let r=e.style.position||("function"==typeof getComputedStyle?getComputedStyle(e).position:"");("fixed"===r||"sticky"===r)&&(e.remove(),t+=1)}),t}},15721:function(e,t,r){"use strict";r.d(t,{Cb:function(){return a},Im:function(){return s},a_:function(){return o},l5:function(){return i}});var n=r(76374);let a=(0,n.XX)("https://play.google.com/store/apps/details?id=".concat("uk.co.postboxmap.app")),i=null;function o(){return i?(0,n.XX)(i):"/app#ios"}function s(){return!!i}},37836:function(e,t,r){"use strict";function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3,r=window.requestIdleCallback;if("function"==typeof r){let n=r(e,{timeout:t});return()=>cancelIdleCallback(n)}let n=setTimeout(e,Math.min(t,2e3));return()=>clearTimeout(n)}r.d(t,{T:function(){return n},k:function(){return i}});let a=["scroll","keydown","pointerdown","touchstart"];function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8e3,r=!1,i=()=>{r||(r=!0,e())},o=()=>{d(),l(),i()},s={passive:!0};for(let e of a)window.addEventListener(e,o,s);let l=n(i,t),d=()=>{for(let e of a)window.removeEventListener(e,o)};return()=>{d(),l()}}},84584:function(e,t,r){"use strict";r.d(t,{FU:function(){return f},Fb:function(){return v},Hh:function(){return p},QE:function(){return x},SH:function(){return g},Ui:function(){return a},Wj:function(){return u},cF:function(){return i},iH:function(){return c},q$:function(){return m},t0:function(){return d},tj:function(){return h}});let n="drafts",a=10,i={name:"",reign:"",postbox_type_id:"",subtype:"",in_service:null,manufacturer:"",reg_no:"",finish:"",box_status:"",notes:"",road:"",town:"",county:"",grid_reference:""},o=new Set;
1function s(){o.forEach(e=>{try{e()}catch(e){}})}function l(){return new Promise((e,t)=>{if("undefined"==typeof indexedDB){t(Error("IndexedDB not available"));return}let r=indexedDB.open("postboxmap_field_drafts_v1",1);r.onerror=()=>t(r.error),r.onsuccess=()=>e(r.result),r.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(n)||t.createObjectStore(n,{keyPath:"id"})}})}function d(e){return o.add(e),()=>o.delete(e)}async function c(){let e=await l();return new Promise((t,r)=>{let a=e.transaction(n,"readonly"),i=a.objectStore(n).getAll();i.onsuccess=()=>{let e=i.result||[];e.sort((e,t)=>new Date(e.created_at).getTime()-new Date(t.created_at).getTime()),t(e)},i.onerror=()=>r(i.error),a.oncomplete=()=>e.close()})}async function u(e){let t=await l();return new Promise((r,a)=>{let i=t.transaction(n,"readonly"),o=i.objectStore(n).get(e);o.onsuccess=()=>{var e;return r(null!==(e=o.result)&&void 0!==e?e:null)},o.onerror=()=>a(o.error),i.oncomplete=()=>t.close()})}async function m(){let e=await l();return new Promise((t,r)=>{let a=e.transaction(n,"readonly"),i=a.objectStore(n).count();i.onsuccess=()=>t(i.result),i.onerror=()=>r(i.error),a.oncomplete=()=>e.close()})}async function h(){let e=await c();if(0===e.length)return{pendingCount:0,oldestUpdatedAt:null};let t=1/0,r=null;for(let n of e){let e=new Date(n.updated_at||n.created_at).getTime();Number.isFinite(e)&&e<t&&(t=e,r=new Date(e).toISOString())}return{pendingCount:e.length,oldestUpdatedAt:r}}async function f(e){let t=await m();if(t>=50)throw Error("Draft limit reached (max ".concat(50,"). Submit or delete existing drafts first."));let r=await l();return new Promise((a,i)=>{let o=r.transaction(n,"readwrite"),l=o.objectStore(n).add(e);l.onsuccess=()=>{s(),a({id:e.id,warning:t+1>=20?"approaching_limit":void 0})},l.onerror=()=>i(l.error),o.oncomplete=()=>r.close()})}async function p(e,t){let r=await u(e);if(!r)throw Error("Draft not found");let{form:a,...i}=t,o={...r,...i,id:r.id,created_at:r.created_at,updated_at:new Date().toISOString(),form:{...r.form,...a}};i.images&&(o.images=i.images),"number"==typeof i.main_image_index?o.main_image_index=Math.max(0,Math.min(i.main_image_index,o.images.length-1)):null==o.main_image_index?o.main_image_index=0:o.main_image_index>=o.images.length&&(o.main_image_index=Math.max(0,o.images.length-1));let d=await l();return new Promise((e,t)=>{let r=d.transaction(n,"readwrite"),a=r.objectStore(n).put(o);a.onsuccess=()=>{s(),e()},a.onerror=()=>t(a.error),r.oncomplete=()=>d.close()})}async function x(e){let t=await l();return new Promise((r,a)=>{let i=t.transaction(n,"readwrite"),o=i.objectStore(n).delete(e);o.onsuccess=()=>{s(),r()},o.onerror=()=>a(o.error),i.oncomplete=()=>t.close()})}async function g(e,t){let r=await u(e);if(!r)throw Error("Draft not found");if(r.images.length>=a)throw Error("Maximum ".concat(a," photos per postbox."));await p(e,{images:[...r.images,t]})}async function v(e,t){var r;let n=await u(e);if(!n)throw Error("Draft not found");if(t<0||t>=n.images.length)throw Error("Invalid photo index");let a=n.images.filter((e,r)=>r!==t);if(0===a.length)throw Error("Each draft must have at least one photo.");let i=null!==(r=n.main_image_index)&&void 0!==r?r:0;t===i?i=0:t<i&&(i-=1),await p(e,{images:a,main_image_index:i})}},56520:function(e,t,r){"use strict";r.d(t,{v:function(){return a}});var n=r(99204);async function a(e,t){let r=function(e){if(!e||"object"!=typeof e||null===e||!("postboxId"in e))return"";let t=e.postboxId;return null!=t&&""!==String(t).trim()?String(t):""}(e),a=t.trim();r&&a&&await n.x1.addVisited(r,{visited_at:a}).catch(()=>{})}},20644:function(e,t,r){"use strict";r.d(t,{Il:function(){return i},_J:function(){return o}});let n={main:"min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-50 via-white to-surface py-12 px-4 sm:px-6 lg:px-8",container:"max-w-md w-full space-y-8",heading:"text-4xl font-bold text-gray-900 text-center mb-2",subtitle:"text-center",card:"bg-white rounded-2xl shadow-xl p-8",cardLinkStep:"bg-white rounded-2xl shadow-xl p-8 border-2 border-primary/20",form:"space-y-6",input:"",submit:"w-full",footer:"mt-6 text-center space-y-2",dividerLabel:"bg-white"},a={main:"native-auth-main min-h-0 w-full max-w-none flex flex-col items-stretch bg-white px-4 pb-6 pt-4",container:"native-auth-container w-full max-w-none space-y-3",heading:"text-[1.5rem] leading-tight font-bold text-gray-900 text-left mb-0 tracking-tight",subt
1itle:"text-left text-sm leading-snug",card:"bg-transparent rounded-none shadow-none p-0 w-full max-w-none",cardLinkStep:"bg-transparent rounded-none shadow-none p-0 w-full max-w-none",form:"space-y-3 w-full max-w-none",input:"min-h-[48px] h-[48px] w-full text-base px-3.5 rounded-xl border-gray-300",submit:"w-full min-h-[48px] h-[48px] text-base rounded-xl",footer:"mt-4 text-center space-y-2 pb-1",dividerLabel:"bg-white"};function i(e){return e?a:n}function o(e){return!!e&&("/login"===e||"/register"===e||e.startsWith("/login/")||e.startsWith("/register/"))}},47960:function(){}},function(e){e.O(0,[3587,6066,2972,6137,3464,5878,196,9204,1346,9179,7069,3680,2971,2117,1744],function(){return e(e.s=72415)}),_N_E=e.O()}]);
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.