javascript:(()=>{ (function(){"use strict";if("github.com"!==document.location.host)return alert("This script must be run whilst on github.com");if(window.harvest||window.silo)return;const e="";const t="&s=indexed&o=desc";const n="&s=indexed&o=asc";window.silo={};window.harvest=r;Object.defineProperties(window.silo,{badApples:{value:[],writable:false,configurable:false},reap:{value:h,writable:false,configurable:false}});let o=null;Object.defineProperty(window,"that",{get:()=>o?h(o):""});let s=false;window.addEventListener("beforeunload",e=>s?e.returnValue="Your harvest hasn't finished. Are you sure you wish to cancel?":undefined);Notification.requestPermission();async function r(c,l=null){if(!c){const{pathname:e,search:t}=window.location;if("/search"===e&&/[?&]q=[^?%\s]/.test(t)){l=new URL(window.location).searchParams.get("q").replace(/\s+NOT\s+nothack\s*$/,"").replace(/(?:^|\s+)(filename|extension):(\S+)/,(e,t,n)=>{c=t+":"+n;return""}).trim();if(!p(l,/((?:^|\s)NOT)\s+(?!NOT)\S+/).some(e=>/(?:\s|^)NOT\s+/.test(e)))l+=" "+d();if(c)return r(c,l||null)}throw new TypeError("Missing query parameter")}s=true;if(!/extension:|filename:|in:file|in:path/.test(c))c=`extension:${c}`;if(null==l)l=d();const u=encodeURIComponent(`${c} ${l}`).replace(/%20/g,"+");const f=`https://github.com/search?q=${u}&type=Code`;try{const r=await i(f,e,c);if(r>1e3){await i(f,t,c);await i(f,n,c)}const a="Run `copy(that);` in your console to copy the URLs to your clipboard.";new Notification(`Harvest complete for ${c}`,{body:a});o=c;s=false}catch(e){s=false;console.error(e);if(a.lastResult)console.log({lastPageSnapshot:a.lastResult});throw e}}async function i(e,t,n){const o=silo[n]||(silo[n]={length:0});let s=0;let r;let i;return i=await h();async function f(){++s;if(s>=r)return i;await c(2e3);return h()}async function h(){const n=e+t+(s?`&p=${s+1}`:"");const c=await u(n);const h=await c.text().then(e=>{e=e.replace(/h.querySelector(e);const p=e=>h.querySelectorAll(e);if(d("div.blankslate")){const e="Must include at least one user, organization, or repository";const t=e.split(" ").join("\\s+");new RegExp(t,"i").test(h.textContent)?["Failed.","GitHub's doing that weird thing again:",`\t> "${e}"`].join("\n\n"):"No results";console.error(`Skipping this one: ${n}\n`);console.error("Find it in window.silo.badApples");window.silo.badApples.push(n);f()}const w=d("#code_search_results > .code-list")||l("Search-result list not found");const m=w.querySelectorAll(".code-list-item");if(m.length<1)l("Expected at least one entry to match `.code-list-item`");for(const e of m){const t=/^((?:\/[^\/]+){2})\/blob(?=\/)/gim;const n=[...e.querySelectorAll("a")].find(e=>{const n=e.getAttribute("href");return n&&t.test(n)});if(n&&!o[n.href]){++o.length;o[n.href]=n.href.replace(t,"https://raw.githubusercontent.com$1")}}if(undefined===r){const e=p(".pagination > a[href]");if(e.length){const t=Array.from(e).filter(e=>/^\s*[0-9]+\s*$/.test(e.textContent)).map(e=>parseInt(e.textContent.trim()));r=Math.max(...t);const n=d(".codesearch-results h3");if(n&&n.textContent.match(/\b([0-9.,\s]+)\s/)){i=+RegExp.$1.replace(/\D/g,"");if(!/\b(code\s+results?)\b/.test(n.textContent)){let e=`Missing text found where "${i} code results" expected. `;e+="Please double-check