// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0 (()=>{"use strict";var e,t,s={createElementNS:document.createElementNS};var n=!0;function o(e){n=e}function i(e){try{o(!1),e()}finally{o(!0)}}function a(e){!function(e,t,s){if(s){var n=new Date;n.setTime(n.getTime()+24*s*60*60*1e3);var o="; expires="+n.toGMTString()}else o="";document.cookie=e+"="+t+o+"; path=/"}(e,"",-1)}if(void 0!==window.XMLHttpRequest){var r=class extends XMLHttpRequest{};Object.defineProperty(r.prototype,"responseURL",Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype,"responseURL"))}function c(e,t,s,n,o){var i;if((i=window.XMLHttpRequest?new r:new ActiveXObject("Microsoft.XMLHTTP")).onreadystatechange=function(){4==this.readyState&&s(i)},i.open(e,t,!0),n)for(var a in n)n.hasOwnProperty(a)&&i.setRequestHeader(a,n[a]);i.withCredentials=!0,i.send(o)}function l(e){return void 0!==e&&e&&e.constructor===Array}function h(e,t){const s=window[`HTML${e}Element`];if(void 0!==s){const e=Object.getOwnPropertyDescriptor(s.prototype,t);void 0!==e&&Object.defineProperty(s.prototype,`_wm_${t}`,e)}}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"src";const s=`_wm_${t}`;return s in e.__proto__?e[s]:e[t]}h("Image","src"),h("Media","src"),h("Embed","src"),h("IFrame","src"),h("Script","src"),h("Link","href"),h("Anchor","href");var d=["January","February","March","April","May","June","July","August","September","October","November","December"],p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m={Y:function(e){return e.getUTCFullYear()},m:function(e){return e.getUTCMonth()+1},b:function(e){return p[e.getUTCMonth()]},B:function(e){return d[e.getUTCMonth()]},d:function(e){return e.getUTCDate()},H:function(e){return("0"+e.getUTCHours()).slice(-2)},M:function(e){return("0"+e.getUTCMinutes()).slice(-2)},S:function(e){return("0"+e.getUTCSeconds()).slice(-2)},"%":function(){return"%"}};function f(e){var t=function(e){return"number"==typeof e&&(e=e.toString()),[e.slice(-14,-10),e.slice(-10,-8),e.slice(-8,-6),e.slice(-6,-4),e.slice(-4,-2),e.slice(-2)]}(e);return new Date(Date.UTC(t[0],t[1]-1,t[2],t[3],t[4],t[5]))}function g(e){return p[e]}function w(e,t){return t.replace(/%./g,(function(t){var s=m[t[1]];return s?s(f(e)):t}))}const v=window.Date;function y(e,t){return(e=e.toString()).length>=t?e:"00000000".substring(0,t-e.length)+e}function b(e){for(var t=0,s=0;s3}(e)){var n=[];for(s=0;s0?this.sc.scrollTop=o+this.sc.suggestionHeight+n-this.sc.maxHeight:o<0&&(this.sc.scrollTop=o+n)}}blurHandler(){try{var e=this.root.querySelector(".wb-autocomplete-suggestions:hover")}catch(t){e=null}e?this.input!==document.activeElement&&setTimeout((()=>this.focus()),20):(this.last_val=this.input.value,this.sc.style.display="none",setTimeout((()=>this.sc.style.display="none"),350))}suggest(e){var t=this.input.value;if(this.cache[t]=e,e.length&&t.length>=this.minChars){for(var s="",n=0;n{this.sc.style.display="none"}),20))}}keyupHandler(e){var t=window.event?e.keyCode:e.which;if(!t||(t<35||t>40)&&13!=t&&27!=t){var s=this.input.value;if(s.length>=this.minChars){if(s!=this.last_val){if(this.last_val=s,clearTimeout(this.timer),this.cache){if(s in this.cache)return void this.suggest(this.cache[s]);for(var n=1;n{this.source(s,this.suggest.bind(this))}),this.delay)}}else this.last_val=s,this.sc.style.display="none"}}focusHandler(e){this.last_val="\n",this.keyupHandler(e)}renderItem(e,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var s=new RegExp("("+t.split(" ").join("|")+")","gi");return'
'+e.replace(s,"$1")+"
"}onSelect(e,t,s){}}class L{constructor(e,t){let s=e.getRootNode();if(!s.querySelector)return;let n="object"==typeof e?[e]:s.querySelectorAll(e);this.elems=n.map((e=>new x(e,t)))}destroy(){for(;this.elems.length>0;)this.elems.pop().unload()}}const S=JSON;class H{constructor(e,t,s){this.el=e,this.url=t,this.timestamp=s,e.onclick=this.save.bind(this),document.addEventListener("DOMContentLoaded",(()=>{var e;this.enableSaveSnapshot((e="logged-in-user",document.cookie.search(e)>=0))}))}save(e){var t,s,n,o;this.start(),t=this.url,s=this.timestamp,n=[],o=(o={failure:this.failure.bind(this),success:this.success.bind(this)})||{},c("POST","/__wb/web-archive/",(function(e){401===e.status?o.userNotLoggedIn&&o.userNotLoggedIn(e):e.status>=400?o.failure&&o.failure(e):o.success&&o.success(e)}),{"Content-Type":"application/json"},S.stringify({url:t,snapshot:s,tags:n||[]}))}start(){this.hide(["wm-save-snapshot-fail","wm-save-snapshot-open","wm-save-snapshot-success"]),this.show(["wm-save-snapshot-in-progress"])}failure(e){401==e.status?this.userNotLoggedIn(e):(this.hide(["wm-save-snapshot-in-progress","wm-save-snapshot-success"]),this.show(["wm-save-snapshot-fail","wm-save-snapshot-open"]),console.log("You have got an error."),console.log("If you think something wrong here please send it to support."),console.log('Response: "'+e.responseText+'"'),console.log('status: "'+e.status+'"'))}success(e){this.hide(["wm-save-snapshot-fail","wm-save-snapshot-in-progress"]),this.show(["wm-save-snapshot-open","wm-save-snapshot-success"])}enableSaveSnapshot(){!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?(this.show("wm-save-snapshot-open"),this.hide("wm-sign-in")):(this.hide(["wm-save-snapshot-open","wm-save-snapshot-in-progress"]),this.show("wm-sign-in"))}show(e){this.setDisplayStyle(e,"inline-block")}hide(e){this.setDisplayStyle(e,"none")}setDisplayStyle(e,t){(l(e)?e:[e]).forEach((e=>{let s=this.el.getRootNode().getElementById(e);s&&(s.style.display=t)}))}}function E(e,t,s){s.innerHTML="";const n=s.getRootNode().querySelector("#wm-capresources-loading");n.style.display="block";var o=f(e).getTime(),i=0;t=window.location.origin+t;var a=[];function r(e,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"src";const o=window.location.origin,i=U(window,e);for(let e of i){if(s&&!s(e))continue;const i=u(e,n);i&&(!i.startsWith(t)&&i.startsWith(o)&&(i.startsWith("data:")||a.push(i)))}}r("img"),r("frame"),r("iframe",(e=>"playback"!==e.id)),r("script"),r("link",(e=>"stylesheet"===e.rel),"href");var l=a.filter((function(e,t,s){return s.indexOf(e)===t}));l.length>0?(i=0,l.map((function(e){e.match("^https?://")&&(i++,c("HEAD",e,(function(e){if(200==e.status){var t=e.getResponseHeader("Memento-Datetime");if(null==t)console.log("%s: no Memento-Datetime",h);else{var a=document.createElement("span"),r=function(e,t){var s=new Date(e).getTime()-t,n="";s<0?(n+="-",s=Math.abs(s)):n+="+";var o=!1;if(s<1e3)return{delta:s,text:"",highlight:o};var i=s,a=Math.floor(s/1e3/60/60/24/30/12);s-=1e3*a*60*60*24*30*12;var r=Math.floor(s/1e3/60/60/24/30);s-=1e3*r*60*60*24*30;var c=Math.floor(s/1e3/60/60/24);s-=1e3*c*60*60*24;var l=Math.floor(s/1e3/60/60);s-=1e3*l*60*60;var h=Math.floor(s/1e3/60);s-=1e3*h*60;var u=Math.floor(s/1e3),d=[];return a>1?(d.push(a+" years"),o=!0):1==a&&(d.push(a+" year"),o=!0),r>1?(d.push(r+" months"),o=!0):1==r&&(d.push(r+" month"),o=!0),c>1?d.push(c+" days"):1==c&&d.push(c+" day"),l>1?d.push(l+" hours"):1==l&&d.push(l+" hour"),h>1?d.push(h+" minutes"):1==h&&d.push(h+" minute"),u>1?d.push(u+" seconds"):1==u&&d.push(u+" second"),d.length>2&&(d=d.slice(0,2)),{delta:i,text:n+d.join(" "),highlight:o}}(t,o),c=r.highlight?"color:red;":"";a.innerHTML=" "+r.text,a.title=t,a.setAttribute("style",c);var l=e.getResponseHeader("Content-Type"),h=e.responseURL.replace(window.location.origin,""),u=document.createElement("a");u.innerHTML=h.split("/").splice(3).join("/"),u._wm_href=h,u.title=l,u.onmouseover=R,u.onmouseout=A;var d=document.createElement("div");d.setAttribute("data-delta",r.delta),d.appendChild(u),d.append(a),s.appendChild(d);var p=Array.prototype.slice.call(s.childNodes,0);p.sort((function(e,t){return t.getAttribute("data-delta")-e.getAttribute("data-delta")})),s.innerHTML="";for(var m=0,f=p.length;m0)for(var s=0;s0)for(var s=0;s0)for(const e of s)r.push(e.notice)}const c=!!e.getAttribute("birdwatch");if(c){const s=function(e){let t=e.match(/^https?:\/\/(?:twitter|x)\.com\/i\/web\/status\/(\d+)/);if(t)return t[1];if(t=e.match(/^https?:\/\/twitter\.com\/[^/]+\/status\/(\d+)/),t)return t[1];return null}(t.url);if(s){const t=new URLSearchParams([["url",`https://x.com/i/web/status/${s}`]]),n=`${P}?${t}`,o=await O(n,{credentials:"omit"}),{status:i,notes:a}=await o.json();if("success"==i&&a?.length>0){const t=(e.getAttribute("birdwatch-browse")||W)+s;r.push(`This post has ${a.length} community note${a.length>1?"s":""}`)}}}r.length>0&&function(e,t){try{const s=document.createElement("div");s.setAttribute("style","background-color:#666;color:#fff;font-weight:bold;text-align:center"),s.textContent="NOTICE";const n=document.createElement("div");n.className="wm-capinfo-content";for(let e of t)"string"==typeof e&&i((()=>{const t=document.createElement("div");t.innerHTML=e,n.appendChild(t)}));e.appendChild(s),i((()=>e.appendChild(n))),j(!0)}catch(e){console.error("failed to build content of %o - maybe notice text is malformed: %s",$notice,t)}}(e,r)}(n,s):j(!0))}function j(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=$._dstate||{root:!1},s=!1;t.root?$._dstate={root:!1}:e?$._dstate={root:!1,notice:!0}:t.notice?$._dstate={root:!1}:($._dstate={root:!0},s=!0);const{root:n,notice:o}=$._dstate;if(n?($.style.display="block",D.classList.add("wm-open"),D.classList.remove("wm-closed")):o?($.style.display="block",$.classList.add("notice-only"),D.classList.add("wm-open"),D.classList.remove("wm-closed")):($.style.display="none",$.classList.remove("notice-only"),D.classList.remove("wm-open"),D.classList.add("wm-closed")),s){const e=$.querySelector("#wm-capresources");E(I.timestamp,I.staticPrefix,e)}}const B="https://wayback-api.archive.org/services/context/notices",P="https://wayback-api.archive.org/services/context/birdwatch",W="https://wayback-api.archive.org/services/context/birdwatch/_browse/";const F=window.JSON,J=window.open,X=window.Date,Y=document;var G=document,z=function(e){return G.getElementById(e)};var V,K="/static/";function Q(e,t){var s=z(e);s&&(s.style.visibility=t?"visible":"hidden")}function Z(e,t){l(e)||(e=[e]);for(var s=0;s{}))}if(window.__wm={init:function(t){!function(){var e=document.cookie.split(";");if(e.length>40)for(var t=0;t1?s-1:0),i=1;i0;)R.appendChild(N.children[0]);if(h)for(var A=0;A baseHeight=%s",e,t,s),N.style.height=s+"px",document.documentElement.style.setProperty("--wm-toolbar-height",s+"px")}window.top!=window.self&&"force"!=N.getAttribute("toolbar-mode")||(N.style.display="block");var $=!1,D=!0;const I=z("donato-if")?.contentWindow;var B=z("donato");if(console.debug("$donato = %o",B),B)if(window.top!=window.self)B.style.display="none",console.debug("hid $donato as window.top != window.self");else{var P=z("donato-base");window.addEventListener("message",(function(e){if(e.source===I){var t="string"==typeof e.data?F.parse(e.data):e.data;if(console.log("got message %o",t),"set height"==t.event){var s=t.value,n=t.bannerHeight;if("number"!=typeof s||s<=0)return;if(!D)return;if(t.value,$)return;B.style.height=n+"px",P.style.height=s+"px",O()}else if("open modal"==t.event)P.style.height="",document.body.classList.add("wm-modal"),window.scrollTo(0,0),$=!0;else if("close modal"==t.event)B.style.marginBottom="0px",document.body.classList.remove("wm-modal"),$=!1;else if("hide banner"==t.event){B.style.height=0,B.style.visibility="hidden";var o=new X(X.now()+24*t.value*3600*1e3);document.cookie="donation=x; domain=archive.org; path=/; expires="+o.toUTCString(),D=!1,$=!1,0,O()}}}),!1),console.debug("installed message listener to #donato-base: %o",P)}z("wm-tb-close").addEventListener("click",(e=>{z("wm-ipp-inside").style.display="none",e.preventDefault(),O()}));var W=z("wm-ipp-sparkline");function Q(e){var t="mouseenter"==e.type?1:0;if(t!==_){var s=z("wm-ipp"),n=z("displayYearEl"),o=z("displayMonthEl"),i=z("displayDayEl");t?s.className="hi":(s.className="",n.innerHTML=T,o.innerHTML=g(M-1),i.innerHTML=y(C,2)),x.style.display=t?"inline":"none",S.style.display=t?"inline":"none",_=t}}z("wm-expand").addEventListener("click",(e=>{e.stopPropagation(),j()})),z("wm-graph-anchor")._no_rewrite=!0,(x=Y.createElement("div")).className="yt",x.style.display="none",x.style.width=s+"px",x.style.height=t+"px",(S=Y.createElement("div")).className="mt",S.style.display="none",S.style.width=n+"px",S.style.height=t+"px",W.appendChild(x),W.appendChild(S);var te=z("wm-sparkline-canvas");W.onmouseenter=Q,W.onmouseleave=Q,W.onmousemove=function(t){var o,a,c=W,l=function(e){var t=0;return e.pageX||e.pageY?t=e.pageX:(e.clientX||e.clientY)&&(t=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft),t}(t),h=(o=c,a=Y.documentElement,(void 0!==o.getBoundingClientRect?o.getBoundingClientRect():{top:0,left:0}).left+(window.scrollX||a.scrollLeft)-(a.clientLeft||0)),u=Math.min(Math.max(0,l-h),e),d=u%s,m=Math.floor(u/s),f=Math.min(11,Math.floor(d/n)),w=12*m+f,v=d%2==1?15:1,b=y(m+r)+y(f+1,2)+y(v,2)+"000000";z("displayYearEl").innerHTML=m+r,z("displayMonthEl").innerHTML=g(f);var T=p+b+"/"+i;if(z("wm-graph-anchor").href=T,E!=m){var M=m*s;x.style.left=M+"px",E=m}if(k!=w){var C=m+w*n+1;S.style.left=C+"px",k=w}};var se=z("wm-sparkline-canvas");if(se.getContext&&se.getContext("2d")){c("GET","/__wb/sparkline?output=json&url="+encodeURIComponent(i)+(o&&"&collection="+o||""),(function(s){if(200==s.status){for(var n=F.parse(s.responseText),o=n.years,a=Object.getOwnPropertyNames(o),c=n.years=[],l=0;l1?"captures":"capture"}`;var d=w(o,"%d %b %Y");a!=o&&(d+=` - ${w(a,"%d %b %Y")}`);const m=document.createElement("div");m.className="r",m.title="Timespan for captures of this URL",m.innerText=d,t.innerHTML="",t.appendChild(h),t.appendChild(m)}(n),function(e,t,s,n,o,i,a){var r=n.getContext("2d");if(r){r.fillStyle="#FFF";var c=(new v).getUTCFullYear(),l=t/(c-o+1),h=b(e.years),u=h[0],d=s/h[1];if(i>=o){var p=_(i);r.fillStyle="#FFFFA5",r.fillRect(p,0,l,s)}for(var m=o;m<=c;m++)p=_(m),r.beginPath(),r.moveTo(p,0),r.lineTo(p,s),r.lineWidth=1,r.strokeStyle="#CCC",r.stroke();a=parseInt(a)-1;for(var f=(l-1)/12,g=0;g0){var C=Math.ceil(M*d);r.fillStyle=m==i&&T==a?"#EC008C":"#000",r.fillRect(Math.round(y),Math.ceil(s-C),Math.ceil(f),Math.round(C))}y+=f}}}function _(e){return Math.ceil((e-o)*l)+.5}}(n,e,t,se,r,T,M)}}))}else{var ne=new Image(e,t);ne.src="/__wb/sparkline?url="+encodeURIComponent(i)+"&width="+e+"&height="+t+"&selected_year="+T+"&selected_month="+M+(o&&"&collection="+o||""),ne.alt="sparkline",ne.id="sparklineImgId",ne.border="0",te.parentNode.replaceChild(ne,te)}function oe(e){return e.filter((e=>void 0===e.excluded)).map((e=>e.display_name))}z("wm-share-facebook").onclick=function(e){const t=this.dataset.url;return J("https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(t),"","height=400,width=600"),e.preventDefault(),!1},z("wm-share-twitter").onclick=function(e){const t=this.dataset.url;return J("https://x.com/intent/post?text="+encodeURIComponent(t)+"&via=internetarchive","","height=446,width=600"),e.preventDefault(),!1},new L(z("wmtbURL"),{delay:400,source:function(e,t){c("GET","/__wb/search/host?q="+encodeURIComponent(e),(function(s){if(void 0!==(s=F.parse(s.response)).hosts&&s.hosts.length>0){var n=oe(s.hosts);t(n)}else void 0!==s.isUrl&&!0===s.isUrl&&void 0===s.excluded?t([e]):c("GET","/__wb/search/anchor?q="+encodeURIComponent(e),(function(e){if(void 0!==(e=F.parse(e.response))&&e.length>0){var s=oe(e.slice(0,5));t(s)}}))}))},onSelect:function(e,t,s){z("wmtb").submit()}}),z("wmtb").onsubmit=function(e){var t=z("wmtbURL").value;if(0!==t.indexOf("http://")&&0!==t.indexOf("https://")&&!t.match(/[\w\.]{2,256}\.[a-z]{2,4}/gi))return document.location.href="/web/*/"+z("wmtbURL").value,e.preventDefault(),!1},function(e,t,s){!function(e,t){c("HEAD",e,(function(e){t(e.status<300,e.responseURL)}))}("/web/"+t+"/http://web.archive.org/screenshot/"+e,(function(e,n){if(!e)return s(!1);var o=function(e){var t=ee.exec(e);return t&&t[1]?t[1]:null}(n);if(!o)return console.warn("failed to extract timestamp from %s",n),void s(!1);var i=(f(o).getTime()-f(t).getTime())/1e3;console.log("screenshot delta: "+i+"s"),s(i>0&&i<60,i)}))}(i,V,(function(e,t){e?(z("wm-screenshot").title="screenshot (delta: "+t+"s)",Z("wm-screenshot",!0)):Z("wm-screenshot",!1)})),u&&function(e,t){!function(e,t,s){const n="/web/"+t+"id_/http://wayback-metadata.archive.org/youtube-dl/"+e;c("GET",n,s)}(e,t,(function(e){if(e.status<300){const t=F.parse(e.responseText);Z("wm-video",!0),z("wm-video").href=t.url,z("wm-video").title="Video: "+t.title}else Z("wm-video",!1)}))}(i,V),q(z("wm-capinfo"),z("wm-expand"),d),new H(z("wm-save-snapshot-open"),i,V),O()},ajax:c,sp:function(){return K},pc:function(e){(Math.random()=0&&document.cookie.search("logged-in-sig")>=0)&&window.addEventListener("load",se)}},window.parent!==window.self){const e={event:"playbackReady",pageUrl:document.location.href,pageTitle:document.title};window.parent.postMessage(JSON.stringify(e),"*"),document.addEventListener("DOMContentLoaded",(()=>{const e={event:"domContentLoaded",pageUrl:document.location.href,pageTitle:document.title};window.parent.postMessage(JSON.stringify(e),"*")})),window.addEventListener("pagehide",(e=>{const t={event:"pagehide",pageUrl:e.currentTarget.document.location.href,pageTitle:e.currentTarget.document.title};window.parent.postMessage(JSON.stringify(t),"*")})),"undefined"!=typeof navigation&&navigation.addEventListener("navigate",(e=>{if("replace"===e.navigationType){const t={event:"navigate",pageUrl:e.destination.url,pageTitle:document.title};window.parent.postMessage(JSON.stringify(t),"*")}}))}})(); // @license-end