{"id":40154374,"url":"https://github.com/johnsyweb/tampermonkey-parkrun","last_synced_at":"2026-01-19T15:33:50.618Z","repository":{"id":269276694,"uuid":"906930353","full_name":"johnsyweb/tampermonkey-parkrun","owner":"johnsyweb","description":"Messing with parkrun pages for my own enjoyment","archived":false,"fork":false,"pushed_at":"2026-01-12T02:00:27.000Z","size":12285,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T06:06:49.033Z","etag":null,"topics":["parkrun","parkrun-alphabet-challenge","parkrun-analysis","parkrun-bingo","parkrun-challenges","parkrun-charts","parkrun-compass","parkrun-data-analysis","parkrun-statistics","parkrun-visualisations","tampermonkey","userscript"],"latest_commit_sha":null,"homepage":"https://www.johnsy.com/tampermonkey-parkrun/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnsyweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-22T10:42:54.000Z","updated_at":"2026-01-12T02:00:30.000Z","dependencies_parsed_at":"2024-12-22T11:34:04.177Z","dependency_job_id":"e985b00b-2455-44d1-a1e4-0546c76f739d","html_url":"https://github.com/johnsyweb/tampermonkey-parkrun","commit_stats":null,"previous_names":["johnsyweb/tampermonkey-parkrun"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johnsyweb/tampermonkey-parkrun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsyweb%2Ftampermonkey-parkrun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsyweb%2Ftampermonkey-parkrun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsyweb%2Ftampermonkey-parkrun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsyweb%2Ftampermonkey-parkrun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnsyweb","download_url":"https://codeload.github.com/johnsyweb/tampermonkey-parkrun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsyweb%2Ftampermonkey-parkrun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28573017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T14:39:55.009Z","status":"ssl_error","status_checked_at":"2026-01-19T14:39:01.217Z","response_time":67,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parkrun","parkrun-alphabet-challenge","parkrun-analysis","parkrun-bingo","parkrun-challenges","parkrun-charts","parkrun-compass","parkrun-data-analysis","parkrun-statistics","parkrun-visualisations","tampermonkey","userscript"],"created_at":"2026-01-19T15:33:50.528Z","updated_at":"2026-01-19T15:33:50.582Z","avatar_url":"https://github.com/johnsyweb.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pete's parkrun userscripts\n\n## A script or scripts for messing with parkrun results pages\n\nYou'll need something like [Tampermonkey](https://www.tampermonkey.net) if\nyou'd like to enjoy them. Or you can use the bookmarklet versions.\n\n## Development Setup\n\nThis project uses [mise](https://mise.jdx.dev/) for development environment management.\n\n### Prerequisites\n\n- [mise](https://mise.jdx.dev/) - for managing development tools\n\n### Setup\n\n1. Install dependencies with mise (installs Ruby, Node, and pnpm):\n   ```bash\n   mise install\n   ```\n\n2. Install npm dependencies:\n   ```bash\n   pnpm install\n   ```\n   \nThe `mise.toml` file specifies the required versions:\n- Ruby 3.4.7 (for Jekyll)\n- Node LTS (for development tools)\n- pnpm latest (for package management)\n\n3. For microsite development, install Ruby/Jekyll dependencies:\n   ```bash\n   cd docs\n   bundle install\n   ```\n\n### Previewing the Microsite Locally\n\nThe microsite documentation is built with Jekyll and served from the `docs/` directory.\n\n1. Start the Jekyll server:\n   ```bash\n   cd docs\n   bundle exec jekyll serve --port 4000 --host 0.0.0.0\n   ```\n\n2. Visit http://localhost:4000/tampermonkey-parkrun/ in your browser\n\n### Generating Screenshots\n\nTo generate screenshots for the microsite:\n\n```bash\npnpm screenshots\n```\n\nThis will create screenshots of all userscripts in `docs/images/`.\n\n### Building the Microsite\n\nThe microsite is automatically deployed to GitHub Pages on every push to `main`. \n\nTo build the site locally:\n\n```bash\npnpm docs:build\n```\n\nTo serve the site locally:\n\n```bash\npnpm docs:serve\n```\n\nThe site will be available at http://localhost:4000/tampermonkey-parkrun/\n\n### Git Hooks\n\nThis project uses [husky](https://typicode.github.io/husky/) to manage git hooks. Hooks are automatically installed when you run `pnpm install`.\n\n#### Pre-commit Hook\n\nThe pre-commit hook ensures code quality by running:\n- `pnpm check-format` - Checks code formatting with Prettier\n- `pnpm test` - Runs all Jest tests\n- `pnpm lint` - Runs ESLint to check for linting errors\n\nAll checks must pass before a commit is allowed. This ensures all code is properly formatted, tested, and linted before being committed.\n\n#### Pre-push Hook\n\nThe pre-push hook automatically generates screenshots when userscripts are modified:\n\n- Checks if any `.user.js` files have been modified in the commits being pushed\n- Automatically runs `pnpm screenshots` if userscripts were changed\n- Prevents the push if screenshot generation fails\n\n**Note:** Screenshots must be generated locally because parkrun websites block automated agents from accessing them in CI environments.\n\n### GitHub Actions Workflow\n\nThe project includes a GitHub Actions workflow that:\n\n1. Sets up Ruby (for Jekyll) and Node.js (for scripts)\n2. Installs dependencies (via mise, pnpm, and bundler)\n3. Updates the scripts data file from userscript metadata\n4. Builds the Jekyll site\n5. Deploys to GitHub Pages\n\nThis workflow runs on every push to `main` and automatically keeps the microsite up to date with the latest scripts.\n\n## Why?\n\nWhy not?\n\n## How to Install Bookmarklets\n\nTo use these scripts as bookmarklets, follow these steps:\n\n1. Copy the JavaScript code for the desired bookmarklet from the sections below.\n2. Open your browser's bookmarks manager.\n3. Create a new bookmark.\n4. Paste the JavaScript code into the URL field of the bookmark.\n5. Save the bookmark.\n\nNow, you can click the bookmark while on a parkrun results page to run the script.\n\n## Updating Versions\n\nTo update the `@version` field in all userscripts, run the following Node.js script:\n\n```bash\nnode scripts/update-version.js\n```\n\nThis will automatically update the `@version` field in all `.user.js` files based on the current date and time.\n\n## Bookmarklets\n\nYou can also use these scripts as bookmarklets by creating bookmarks with the following URLs:\n\n### parkrun Alphabet Challenge\n\n\u003e Tracks progress on the unofficial parkrun alphabet challenge (A-Z, excluding X) with a 5x5 grid visualization and download feature.\n\n\n[alphabet-challenge.user.js](https://raw.githubusercontent.com/johnsyweb/tampermonkey-parkrun/refs/heads/main/alphabet-challenge.user.js)\n\n```javascript\njavascript:(async()=\u003e{var o,e,t,p;function c(e,t){var n,o,r,l,a=\"undefined\"!=typeof Symbol\u0026\u0026e[Symbol.iterator]||e[\"@@iterator\"];if(a)return r=!(o=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){r=!0,n=e},f:function(){try{o||null==a.return||a.return()}finally{if(r)throw n}}};if(Array.isArray(e)||(a=((e,t)=\u003e{var n;if(e)return\"string\"==typeof e?i(e,t):\"Map\"===(n=\"Object\"===(n={}.toString.call(e).slice(8,-1))\u0026\u0026e.constructor?e.constructor.name:n)||\"Set\"===n?Array.from(e):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0})(e))||t\u0026\u0026e\u0026\u0026\"number\"==typeof e.length)return a\u0026\u0026(e=a),l=0,{s:t=function(){},n:function(){return l\u003e=e.length?{done:!0}:{done:!1,value:e[l++]}},e:function(e){throw e},f:t};throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}function i(e,t){(null==t||t\u003ee.length)\u0026\u0026(t=e.length);for(var n=0,o=Array(t);n\u003ct;n++)o[n]=e[n];return o}function d(){return window.innerWidth\u003c768?{isMobile:!0,spacing:{small:\"8px\",medium:\"10px\",large:\"10px\"},container:{padding:\"10px\",marginTop:\"10px\"},typography:{heading:\"1.1em\",stats:\"1em\",statsSubtext:\"0.9em\"},grid:{gapSize:\"5px\",marginTop:\"10px\",cellPadding:\"5px\",letterFontSize:\"1.2em\",letterMarginBottom:\"2px\",eventFontSize:\"0.7em\",dateFontSize:\"0.65em\"},button:{padding:\"6px 12px\",fontSize:\"0.9em\",marginTop:\"10px\"},heading:{marginBottom:\"10px\"}}:{isMobile:!1,spacing:{small:\"10px\",medium:\"15px\",large:\"20px\"},container:{padding:\"20px\",marginTop:\"20px\"},typography:{heading:\"1.3em\",stats:\"1.2em\",statsSubtext:\"1em\"},grid:{gapSize:\"10px\",marginTop:\"20px\",cellPadding:\"10px\",letterFontSize:\"1.5em\",letterMarginBottom:\"5px\",eventFontSize:\"0.8em\",dateFontSize:\"0.7em\"},button:{padding:\"8px 15px\",fontSize:\"1em\",marginTop:\"15px\"},heading:{marginBottom:\"15px\"}}}function n(l){var e,t,r,n=d(),o=document.createElement(\"div\"),a=(o.className=\"parkrun-alphabet-container\",o.style.width=\"100%\",o.style.maxWidth=\"800px\",o.style.margin=\"\".concat(n.container.marginTop,\" auto\"),o.style.padding=n.container.padding,o.style.backgroundColor=\"#2b223d\",o.style.borderRadius=\"8px\",o.style.boxShadow=\"0 2px 4px rgba(0,0,0,0.1)\",o.style.color=\"#e0e0e0\",o.style.textAlign=\"center\",document.createElement(\"h3\")),a=(a.textContent=\"Alphabet Challenge\",a.style.marginBottom=n.heading.marginBottom,a.style.color=\"#FFA300\",a.style.fontSize=n.typography.heading,o.appendChild(a),document.createElement(\"div\")),i=(a.innerHTML='\u003cdiv style=\"font-size: '.concat(n.typography.stats,\"; margin-bottom: \").concat(n.spacing.small,';\"\u003e')+\"\u003cstrong\u003e\"+l.completedCount+\" of 25\u003c/strong\u003e letters completed\u003c/div\u003e\"+'\u003cdiv style=\"font-size: '.concat(n.typography.statsSubtext,';\"\u003eAfter ')+l.totalEvents+\" parkruns\u003c/div\u003e\"+(l.dateOfCompletion?'\u003cdiv style=\"font-size: '.concat(n.typography.statsSubtext,';\"\u003e🎉 Challenge completed on: ').concat(l.dateOfCompletion,\"\u003c/div\u003e\"):\"\"),o.appendChild(a),document.createElement(\"div\"));return i.style.display=\"grid\",i.style.gridTemplateColumns=\"repeat(5, 1fr)\",i.style.gap=n.grid.gapSize,i.style.marginTop=n.grid.marginTop,p.forEach(function(r){var e=document.createElement(\"div\"),t=(e.style.aspectRatio=\"1\",e.style.position=\"relative\",e.style.border=\"1px solid #666\",e.style.borderRadius=\"4px\",e.style.backgroundColor=l.completedLetters[r]?\"#FFA300\":\"#008080\",e.style.color=\"#fff\",e.style.display=\"flex\",e.style.flexDirection=\"column\",e.style.alignItems=\"flex-start\",e.style.justifyContent=\"flex-start\",e.style.padding=n.grid.cellPadding,e.style.fontWeight=\"bold\",e.style.fontSize=\"1em\",e.style.cursor=l.completedLetters[r]?\"pointer\":\"default\",document.createElement(\"div\"));t.textContent=r,t.style.fontSize=n.grid.letterFontSize,t.style.marginBottom=n.grid.letterMarginBottom,e.appendChild(t),l.completedLetters[r]\u0026\u0026((t=document.createElement(\"div\")).innerHTML='\u003cdiv style=\"font-size: '.concat(n.grid.eventFontSize,'; text-align: left;\"\u003e')+l.completedLetters[r].eventName+\"\u003cbr\u003e\"+'\u003cspan style=\"font-size: '.concat(n.grid.dateFontSize,';\"\u003e(')+l.completedLetters[r].date+\")\u003c/span\u003e\u003c/div\u003e\",n.isMobile\u0026\u0026(t.style.display=\"none\"),e.appendChild(t),e.addEventListener(\"click\",function(){var e=d(),t=document.createElement(\"div\"),n=(t.style.position=\"fixed\",t.style.top=\"0\",t.style.left=\"0\",t.style.width=\"100%\",t.style.height=\"100%\",t.style.backgroundColor=\"rgba(0, 0, 0, 0.5)\",t.style.zIndex=\"999\",t.addEventListener(\"click\",function(){document.body.removeChild(t)}),document.createElement(\"div\")),o=(n.style.position=\"fixed\",n.style.top=\"50%\",n.style.left=\"50%\",n.style.transform=\"translate(-50%, -50%)\",n.style.backgroundColor=\"#2b223d\",n.style.color=\"#fff\",e.isMobile?\"15px\":\"20px\"),o=(n.style.padding=o,n.style.borderRadius=\"8px\",n.style.boxShadow=\"0 2px 4px rgba(0,0,0,0.5)\",n.style.zIndex=\"1000\",n.style.maxWidth=e.isMobile?\"95%\":\"90%\",n.style.maxHeight=e.isMobile?\"85%\":\"80%\",n.style.overflowY=\"auto\",n.style.fontSize=e.isMobile?\"0.9em\":\"1em\",document.createElement(\"h4\")),e=(o.textContent=\"Letter \".concat(r),o.style.marginBottom=\"10px\",o.style.color=\"#FFA300\",n.appendChild(o),document.createElement(\"div\"));e.style.marginBottom=\"10px\",e.innerHTML=\"\u003cstrong\u003e\"+l.completedLetters[r].eventName+'\u003c/strong\u003e\u003cbr\u003e\u003cspan style=\"font-size: 0.9em;\"\u003e'+l.completedLetters[r].date+\"\u003c/span\u003e\",n.appendChild(e),t.appendChild(n),document.body.appendChild(t)})),i.appendChild(e)}),o.appendChild(i),e=o,a=d(),(t=document.createElement(\"div\")).style.marginTop=a.button.marginTop,t.id=\"alphabet-download-btn-container\",(r=document.createElement(\"button\")).textContent=\"💾 Save as Image\",r.style.padding=a.button.padding,r.style.backgroundColor=\"#FFA300\",r.style.color=\"#2b223d\",r.style.border=\"none\",r.style.borderRadius=\"4px\",r.style.cursor=\"pointer\",r.style.fontWeight=\"bold\",r.style.fontSize=a.button.fontSize,r.addEventListener(\"mouseover\",function(){this.style.backgroundColor=\"#e59200\"}),r.addEventListener(\"mouseout\",function(){this.style.backgroundColor=\"#FFA300\"}),r.addEventListener(\"click\",function(){r.style.display=\"none\",html2canvas(e,{backgroundColor:\"#2b223d\",scale:2,logging:!1,allowTaint:!0,useCORS:!0}).then(function(e){r.style.display=\"block\";var t=document.createElement(\"a\"),n=(new Date).toISOString().split(\"T\")[0],o=window.location.pathname.split(\"/\")[2]||\"parkrunner\";t.download=\"alphabet-challenge-\".concat(o,\"-\").concat(n,\".png\"),t.href=e.toDataURL(\"image/png\"),t.click()})}),t.appendChild(r),e.appendChild(t),o}o=\"https://html2canvas.hertzen.com/dist/html2canvas.min.js\",await new Promise((e,t)=\u003e{var n=document.createElement(\"script\");n.src=o,n.onload=e,n.onerror=t,document.head.appendChild(n)}),p=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\").filter(function(e){return\"X\"!==e}),(t=(t=document.querySelectorAll(\"#results\"))[t.length-1])?(t=t=n((e=\u003e{var t,n={},o=0,r=null,l=c(Array.from(e.querySelectorAll(\"tr\")).reverse());try{for(l.s();!(t=l.n()).done;){var a=t.value.querySelectorAll(\"td\");if(!(a.length\u003c1)){var i=a[0].textContent.trim(),d=a[1].textContent.trim(),s=i.charAt(0).toUpperCase();if(o++,p.includes(s)\u0026\u0026!n[s]\u0026\u0026(n[s]={eventName:i,date:d},25===Object.keys(n).length)){r=d;break}}}}catch(e){l.e(e)}finally{l.f()}return e=Object.keys(n).length,{completedLetters:n,remainingLetters:p.filter(function(e){return!n[e]}),completedCount:e,dateOfCompletion:r,totalEvents:o}})(t)),(e=document.querySelector(\"h2\"))\u0026\u0026e.parentNode\u0026\u0026(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t))):console.log(\"Results table not found\")})();\n```\n\n### parkrun Compass Challenge\n\n\u003e Visualizes your progress on the compass challenge (North, South, East, West parkruns)\n\n\n[compass-challenge.user.js](https://raw.githubusercontent.com/johnsyweb/tampermonkey-parkrun/refs/heads/main/compass-challenge.user.js)\n\n```javascript\njavascript:(async()=\u003e{var o,t,e,b,w;function y(t,e){return(t=\u003e{if(Array.isArray(t))return t})(t)||((t,e)=\u003e{var n=null==t?null:\"undefined\"!=typeof Symbol\u0026\u0026t[Symbol.iterator]||t[\"@@iterator\"];if(null!=n){var o,a,r,i,c=[],s=!0,l=!1;try{if(r=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(o=r.call(n)).done)\u0026\u0026(c.push(o.value),c.length!==e);s=!0);}catch(t){l=!0,a=t}finally{try{if(!s\u0026\u0026null!=n.return\u0026\u0026(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return c}})(t,e)||((t,e)=\u003e{var n;if(t)return\"string\"==typeof t?a(t,e):\"Map\"===(n=\"Object\"===(n={}.toString.call(t).slice(8,-1))\u0026\u0026t.constructor?t.constructor.name:n)||\"Set\"===n?Array.from(t):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0})(t,e)||(()=\u003e{throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")})()}function a(t,e){(null==e||e\u003et.length)\u0026\u0026(e=t.length);for(var n=0,o=Array(e);n\u003ce;n++)o[n]=t[n];return o}function s(){return window.innerWidth\u003c768?{isMobile:!0,spacing:{small:\"10px\",medium:\"15px\",statsMarginBottom:\"8px\",completionMarginTop:\"8px\"},container:{padding:\"10px\",marginTop:\"10px\"},typography:{heading:\"1.1em\",stats:\"1em\",statsSubtext:\"0.9em\",completion:\"0.95em\"},compass:{baseSize:320},button:{padding:\"6px 12px\",fontSize:\"0.9em\",marginTop:\"10px\"}}:{isMobile:!1,spacing:{small:\"20px\",medium:\"20px\",statsMarginBottom:\"10px\",completionMarginTop:\"10px\"},container:{padding:\"20px\",marginTop:\"20px\"},typography:{heading:\"1.3em\",stats:\"1.2em\",statsSubtext:\"1em\",completion:\"1.1em\"},compass:{baseSize:700},button:{padding:\"8px 15px\",fontSize:\"1em\",marginTop:\"15px\"}}}function n(t){var e=s(),n=(n=\"Compass Challenge\",o=s(),(r=document.createElement(\"div\")).className=\"parkrun-compass-container\",r.style.width=\"100%\",r.style.maxWidth=\"800px\",r.style.margin=\"\".concat(o.container.marginTop,\" auto\"),r.style.padding=o.container.padding,r.style.backgroundColor=b.backgroundColor,r.style.borderRadius=\"8px\",r.style.boxShadow=\"0 2px 4px rgba(0,0,0,0.1)\",r.style.textAlign=\"center\",(a=document.createElement(\"h3\")).textContent=n,a.style.marginBottom=o.spacing.small,a.style.color=b.accentColor,a.style.fontSize=o.typography.heading,r.appendChild(a),r),o=document.createElement(\"div\"),a=(o.style.marginBottom=e.spacing.small,o.style.color=b.textColor,'\u003cdiv style=\"font-size: '.concat(e.typography.stats,\"; margin-bottom: \").concat(e.spacing.statsMarginBottom,';\"\u003e\u003cstrong\u003e').concat(t.completedCount,\" of 4\u003c/strong\u003e compass directions completed\u003c/div\u003e\")),r=(a+='\u003cdiv style=\"font-size: '.concat(e.typography.statsSubtext,';\"\u003eAfter ').concat(t.totalEvents,\" parkruns\u003c/div\u003e\"),t.dateOfCompletion\u0026\u0026(a+='\u003cdiv style=\"margin-top: '.concat(e.spacing.completionMarginTop,\"; font-size: \").concat(e.typography.completion,';\"\u003e🧭 Challenge completed on ').concat(t.dateOfCompletion,\"\u003c/div\u003e\")),o.innerHTML=a,n.appendChild(o),e.isMobile?Math.min(e.compass.baseSize,window.innerWidth-40):e.compass.baseSize),a=document.createElement(\"div\"),p=(a.style.position=\"relative\",a.style.width=\"\".concat(r,\"px\"),a.style.height=\"\".concat(r,\"px\"),a.style.margin=\"0 auto\",a.style.boxSizing=\"content-box\",document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\")),m=(p.setAttribute(\"width\",\"100%\"),p.setAttribute(\"height\",\"100%\"),p.setAttribute(\"viewBox\",\"0 0 \".concat(700,\" \").concat(700)),p.style.position=\"absolute\",p.style.top=\"0\",p.style.left=\"0\",350),h=350,o=document.createElementNS(\"http://www.w3.org/2000/svg\",\"circle\");o.setAttribute(\"cx\",m),o.setAttribute(\"cy\",h),o.setAttribute(\"r\",230),o.setAttribute(\"fill\",\"#334\"),o.setAttribute(\"stroke\",b.accentColor),o.setAttribute(\"stroke-width\",\"5\"),p.appendChild(o);[{name:\"north\",angle:270,label:\"N\",data:t.directions.north},{name:\"east\",angle:0,label:\"E\",data:t.directions.east},{name:\"south\",angle:90,label:\"S\",data:t.directions.south},{name:\"west\",angle:180,label:\"W\",data:t.directions.west}].forEach(function(t){var e=t.angle*(Math.PI/180),n=m+230*Math.cos(e),o=h+230*Math.sin(e),a=230*.12,r=m+115*Math.cos(e),i=h+115*Math.sin(e),c=e+Math.PI/2,s=r+a*Math.cos(c),l=i+a*Math.sin(c),r=r-a*Math.cos(c),i=i-a*Math.sin(c),a=document.createElementNS(\"http://www.w3.org/2000/svg\",\"path\"),c=\"M \".concat(m,\" \").concat(h,\" L \").concat(s,\" \").concat(l,\" L \").concat(n,\" \").concat(o,\" L \").concat(r,\" \").concat(i,\" Z\"),s=(a.setAttribute(\"d\",c),a.setAttribute(\"fill\",t.data?b.completedColor:b.pendingColor),a.setAttribute(\"stroke\",\"#000\"),a.setAttribute(\"stroke-width\",\"1\"),a.setAttribute(\"stroke-opacity\",\"0.3\"),p.appendChild(a),m+115*Math.cos(e)),l=h+115*Math.sin(e),n=document.createElementNS(\"http://www.w3.org/2000/svg\",\"text\");if(n.setAttribute(\"x\",s),n.setAttribute(\"y\",l),n.setAttribute(\"text-anchor\",\"middle\"),n.setAttribute(\"dominant-baseline\",\"middle\"),n.setAttribute(\"fill\",\"#fff\"),n.setAttribute(\"font-size\",\"28px\"),n.setAttribute(\"font-weight\",\"bold\"),n.setAttribute(\"stroke\",\"#000\"),n.setAttribute(\"stroke-width\",\"1\"),n.setAttribute(\"paint-order\",\"stroke\"),n.textContent=t.label,p.appendChild(n),t.data){var o=t.data.eventName.match(/(.+?)(?:\\s+parkrun)?$/i),r=o?o[1]:t.data.eventName,i=\"\".concat(r,\" - \").concat(t.data.date),c=\"text-path-\".concat(t.name),a=document.createElementNS(\"http://www.w3.org/2000/svg\",\"path\"),d=\"\",u=245;switch(t.name){case\"north\":d=\"M \".concat(180,\" \").concat(105,\" A \").concat(u,\" \").concat(u,\" 0 0 1 \").concat(520,\" \").concat(105);break;case\"east\":d=\"M \".concat(595,\" \").concat(180,\" A \").concat(u,\" \").concat(u,\" 0 0 1 \").concat(595,\" \").concat(520);break;case\"south\":d=\"M \".concat(180,\" \").concat(595,\" A \").concat(u,\" \").concat(u,\" 0 0 0 \").concat(520,\" \").concat(595);break;case\"west\":d=\"M \".concat(105,\" \").concat(520,\" A \").concat(u,\" \").concat(u,\" 0 0 1 \").concat(105,\" \").concat(180);break;default:console.warn(\"Unknown direction: \".concat(t.name))}a.setAttribute(\"id\",c),a.setAttribute(\"d\",d),a.setAttribute(\"fill\",\"none\"),p.appendChild(a);e=document.createElementNS(\"http://www.w3.org/2000/svg\",\"text\"),s=(e.setAttribute(\"fill\",\"#FFFFFF\"),e.setAttribute(\"font-size\",\"14px\"),e.setAttribute(\"font-weight\",\"bold\"),document.createElementNS(\"http://www.w3.org/2000/svg\",\"textPath\"));s.setAttribute(\"href\",\"#\".concat(c)),s.setAttribute(\"startOffset\",\"50%\"),s.setAttribute(\"text-anchor\",\"middle\"),\"south\"===t.name\u0026\u0026s.setAttribute(\"side\",\"left\"),s.textContent=i,e.appendChild(s),p.appendChild(e)}});var i,c,e=document.createElementNS(\"http://www.w3.org/2000/svg\",\"defs\"),r=document.createElementNS(\"http://www.w3.org/2000/svg\",\"filter\"),o=(r.setAttribute(\"id\",\"text-shadow\"),r.setAttribute(\"x\",\"-20%\"),r.setAttribute(\"y\",\"-20%\"),r.setAttribute(\"width\",\"140%\"),r.setAttribute(\"height\",\"140%\"),document.createElementNS(\"http://www.w3.org/2000/svg\",\"feDropShadow\")),o=(o.setAttribute(\"dx\",\"0\"),o.setAttribute(\"dy\",\"0\"),o.setAttribute(\"stdDeviation\",\"2\"),o.setAttribute(\"flood-color\",\"#000000\"),o.setAttribute(\"flood-opacity\",\"0.7\"),r.appendChild(o),e.appendChild(r),p.appendChild(e),document.createElementNS(\"http://www.w3.org/2000/svg\",\"circle\")),r=(o.setAttribute(\"cx\",m),o.setAttribute(\"cy\",h),o.setAttribute(\"r\",30),o.setAttribute(\"fill\",b.accentColor),p.appendChild(o),document.createElementNS(\"http://www.w3.org/2000/svg\",\"text\"));return r.setAttribute(\"x\",m),r.setAttribute(\"y\",h),r.setAttribute(\"text-anchor\",\"middle\"),r.setAttribute(\"dominant-baseline\",\"middle\"),r.setAttribute(\"fill\",b.backgroundColor),r.setAttribute(\"font-size\",\"24px\"),r.setAttribute(\"font-weight\",\"bold\"),r.textContent=\"\".concat(Math.round(t.completedCount/4*100),\"%\"),p.appendChild(r),a.appendChild(p),n.appendChild(a),i=n,e=s(),(o=document.createElement(\"div\")).style.marginTop=e.button.marginTop,o.id=\"compass-download-btn-container\",(c=document.createElement(\"button\")).textContent=\"💾 Save as Image\",c.style.padding=e.button.padding,c.style.backgroundColor=b.accentColor,c.style.color=b.backgroundColor,c.style.border=\"none\",c.style.borderRadius=\"4px\",c.style.cursor=\"pointer\",c.style.fontWeight=\"bold\",c.style.fontSize=e.button.fontSize,c.addEventListener(\"mouseover\",function(){this.style.backgroundColor=\"#e59200\"}),c.addEventListener(\"mouseout\",function(){this.style.backgroundColor=b.accentColor}),c.addEventListener(\"click\",function(){c.style.display=\"none\",html2canvas(i,{backgroundColor:b.backgroundColor,scale:2,logging:!1,allowTaint:!0,useCORS:!0}).then(function(t){c.style.display=\"block\";var e=document.createElement(\"a\"),n=(new Date).toISOString().split(\"T\")[0],o=window.location.pathname.split(\"/\")[2]||\"parkrunner\";e.download=\"compass-challenge-\".concat(o,\"-\").concat(n,\".png\"),e.href=t.toDataURL(\"image/png\"),e.click()})}),o.appendChild(c),i.appendChild(o),n}o=\"https://html2canvas.hertzen.com/dist/html2canvas.min.js\",await new Promise((t,e)=\u003e{var n=document.createElement(\"script\");n.src=o,n.onload=t,n.onerror=e,document.head.appendChild(n)}),b={backgroundColor:\"#2b223d\",accentColor:\"#FFA300\",completedColor:\"#53BA9D\",pendingColor:\"#666\",textColor:\"#e0e0e0\",subtleTextColor:\"#cccccc\"},w={north:/north/i,south:/south/i,east:/east/i,west:/west/i},document.querySelector(\"#results\")?(t=t=n((t=\u003e{for(var e={north:null,south:null,east:null,west:null},n=0,o=null,a=0,t=t.querySelectorAll(\"tr\"),r=[],i=(t.forEach(function(t){var e,n,o,t=t.querySelectorAll(\"td\");t.length\u003c5||(e=t[0].textContent.trim(),n=t[1].textContent.trim(),o=t[2].textContent.trim(),(t=t[4].textContent.trim())\u0026\u0026o\u0026\u0026n\u0026\u0026e\u0026\u0026r.push({eventName:e,date:n,eventNumber:o,time:t}))}),r.reverse()),c=0;!o\u0026\u0026c\u003ci.length;c++){var s=i[c],l=s.eventName,d=s.date,u=s.eventNumber,p=s.time;a++;for(var m=0,h=Object.entries(w);m\u003ch.length;m++){var b=y(h[m],2),g=b[0];b[1].test(l)\u0026\u0026!e[g]\u0026\u0026(e[g]={eventName:l,date:d,eventNumber:u,time:p},4===++n)\u0026\u0026(o=o||d)}}return{directions:e,completedCount:n,dateOfCompletion:o,totalEvents:a}})((t=document.querySelectorAll(\"#results\"))[t.length-1])),(e=document.querySelector(\"h2\"))\u0026\u0026e.parentNode\u0026\u0026(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t))):console.log(\"Results table not found\")})();\n```\n\n### parkrun Launch Returnees\n\n\u003e Identifies and displays participants who attended both the launch event and the latest event\n\n\n[launch-returnees.user.js](https://raw.githubusercontent.com/johnsyweb/tampermonkey-parkrun/refs/heads/main/launch-returnees.user.js)\n\n```javascript\njavascript:(async()=\u003e{function m(t){return(t=\u003e{if(Array.isArray(t))return r(t)})(t)||(t=\u003e{if(\"undefined\"!=typeof Symbol\u0026\u0026null!=t[Symbol.iterator]||null!=t[\"@@iterator\"])return Array.from(t)})(t)||((t,e)=\u003e{var n;if(t)return\"string\"==typeof t?r(t,e):\"Map\"===(n=\"Object\"===(n={}.toString.call(t).slice(8,-1))\u0026\u0026t.constructor?t.constructor.name:n)||\"Set\"===n?Array.from(t):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0})(t)||(()=\u003e{throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")})()}function r(t,e){(null==e||e\u003et.length)\u0026\u0026(e=t.length);for(var n=0,r=Array(e);n\u003ce;n++)r[n]=t[n];return r}function g(){var y,t=\"function\"==typeof Symbol?Symbol:{},e=t.iterator||\"@@iterator\",n=t.toStringTag||\"@@toStringTag\";function r(t,e,n,r){var o,a,i,c,u,l,s,f,p,e=e\u0026\u0026e.prototype instanceof m?e:m,e=Object.create(e.prototype);return b(e,\"_invoke\",(o=t,a=n,s=r||[],f=!1,p={p:l=0,n:0,v:y,a:d,f:d.bind(y,4),d:function(t,e){return i=t,c=0,u=y,p.n=e,h}},function(t,e,n){if(1\u003cl)throw TypeError(\"Generator is already running\");for(f\u0026\u00261===e\u0026\u0026d(e,n),c=e,u=n;(v=c\u003c2?y:u)||!f;){i||(c?c\u003c3?(1\u003cc\u0026\u0026(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(v=i[t=c?t:\"next\"]){if(!(v=v.call(i,u)))throw TypeError(\"iterator result is not an object\");if(!v.done)return v;u=v.value,c\u003c2\u0026\u0026(c=0)}else 1===c\u0026\u0026(v=i.return)\u0026\u0026v.call(i),c\u003c2\u0026\u0026(u=TypeError(\"The iterator does not provide a '\"+t+\"' method\"),c=1);i=y}else if((v=(f=p.n\u003c0)?u:o.call(a,p))!==h)break}catch(t){i=y,c=1,u=t}finally{l=1}}return{value:v,done:f}}),!0),e;function d(t,e){for(c=t,u=e,v=0;!f\u0026\u0026l\u0026\u0026!n\u0026\u0026v\u003cs.length;v++){var n,r=s[v],o=p.p,a=r[2];3\u003ct?(n=a===e)\u0026\u0026(u=r[(c=r[4])?5:c=3],r[4]=r[5]=y):r[0]\u003c=o\u0026\u0026((n=t\u003c2\u0026\u0026o\u003cr[1])?(c=0,p.v=e,p.n=r[1]):o\u003ca\u0026\u0026(n=t\u003c3||r[0]\u003ee||a\u003ce)\u0026\u0026(r[4]=t,r[5]=e,p.n=a,c=0))}if(n||1\u003ct)return h;throw f=!0,e}}var h={};function m(){}function o(){}function a(){}var v=Object.getPrototypeOf,t=[][e]?v(v([][e]())):(b(v={},e,function(){return this}),v),i=a.prototype=m.prototype=Object.create(t);function c(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,b(t,n,\"GeneratorFunction\")),t.prototype=Object.create(i),t}return b(i,\"constructor\",o.prototype=a),b(a,\"constructor\",o),b(a,n,o.displayName=\"GeneratorFunction\"),b(i),b(i,n,\"Generator\"),b(i,e,function(){return this}),b(i,\"toString\",function(){return\"[object Generator]\"}),(g=function(){return{w:r,m:c}})()}function b(t,e,n,r){var a=Object.defineProperty;try{a({},\"\",{})}catch(t){a=0}(b=function(t,e,n,r){function o(e,n){b(t,e,function(t){return this._invoke(e,n,t)})}e?a?a(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o(\"next\",0),o(\"throw\",1),o(\"return\",2))})(t,e,n,r)}function u(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function o(c){return function(){var t=this,i=arguments;return new Promise(function(e,n){var r=c.apply(t,i);function o(t){u(r,e,n,o,a,\"next\",t)}function a(t){u(r,e,n,o,a,\"throw\",t)}o(void 0)})}}o(g().m(function t(){var i,s,a,c,e,u,l,f,p,d,y,h,n,r;return g().w(function(t){for(;;)switch(t.n){case 0:if(r=function(){return(r=o(g().m(function t(){var e,n,r,o;return g().w(function(t){for(;;)switch(t.n){case 0:return o=window.location.pathname,o=o.match(/\\/([^/]+)\\/results\\/latestresults/),o=o[1],e=window.location.origin,o=\"\".concat(e,\"/\").concat(o,\"/results/1/\"),n=a(),t.n=1,c(o);case 1:r=t.v,o=m(n.keys()).filter(function(t){return r.has(t)}),h(o,n,r,e);case 2:return t.a(2)}},t)}))).apply(this,arguments)},n=function(){return r.apply(this,arguments)},h=function(t,e,n,r){var o=y(),a=l(\"Participants Who Attended the Launch Event\");o.appendChild(a),0===t.length?(a=f(\"No attendees from the launch event were present at the latest event.\"),o.appendChild(a)):(a=d(t,e,n,r),o.appendChild(a)),u(o)},y=function(){var t=document.createElement(\"div\");return t.id=\"parkrun-launch-returnees\",t.style.width=\"100%\",t.style.maxWidth=\"800px\",t.style.margin=\"20px auto\",t.style.padding=\"15px\",t.style.backgroundColor=i.backgroundColor,t.style.borderRadius=\"8px\",t.style.boxShadow=\"0 2px 4px rgba(0,0,0,0.1)\",t.style.color=i.textColor,t},d=function(t,e,n,r){var o=document.createElement(\"div\"),a=(o.style.maxHeight=\"400px\",o.style.overflow=\"auto\",document.createElement(\"ul\"));return a.style.listStyleType=\"none\",a.style.padding=\"0\",a.style.margin=\"0\",a.style.textAlign=\"center\",t.forEach(function(t){t=p(t,e,n,r);a.appendChild(t)}),o.appendChild(a),o},p=function(t,e,n,r){var o=document.createElement(\"li\"),a=document.createElement(\"a\"),r=(a.href=\"\".concat(r,\"/parkrunner/\").concat(t,\"/\"),a.target=\"_blank\",e.get(t)||n.get(t)||\"Unknown parkrunner\");return a.textContent=\"\".concat(r,\" (A\").concat(t,\")\"),a.style.color=i.linkColor,a.style.textDecoration=\"none\",o.appendChild(a),o},f=function(t){var e=document.createElement(\"p\");return e.textContent=t,e.style.textAlign=\"center\",e.style.fontWeight=\"bold\",e},l=function(t){var e=document.createElement(\"h3\");return e.textContent=t,e.style.textAlign=\"center\",e.style.marginBottom=\"15px\",e.style.color=i.headerColor,e},u=function(t){var e=document.querySelector(\"h1\");e\u0026\u0026e.parentNode?e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t):document.body.insertBefore(t,document.body.firstChild)},e=function(){return(e=o(g().m(function t(e){var n,r,o,a,i,c,u,l;return g().w(function(t){for(;;)switch(t.p=t.n){case 0:if(n=\"parkrun-launch-returnees-\".concat(e),t.p=1,r=localStorage.getItem(n))if(r=JSON.parse(r),o=r.data,r=r.timestamp,Date.now()-r\u003cs)return t.a(2,new Map(o));t.n=2;break;case 2:return t.n=3,fetch(e);case 3:return r=t.v,t.n=4,r.text();case 4:for(o=t.v,l=new DOMParser,l=l.parseFromString(o,\"text/html\"),a=l.querySelectorAll('a[href*=\"/parkrunner/\"]'),i=new Map,c=0;c\u003ca.length;c++)(u=a[c].href.match(/\\/parkrunner\\/(\\d+)/))\u0026\u0026i.set(u[1],a[c].textContent.trim());return l={data:Array.from(i.entries()),timestamp:Date.now()},localStorage.setItem(n,JSON.stringify(l)),t.a(2,i);case 5:return t.p=5,l=t.v,console.error(\"Error fetching or parsing:\",e,l),t.a(2,new Map)}},t,null,[[1,5]])}))).apply(this,arguments)},c=function(t){return e.apply(this,arguments)},a=function(){for(var t=document.querySelectorAll('a[href*=\"/parkrunner/\"]'),e=new Map,n=0;n\u003ct.length;n++){var r=t[n].href.match(/\\/parkrunner\\/(\\d+)/);r\u0026\u0026e.set(r[1],t[n].textContent.trim())}return e},document.getElementById(\"parkrun-launch-returnees\"))return t.a(2);t.n=1;break;case 1:i={backgroundColor:\"#2b223d\",headerColor:\"#FFA300\",textColor:\"#EEE\",linkColor:\"#53BA9D\"},s=864e5,n();case 2:return t.a(2)}},t)}))()})();\n```\n\n### parkrun p-index display\n\n\u003e The parkrun p-index is an unofficial statistic that measures the number of different parkrun events a person has completed a specific number of times. To achieve a p-index of 10, you must have completed at least 10 different parkrun events 10 times each. This script calculate the p-index for a parkrunner and displays it on their results page.\n\n\n[p-index.user.js](https://raw.githubusercontent.com/johnsyweb/tampermonkey-parkrun/refs/heads/main/p-index.user.js)\n\n```javascript\njavascript:(async()=\u003e{var r,t,e,n,o,i,a,l,d;function s(t,e){return(t=\u003e{if(Array.isArray(t))return t})(t)||((t,e)=\u003e{var n=null==t?null:\"undefined\"!=typeof Symbol\u0026\u0026t[Symbol.iterator]||t[\"@@iterator\"];if(null!=n){var r,o,i,a,l=[],d=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=i.call(n)).done)\u0026\u0026(l.push(r.value),l.length!==e);d=!0);}catch(t){s=!0,o=t}finally{try{if(!d\u0026\u0026null!=n.return\u0026\u0026(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}})(t,e)||((t,e)=\u003e{var n;if(t)return\"string\"==typeof t?u(t,e):\"Map\"===(n=\"Object\"===(n={}.toString.call(t).slice(8,-1))\u0026\u0026t.constructor?t.constructor.name:n)||\"Set\"===n?Array.from(t):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,e):void 0})(t,e)||(()=\u003e{throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")})()}function u(t,e){(null==e||e\u003et.length)\u0026\u0026(e=t.length);for(var n=0,r=Array(e);n\u003ce;n++)r[n]=t[n];return r}function c(){return window.innerWidth\u003c768?{isMobile:!0,spacing:{small:\"10px\",medium:\"15px\"},container:{padding:\"10px\",marginTop:\"10px\",width:\"100%\",maxWidth:\"800px\",aspectRatio:\"auto\"},typography:{pIndex:\"1.2em\",listItem:\"0.9em\"},listItem:{marginBottom:\"5px\",textAlign:\"left\"},button:{padding:\"6px 12px\",fontSize:\"0.9em\",marginTop:\"10px\"}}:{isMobile:!1,spacing:{small:\"20px\",medium:\"20px\"},container:{padding:\"20px\",marginTop:\"20px\",width:\"auto\",maxWidth:\"none\",aspectRatio:\"1\"},typography:{pIndex:\"1.5em\",listItem:\"1em\"},listItem:{marginBottom:\"8px\",textAlign:\"center\"},button:{padding:\"8px 15px\",fontSize:\"1em\",marginTop:\"15px\"}}}function p(t){var r=[],t=(t.querySelectorAll(\"tbody \u003e tr\").forEach(function(t){var e=t.querySelector(\"td:nth-child(1) \u003e a\").textContent.trim(),n=t.querySelector(\"td:nth-child(2)\").textContent.trim(),t=t.querySelector(\"td:nth-child(3)\").textContent.trim();r.unshift({eventName:e,date:n,eventNumber:t})}),r.reduce(function(t,e){var n=e.eventName,r=e.date,e=e.eventNumber;return t[n]||(t[n]=[]),t[n].push({date:r,eventNumber:e}),t},{}));return Object.entries(t).sort(function(t,e){return e[1].length-t[1].length})}function m(){var t=document.querySelectorAll(\"#results\");return t[t.length-1]}function y(t){var t=t.filter(function(t,e){return s(t,2)[1].length\u003ee}),o=t.length;function i(t){return new Date(t.split(\"/\").reverse().join(\"-\"))}t=t.map(function(t){var t=s(t,2),e=t[0],t=t[1],n=t[0],r=t[o-1];return{eventName:e,eventCount:t.length,firstDate:n.date,firstEventNumber:n.eventNumber,pIndexDate:r.date,pIndexEventNumber:r.eventNumber,firstDateForSorting:i(n.date),pIndexDateForSorting:i(r.date)}}).sort(function(t,e){return t.pIndexDateForSorting-e.pIndexDateForSorting}).slice(0,o).map(function(t){return t.eventName+\" (\"+t.eventCount+\"): \"+t.firstDate+\" (#\"+t.firstEventNumber+\") - \"+t.pIndexDate+\" (#\"+t.pIndexEventNumber+\")\"});return{pIndex:o,contributingEvents:t}}r=\"https://html2canvas.hertzen.com/dist/html2canvas.min.js\",await new Promise((t,e)=\u003e{var n=document.createElement(\"script\");n.src=r,n.onload=t,n.onerror=e,document.head.appendChild(n)}),\"undefined\"!=typeof module\u0026\u0026module.exports?module.exports={calculatePIndex:y,extractEventDetails:p,findResultsTable:m}:(d=m())?(t=(d=y(p(d))).pIndex,d=d.contributingEvents,a=c(),(l=document.querySelector(\"h2\"))\u0026\u0026((e=document.createElement(\"div\")).textContent=\"p-index: \"+t,e.style.fontSize=a.typography.pIndex,e.style.fontWeight=\"bold\",e.style.marginTop=a.container.marginTop,e.style.backgroundColor=\"#2b223d\",e.style.color=\"#ffa300\",e.style.padding=a.container.padding,e.style.borderRadius=\"5px\",e.style.display=\"flex\",e.style.flexDirection=\"column\",e.style.alignItems=\"center\",e.style.justifyContent=\"center\",e.style.width=a.container.width,e.style.maxWidth=a.container.maxWidth,e.style.marginLeft=\"auto\",e.style.marginRight=\"auto\",e.style.aspectRatio=a.container.aspectRatio,e.setAttribute(\"id\",\"p-index-display\"),(n=document.createElement(\"ul\")).style.listStyleType=\"none\",n.style.padding=\"0\",n.style.marginTop=a.spacing.small,n.style.width=\"100%\",d.forEach(function(t){var e=document.createElement(\"li\");e.textContent=t,e.style.fontWeight=\"normal\",e.style.fontSize=a.typography.listItem,e.style.marginBottom=a.listItem.marginBottom,e.style.textAlign=a.listItem.textAlign,e.style.wordBreak=\"break-word\",n.appendChild(e)}),e.appendChild(n),o=e,t=c(),(d=document.createElement(\"div\")).style.marginTop=t.button.marginTop,d.id=\"p-index-download-btn-container\",(i=document.createElement(\"button\")).textContent=\"💾 Save as Image\",i.style.padding=t.button.padding,i.style.backgroundColor=\"#ffa300\",i.style.color=\"#2b223d\",i.style.border=\"none\",i.style.borderRadius=\"4px\",i.style.cursor=\"pointer\",i.style.fontWeight=\"bold\",i.style.fontSize=t.button.fontSize,i.addEventListener(\"mouseover\",function(){this.style.backgroundColor=\"#e59200\"}),i.addEventListener(\"mouseout\",function(){this.style.backgroundColor=\"#ffa300\"}),i.addEventListener(\"click\",function(){i.style.display=\"none\",html2canvas(o,{backgroundColor:\"#2b223d\",scale:2,logging:!1,allowTaint:!0,useCORS:!0}).then(function(t){i.style.display=\"block\";var e=document.createElement(\"a\"),n=(new Date).toISOString().split(\"T\")[0],r=window.location.pathname.split(\"/\")[2]||\"parkrunner\";e.download=\"p-index-\".concat(r,\"-\").concat(n,\".png\"),e.href=t.toDataURL(\"image/png\"),e.click()})}),d.appendChild(i),o.appendChild(d),l.parentNode.insertBefore(e,l.nextSibling),a.isMobile||setTimeout(function(){var t=e.getBoundingClientRect(),t=Math.max(t.width,t.height);e.style.width=t+\"px\",e.style.height=t+\"px\"},0))):console.error(\"Results table not found\")})();\n```\n\n### parkrun Annual Summary\n\n\u003e Adds an annual participation summary (totals, averages, min/max) to parkrun event history pages\n\n\n[parkrun-annual-summary.user.js](https://raw.githubusercontent.com/johnsyweb/tampermonkey-parkrun/refs/heads/main/parkrun-annual-summary.user.js)\n\n```javascript\njavascript:(async()=\u003e{var r,w,E,S;function p(e){return(p=\"function\"==typeof Symbol\u0026\u0026\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e\u0026\u0026\"function\"==typeof Symbol\u0026\u0026e.constructor===Symbol\u0026\u0026e!==Symbol.prototype?\"symbol\":typeof e})(e)}function A(e){return(e=\u003e{if(Array.isArray(e))return o(e)})(e)||(e=\u003e{if(\"undefined\"!=typeof Symbol\u0026\u0026null!=e[Symbol.iterator]||null!=e[\"@@iterator\"])return Array.from(e)})(e)||n(e)||(()=\u003e{throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")})()}function F(){var h,e=\"function\"==typeof Symbol?Symbol:{},t=e.iterator||\"@@iterator\",n=e.toStringTag||\"@@toStringTag\";function r(e,t,n,r){var o,a,l,i,s,c,u,d,p,t=t\u0026\u0026t.prototype instanceof f?t:f,t=Object.create(t.prototype);return b(t,\"_invoke\",(o=e,a=n,u=r||[],d=!1,p={p:c=0,n:0,v:h,a:m,f:m.bind(h,4),d:function(e,t){return l=e,i=0,s=h,p.n=t,y}},function(e,t,n){if(1\u003cc)throw TypeError(\"Generator is already running\");for(d\u0026\u00261===t\u0026\u0026m(t,n),i=t,s=n;(g=i\u003c2?h:s)||!d;){l||(i?i\u003c3?(1\u003ci\u0026\u0026(p.n=-1),m(i,s)):p.n=s:p.v=s);try{if(c=2,l){if(g=l[e=i?e:\"next\"]){if(!(g=g.call(l,s)))throw TypeError(\"iterator result is not an object\");if(!g.done)return g;s=g.value,i\u003c2\u0026\u0026(i=0)}else 1===i\u0026\u0026(g=l.return)\u0026\u0026g.call(l),i\u003c2\u0026\u0026(s=TypeError(\"The iterator does not provide a '\"+e+\"' method\"),i=1);l=h}else if((g=(d=p.n\u003c0)?s:o.call(a,p))!==y)break}catch(e){l=h,i=1,s=e}finally{c=1}}return{value:g,done:d}}),!0),t;function m(e,t){for(i=e,s=t,g=0;!d\u0026\u0026c\u0026\u0026!n\u0026\u0026g\u003cu.length;g++){var n,r=u[g],o=p.p,a=r[2];3\u003ce?(n=a===t)\u0026\u0026(s=r[(i=r[4])?5:i=3],r[4]=r[5]=h):r[0]\u003c=o\u0026\u0026((n=e\u003c2\u0026\u0026o\u003cr[1])?(i=0,p.v=t,p.n=r[1]):o\u003ca\u0026\u0026(n=e\u003c3||r[0]\u003et||a\u003ct)\u0026\u0026(r[4]=e,r[5]=t,p.n=a,i=0))}if(n||1\u003ce)return y;throw d=!0,t}}var y={};function f(){}function o(){}function a(){}var g=Object.getPrototypeOf,e=[][t]?g(g([][t]())):(b(g={},t,function(){return this}),g),l=a.prototype=f.prototype=Object.create(e);function i(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,b(e,n,\"GeneratorFunction\")),e.prototype=Object.create(l),e}return b(l,\"constructor\",o.prototype=a),b(a,\"constructor\",o),b(a,n,o.displayName=\"GeneratorFunction\"),b(l),b(l,n,\"Generator\"),b(l,t,function(){return this}),b(l,\"toString\",function(){return\"[object Generator]\"}),(F=function(){return{w:r,m:i}})()}function b(e,t,n,r){var a=Object.defineProperty;try{a({},\"\",{})}catch(e){a=0}(b=function(e,t,n,r){function o(t,n){b(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o(\"next\",0),o(\"throw\",1),o(\"return\",2))})(e,t,n,r)}function t(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols\u0026\u0026(n=Object.getOwnPropertySymbols(t),e\u0026\u0026(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function T(r){for(var e=1;e\u003carguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(Object(o),!0).forEach(function(e){var t,n;t=r,n=o[e=e],(e=(e=\u003e(e=((e,t)=\u003e{if(\"object\"!=p(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return(\"string\"===t?String:Number)(e);if(\"object\"!=p(n=n.call(e,t||\"default\")))return n;throw new TypeError(\"@@toPrimitive must return a primitive value.\")})(e,\"string\"),\"symbol\"==p(e)?e:e+\"\"))(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function N(e,t){return(e=\u003e{if(Array.isArray(e))return e})(e)||((e,t)=\u003e{var n=null==e?null:\"undefined\"!=typeof Symbol\u0026\u0026e[Symbol.iterator]||e[\"@@iterator\"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)\u0026\u0026(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s\u0026\u0026null!=n.return\u0026\u0026(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}})(e,t)||n(e,t)||(()=\u003e{throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")})()}function n(e,t){var n;if(e)return\"string\"==typeof e?o(e,t):\"Map\"===(n=\"Object\"===(n={}.toString.call(e).slice(8,-1))\u0026\u0026e.constructor?e.constructor.name:n)||\"Set\"===n?Array.from(e):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}function o(e,t){(null==t||t\u003ee.length)\u0026\u0026(t=e.length);for(var n=0,r=Array(t);n\u003ct;n++)r[n]=e[n];return r}function s(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function O(i){return function(){var e=this,l=arguments;return new Promise(function(t,n){var r=i.apply(e,l);function o(e){s(r,t,n,o,a,\"next\",e)}function a(e){s(r,t,n,o,a,\"throw\",e)}o(void 0)})}}function a(){return(a=O(F().m(function e(){var t,n,r,o,a,l;return F().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=\"parkrun_events_cache\",e.p=1,a=localStorage.getItem(t)){if(e.p=2,a=JSON.parse(a),r=a.data,a=a.timestamp,(a=Date.now()-a)\u003c864e5)return console.log(\"Using cached parkrun events (\".concat(Math.round(a/1e3/60),\" minutes old)\")),e.a(2,r);e.n=3}else e.n=5;break;case 3:e.n=5;break;case 4:e.p=4,a=e.v,console.log(\"Cache parse error, fetching fresh data\",a);case 5:return console.log(\"Fetching parkrun events from https://images.parkrun.com/events.json\"),e.n=6,fetch(\"https://images.parkrun.com/events.json\");case 6:if(n=e.v,console.log(\"Fetch response status:\",n.status,n.statusText),n.ok){e.n=7;break}return console.error(\"Fetch failed with status:\",n.status),e.a(2,[]);case 7:return e.n=8,n.json();case 8:if(r=e.v,o=(null==(o=r.events)?void 0:o.features)||r.features||[],console.log(\"Features array length:\",o.length),o\u0026\u00260!==o.length){e.n=9;break}return console.error(\"No features found in response data\"),e.a(2,[]);case 9:try{localStorage.setItem(t,JSON.stringify({data:o,timestamp:Date.now()})),console.log(\"Cached\",o.length,\"parkrun events for 24 hours\")}catch(e){console.warn(\"Failed to cache parkrun events:\",e)}return console.log(\"Successfully loaded\",o.length,\"parkrun events\"),e.a(2,o);case 10:return e.p=10,l=e.v,console.error(\"Failed to fetch parkruns:\",l),console.error(\"Error details:\",l.message,l.stack),e.a(2,[])}},e,null,[[2,4],[1,10]])}))).apply(this,arguments)}function j(){return{eventName:window.location.pathname.split(\"/\")[1],domain:window.location.hostname,url:window.location.origin}}function V(e,t,n,r){var o=(n-e)*Math.PI/180,r=(r-t)*Math.PI/180,t=Math.sin(o/2)*Math.sin(o/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 6371*(2*Math.atan2(Math.sqrt(t),Math.sqrt(1-t)))}function l(){return(l=O(F().m(function e(t,n){var r,o,a,l;return F().w(function(e){for(;;)if(0===e.n)return r=t.cloneNode(!0),a=t.querySelectorAll(\"canvas\"),o=r.querySelectorAll(\"canvas\"),a.forEach(function(e,t){try{var n=e.toDataURL(\"image/png\"),r=document.createElement(\"img\");r.src=n,r.alt=\"Chart snapshot\",r.style.maxWidth=\"100%\",r.style.display=\"block\",r.style.backgroundColor=\"#2b223d\",o[t]\u0026\u0026o[t].replaceWith(r)}catch(e){console.error(\"Failed to serialize chart canvas:\",e)}}),a=\"\\n      :root { color-scheme: dark; }\\n      body { margin: 0; padding: 20px; background: \".concat(w.backgroundColor,\"; color: \").concat(w.textColor,'; font-family: \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif; line-height: 1.5; }\\n      a { color: ').concat(w.lineColor,\"; }\\n      h1, h2, h3, h4 { color: \").concat(w.barColor,\"; margin: 0 0 10px 0; }\\n      table { width: 100%; border-collapse: collapse; }\\n      th, td { border: 1px solid \").concat(w.gridColor,\"; padding: 10px; text-align: left; }\\n      th { background: #2b223d; color: \").concat(w.barColor,\"; }\\n      tr:nth-child(even) td { background: #241c35; }\\n      tr:nth-child(odd) td { background: #1f182e; }\\n      .parkrun-annual-summary { background: \").concat(w.backgroundColor,\"; padding: 16px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }\\n      .chart-img { max-width: 100%; display: block; }\\n      .meta { margin-bottom: 16px; color: \").concat(w.subtleTextColor,\"; font-size: 13px; }\\n      .meta strong { color: \").concat(w.textColor,\"; }\\n    \"),l='\\n      \u003cheader\u003e\\n        \u003ch1\u003eparkrun Annual Summary\u003c/h1\u003e\\n        \u003cdiv class=\"meta\"\u003e\\n          \u003cdiv\u003e\u003cstrong\u003eEvent:\u003c/strong\u003e '.concat(n.eventShortName,\"\u003c/div\u003e\\n          \u003cdiv\u003e\u003cstrong\u003eGenerated:\u003c/strong\u003e \").concat(n.generatedAt,\"\u003c/div\u003e\\n        \u003c/div\u003e\\n      \u003c/header\u003e\\n    \"),e.a(2,'\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003cmeta charset=\"UTF-8\"\u003e\u003ctitle\u003eparkrun Annual Summary - '.concat(n.eventShortName,\"\u003c/title\u003e\u003cstyle\u003e\").concat(a,\"\u003c/style\u003e\u003c/head\u003e\u003cbody\u003e\").concat(l).concat(r.outerHTML,\"\u003c/body\u003e\u003c/html\u003e\"))},e)}))).apply(this,arguments)}function P(){return e.apply(this,arguments)}function e(){return(e=O(F().m(function e(t,n){var r,o;return F().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return l.apply(this,arguments)}(t,n);case 1:return r=e.v,o=\"parkrun-annual-summary-\".concat(n.eventShortName,\"-\").concat(n.generatedAtISO,\".html\"),e.a(2,{blob:new Blob([r],{type:\"text/html\"}),filename:o})}},e)}))).apply(this,arguments)}function i(){return(i=O(F().m(function e(t,n){var r,o,a,l,i,s,c;return F().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=\"\".concat(n,\"/\").concat(t,\"/results/eventhistory/\"),e.n=1,fetch(r);case 1:return r=e.v,e.n=2,r.text();case 2:return o=e.v,c=new DOMParser,c=c.parseFromString(o,\"text/html\"),o=null!=(o=null==(o=c.querySelector(\"h1\"))?void 0:o.textContent.trim())?o:\"\".concat(t,\" Event History\"),a=[],l=[],i=[],s=[],c=c.querySelectorAll(\"tr.Results-table-row\"),Array.from(c).reverse().forEach(function(e){var t=e.getAttribute(\"data-parkrun\"),t=(t\u0026\u0026a.push(t),e.getAttribute(\"data-date\")),t=(t\u0026\u0026(t=new Date(t).toLocaleDateString(void 0,{year:\"numeric\",month:\"short\",day:\"numeric\"}),l.push(t)),e.getAttribute(\"data-finishers\")),t=(t\u0026\u0026i.push(parseInt(t,10)),e.getAttribute(\"data-volunteers\"));t\u0026\u0026s.push(parseInt(t,10))}),e.a(2,{eventName:t,title:o,eventNumbers:a,dates:l,finishers:i,volunteers:s});case 3:return e.p=3,c=e.v,console.error(\"Failed to fetch event history for \".concat(t,\":\"),c),e.a(2,null)}},e,null,[[0,3]])}))).apply(this,arguments)}function R(a){var l={};return a.dates.forEach(function(e,t){var e=new Date(e).getFullYear(),n=null!=(n=a.finishers[t])?n:0,r=null!=(r=a.volunteers[t])?r:0,o=a.eventNumbers[t],e=(l[e]||(l[e]={year:e,eventCount:0,totalFinishers:0,totalVolunteers:0,minFinishers:null,maxFinishers:null,minVolunteers:null,maxVolunteers:null}),l[e]);e.eventCount++,e.totalFinishers+=n,e.totalVolunteers+=r,(null===e.minFinishers||n\u003ce.minFinishers.value)\u0026\u0026(e.minFinishers={value:n,date:a.dates[t],eventNumber:o}),(null===e.maxFinishers||n\u003ee.maxFinishers.value)\u0026\u0026(e.maxFinishers={value:n,date:a.dates[t],eventNumber:o}),(null===e.minVolunteers||r\u003ce.minVolunteers.value)\u0026\u0026(e.minVolunteers={value:r,date:a.dates[t],eventNumber:o}),(null===e.maxVolunteers||r\u003ee.maxVolunteers.value)\u0026\u0026(e.maxVolunteers={value:r,date:a.dates[t],eventNumber:o})}),Object.keys(l).map(Number).sort(function(e,t){return e-t}).map(function(e){var t=l[e];return{year:e,eventCount:t.eventCount,totalFinishers:t.totalFinishers,totalVolunteers:t.totalVolunteers,avgFinishers:Math.round(t.totalFinishers/t.eventCount),avgVolunteers:Math.round(t.totalVolunteers/t.eventCount),minFinishers:t.minFinishers,maxFinishers:t.maxFinishers,minVolunteers:t.minVolunteers,maxVolunteers:t.maxVolunteers,finishersGrowth:null,volunteersGrowth:null}}).map(function(e,t,n){return 0===t?e:(t=(n=n[t-1]).avgFinishers?(e.avgFinishers-n.avgFinishers)/n.avgFinishers*100:null,n=n.avgVolunteers?(e.avgVolunteers-n.avgVolunteers)/n.avgVolunteers*100:null,T(T({},e),{},{finishersGrowth:t,volunteersGrowth:n}))})}function m(e){return e?e.value.toLocaleString():\"-\"}function h(e){var t,n;return null===e||Number.isNaN(e)?\"-\":(t=0\u003ce?\"+\":\"\",n=0\u003ce?\"#53BA9D\":e\u003c0?\"#ff6b6b\":w.subtleTextColor,'\u003cspan style=\"color: '.concat(n,';\"\u003e').concat(t).concat(e.toFixed(1),\"%\u003c/span\u003e\"))}function L(o){var e=document.createElement(\"div\"),t=(e.style.marginBottom=\"15px\",e.style.padding=\"10px\",e.style.backgroundColor=w.backgroundColor,e.style.borderRadius=\"6px\",e.style.display=\"flex\",e.style.alignItems=\"center\",e.style.gap=\"10px\",e.style.flexWrap=\"wrap\",document.createElement(\"span\")),a=(t.textContent=\"Compare with:\",t.style.color=w.textColor,t.style.fontWeight=\"bold\",e.appendChild(t),document.createElement(\"select\")),t=(a.style.padding=\"6px 12px\",a.style.backgroundColor=\"#3a3250\",a.style.color=w.textColor,a.style.border=\"1px solid \".concat(w.gridColor),a.style.borderRadius=\"4px\",a.style.cursor=\"pointer\",document.createElement(\"option\")),l=(t.value=\"\",t.textContent=\"-- Select parkrun --\",a.appendChild(t),o.forEach(function(e){var t=document.createElement(\"option\");t.value=e.properties.eventname,t.textContent=\"\".concat(e.properties.EventShortName,\" (\").concat(e.distance.toFixed(1),\"km)\"),a.appendChild(t)}),document.createElement(\"button\"));return l.textContent=\"+ Add\",l.style.padding=\"6px 12px\",l.style.backgroundColor=w.lineColor,l.style.color=\"#2b223d\",l.style.border=\"none\",l.style.borderRadius=\"4px\",l.style.cursor=\"pointer\",l.style.fontWeight=\"bold\",l.addEventListener(\"click\",O(F().m(function e(){var t,n,r;return F().w(function(e){for(;;)switch(e.n){case 0:if(t=a.value){e.n=1;break}return e.a(2);case 1:if(S.comparisonEvents.some(function(e){return e.eventName===t}))return alert(\"This parkrun is already selected for comparison\"),e.a(2);e.n=2;break;case 2:return l.disabled=!0,l.textContent=\"Loading...\",n=j(),e.n=3,function(){return i.apply(this,arguments)}(t,n.url);case 3:(n=e.v)?(r=o.find(function(e){return e.properties.eventname===t}),S.comparisonEvents.push(T(T({},n),{},{distance:null==r?void 0:r.distance})),W()):alert(\"Failed to fetch event history\"),l.disabled=!1,l.textContent=\"+ Add\",a.value=\"\";case 4:return e.a(2)}},e)}))),e.appendChild(a),e.appendChild(l),e}function M(e,t){var n=R(e);if(0===n.length)return null;var e=document.createElement(\"div\"),r=(e.className=\"tab-content\",e.style.display=0===t?\"block\":\"none\",e.style.backgroundColor=w.backgroundColor,e.style.padding=\"15px\",e.style.borderRadius=\"6px\",document.createElement(\"div\")),o=(r.style.overflowX=\"auto\",document.createElement(\"table\")),a=(o.className=\"annualSummaryTable\",o.style.width=\"100%\",o.style.borderCollapse=\"collapse\",o.style.fontSize=\"14px\",o.style.color=w.textColor,o.style.backgroundColor=w.backgroundColor,{key:\"year\",dir:\"asc\"}),l=[{key:\"year\",label:\"Year\",align:\"left\"},{key:\"eventCount\",label:\"Events\",align:\"center\"},{key:\"totalFinishers\",label:\"Finishers Total\",align:\"right\",color:w.barColor},{key:\"minFinishers\",label:\"Finishers Min\",align:\"right\",color:w.barColor},{key:\"maxFinishers\",label:\"Finishers Max\",align:\"right\",color:w.barColor},{key:\"avgFinishers\",label:\"Finishers Avg\",align:\"right\",color:w.barColor},{key:\"finishersGrowth\",label:\"Finishers YoY\",align:\"right\"},{key:\"totalVolunteers\",label:\"Volunteers Total\",align:\"right\",color:w.lineColor},{key:\"minVolunteers\",label:\"Volunteers Min\",align:\"right\",color:w.lineColor},{key:\"maxVolunteers\",label:\"Volunteers Max\",align:\"right\",color:w.lineColor},{key:\"avgVolunteers\",label:\"Volunteers Avg\",align:\"right\",color:w.lineColor},{key:\"volunteersGrowth\",label:\"Volunteers YoY\",align:\"right\"}],i=document.createElement(\"thead\"),s=document.createElement(\"tr\"),c=(s.style.borderBottom=\"2px solid \".concat(w.gridColor),l.forEach(function(e){var t=document.createElement(\"th\");t.textContent=e.label,t.style.padding=\"10px\",t.style.textAlign=e.align,t.style.cursor=\"pointer\",e.color\u0026\u0026(t.style.color=e.color),t.addEventListener(\"click\",function(){a.key===e.key?a.dir=\"asc\"===a.dir?\"desc\":\"asc\":(a.key=e.key,a.dir=\"desc\"),u()}),s.appendChild(t)}),i.appendChild(s),o.appendChild(i),document.createElement(\"tbody\"));function u(){c.innerHTML=\"\",A(n).sort(function(e,t){function n(e){return null==(e=e[r])?-1/0:\"object\"===p(e)\u0026\u0026void 0!==e.value?e.value:e}var r=a.key,o=\"asc\"===a.dir?1:-1,e=n(e),t=n(t);return e===t?0:t\u003ce?o:-o}).forEach(function(e){var t=document.createElement(\"tr\");t.style.borderBottom=\"1px solid \".concat(w.gridColor),t.innerHTML='\\n          \u003ctd style=\"padding: 10px; text-align: left; font-weight: bold;\"\u003e'.concat(e.year,'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: center;\"\u003e').concat(e.eventCount,'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.barColor,';\"\u003e').concat(e.totalFinishers.toLocaleString(),'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.barColor,';\"\u003e').concat(m(e.minFinishers),'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.barColor,';\"\u003e').concat(m(e.maxFinishers),'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.barColor,';\"\u003e').concat(e.avgFinishers,'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right;\"\u003e').concat(h(e.finishersGrowth),'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.lineColor,';\"\u003e').concat(e.totalVolunteers.toLocaleString(),'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.lineColor,';\"\u003e').concat(m(e.minVolunteers),'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.lineColor,';\"\u003e').concat(m(e.maxVolunteers),'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right; color: ').concat(w.lineColor,';\"\u003e').concat(e.avgVolunteers,'\u003c/td\u003e\\n          \u003ctd style=\"padding: 10px; text-align: right;\"\u003e').concat(h(e.volunteersGrowth),\"\u003c/td\u003e\\n        \"),c.appendChild(t)})}o.appendChild(c),r.appendChild(o),e.appendChild(r),u();var l=document.createElement(\"div\"),i=(l.style.display=\"grid\",l.style.gridTemplateColumns=\"1fr 1fr\",l.style.gap=\"20px\",l.style.marginTop=\"20px\",document.createElement(\"div\")),o=(i.style.minWidth=\"0\",document.createElement(\"canvas\")),r=(o.className=\"annualTotalsChart-\".concat(t),i.appendChild(o),document.createElement(\"div\")),d=(r.style.minWidth=\"0\",document.createElement(\"canvas\"));return d.className=\"annualGrowthChart-\".concat(t),r.appendChild(d),l.appendChild(i),l.appendChild(r),e.appendChild(l),\"undefined\"!=typeof Chart\u0026\u0026(t=o.getContext(\"2d\"),i=d.getContext(\"2d\"),r=n.map(function(e){return e.year.toString()}),new Chart(t,{type:\"bar\",data:{labels:r,datasets:[{label:\"Total Finishers\",data:n.map(function(e){return e.totalFinishers}),backgroundColor:w.barColor,borderColor:w.barColor,borderWidth:1},{label:\"Total Volunteers\",data:n.map(function(e){return e.totalVolunteers}),backgroundColor:w.lineColor,borderColor:w.lineColor,borderWidth:1}]},options:{animation:!1,responsive:!0,maintainAspectRatio:!0,aspectRatio:1.3,plugins:{legend:{labels:{color:w.textColor}},title:{display:!0,text:\"Annual Totals\",color:w.textColor}},scales:{x:{title:{display:!0,text:\"Year\",color:w.textColor},ticks:{color:w.subtleTextColor},grid:{color:w.gridColor}},y:{beginAtZero:!0,title:{display:!0,text:\"Participants\",color:w.textColor},ticks:{precision:0,color:w.subtleTextColor},grid:{color:w.gridColor}}}}}),l=n.filter(function(e){return null!==e.finishersGrowth}),new Chart(i,{type:\"line\",data:{labels:l.map(function(e){return e.year.toString()}),datasets:[{label:\"Finishers Growth\",data:l.map(function(e){return e.finishersGrowth}),borderColor:w.barColor,backgroundColor:w.barColor,borderWidth:2,pointRadius:4,pointBackgroundColor:w.barColor,fill:!1,tension:.2},{label:\"Volunteers Growth\",data:l.map(function(e){return e.volunteersGrowth}),borderColor:w.lineColor,backgroundColor:w.lineColor,borderWidth:2,pointRadius:4,pointBackgroundColor:w.lineColor,fill:!1,tension:.2}]},options:{animation:!1,responsive:!0,maintainAspectRatio:!0,aspectRatio:1.3,plugins:{legend:{labels:{color:w.textColor}},title:{display:!0,text:\"Year-over-Year Growth (%)\",color:w.textColor}},scales:{x:{title:{display:!0,text:\"Year\",color:w.textColor},ticks:{color:w.subtleTextColor},grid:{color:w.gridColor}},y:{title:{display:!0,text:\"Growth (%)\",color:w.textColor},ticks:{color:w.subtleTextColor,callback:function(e){return e+\"%\"}},grid:{color:w.gridColor}}}}})),e}function G(e){var t=document.createElement(\"div\");return t.style.minWidth=\"0\",t.appendChild(e),t}function I(e,t,o,n,a,r,l){l=6\u003carguments.length\u0026\u0026void 0!==l\u0026\u0026l,n=n.map(function(e,t){var n=e.event,r=e.yearly,e=E[t%E.length],t=o.map(function(t){var e=r.find(function(e){return e.year===t});return e\u0026\u0026null!=(e=a(e))?e:null});return{label:n.title||n.eventName,data:t,borderColor:e,backgroundColor:e,borderWidth:2,pointRadius:4,pointBackgroundColor:e,fill:!1,tension:.2,spanGaps:!0}}),e=e.getContext(\"2d\");new Chart(e,{type:\"line\",data:{labels:o.map(function(e){return e.toString()}),datasets:n},options:{animation:!1,responsive:!0,maintainAspectRatio:!0,aspectRatio:1.3,plugins:{legend:{labels:{color:w.textColor}},title:{display:!0,text:t,color:w.textColor}},scales:{x:{title:{display:!0,text:\"Year\",color:w.textColor},ticks:{color:w.subtleTextColor},grid:{color:w.gridColor}},y:{beginAtZero:!l,title:{display:!0,text:r,color:w.textColor},ticks:{precision:0,color:w.subtleTextColor,callback:l?function(e){return e+\"%\"}:void 0},grid:{color:w.gridColor}}}}})}function W(){var n,r,o,a,l,i,e,s,c,t,u,d,p,m,h,y,f,g,b,v,x=document.querySelector(\".parkrun-annual-summary\"),C=(x\u0026\u0026x.remove(),x=null!=(x=null==(x=document.querySelector(\"h1\"))?void 0:x.textContent.trim())?x:\"Event History\",n=[],r=[],o=[],a=[],C=document.querySelectorAll(\"tr.Results-table-row\"),Array.from(C).reverse().forEach(function(e){var t=e.getAttribute(\"data-parkrun\"),t=(t\u0026\u0026n.push(t),e.getAttribute(\"data-date\")),t=(t\u0026\u0026(t=new Date(t).toLocaleDateString(void 0,{year:\"numeric\",month:\"short\",day:\"numeric\"}),r.push(t)),e.getAttribute(\"data-finishers\")),t=(t\u0026\u0026o.push(parseInt(t,10)),e.getAttribute(\"data-volunteers\"));t\u0026\u0026a.push(parseInt(t,10))}),{title:x,eventNumbers:n,dates:r,finishers:o,volunteers:a});function k(){l.innerHTML=\"\",[S.currentEvent].concat(A(S.comparisonEvents)).forEach(function(e,t){var n=document.createElement(\"div\"),r=(n.style.display=\"inline-flex\",n.style.alignItems=\"center\",n.style.gap=\"6px\",n.style.padding=\"4px 10px\",n.style.backgroundColor=E[t%E.length],n.style.color=\"#2b223d\",n.style.borderRadius=\"12px\",n.style.fontSize=\"12px\",n.style.fontWeight=\"bold\",document.createElement(\"span\"));r.textContent=e.title||e.eventName,n.appendChild(r),0\u003ct\u0026\u0026((e=document.createElement(\"span\")).textContent=\"×\",e.style.cursor=\"pointer\",e.style.marginLeft=\"4px\",e.style.fontSize=\"16px\",e.addEventListener(\"click\",function(){S.comparisonEvents.splice(t-1,1),W()}),n.appendChild(e)),l.appendChild(n)})}0===C.eventNumbers.length?console.log(\"No event history data found\"):(S.currentEvent=T(T({},C),{},{eventName:j().eventName}),x=[S.currentEvent].concat(A(S.comparisonEvents)),(C=document.createElement(\"div\")).className=\"parkrun-annual-summary\",C.style.width=\"100%\",C.style.maxWidth=\"1200px\",C.style.margin=\"20px auto\",C.style.padding=\"15px\",C.style.backgroundColor=w.backgroundColor,C.style.borderRadius=\"8px\",C.style.boxShadow=\"0 2px 4px rgba(0,0,0,0.1)\",(t=document.createElement(\"h3\")).textContent=\"Annual Participation Summary\",t.style.textAlign=\"center\",t.style.marginBottom=\"15px\",t.style.color=w.barColor,C.appendChild(t),null===S.allParkruns?((t=document.createElement(\"div\")).style.padding=\"10px\",t.style.color=w.subtleTextColor,t.style.textAlign=\"center\",t.style.fontSize=\"13px\",t.textContent=\"Loading parkrun events for comparison...\",C.appendChild(t)):0===S.allParkruns.length?((t=document.createElement(\"div\")).style.padding=\"10px\",t.style.color=\"#ff6b6b\",t.style.textAlign=\"center\",t.style.fontSize=\"13px\",t.textContent=\"Failed to load parkrun events data. Check console for details.\",C.appendChild(t),console.error(\"No parkrun events loaded. Expected data from https://images.parkrun.com/events.json\")):0\u003c(t=function(o,e,t){var n,a,l,i,s,c=2\u003carguments.length\u0026\u0026void 0!==t?t:50,t=e.find(function(e){return e.properties.eventname===o.eventName});return t?(n=N(t.geometry.coordinates,2),a=n[0],l=n[1],i=t.properties.countrycode,s=t.properties.seriesid,e.filter(function(e){var t,n,r;return e.properties.eventname!==o.eventName\u0026\u0026e.properties.countrycode===i\u0026\u0026e.properties.seriesid===s\u0026\u0026(t=(e=N(e.geometry.coordinates,2))[0],e=e[1],n=Math.abs(e-l),r=Math.abs(t-a),!(.5\u003cn||.5\u003cr))\u0026\u0026V(l,a,e,t)\u003c=c}).map(function(e){var t=N(e.geometry.coordinates,2),n=t[0],t=V(l,a,t[1],n);return T(T({},e),{},{distance:t})}).sort(function(e,t){return e.distance-t.distance})):[]}(j(),S.allParkruns)).length?((t=L(t)).className=\"parkrun-comparison-selector-controls\",C.appendChild(t)):((t=document.createElement(\"div\")).style.padding=\"10px\",t.style.color=w.subtleTextColor,t.style.textAlign=\"center\",t.style.fontSize=\"13px\",e=j(),t.textContent=\"No nearby parkruns found for comparison (within 50km of \".concat(e.eventName,\")\"),C.appendChild(t),console.log(\"Current event:\",e.eventName,\"Total parkruns loaded:\",S.allParkruns.length)),0\u003cS.comparisonEvents.length\u0026\u0026((l=document.createElement(\"div\")).id=\"selectedEventsDisplay\",l.style.display=\"flex\",l.style.gap=\"8px\",l.style.flexWrap=\"wrap\",l.style.marginTop=\"10px\",k(),t={container:l,updateDisplay:k},C.appendChild(t.container)),e=x,(t=document.createElement(\"div\")).id=\"eventTabs\",t.style.marginTop=\"15px\",(s=document.createElement(\"div\")).style.display=\"flex\",s.style.gap=\"5px\",s.style.borderBottom=\"2px solid \".concat(w.gridColor),s.style.marginBottom=\"15px\",(c=document.createElement(\"div\")).id=\"tabContents\",e.forEach(function(e,n){var t=document.createElement(\"button\");t.textContent=e.title||e.eventName,t.style.padding=\"10px 20px\",t.style.backgroundColor=0===n?E[n%E.length]:\"#3a3250\",t.style.color=0===n?\"#2b223d\":w.textColor,t.style.border=\"none\",t.style.borderRadius=\"6px 6px 0 0\",t.style.cursor=\"pointer\",t.style.fontWeight=\"bold\",t.dataset.index=n,t.addEventListener(\"click\",function(){s.querySelectorAll(\"button\").forEach(function(e,t){e.style.backgroundColor=t===n?E[t%E.length]:\"#3a3250\",e.style.color=t===n?\"#2b223d\":w.textColor}),c.querySelectorAll(\".tab-content\").forEach(function(e,t){e.style.display=t===n?\"block\":\"none\"})}),s.appendChild(t)}),t.appendChild(s),t.appendChild(c),i=(t={tabsContainer:t,tabContents:c}).tabContents,C.appendChild(t.tabsContainer),x.forEach(function(e,t){e=M(e,t);e\u0026\u0026i.appendChild(e)}),1\u003cx.length\u0026\u0026(m=(t=x).length\u003c2?null:((x=document.createElement(\"div\")).id=\"comparisonSection\",x.style.marginTop=\"30px\",x.style.padding=\"15px\",x.style.backgroundColor=w.backgroundColor,x.style.borderRadius=\"8px\",(u=document.createElement(\"h3\")).textContent=\"Comparison Charts\",u.style.textAlign=\"center\",u.style.color=w.barColor,u.style.marginBottom=\"20px\",x.appendChild(u),u=t.map(function(e){return{event:e,yearly:R(e)}}),d=new Set,u.forEach(function(e){e.yearly.forEach(function(e){return d.add(e.year)})}),t=Array.from(d).sort(function(e,t){return e-t}),(m=document.createElement(\"div\")).style.display=\"grid\",m.style.gridTemplateColumns=\"1fr 1fr\",m.style.gap=\"20px\",g=document.createElement(\"canvas\"),m.appendChild(G(g)),b=document.createElement(\"canvas\"),m.appendChild(G(b)),v=document.createElement(\"canvas\"),m.appendChild(G(v)),p=document.createElement(\"canvas\"),m.appendChild(G(p)),x.appendChild(m),(m=document.createElement(\"div\")).style.display=\"flex\",m.style.justifyContent=\"center\",m.style.marginTop=\"20px\",m.style.gap=\"10px\",m.style.flexWrap=\"wrap\",(h=document.createElement(\"button\")).textContent=\"📄 Export HTML\",h.style.padding=\"8px 16px\",h.style.backgroundColor=w.barColor,h.style.color=\"#1c1b2a\",h.style.border=\"none\",h.style.borderRadius=\"4px\",h.style.cursor=\"pointer\",h.style.fontWeight=\"bold\",h.style.fontSize=\"14px\",(y=document.createElement(\"button\")).textContent=\"📤 Share Report\",y.style.padding=\"8px 16px\",y.style.backgroundColor=w.lineColor,y.style.color=\"#2b223d\",y.style.border=\"none\",y.style.borderRadius=\"4px\",y.style.cursor=\"pointer\",y.style.fontWeight=\"bold\",y.style.fontSize=\"14px\",f=function(){var t=j(),e=null==(e=S.allParkruns)?void 0:e.find(function(e){return e.properties.eventname===t.eventName}),e=(null==e||null==(e=e.properties)?void 0:e.EventShortName)||t.eventName,n=new Date,r=n.toISOString().split(\"T\")[0];return{eventShortName:e,generatedAt:n.toLocaleString(),generatedAtISO:r}},h.addEventListener(\"click\",O(F().m(function e(){var t,n,r,o,a,l,i;return F().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=h.textContent,n=h.style.display,h.textContent=\"Exporting...\",h.disabled=!0,h.style.display=\"none\",e.p=1,r=document.querySelector(\".parkrun-annual-summary\")){e.n=2;break}throw new Error(\"Report container not found\");case 2:return o=f(),e.n=3,P(r,o);case 3:o=e.v,l=o.blob,i=o.filename,a=URL.createObjectURL(l),(l=document.createElement(\"a\")).href=a,l.download=i,l.click(),setTimeout(function(){return URL.revokeObjectURL(a)},1e3),console.log(\"Annual summary HTML export complete\"),e.n=5;break;case 4:e.p=4,i=e.v,console.error(\"Annual summary export failed:\",i),alert(\"Error exporting HTML: \"+i.message);case 5:return e.p=5,h.disabled=!1,h.textContent=t,h.style.display=n,e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}))),y.addEventListener(\"click\",O(F().m(function e(){var t,n,r,o,a,l,i,s,c;return F().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=y.textContent,n=y.style.display,y.textContent=\"Sharing...\",y.disabled=!0,y.style.display=\"none\",e.p=1,r=document.querySelector(\".parkrun-annual-summary\")){e.n=2;break}throw new Error(\"Report container not found\");case 2:return o=f(),e.n=3,P(r,o);case 3:if(l=e.v,a=l.blob,l=l.filename,s=new File([a],l,{type:\"text/html\"}),navigator.canShare\u0026\u0026navigator.canShare({files:[s]}))return e.n=4,navigator.share({title:\"parkrun Annual Summary - \".concat(o.eventShortName),text:\"Annual participation summary report\",files:[s]});e.n=5;break;case 4:console.log(\"Annual summary shared via Web Share API\"),e.n=6;break;case 5:i=URL.createObjectURL(a),(s=document.createElement(\"a\")).href=i,s.download=l,s.click(),setTimeout(function(){return URL.revokeObjectURL(i)},1e3),alert(\"Sharing is not supported in this browser, so the HTML report was downloaded instead.\");case 6:e.n=8;break;case 7:e.p=7,c=e.v,console.error(\"Annual summary share failed:\",c),alert(\"Error sharing report: \"+c.message);case 8:return e.p=8,y.disabled=!1,y.textContent=t,y.style.display=n,e.f(8);case 9:return e.a(2)}},e,null,[[1,7,8,9]])}))),m.appendChild(h),m.appendChild(y),x.appendChild(m),\"undefined\"!=typeof Chart\u0026\u0026(I(g,\"Annual Totals - Finishers\",t,u,function(e){return e.totalFinishers},\"Finishers\"),I(b,\"Annual Totals - Volunteers\",t,u,function(e){return e.totalVolunteers},\"Volunteers\"),I(v,\"YoY Growth - Finishers (%)\",t,u,function(e){return e.finishersGrowth},\"Growth (%)\",!0),I(p,\"YoY Growth - Volunteers (%)\",t,u,function(e){return e.volunteersGrowth},\"Growth (%)\",!0)),x))\u0026\u0026C.appendChild(m),(g=document.getElementById(\"eventHistoryChart\"))\u0026\u0026g.parentElement?g.parentElement.parentNode.insertBefore(C,g.parentElement.nextSibling):(b=\"h1\",v=C,(b=document.querySelector(b))\u0026\u0026b.parentNode\u0026\u0026(b.nextSibling?b.parentNode.insertBefore(v,b.nextSibling):b.parentNode.appendChild(v))))}function c(){return(c=O(F().m(function e(){var t,n;return F().w(function(e){for(;;)switch(e.n){case 0:if(t=document.querySelector(\".Results-table\"),n=window.location.href,n=n.includes(\"/eventhistory/\"),t\u0026\u0026n){e.n=1;break}return e.a(2);case 1:return e.n=2,function(){return a.apply(this,arguments)}();case 2:S.allParkruns=e.v,document.getElementById(\"annualSummaryTable\")||document.getElementById(\"eventTabs\")?console.log(\"Annual summary already exists, skipping render\"):W();case 3:return e.a(2)}},e)}))).apply(this,arguments)}r=\"https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js\",await new Promise((e,t)=\u003e{var n=document.createElement(\"script\");n.src=r,n.onload=e,n.onerror=t,document.head.appendChild(n)}),w={backgroundColor:\"#1c1b2a\",barColor:\"#f59e0b\",lineColor:\"#22d3ee\",textColor:\"#f3f4f6\",subtleTextColor:\"#d1d5db\",gridColor:\"rgba(243, 244, 246, 0.18)\"},E=[\"#f59e0b\",\"#22d3ee\",\"#f97316\",\"#10b981\",\"#a855f7\",\"#ef4444\",\"#3b82f6\",\"#84cc16\"],S={currentEvent:null,comparisonEvents:[],allParkruns:null},function(){c.apply(this,arguments)}()})();\n```\n\n### parkrun Cancellation Impact\n\n\u003e Analyzes the impact of cancelled parkrun events on nearby alternatives\n\n\n[parkrun-cancellation-impact.user.js](https://raw.githubusercontent.com/johnsyweb/tampermonkey-parkrun/refs/heads/main/parkrun-cancellation-impact.user.js)\n\n```javascript\njavascript:(async()=\u003e{var r,k,v,C,g,w;function a(e){return(a=\"function\"==typeof Symbol\u0026\u0026\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e\u0026\u0026\"function\"==typeof Symbol\u0026\u0026e.constructor===Symbol\u0026\u0026e!==Symbol.prototype?\"symbol\":typeof e})(e)}function E(){var g,e=\"function\"==typeof Symbol?Symbol:{},t=e.iterator||\"@@iterator\",n=e.toStringTag||\"@@toStringTag\";function r(e,t,n,r){var o,a,l,s,i,c,d,u,p,t=t\u0026\u0026t.prototype instanceof m?t:m,t=Object.create(t.prototype);return b(t,\"_invoke\",(o=e,a=n,d=r||[],u=!1,p={p:c=0,n:0,v:g,a:h,f:h.bind(g,4),d:function(e,t){return l=e,s=0,i=g,p.n=t,y}},function(e,t,n){if(1\u003cc)throw TypeError(\"Generator is already running\");for(u\u0026\u00261===t\u0026\u0026h(t,n),s=t,i=n;(f=s\u003c2?g:i)||!u;){l||(s?s\u003c3?(1\u003cs\u0026\u0026(p.n=-1),h(s,i)):p.n=i:p.v=i);try{if(c=2,l){if(f=l[e=s?e:\"next\"]){if(!(f=f.call(l,i)))throw TypeError(\"iterator result is not an object\");if(!f.done)return f;i=f.value,s\u003c2\u0026\u0026(s=0)}else 1===s\u0026\u0026(f=l.return)\u0026\u0026f.call(l),s\u003c2\u0026\u0026(i=TypeError(\"The iterator does not provide a '\"+e+\"' method\"),s=1);l=g}else if((f=(u=p.n\u003c0)?i:o.call(a,p))!==y)break}catch(e){l=g,s=1,i=e}finally{c=1}}return{value:f,done:u}}),!0),t;function h(e,t){for(s=e,i=t,f=0;!u\u0026\u0026c\u0026\u0026!n\u0026\u0026f\u003cd.length;f++){var n,r=d[f],o=p.p,a=r[2];3\u003ce?(n=a===t)\u0026\u0026(i=r[(s=r[4])?5:s=3],r[4]=r[5]=g):r[0]\u003c=o\u0026\u0026((n=e\u003c2\u0026\u0026o\u003cr[1])?(s=0,p.v=t,p.n=r[1]):o\u003ca\u0026\u0026(n=e\u003c3||r[0]\u003et||a\u003ct)\u0026\u0026(r[4]=e,r[5]=t,p.n=a,s=0))}if(n||1\u003ce)return y;throw u=!0,t}}var y={};function m(){}function o(){}function a(){}var f=Object.getPrototypeOf,e=[][t]?f(f([][t]())):(b(f={},t,function(){return this}),f),l=a.prototype=m.prototype=Object.create(e);function s(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,b(e,n,\"GeneratorFunction\")),e.prototype=Object.create(l),e}return b(l,\"constructor\",o.prototype=a),b(a,\"constructor\",o),b(a,n,o.displayName=\"GeneratorFunction\"),b(l),b(l,n,\"Generator\"),b(l,t,function(){return this}),b(l,\"toString\",function(){return\"[object Generator]\"}),(E=function(){return{w:r,m:s}})()}function b(e,t,n,r){var a=Object.defineProperty;try{a({},\"\",{})}catch(e){a=0}(b=function(e,t,n,r){function o(t,n){b(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o(\"next\",0),o(\"throw\",1),o(\"return\",2))})(e,t,n,r)}function S(e){return(e=\u003e{if(Array.isArray(e))return o(e)})(e)||(e=\u003e{if(\"undefined\"!=typeof Symbol\u0026\u0026null!=e[Symbol.iterator]||null!=e[\"@@iterator\"])return Array.from(e)})(e)||n(e)||(()=\u003e{throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")})()}function t(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols\u0026\u0026(n=Object.getOwnPropertySymbols(t),e\u0026\u0026(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function d(r){for(var e=1;e\u003carguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(Object(o),!0).forEach(function(e){var t,n;t=r,n=o[e=e],(e=(e=\u003e(e=((e,t)=\u003e{if(\"object\"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return(\"string\"===t?String:Number)(e);if(\"object\"!=a(n=n.call(e,t||\"default\")))return n;throw new TypeError(\"@@toPrimitive must return a primitive value.\")})(e,\"string\"),\"symbol\"==a(e)?e:e+\"\"))(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function u(e,t){return(e=\u003e{if(Array.isArray(e))return e})(e)||((e,t)=\u003e{var n=null==e?null:\"undefined\"!=typeof Symbol\u0026\u0026e[Symbol.iterator]||e[\"@@iterator\"];if(null!=n){var r,o,a,l,s=[],i=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;i=!1}else for(;!(i=(r=a.call(n)).done)\u0026\u0026(s.push(r.value),s.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{if(!i\u0026\u0026null!=n.return\u0026\u0026(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return s}})(e,t)||n(e,t)||(()=\u003e{throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")})()}function n(e,t){var n;if(e)return\"string\"==typeof e?o(e,t):\"Map\"===(n=\"Object\"===(n={}.toString.call(e).slice(8,-1))\u0026\u0026e.constructor?e.constructor.name:n)||\"Set\"===n?Array.from(e):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}function o(e,t){(null==t||t\u003ee.length)\u0026\u0026(t=e.length);for(var n=0,r=Array(t);n\u003ct;n++)r[n]=e[n];return r}function i(e,t,n,r,o,a,l){try{var s=e[a](l),i=s.value}catch(e){return n(e)}s.done?t(i):Promise.resolve(i).then(r,o)}function D(s){return function(){var e=this,l=arguments;return new Promise(function(t,n){var r=s.apply(e,l);function o(e){i(r,t,n,o,a,\"next\",e)}function a(e){i(r,t,n,o,a,\"throw\",e)}o(void 0)})}}function x(e){return new Date(\"\".concat(e,\"T00:00:00Z\"))}function c(e,t){e=document.querySelector(e);e\u0026\u0026e.parentNode\u0026\u0026(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t))}function l(){return(l=D(E().m(function e(){var t,n,r,o,a,l;return E().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=\"parkrun_events_cache\",e.p=1,a=localStorage.getItem(t)){if(e.p=2,a=JSON.parse(a),r=a.data,a=a.timestamp,(a=Date.now()-a)\u003cg)return console.log(\"Using cached parkrun events (\".concat(Math.round(a/1e3/60),\" minutes old)\")),e.a(2,r);e.n=3}else e.n=5;break;case 3:e.n=5;break;case 4:e.p=4,a=e.v,console.log(\"Cache parse error, fetching fresh data\",a);case 5:return console.log(\"Fetching parkrun events from https://images.parkrun.com/events.json\"),e.n=6,fetch(\"https://images.parkrun.com/events.json\");case 6:if((n=e.v).ok){e.n=7;break}return console.error(\"Fetch failed with status:\",n.status),e.a(2,[]);case 7:return e.n=8,n.json();case 8:if(r=e.v,(o=(null==(o=r.events)?void 0:o.features)||r.features||[])\u0026\u00260!==o.length){e.n=9;break}return console.error(\"No features found in response data\"),e.a(2,[]);case 9:try{localStorage.setItem(t,JSON.stringify({data:o,timestamp:Date.now()}))}catch(e){console.warn(\"Failed to cache parkrun events:\",e)}return console.log(\"Successfully loaded\",o.length,\"parkrun events\"),e.a(2,o);case 10:return e.p=10,l=e.v,console.error(\"Failed to fetch parkruns:\",l),e.a(2,[])}},e,null,[[2,4],[1,10]])}))).apply(this,arguments)}function T(){return{eventName:window.location.pathname.split(\"/\")[1],domain:window.location.hostname,url:window.location.origin}}function p(e,t,n,r){var o=(n-e)*Math.PI/180,r=(r-t)*Math.PI/180,t=Math.sin(o/2)*Math.sin(o/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 6371*(2*Math.atan2(Math.sqrt(t),Math.sqrt(1-t)))}function A(e,t){var t=1\u003carguments.length\u0026\u0026void 0!==t?t:C,n=new Date(e),e=(n.setUTCDate(n.getUTCDate()-7*t),new Date(e));return e.setUTCDate(e.getUTCDate()+7*t),{start:n,end:e}}function N(){return(N=D(E().m(function e(t,n){var r,o,a,l,s,i,c,d,u,p,h;return E().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=\"parkrun_history_\".concat(t),e.p=1,p=localStorage.getItem(r)){if(e.p=2,p=JSON.parse(p),o=p.data,p=p.timestamp,(p=Date.now()-p)\u003cg)return console.log(\"Using cached history for \".concat(t,\" (\").concat(Math.round(p/1e3/60),\" minutes old)\")),e.a(2,o);e.n=3}else e.n=5;break;case 3:e.n=5;break;case 4:e.p=4,p=e.v,console.log(\"Cache parse error for \".concat(t,\", fetching fresh data\"),p);case 5:return o=\"\".concat(n,\"/\").concat(t,\"/results/eventhistory/\"),e.n=6,fetch(o);case 6:return a=e.v,e.n=7,a.text();case 7:a=e.v,u=new DOMParser,u=u.parseFromString(a,\"text/html\"),h=null!=(h=null==(h=u.querySelector(\"h1\"))?void 0:h.textContent.trim())?h:t,l=[],s=[],i=[],c=[],d=[],u=u.querySelectorAll(\"tr.Results-table-row\"),Array.from(u).reverse().forEach(function(e){var t=e.getAttribute(\"data-parkrun\"),t=(t\u0026\u0026l.push(t),e.getAttribute(\"data-date\")),t=(t\u0026\u0026(i.push(t),t=new Date(t).toLocaleDateString(void 0,{year:\"numeric\",month:\"short\",day:\"numeric\"}),s.push(t)),e.getAttribute(\"data-finishers\")),t=(t\u0026\u0026c.push(parseInt(t,10)),e.getAttribute(\"data-volunteers\"));t\u0026\u0026d.push(parseInt(t,10))}),u={eventName:t,title:h,eventNumbers:l,dates:s,rawDates:i,finishers:c,volunteers:d};try{localStorage.setItem(r,JSON.stringify({data:u,timestamp:Date.now()}))}catch(e){console.warn(\"Failed to cache history for \".concat(t,\":\"),e)}return e.a(2,u);case 8:return e.p=8,h=e.v,console.error(\"Failed to fetch event history for \".concat(t,\":\"),h),e.a(2,null)}},e,null,[[2,4],[1,8]])}))).apply(this,arguments)}function O(n,r,o){var a={dates:[],finishers:[],volunteers:[]};return n.rawDates.forEach(function(e,t){e=new Date(e);r\u003c=e\u0026\u0026e\u003c=o\u0026\u0026(a.dates.push(n.dates[t]),a.finishers.push(n.finishers[t]),a.volunteers.push(n.volunteers[t]))}),a}function L(e){return 0===e.dates.length?{avgFinishers:0,avgVolunteers:0,totalEvents:0,minFinishers:0,maxFinishers:0,minVolunteers:0,maxVolunteers:0}:{avgFinishers:Math.round(e.finishers.reduce(function(e,t){return e+t},0)/e.dates.length),avgVolunteers:Math.round(e.volunteers.reduce(function(e,t){return e+t},0)/e.dates.length),totalEvents:e.dates.length,minFinishers:Math.min.apply(Math,S(e.finishers)),maxFinishers:Math.max.apply(Math,S(e.finishers)),minVolunteers:Math.min.apply(Math,S(e.volunteers)),maxVolunteers:Math.max.apply(Math,S(e.volunteers))}}function s(){return(s=D(E().m(function e(){var t,n,r,o,a,l,s,i;return E().w(function(e){for(;;)switch(e.n){case 0:if((t=document.querySelector(\".parkrun-cancellation-impact\"))\u0026\u0026t.remove(),0===(t=(()=\u003e{var e=null!=(e=null==(e=document.querySelector(\"h1\"))?void 0:e.textContent.trim())?e:\"Event History\",n=[],r=[],o=[],a=[],l=[],t=document.querySelectorAll(\"tr.Results-table-row\");return Array.from(t).reverse().forEach(function(e){var t=e.getAttribute(\"data-parkrun\"),t=(t\u0026\u0026n.push(t),e.getAttribute(\"data-date\")),t=(t\u0026\u0026(o.push(t),t=new Date(t).toLocaleDateString(void 0,{year:\"numeric\",month:\"short\",day:\"numeric\"}),r.push(t)),e.getAttribute(\"data-finishers\")),t=(t\u0026\u0026a.push(parseInt(t,10)),e.getAttribute(\"data-volunteers\"));t\u0026\u0026l.push(parseInt(t,10))}),{title:e,eventNumbers:n,dates:r,rawDates:o,finishers:a,volunteers:l}})()).eventNumbers.length)return console.log(\"No event history data found\"),e.a(2);e.n=1;break;case 1:if(n=(e=\u003e{var t=e.rawDates.map(x);if(t.length\u003c2)return null;for(var n=[],r=1;r\u003ct.length;r++){var o=t[r-1],a=t[r],l=(a-o)/864e5;v\u003cl\u0026\u0026n.push({gapStartDate:o,gapEndDate:a,daysDiff:l,eventsBefore:r,eventsAfter:t.length-r})}return 0===n.length?null:(e=n[n.length-1],console.log(\"Detected \".concat(n.length,\" gap(s); using latest: \").concat(e.daysDiff.toFixed(1),\" days\")),console.log(\"All gaps detected:\",n),e)})(t)){e.n=2;break}return console.log(\"No cancellation gap detected\"),e.a(2);case 2:if(w.currentEvent=d(d({},t),{},{eventName:T().eventName}),w.gapInfo=n,r=T(),(o=document.createElement(\"div\")).className=\"parkrun-cancellation-impact\",o.style.width=\"100%\",o.style.maxWidth=\"1200px\",o.style.margin=\"20px auto\",o.style.padding=\"15px\",o.style.backgroundColor=k.backgroundColor,o.style.borderRadius=\"8px\",o.style.boxShadow=\"0 2px 4px rgba(0,0,0,0.1)\",w.allParkruns\u0026\u00260!==w.allParkruns.length){e.n=3;break}return(a=document.createElement(\"div\")).style.padding=\"10px\",a.style.color=k.subtleTextColor,a.style.textAlign=\"center\",a.textContent=\"Loading nearby parkruns...\",o.appendChild(a),c(\"h1\",o),e.a(2);case 3:if(w.nearbyParkruns=function(o,e,t){var n,a,l,s,i,c=2\u003carguments.length\u0026\u0026void 0!==t?t:50,t=e.find(function(e){return e.properties.eventname===o.eventName});return t?(n=u(t.geometry.coordinates,2),a=n[0],l=n[1],s=t.properties.countrycode,i=t.properties.seriesid,e.filter(function(e){var t,n,r;return e.properties.eventname!==o.eventName\u0026\u0026e.properties.countrycode===s\u0026\u0026e.properties.seriesid===i\u0026\u0026(t=(e=u(e.geometry.coordinates,2))[0],e=e[1],n=Math.abs(e-l),r=Math.abs(t-a),!(.5\u003cn||.5\u003cr))\u0026\u0026p(l,a,e,t)\u003c=c}).map(function(e){var t=u(e.geometry.coordinates,2),n=t[0],t=p(l,a,t[1],n);return d(d({},e),{},{distance:t})}).sort(function(e,t){return e.distance-t.distance})):[]}(r,w.allParkruns),0===w.nearbyParkruns.length)return(a=document.createElement(\"div\")).style.padding=\"10px\",a.style.color=k.subtleTextColor,a.style.textAlign=\"center\",a.textContent=\"No nearby parkruns found within 50km.\",o.appendChild(a),c(\"h1\",o),e.a(2);e.n=4;break;case 4:l=w.allParkruns.find(function(e){return e.properties.eventname===r.eventName}),l=(null==l||null==(l=l.properties)?void 0:l.EventShortName)||null,l=(e=\u003e{var t=document.createElement(\"div\"),n=(t.style.padding=\"20px\",t.style.backgroundColor=\"#2b223d\",t.style.borderRadius=\"8px\",t.style.marginBottom=\"20px\",t.style.border=\"1px solid \".concat(k.gridColor),document.createElement(\"h3\")),r=(n.textContent=\"Cancellation Impact Analysis\",n.style.color=k.barColor,n.style.margin=\"0 0 15px 0\",n.style.fontSize=\"20px\",t.appendChild(n),(n=document.createElement(\"div\")).style.fontSize=\"16px\",n.style.color=k.textColor,n.style.marginBottom=\"15px\",n.innerHTML='\u003cstrong style=\"color: '.concat(k.lineColor,';\"\u003e').concat(e,\"\u003c/strong\u003e\"),t.appendChild(n),(e=document.createElement(\"div\")).style.fontSize=\"14px\",e.style.lineHeight=\"1.8\",e.style.color=k.subtleTextColor,e.style.marginBottom=\"18px\",e.innerHTML=\"📍 Analyzing impact on nearby parkruns within 50km\",t.appendChild(e),document.createElement(\"button\"));return r.textContent=\"▶ Start Analysis\",r.className=\"start-analysis-btn\",r.style.padding=\"12px 24px\",r.style.backgroundColor=k.lineColor,r.style.color=\"#1c1b2a\",r.style.border=\"none\",r.style.borderRadius=\"6px\",r.style.cursor=\"pointer\",r.style.fontWeight=\"bold\",r.style.fontSize=\"14px\",r.style.transition=\"all 0.2s\",r.addEventListener(\"mouseenter\",function(){r.style.backgroundColor=\"#0ea5e9\",r.style.transform=\"translateY(-1px)\"}),r.addEventListener(\"mouseleave\",function(){r.style.backgroundColor=k.lineColor,r.style.transform=\"translateY(0)\"}),t.appendChild(r),{section:t,startButton:r}})(l),s=l.section,i=l.startButton,o.appendChild(s),c(\"h1\",o),i.addEventListener(\"click\",function(){i.disabled=!0,i.textContent=\"Starting...\",i.style.opacity=\"0.6\",i.style.cursor=\"not-allowed\";var e=(()=\u003e{var e=document.createElement(\"div\"),t=(e.className=\"parkrun-cancellation-progress\",e.style.padding=\"15px\",e.style.backgroundColor=k.backgroundColor,e.style.borderRadius=\"6px\",e.style.marginBottom=\"15px\",e.style.border=\"1px solid \".concat(k.gridColor),document.createElement(\"h4\")),r=(t.textContent=\"Analyzing Nearby parkrun Impact\",t.style.margin=\"0 0 12px 0\",t.style.color=k.barColor,e.appendChild(t),(t=document.createElement(\"div\")).style.width=\"100%\",t.style.height=\"20px\",t.style.backgroundColor=\"#3a3250\",t.style.borderRadius=\"4px\",t.style.marginBottom=\"10px\",t.style.overflow=\"hidden\",document.createElement(\"div\")),o=(r.style.width=\"0%\",r.style.height=\"100%\",r.style.backgroundColor=k.lineColor,r.style.transition=\"width 0.3s ease\",t.appendChild(r),e.appendChild(t),document.createElement(\"div\")),n=(o.style.fontSize=\"13px\",o.style.color=k.subtleTextColor,o.style.marginBottom=\"12px\",e.appendChild(o),document.createElement(\"div\"));return n.style.fontSize=\"12px\",n.style.color=k.lineColor,n.style.fontWeight=\"bold\",n.style.marginBottom=\"10px\",e.appendChild(n),(t=document.createElement(\"button\")).textContent=\"Stop Analysis\",t.style.padding=\"6px 12px\",t.style.backgroundColor=k.alertColor,t.style.color=k.textColor,t.style.border=\"none\",t.style.borderRadius=\"4px\",t.style.cursor=\"pointer\",t.style.fontWeight=\"bold\",t.style.fontSize=\"12px\",e.appendChild(t),{progressSection:e,updateProgress:function(e,t){var n=Math.round(e/t*100);r.style.width=n+\"%\",o.textContent=\"\".concat(e,\"/\").concat(t,\" parkruns analyzed\")},updateStatus:function(e){n.textContent=e},stop:t,hide:function(){e.style.display=\"none\"}}})();s.insertAdjacentElement(\"afterend\",e.progressSection),w.fetchController=new AbortController,function(){h.apply(this,arguments)}(e,o,s)});case 5:return e.a(2)}},e)}))).apply(this,arguments)}function h(){return(h=D(E().m(function e(t,n,r){var o,a,l,c,s,i,d,u,p,h,g,y,m,f,b;return E().w(function(e){for(;;)switch(e.p=e.n){case 0:o=T(),a=w.nearbyParkruns,s=(e=\u003e{var t=e.rawDates.map(x);if(t.length\u003c2)return[];for(var n=[],r=1;r\u003ct.length;r++){var o=t[r-1],a=t[r],l=(a-o)/864e5;v\u003cl\u0026\u0026n.push({gapStartDate:o,gapEndDate:a,daysDiff:l,eventsBefore:r,eventsAfter:t.length-r})}return console.log(\"Detected \".concat(n.length,\" total gap(s)\")),n})(w.currentEvent),l=[],s.forEach(function(e){e=((e,t)=\u003e{var n=[],r=(6-(e=x(e.toISOString().split(\"T\")[0])).getUTCDay())%7,o=(0===r\u0026\u0026(r=7),new Date(e));for(o.setUTCDate(o.getUTCDate()+r);o\u003ct;)n.push(new Date(o)),o.setUTCDate(o.getUTCDate()+7);return n})(e.gapStartDate,e.gapEndDate);l.push.apply(l,S(e))}),l.sort(function(e,t){return t-e}),w.cancellationDates=l,console.log(\"All Cancellation Saturdays:\",l),c=[],s=0;case 1:if(s\u003ca.length){if(w.fetchController.signal.aborted)return console.log(\"Analysis stopped by user\"),e.a(3,8);e.n=2}else e.n=8;break;case 2:return i=a[s],d=i.properties.eventname,u=i.properties.EventShortName||d,p=i.distance.toFixed(1),t.updateStatus(\"Fetching: \".concat(u,\" (\").concat(p,\"km)\")),t.updateProgress(s,a.length),e.p=3,e.n=4,function(){return N.apply(this,arguments)}(d,o.url);case 4:(b=e.v)\u0026\u0026c.push({parkrun:i,historyData:b,shortName:u,distance:p}),e.n=6;break;case 5:e.p=5,b=e.v,console.error(\"Failed to fetch \".concat(d,\":\"),b);case 6:return e.n=7,new Promise(function(e){return setTimeout(e,100)});case 7:s++,e.n=1;break;case 8:if(h={},g=[],l.forEach(function(l){var e=l.toISOString().split(\"T\")[0],s=[],i=A(l,C);i.end=new Date(l),i.end.setUTCDate(i.end.getUTCDate()-1),c.forEach(function(e){var t=e.parkrun,n=e.historyData,r=e.shortName,e=e.distance,o=L(O(n,i.start,i.end)),a=((e,t)=\u003e{for(var n=t.toISOString().split(\"T\")[0],r=0;r\u003ce.rawDates.length;r++)if(e.rawDates[r]===n)return{date:e.dates[r],eventNumber:e.eventNumbers[r],finishers:e.finishers[r],volunteers:e.volunteers[r]};return null})(n,l);s.push({eventName:t.properties.eventname,title:n.title,displayName:r,distance:e,baseline:o,eventOnDate:a,seasonalTrend:I(n,l),change:a?{finishersChange:a.finishers-o.avgFinishers,volunteersChange:a.volunteers-o.avgVolunteers,finishersPct:0\u003co.avgFinishers?(a.finishers-o.avgFinishers)/o.avgFinishers*100:0,volunteersPct:0\u003co.avgVolunteers?(a.volunteers-o.avgVolunteers)/o.avgVolunteers*100:0}:null})}),1\u003c=s.filter(function(e){return e.eventOnDate}).length?(h[e]=s,g.push(l)):console.log(\"Skipping \".concat(e,\": 0/\").concat(s.length,\" parkruns ran (global cancellation)\"))}),y=0\u003cg.length?g:l,t.updateProgress(a.length,a.length),0===g.length)return t.updateStatus(\"No valid cancellation dates found - all detected dates had global cancellations\"),t.stop.textContent=\"Close\",t.stop.style.backgroundColor=k.alertColor,(m=document.createElement(\"div\")).style.padding=\"15px\",m.style.backgroundColor=\"#3a3250\",m.style.borderRadius=\"6px\",m.style.marginTop=\"15px\",m.style.color=k.textColor,m.style.textAlign=\"center\",m.innerHTML='\\n        \u003ch3 style=\"color: '.concat(k.alertColor,'; margin: 0 0 10px 0;\"\u003e⚠ No Valid Analysis Dates\u003c/h3\u003e\\n        \u003cp style=\"margin: 0 0 8px 0;\"\u003eAll detected cancellation dates appear to be part of global cancellation periods (e.g., COVID-19).\u003c/p\u003e\\n        \u003cp style=\"margin: 0; color: ').concat(k.subtleTextColor,'; font-size: 13px;\"\u003e\\n          No nearby parkruns held events on these dates, indicating system-wide cancellations rather than single-event cancellations.\\n        \u003c/p\u003e\\n      '),n.appendChild(m),t.stop.addEventListener(\"click\",function(){t.hide()}),e.a(2);e.n=9;break;case 9:t.updateStatus(\"Analysis complete! Found \".concat(g.length,\" valid cancellation date(s)\")),(m=document.querySelector(\".start-analysis-btn\"))\u0026\u0026(m.style.display=\"none\"),t.stop.textContent=\"Close\",t.stop.style.backgroundColor=k.successColor,w.resultsByDate=h,w.cancellationDates=y,w.analysisComplete=!0,-1===w.currentCancellationIndex\u0026\u00260\u003cy.length\u0026\u0026(w.currentCancellationIndex=0),f=((r,o,a,l)=\u003e{var e=document.createElement(\"div\"),t=(e.className=\"parkrun-cancellation-nav\",e.style.padding=\"15px\",e.style.backgroundColor=\"#2b223d\",e.style.borderRadius=\"8px\",e.style.marginBottom=\"20px\",e.style.border=\"1px solid \".concat(k.gridColor),document.createElement(\"div\"));t.style.color=k.textColor,t.style.fontSize=\"14px\",t.style.marginBottom=\"12px\",t.innerHTML=\"\\n      \u003cstrong\u003e\".concat(a.length,\" Cancellation Date\").concat(1!==a.length?\"s\":\"\",' Available\u003c/strong\u003e\\n      \u003cdiv style=\"color: ').concat(k.subtleTextColor,'; font-size: 12px; margin-top: 4px;\"\u003e\\n        Use dropdown or buttons to navigate • Keyboard: \u003ckbd style=\"background: #3a3250; padding: 2px 6px; border-radius: 3px; font-family: monospace; border: 1px solid ').concat(k.gridColor,';\"\u003e←\u003c/kbd\u003e \u003ckbd style=\"background: #3a3250; padding: 2px 6px; border-radius: 3px; font-family: monospace; border: 1px solid ').concat(k.gridColor,';\"\u003e→\u003c/kbd\u003e\\n      \u003c/div\u003e\\n    '),e.appendChild(t);(t=document.createElement(\"div\")).style.display=\"flex\",t.style.alignItems=\"center\",t.style.gap=\"8px\",t.style.flexWrap=\"wrap\";var n=document.createElement(\"button\"),s=(n.textContent=\"←\",n.style.padding=\"6px 10px\",l\u003ca.length-1),i=(n.style.backgroundColor=s?k.lineColor:\"#3a3250\",n.style.color=s?\"#2b223d\":k.subtleTextColor,n.style.border=\"1px solid \".concat(k.gridColor),n.style.borderRadius=\"4px\",n.style.cursor=s?\"pointer\":\"not-allowed\",n.style.fontWeight=\"bold\",n.style.fontSize=\"14px\",n.style.transition=\"all 0.2s ease\",n.disabled=!s,s\u0026\u0026(n.addEventListener(\"mouseenter\",function(){n.style.transform=\"translateY(-1px)\",n.style.boxShadow=\"0 2px 4px rgba(34, 211, 238, 0.3)\"}),n.addEventListener(\"mouseleave\",function(){n.style.transform=\"translateY(0)\",n.style.boxShadow=\"none\"})),document.createElement(\"select\")),c=(i.style.padding=\"6px 8px\",i.style.backgroundColor=\"#3a3250\",i.style.color=k.textColor,i.style.border=\"1px solid \".concat(k.gridColor),i.style.borderRadius=\"4px\",i.style.cursor=\"pointer\",i.style.fontWeight=\"bold\",i.style.fontSize=\"12px\",i.style.minWidth=\"220px\",i.style.flex=\"1\",a.forEach(function(e,t){var n=document.createElement(\"option\"),e=e.toLocaleDateString(void 0,{year:\"numeric\",month:\"short\",day:\"numeric\",weekday:\"short\"});n.value=t,n.textContent=e,n.selected=t===l,i.appendChild(n)}),document.createElement(\"button\")),s=(c.textContent=\"→\",c.style.padding=\"6px 10px\",0\u003cl);function d(){var e,t,n=r.querySelector(\".parkrun-cancellation-results\");n\u0026\u0026n.remove(),F(r,o,a,w.currentCancellationIndex),(n=r.querySelector(\".parkrun-cancellation-nav\"))\u0026\u0026((e=n.querySelectorAll(\"select\"))[0]\u0026\u0026(e[0].value=w.currentCancellationIndex),n=(e=n.querySelectorAll(\"button\"))[0],e=e[1],n\u0026\u0026(t=w.currentCancellationIndex\u003ca.length-1,n.disabled=!t,n.style.backgroundColor=t?k.lineColor:\"#3a3250\",n.style.color=t?\"#2b223d\":k.subtleTextColor,n.style.cursor=t?\"pointer\":\"not-allowed\"),e)\u0026\u0026(n=0\u003cw.currentCancellationIndex,e.disabled=!n,e.style.backgroundColor=n?k.lineColor:\"#3a3250\",e.style.color=n?\"#2b223d\":k.subtleTextColor,e.style.cursor=n?\"pointer\":\"not-allowed\")}function u(){w.currentCancellationIndex\u003ca.length-1\u0026\u0026(w.currentCancellationIndex+=1,d())}function p(){0\u003cw.currentCancellationIndex\u0026\u0026(--w.currentCancellationIndex,d())}return c.style.backgroundColor=s?k.lineColor:\"#3a3250\",c.style.color=s?\"#2b223d\":k.subtleTextColor,c.style.border=\"1px solid \".concat(k.gridColor),c.style.borderRadius=\"4px\",c.style.cursor=s?\"pointer\":\"not-allowed\",c.style.fontWeight=\"bold\",c.style.fontSize=\"14px\",c.style.transition=\"all 0.2s ease\",c.disabled=!s,s\u0026\u0026(c.addEventListener(\"mouseenter\",function(){c.style.transform=\"translateY(-1px)\",c.style.boxShadow=\"0 2px 4px rgba(34, 211, 238, 0.3)\"}),c.addEventListener(\"mouseleave\",function(){c.style.transform=\"translateY(0)\",c.style.boxShadow=\"none\"})),t.appendChild(n),t.appendChild(i),t.appendChild(c),e.appendChild(t),n.addEventListener(\"click\",u),c.addEventListener(\"click\",p),i.addEventListener(\"change\",function(e){w.currentCancellationIndex=parseInt(e.target.value,10),d()}),w.keyboardHandler\u0026\u0026document.removeEventListener(\"keydown\",w.keyboardHandler),w.keyboardHandler=function(e){\"ArrowLeft\"===e.key\u0026\u0026u(),\"ArrowRight\"===e.key\u0026\u0026p()},document.addEventListener(\"keydown\",w.keyboardHandler),e})(n,h,y,w.currentCancellationIndex),r.insertAdjacentElement(\"afterend\",f),F(n,h,y,w.currentCancellationIndex),setTimeout(function(){t.hide()},500),t.stop.addEventListener(\"click\",function(){t.hide()});case 10:return e.a(2)}},e,null,[[3,5]])}))).apply(this,arguments)}function M(e,t,n){function r(e){switch(t){case\"name\":return e.displayName||e.eventName;case\"distance\":return parseFloat(e.distance);case\"eventNumber\":return e.eventOnDate?parseInt(e.eventOnDate.eventNumber,10):-1;case\"baseline\":return e.baseline.avgFinishers;case\"onDate\":return e.eventOnDate?e.eventOnDate.finishers:-1;case\"change\":return e.change?e.change.finishersChange:-999999;case\"changePct\":return e.change?e.change.finishersPct:-999999;default:return 0}}e=S(e);return e.sort(function(e,t){e=r(e),t=r(t);return\"asc\"===n?e-t:t-e}),e}function y(){return(y=D(E().m(function e(t,n){var r,o,a,l;return E().w(function(e){for(;;)if(0===e.n)return r=t.cloneNode(!0),a=t.querySelectorAll(\"canvas\"),o=r.querySelectorAll(\"canvas\"),a.forEach(function(e,t){try{var n=e.toDataURL(\"image/png\"),r=document.createElement(\"img\");r.src=n,r.alt=\"Chart snapshot\",r.style.maxWidth=\"100%\",r.style.display=\"block\",r.style.backgroundColor=\"#2b223d\",o[t]\u0026\u0026o[t].replaceWith(r)}catch(e){console.error(\"Failed to serialize chart canvas:\",e)}}),a=\"\\n      :root { color-scheme: dark; }\\n      body { margin: 0; padding: 20px; background: \".concat(k.backgroundColor,\"; color: \").concat(k.textColor,'; font-family: \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif; line-height: 1.5; }\\n      a { color: ').concat(k.lineColor,\"; }\\n      h1, h2, h3, h4 { color: \").concat(k.barColor,\"; margin: 0 0 10px 0; }\\n      table { width: 100%; border-collapse: collapse; }\\n      th, td { border: 1px solid \").concat(k.gridColor,\"; padding: 10px; text-align: left; }\\n      th { background: #2b223d; color: \").concat(k.barColor,\"; }\\n      tr:nth-child(even) td { background: #241c35; }\\n      tr:nth-child(odd) td { background: #1f182e; }\\n      .parkrun-cancellation-results { background: \").concat(k.backgroundColor,\"; padding: 16px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }\\n      .chart-img { max-width: 100%; display: block; }\\n      .meta { margin-bottom: 16px; color: \").concat(k.subtleTextColor,\"; font-size: 13px; }\\n      .meta strong { color: \").concat(k.textColor,\"; }\\n    \"),l='\\n      \u003cheader\u003e\\n        \u003ch1\u003eparkrun Cancellation Impact\u003c/h1\u003e\\n        \u003cdiv class=\"meta\"\u003e\\n          \u003cdiv\u003e\u003cstrong\u003eEvent:\u003c/strong\u003e '.concat(n.eventShortName,\"\u003c/div\u003e\\n          \u003cdiv\u003e\u003cstrong\u003eCancelled date:\u003c/strong\u003e \").concat(n.cancellationDateStr,\"\u003c/div\u003e\\n          \u003cdiv\u003e\u003cstrong\u003eGenerated:\u003c/strong\u003e \").concat(n.generatedAt,\"\u003c/div\u003e\\n        \u003c/div\u003e\\n      \u003c/header\u003e\\n    \"),e.a(2,'\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003cmeta charset=\"UTF-8\"\u003e\u003ctitle\u003eparkrun Cancellation Impact - '.concat(n.eventShortName,\" - \").concat(n.cancellationDateStr,\"\u003c/title\u003e\u003cstyle\u003e\").concat(a,\"\u003c/style\u003e\u003c/head\u003e\u003cbody\u003e\").concat(l).concat(r.outerHTML,\"\u003c/body\u003e\u003c/html\u003e\"))},e)}))).apply(this,arguments)}function P(){return e.apply(this,arguments)}function e(){return(e=D(E().m(function e(t,n){var r,o;return E().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return y.apply(this,arguments)}(t,n);case 1:return r=e.v,o=\"parkrun-cancellation-impact-\".concat(n.eventShortName,\"-\").concat(n.cancellationDateStr,\".html\"),e.a(2,{blob:new Blob([r],{type:\"text/html\"}),filename:o})}},e)}))).apply(this,arguments)}function I(e,t){var n=A(t,C),t=(n.end=new Date(t),n.end.setUTCDate(n.end.getUTCDate()-1),O(e,n.start,n.end));return{window:n,filtered:t,baseline:L(t)}}function F(e,t,n,r){function o(e){var t=p.querySelector(\"tbody\"),c=(t\u0026\u0026t.remove(),document.createElement(\"tbody\"));e.forEach(function(e){var t,n,r=document.createElement(\"tr\"),o=(r.style.borderBottom=\"1px solid \".concat(k.gridColor),r.style.transition=\"background-color 0.15s ease\",null!==e.eventOnDate),a=(o||(r.style.opacity=\"0.6\"),r.addEventListener(\"mouseenter\",function(){r.style.backgroundColor=o?\"rgba(34, 211, 238, 0.08)\":\"rgba(243, 244, 246, 0.03)\"}),r.addEventListener(\"mouseleave\",function(){r.style.backgroundColor=\"transparent\"}),document.createElement(\"td\")),l=(a.style.padding=\"10px\",a.style.textAlign=\"left\",a.style.fontWeight=\"bold\",document.createElement(\"a\")),a=(l.href=\"\".concat(T().url,\"/\").concat(e.eventName,\"/results/eventhistory/\"),l.textContent=e.displayName||e.eventName,l.style.color=k.lineColor,l.style.textDecoration=\"none\",l.target=\"_blank\",l.addEventListener(\"mouseenter\",function(){l.style.textDecoration=\"underline\"}),l.addEventListener(\"mouseleave\",function(){l.style.textDecoration=\"none\"}),a.appendChild(l),r.appendChild(a),document.createElement(\"td\")),a=(a.style.padding=\"10px\",a.style.textAlign=\"right\",a.style.color=k.subtleTextColor,a.textContent=\"\".concat(e.distance,\"km\"),r.appendChild(a),document.createElement(\"td\")),a=(a.style.padding=\"10px\",a.style.textAlign=\"right\",e.eventOnDate\u0026\u0026e.eventOnDate.eventNumber?(a.textContent=e.eventOnDate.eventNumber,a.style.color=k.textColor):(a.textContent=\"—\",a.style.color=k.subtleTextColor),r.appendChild(a),document.createElement(\"td\")),a=(a.style.padding=\"10px\",a.style.textAlign=\"right\",a.innerHTML=\"\u003cstrong\u003e\".concat(e.baseline.avgFinishers,\"\u003c/strong\u003e / \").concat(e.baseline.avgVolunteers),r.appendChild(a),document.createElement(\"td\")),a=(a.style.padding=\"10px\",a.style.textAlign=\"right\",e.eventOnDate?a.innerHTML=\"\u003cstrong\u003e\".concat(e.eventOnDate.finishers,\"\u003c/strong\u003e / \").concat(e.eventOnDate.volunteers):(a.textContent=\"—\",a.style.color=k.subtleTextColor),r.appendChild(a),document.createElement(\"td\")),s=(a.style.padding=\"10px\",a.style.textAlign=\"right\",e.change?(t=0\u003ce.change.finishersChange?\"+\":\"\",i=0\u003ce.change.volunteersChange?\"+\":\"\",s=0\u003ce.change.finishersChange?k.successColor:k.alertColor,n=0\u003ce.change.volunteersChange?k.successColor:k.alertColor,a.innerHTML='\\n          \u003cspan style=\"color: '.concat(s,';\"\u003e').concat(t).concat(e.change.finishersChange,'\u003c/span\u003e /\\n          \u003cspan style=\"color: ').concat(n,';\"\u003e').concat(i).concat(e.change.volunteersChange,\"\u003c/span\u003e\\n        \")):(a.textContent=\"—\",a.style.color=k.subtleTextColor),r.appendChild(a),document.createElement(\"td\")),i=(s.style.padding=\"10px\",s.style.textAlign=\"right\",e.change?(t=0\u003ce.change.finishersPct?k.successColor:k.alertColor,n=0\u003ce.change.finishersPct?\"+\":\"\",s.innerHTML='\u003cspan style=\"color: '.concat(t,';\"\u003e').concat(n).concat(e.change.finishersPct.toFixed(1),\"%\u003c/span\u003e\")):(s.textContent=\"—\",s.style.color=k.subtleTextColor),r.appendChild(s),document.createElement(\"td\"));i.style.padding=\"10px\",i.style.textAlign=\"right\",e.eventOnDate?e.change.finishersChange\u003c-5?(i.textContent=\"↓ Loss\",i.style.color=k.alertColor):5\u003ce.change.finishersChange?(i.textContent=\"↑ Gain\",i.style.color=k.successColor):(i.textContent=\"→ Stable\",i.style.color=k.subtleTextColor):(i.textContent=\"No Event\",i.style.color=k.subtleTextColor),r.appendChild(i),c.appendChild(r)}),p.appendChild(c)}function d(){var t=T(),e=w.allParkruns.find(function(e){return e.properties.eventname===t.eventName});return{eventShortName:(null==e||null==(e=e.properties)?void 0:e.EventShortName)||t.eventName,cancellationDateStr:a.toISOString().split(\"T\")[0]}}var l,a=n[r],s=t[a.toISOString().split(\"T\")[0]]||[],i=a.toLocaleDateString(void 0,{year:\"numeric\",month:\"short\",day:\"numeric\"}),u=document.createElement(\"div\"),n=(u.className=\"parkrun-cancellation-results\",u.style.marginTop=\"20px\",document.createElement(\"h3\")),r=(n.textContent=\"Nearby parkrun Impact on \".concat(i),n.style.color=k.barColor,n.style.marginTop=\"20px\",n.style.marginBottom=\"12px\",u.appendChild(n),document.createElement(\"div\")),p=(r.style.overflowX=\"auto\",document.createElement(\"table\")),t=(p.style.width=\"100%\",p.style.borderCollapse=\"collapse\",p.style.fontSize=\"13px\",p.style.color=k.textColor,document.createElement(\"thead\")),c=(t.style.position=\"sticky\",t.style.top=\"0\",t.style.backgroundColor=\"#2b223d\",t.style.zIndex=\"10\",document.createElement(\"tr\")),h=(c.style.borderBottom=\"2px solid \".concat(k.gridColor),[{label:\"parkrun\",key:\"name\",align:\"left\",info:\"Click column headers to sort. Default ordering is by distance.\"},{label:\"Distance\",key:\"distance\",align:\"right\",info:\"Distance from cancelled event in kilometers.\"},{label:\"Event #\",key:\"eventNumber\",align:\"right\",info:\"Event number on \".concat(i,\". Lower numbers indicate newer parkruns.\")},{label:\"Baseline (Avg)\",key:\"baseline\",align:\"right\",info:\"12-week season","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsyweb%2Ftampermonkey-parkrun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnsyweb%2Ftampermonkey-parkrun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsyweb%2Ftampermonkey-parkrun/lists"}