1class AjaxCaptchaManager{constructor(t={}){this.siteKey=t.siteKey||"";this.verifyEndpoint=t.verifyEndpoint||"/verify/ajax";this.turnstileLoaded=!1;this.widgetId=null;this.pendingRequest=null;this.onSuccessCallback=null;this.retryCount=0;this.maxRetries=2;this.isVerifying=!1;this.scrollLocked=!1;this.scrollYBeforeLock=0;this.modal=null;this.container=null;this.statusEl=null;this.errorEl=null;this.debug=!0;this.init()}log(...t){this.debug}init(){this.log("Initializing...");if("loading"===document.readyState)document.addEventListener("DOMContentLoaded",(()=>{this.injectModal();this.loadTurnstileScript();this.setupInterceptor();this.log("Initialized. Site key:",this.siteKey)}));else{this.injectModal();this.loadTurnstileScript();this.setupInterceptor();this.log("Initialized. Site key:",this.siteKey)}}injectModal(){let t=document.getElementById("ajax-captcha-modal");if(t){this.log("Modal already exists, reusing it");this.cacheModalReferences();return}this.log("Creating modal HTML...");const e='\n <div id="ajax-captcha-modal" class="captcha-modal" style="display: none;" role="dialog" aria-labelledby="captcha-modal-title" aria-modal="true"><div class="captcha-modal-container"><div class="captcha-modal-content"><div class="captcha-modal-header"><h2 id="captcha-modal-title">Quick security check</h2><p class="captcha-subtitle"><strong>To keep the site fast and spam-free for everyone, we sometimes ask visitors to pass a quick check.</strong></p></div><div class="captcha-modal-body"><div id="ajax-turnstile-container" class="turnstile-wrapper"></div><div class="captcha-status" id="captcha-status" role="status" aria-live="polite"><div class="status-spinner"><span class="spinner-dot"></span><span class="spinner-dot"></span><span class="spinner-dot"></span></div><span class="status-text"></span></div><div class="captcha-error" id="captcha-error" style="display: none;" role="alert"><span class="error-text"></span></div></div><div class="captcha-modal-footer"><p class="captcha-help-text">\n If the test doesn\'t appear or keeps failing, try allowing this page in your ad-blocker or privacy extensions, make sure your browser is up to date, and then refresh.\n </p></div></div></div></div>\n ',i=document.createElement("div");i.innerHTML=e;const s=i.firstElementChild;document.body.appendChild(s);this.log("Modal HTML appended to body");this.cacheModalReferences()}cacheModalReferences(){this.modal=document.getElementById("ajax-captcha-modal");this.container=document.getElementById("ajax-turnstile-container");this.statusEl=document.getElementById("captcha-status");this.errorEl=document.getElementById("captcha-error");this.modal&&this.container&&this.statusEl&&this.errorEl?this.log("All modal elements cached successfully"):this.log("WARNING: Some modal elements not found",{modal:!!this.modal,container:!!this.container,statusEl:!!this.statusEl,errorEl:!!this.errorEl})}loadTurnstileScript(){if(this.turnstileLoaded||window.turnstile){this.turnstileLoaded=!0;this.log("Turnstile already loaded");return Promise.resolve()}this.log("Loading Turnstile script...");return new Promise(((t,e)=>{const i=document.createElement("script");i.src="https://challenges.cloudflare.com/turnstile/v0/api.js";i.async=!0;i.defer=!0;i.onload=()=>{this.turnstileLoaded=!0;this.log("Turnstile loaded successfully");t()};i.onerror=()=>{this.log("Failed to load Turnstile");e(new Error("Failed to load Turnstile"))};document.head.appendChild(i)}))}lockScroll(){if(this.scrollLocked)return;this.scrollLocked=!0;const t=document.documentElement,e=document.body,i=window.scrollY||window.pageYOffset||0;this.scrollYBeforeLock=i;const s=window.innerWidth-t.clientWidth,r=s>0?s:0;r>0&&(e.style.paddingRight=(parseFloat(getComputedStyle(e).paddingRight)||0)+r+"px");e.style.position="fixed";e.style.top=`-${i}px`;e.style.left="0";e.style.right="0"}unlockScroll(){if(!this.scrollLocked)return;this.scrollLocked=!1;const t=document.body,e=this.scrollYBeforeLock||0;t.style.position="";t.style.top="";t.style.left="";t.style.right="";t.style.paddingRight="";window.scrollTo(0,e)}setupInterceptor(){const t=window.fetch,e=this;this.log("Setting up fetch interceptor");window.fetch=async function(...i){const url="string"==typeof i[0]?i[0]:i[0]?.url||"";try{const s=await t.apply(this,i);403===s.status&&e.log("Fetch response:",url,"Status:",s.status);const r=url.includes("/verify/ajax")||url.includes("rvt-mint.php");if(r){e.log("Skipping interception (verify endpoint):",url);return s}if(e.isVerifying){e.log("Skipping interception (currently verifying)");return s}if(403===s.status){const r=s.headers.get("X-Challenge-Required");e.log("Got 403. Challenge header:",r);
1if("true"===r||"1"===r){let r=null;try{const t=s.clone(),text=await t.text();e.log("Response body:",text.substring(0,200));if(text&&text.trim()){r=JSON.parse(text);e.log("Parsed challenge data:",r)}}catch(t){e.log("Failed to parse response:",t);return s}if(r&&r.challenge_required&&r.turnstile_site_key){e.log("Valid challenge detected, showing modal...");return new Promise((s=>{e.showModal(r,(()=>{e.log("Challenge completed, retrying original request...");t.apply(this,i).then(s).catch(s)}))}))}e.log("Invalid challenge data:",r)}}return s}catch(t){e.log("Fetch error:",t);throw t}};const i=XMLHttpRequest.prototype.open,s=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(t,url,...e){this._url=url;this._method=t;return i.call(this,t,url,...e)};XMLHttpRequest.prototype.send=function(...t){const i=this.onload,xhr=this;this.onload=function(){const s=xhr._url&&(xhr._url.includes("/verify/ajax")||xhr._url.includes("rvt-mint.php"));if(s||e.isVerifying)return i?i.apply(this,arguments):void 0;if(403===this.status){const s=this.getResponseHeader("X-Challenge-Required");e.log("XHR 403. Challenge header:",s);if("true"===s||"1"===s)try{const text=this.responseText||"";if(text.trim()){const s=JSON.parse(text);e.log("XHR challenge data:",s);if(s.challenge_required&&s.turnstile_site_key){e.showModal(s,(()=>{const e=new XMLHttpRequest;e.open(xhr._method||"GET",xhr._url,!0);e.setRequestHeader("X-Requested-With","XMLHttpRequest");i&&(e.onload=i);e.send(...t)}));return}}}catch(t){e.log("XHR parse error:",t)}}i&&i.apply(this,arguments)};return s.apply(this,t)}}showModal(t={},e=null){this.log("showModal called with data:",t);if(!this.modal){this.log("Modal not cached, attempting to find it...");this.cacheModalReferences()}if(!this.modal){this.log("ERROR: Modal element not found! Attempting to inject now...");this.injectModal();if(!this.modal){this.log("FATAL: Still cannot find modal element");alert("Security check required. Please refresh the page.");return}}this.siteKey=t.turnstile_site_key||this.siteKey;this.onSuccessCallback=e;this.retryCount=0;this.log("Using site key:",this.siteKey);if(this.siteKey){this.hideError();this.statusEl&&(this.statusEl.style.display="none");this.log("Displaying modal...");this.modal.style.display="flex";requestAnimationFrame((()=>{this.modal.style.opacity="1";this.log("Modal should be visible now")}));this.lockScroll();try{this.modal.focus()}catch(t){}this.renderWidget()}else{this.log("ERROR: No site key available");this.showError("Configuration error. Please refresh the page.")}}hideModal(){this.log("Hiding modal...");if(this.modal){this.modal.style.opacity="0";setTimeout((()=>{this.modal.style.display="none";this.unlockScroll();if(null!==this.widgetId&&window.turnstile){try{window.turnstile.remove(this.widgetId)}catch(t){this.log("Widget remove failed:",t)}this.widgetId=null}this.log("Modal hidden")}),200)}}async renderWidget(){this.log("renderWidget called");if(this.container){this.container.innerHTML='\n <div class="turnstile-inline-loader"><div class="status-spinner"><span class="spinner-dot"></span><span class="spinner-dot"></span><span class="spinner-dot"></span></div><span class="turnstile-inline-text">Loading security checkâ¦</span></div>\n ';try{this.log("Ensuring Turnstile loaded...");await this.loadTurnstileScript();if(!window.turnstile)throw new Error("Turnstile API not available");this.log("Rendering Turnstile widget...");this.widgetId=window.turnstile.render(this.container,{sitekey:this.siteKey,theme:"dark",action:"ajax_pagination",callback:t=>this.onTurnstileSuccess(t),"error-callback":()=>this.onTurnstileError(),"expired-callback":()=>this.onTurnstileExpired(),"timeout-callback":()=>this.onTurnstileTimeout()});const t=this.container.querySelector(".turnstile-inline-loader");t&&t.remove();this.log("Widget rendered with ID:",this.widgetId);this.updateStatus("Please complete the challenge above",!1)}catch(t){this.log("Widget render error:",t);this.showError("Failed to load verification. Please refresh the page.")}}else{this.log("ERROR: Container not found");this.showError("Modal error. Please refresh the page.")}}async onTurnstileSuccess(t){this.log("Turnstile success, token:",t.substring(0,20)+"...");this.isVerifying=!0;this.updateStatus("Verifying...",!1);try{this.log("Sending verification request to:",this.verifyEndpoint);const e=await fetch(this.verifyEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:new URLSearchParams({"cf-turnstile-response":t})});this.log("Verification response status:",e.status);if(!e.ok){const text=await e.text();this.log("Verification failed. Response:",text);throw new Error(`Verification failed (${e.status})`)}const i=await e.json();this.log("Verification data:",i);if(!i.success)throw new Error(i.error||"Verification failed");this.log("Verification successful!");this.updateStatus("â Verified",!0);setTimeout((()=>{this.hideModal();if(this.onSuccessCallback){this.log("Calling success callback");this.onSuccessCallback();this.onSuccessCallback=null}this.isVerifying=!1}),800)}catch(t){this.log("Verification error:",t);this.isVerifying=!1;this.handleVerificationError(t)}}handleVerificationError(error){this.retryCount++;this.log("Verification error, retry count:",this.retryCount);if(this.retryCount<this.maxRetries){this.showError(`${error.message}. Please try again.`);if(null!==this.widgetId&&window.turnstile)try{window.turnstile.reset(this.widgetId)}catch(t){this.renderWidget()}}else this.showError("Verification failed. Please refresh the page and try again.")}onTurnstileError(){this.log("Turnstile error callback");this.showError("Challenge failed. Please try again.");this.retryCount++;this.retryCount<this.maxRetries&&null!==this.widgetId&&setTimeout((()=>{try{window.turnstile.reset(this.widgetId)}catch(t){this.renderWidget()}}),1e3)}onTurnstileExpired(){this.log("Turnstile expired");this.showError("Challenge expired. Please complete it again.");if(null!==this.widgetId)try{window.turnstile.reset(this.widgetId)}catch(t){this.renderWidget()}}onTurnstileTimeout(){this.log("Turnstile timeout");this.showError("Challenge timed out. Please try again.");if(null!==this.widgetId)try{window.turnstile.reset(this.widgetId)}catch(t){this.renderWidget()}}updateStatus(t,e=!1){if(!this.statusEl)return;this.statusEl.style.display="flex";const i=this.statusEl.querySelector(".status-text");i&&(i.textContent=t);e?this.statusEl.classList.add("success"):this.statusEl.classList.remove("success")}showError(t){this.log("Showing error:",t);if(!this.errorEl)return;const e=this.errorEl.querySelector(".error-text");e&&(e.textContent=t);this.errorEl.style.display="flex";this.statusEl&&(this.statusEl.style.display="none")}hideError(){this.errorEl&&(this.errorEl.style.display="none");this.statusEl&&(this.statusEl.style.display="flex")}triggerChallenge(t=null){this.log("Manual trigger");this.showModal({turnstile_site_key:this.siteKey||window.TURNSTILE_SITE_KEY,challenge_required:!0},t)}}!function(){function initialize(){window.ajaxCaptchaManager||(window.ajaxCaptchaManager=new AjaxCaptchaManager({siteKey:window.TURNSTILE_SITE_KEY||""}))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",initialize):initialize()}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.