friendly-challenge
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,2 +0,2 @@ | ||
var friendlycaptcha=function(A){"use strict";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Uint8Array(256);for(let A=0;A<t.length;A++)e[t.charCodeAt(A)]=A;function r(A){const e=A.length;let r="";for(let n=0;n<e;n+=3)r+=t[A[n]>>2],r+=t[(3&A[n])<<4|A[n+1]>>4],r+=t[(15&A[n+1])<<2|A[n+2]>>6],r+=t[63&A[n+2]];return e%3==2?r=r.substring(0,r.length-1)+"=":e%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function n(A){let t=.75*A.length;const r=A.length;"="===A[r-1]&&t--,"="===A[r-2]&&t--;const n=new Uint8Array(t);let i=0;for(let t=0;t<r;t+=4){const r=e[A.charCodeAt(t)],o=e[A.charCodeAt(t+1)],s=e[A.charCodeAt(t+2)],a=e[A.charCodeAt(t+3)];n[i++]=r<<2|o>>4,n[i++]=(15&o)<<4|s>>2,n[i++]=(3&s)<<6|63&a}return n}function i(A,t,e,r=!1,n){return`<div class="frc-container">\n<svg class="frc-icon" role="img" xmlns="http://www.w3.org/2000/svg" height="32" width="32" viewBox="0 0 24 24">${A}</svg>\n<div class="frc-content">\n <span class="frc-text">${t}</span>\n ${e?`<button type="button" class="frc-button">${e}</button>`:""}\n ${r?'<progress class="frc-progress" value="0">0%</progress>':""}\n</div>\n</div><span class="frc-banner"><a href="https://friendlycaptcha.com/" style="text-decoration:none;" target="_blank"><b>Friendly</b>Captcha ⇗</a></span>\n<input name="frc-captcha-solution" class="g-captcha-solution" style="display: none;" type="hidden" value="${n||"UNFINISHED"}">`}function o(A){return i('<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',A,void 0)}const s=window.URL||window.webkitURL;class a{constructor(A,t={}){this.worker=null,this.valid=!1,this.opts=Object.assign({forceJSFallback:!1,startMode:"focus",puzzleEndpoint:"http://localhost:8787/api/v1/puzzle",startedCallback:()=>0,readyCallback:()=>0,doneCallback:()=>0,errorCallback:()=>0},t),this.element=A,A.innerText="FriendlyCaptcha initializing.."}init(){if(this.initWorker(),this.setupSolver(),"focus"===this.opts.startMode){const A=function(A){for(;"FORM"!==A.tagName;)if(!(A=A.parentElement))return null;return A}(this.element);A?function(A,t){A.addEventListener("focusin",t,{once:!0,passive:!0})}(A,()=>this.start()):console.log("FriendlyCaptcha div seems not to be contained in a form, autostart will not work")}else"auto"===this.opts.startMode&&this.start()}async setupSolver(){if(this.opts.forceJSFallback)this.worker.postMessage({type:"js"});else try{const A=WebAssembly.compile(n("AGFzbQEAAAABJgdgAABgAn9/AGADf39/AX9gAX8AYAR/f39/AGABfwF/YAJ/fwF/Ag0BA2VudgVhYm9ydAAEAwsKBgUDAAABAgECAAUDAQABBhYEfwFBAAt/AUEAC38AQQULfwBB0A0LB24JBm1lbW9yeQIAB19fYWxsb2MAAQhfX3JldGFpbgACCV9fcmVsZWFzZQADCV9fY29sbGVjdAAEB19fcmVzZXQABQtfX3J0dGlfYmFzZQMDDVVpbnQ4QXJyYXlfSUQDAgxzb2x2ZUJsYWtlMmIACQgBCgrgEwqSAQEFfyAAQfD///8DSwRAAAsjAUEQaiIEIABBD2pBcHEiAkEQIAJBEEsbIgZqIgI/ACIFQRB0IgNLBEAgBSACIANrQf//A2pBgIB8cUEQdiIDIAUgA0obQABBAEgEQCADQABBAEgEQAALCwsgAiQBIARBEGsiAiAGNgIAIAJBATYCBCACIAE2AgggAiAANgIMIAQLBAAgAAsDAAELAwABCwYAIwAkAQu7AgEBfwJAIAFFDQAgAEEAOgAAIAAgAWpBBGsiAkEAOgADIAFBAk0NACAAQQA6AAEgAEEAOgACIAJBADoAAiACQQA6AAEgAUEGTQ0AIABBADoAAyACQQA6AAAgAUEITQ0AIABBACAAa0EDcSICaiIAQQA2AgAgACABIAJrQXxxIgJqQRxrIgFBADYCGCACQQhNDQAgAEEANgIEIABBADYCCCABQQA2AhAgAUEANgIUIAJBGE0NACAAQQA2AgwgAEEANgIQIABBADYCFCAAQQA2AhggAUEANgIAIAFBADYCBCABQQA2AgggAUEANgIMIAAgAEEEcUEYaiIBaiEAIAIgAWshAQNAIAFBIE8EQCAAQgA3AwAgAEIANwMIIABCADcDECAAQgA3AxggAUEgayEBIABBIGohAAwBCwsLC3MBAX8gAEUEQEEMQQIQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCABQfD///8DIAJ2SwRAQbALQeALQRJBORAAAAsgASACdCIDQQAQASICIAMQBiAAKAIAGiAAIAIiATYCACAAIAI2AgQgACADNgIIIAALqgsCBn8EfiAAKAIYIQcgACgCHCEEIAAoAhghAiAAKAIcIQYDQCADQQhIBEAgByADQQN0IgVqIAUgACgCBCgCBGopAwA3AwAgByADQQhqQQN0aiAFQeQIKAIAaikDADcDACADQQFqIQMMAQsLIAIgAikDYCAAKQMIhTcDYCACIAIpA3BCf4U3A3BBACEDA0AgA0EQSARAIAYgA0EDdCIFaiABIAVqKQMANwMAIANBAWohAwwBCwtBACEDA0AgA0HAAUgEQCACKQMAIAIiAUEgaikDACIIIAQgA0HUCigCAGotAABBA3RqKQMAfHwiCiACQeAAaikDAIVCIIoiCyACQUBrIgUpAwB8IQkgAiAKIAggCYVCGIoiCCAEQdQKKAIAIANBAWpqLQAAQQN0aikDAHx8Igo3AwAgAiAIIAkgCiALhUIQiiIJfCIIhUI/ijcDICAFIAg3AwAgAiAJNwNgIAIpAwggAikDKCIIIARB1AooAgAgA0ECamotAABBA3RqKQMAfHwiCiACKQNohUIgiiILIAIpA0h8IQkgAiAKIAggCYVCGIoiCCAEQdQKKAIAIANBA2pqLQAAQQN0aikDAHx8Igo3AwggAiAIIAkgCiALhUIQiiIJfCIIhUI/ijcDKCACIAg3A0ggAiAJNwNoIAIpAxAgAikDMCIIIARB1AooAgAgA0EEamotAABBA3RqKQMAfHwiCiACKQNwhUIgiiILI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wcODAEDCQUADwQIBgIKBg8OCQsDAAgMAg0HAQQKBQoCCAQHBgEFDwsJDgMMDQAAAQIDBAUGBwgJCgsMDQ4PDgoECAkPDQYBDAACCwcFAwBBwAoLHRAAAAABAAAABAAAABAAAACABAAAgAQAAMAAAADAAEHgCgsxIgAAAAEAAAABAAAAIgAAAHMAcgBjAC8AcwBvAGwAdgBlAHIAVwBhAHMAbQAuAHQAcwBBoAsLKxwAAAABAAAAAQAAABwAAABJAG4AdgBhAGwAaQBkACAAbABlAG4AZwB0AGgAQdALCzUmAAAAAQAAAAEAAAAmAAAAfgBsAGkAYgAvAGEAcgByAGEAeQBiAHUAZgBmAGUAcgAuAHQAcwBBkAwLNSYAAAABAAAAAQAAACYAAAB+AGwAaQBiAC8AcwB0AGEAdABpAGMAYQByAHIAYQB5AC4AdABzAEHQDAszJAAAAAEAAAABAAAAJAAAAEkAbgBkAGUAeAAgAG8AdQB0ACAAbwBmACAAcgBhAG4AZwBlAEGQDQszJAAAAAEAAAABAAAAJAAAAH4AbABpAGIALwB0AHkAcABlAGQAYQByAHIAYQB5AC4AdABzAEHQDQs+CAAAACAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACICAAAAAAAAYgAAAAAAAABhAAAAAgAAACECAAACAAAAJAI="));this.worker.postMessage({type:"module",module:await A})}catch(A){console.log("FriendlyCaptcha failed to initialize WebAssembly, falling back to Javascript solver: "+A.toString()),this.worker.postMessage({type:"js"})}}initWorker(){const A=new Blob(['!function(){class t{constructor(t){this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.v=new Uint32Array(32),this.m=new Uint32Array(32),this.outlen=t}}function e(t,e,n){const r=t[e],s=t[e+1],o=t[n],i=t[n+1],a=r+o>>>0,f=(r&o|(r|o)&~a)>>>31;t[e]=a,t[e+1]=s+i+f>>>0}function n(t,e,n,r){const s=t[e],o=t[e+1],i=s+n>>>0,a=(s&n|(s|n)&~i)>>>31;t[e]=i,t[e+1]=o+r+a>>>0}function r(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function s(t,r,s,o,i,a,f,c){const l=r[f],u=r[f+1],y=r[c],h=r[c+1];e(t,s,o),n(t,s,l,u);let w=t[a]^t[s],_=t[a+1]^t[s+1];t[a]=_,t[a+1]=w,e(t,i,a),w=t[o]^t[i],_=t[o+1]^t[i+1],t[o]=w>>>24^_<<8,t[o+1]=_>>>24^w<<8,e(t,s,o),n(t,s,y,h),w=t[a]^t[s],_=t[a+1]^t[s+1],t[a]=w>>>16^_<<16,t[a+1]=_>>>16^w<<16,e(t,i,a),w=t[o]^t[i],_=t[o+1]^t[i+1],t[o]=_>>>31^w<<1,t[o+1]=w>>>31^_<<1}const o=new Uint32Array(16).map((t,e)=>[4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225][e]),i=[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6,22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8,14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16,18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26,4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18,24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22,26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20,12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10,20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6];function a(t,e){const n=t.v,a=t.m;for(let e=0;e<16;e++)n[e]=t.h[e],n[e+16]=o[e];n[24]=n[24]^t.t,n[25]=n[25]^t.t/4294967296,e&&(n[28]=~n[28],n[29]=~n[29]);for(let e=0;e<32;e++)a[e]=r(t.b,4*e);for(let t=0;t<12;t++)s(n,a,0,8,16,24,i[16*t+0],i[16*t+1]),s(n,a,2,10,18,26,i[16*t+2],i[16*t+3]),s(n,a,4,12,20,28,i[16*t+4],i[16*t+5]),s(n,a,6,14,22,30,i[16*t+6],i[16*t+7]),s(n,a,0,10,20,30,i[16*t+8],i[16*t+9]),s(n,a,2,12,22,24,i[16*t+10],i[16*t+11]),s(n,a,4,14,16,26,i[16*t+12],i[16*t+13]),s(n,a,6,8,18,28,i[16*t+14],i[16*t+15]);for(let e=0;e<16;e++)t.h[e]=t.h[e]^n[e]^n[e+16]}function f(t,e){for(let e=0;e<16;e++)t.h[e]=o[e];t.b.set(e),t.h[0]^=16842752^t.outlen}function c(t,e){const n=new Uint8Array(3),r=new DataView(n.buffer);return r.setUint8(0,t),r.setUint16(1,e),n}let l,u;self.ASC_TARGET=0;let y=new Promise(t=>u=t),h=!1;self.onerror=t=>{self.postMessage({type:"error",error:JSON.stringify(t)})},self.onmessage=e=>{const n=e.data,r=n.type;if("module"===r)(async function(t){const e=await async function(t){const e={env:{abort(){throw Error("Wasm aborted")}}},n=await WebAssembly.instantiate(t,e),r=function(t){const e={},n=t.exports,r=n.memory,s=n.__alloc,o=n.__retain,i=n.__rtti_base||-1;return e.__allocArray=(t,e)=>{const n=function(t){return new Uint32Array(r.buffer)[(i+4>>>2)+2*t]}(t),a=31-Math.clz32(n>>>6&31),f=e.length,c=s(f<<a,0),l=s(12,t),u=new Uint32Array(r.buffer);u[l+0>>>2]=o(c),u[l+4>>>2]=c,u[l+8>>>2]=f<<a;const y=r.buffer,h=new Uint8Array(y);if(16384&n)for(let t=0;t<f;++t)h[(c>>>a)+t]=o(e[t]);else h.set(e,c>>>a);return l},e.__getUint8Array=t=>{const e=new Uint32Array(r.buffer),n=e[t+4>>>2];return new Uint8Array(r.buffer,n,e[n-4>>>2]>>>0)},function(t,e={}){const n=t.__argumentsLength?e=>{t.__argumentsLength.value=e}:t.__setArgumentsLength||t.__setargc||(()=>({}));for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const s=t[r],o=r.split(".")[0];"function"==typeof s&&s!==n?(e[o]=(...t)=>(n(t.length),s(...t))).original=s:e[o]=s}return e}(n,e)}(n);return{...n,exports:r}}(t),n=e.exports.__retain(e.exports.__allocArray(e.exports.Uint8Array_ID,new Uint8Array(128)));let r=e.exports.__getUint8Array(n);return(t,s,o=4294967295)=>{r.set(t);const i=e.exports.solveBlake2b(n,s,o);r=e.exports.__getUint8Array(n);const a=e.exports.__getUint8Array(i);return e.exports.__release(i),[r,a]}})(n.module).then(t=>{self.postMessage({type:"ready",solver:1}),l=1,u(t)});else if("js"===r)(async function(){return(e,n,r=4294967295)=>[e,function(e,n,r){if(128!=e.length)throw Error("Invalid input");const s=e.buffer,o=new DataView(s),i=new t(32);i.t=128;const c=o.getUint32(124,!0),l=c+r;for(let t=c;t<l;t++)if(o.setUint32(124,t,!0),f(i,e),a(i,!0),i.h[0]<n)return 0==ASC_TARGET?new Uint8Array(i.h.buffer):Uint8Array.wrap(i.h.buffer);return new Uint8Array(0)}(e,n,r)]})().then(t=>{self.postMessage({type:"ready",solver:2}),l=2,u(t)});else if("start"===r){if(h)return;h=!0,y.then(t=>{setTimeout(()=>{self.postMessage({type:"started"});let e=Date.now(),r=0;const s=function(t,e){const n=[];for(let r=0;r<e;r++){const e=new Uint8Array(128);e.set(t),e[120]=r,n.push(e)}return n}(n.buffer,n.n),o=new Uint8Array(8*n.n);for(var i=0;i<s.length;i++){const e=Date.now();let f;for(var a=0;a<256;a++){s[i][123]=a;const[e,r]=t(s[i],n.threshold);if(0!==e.length){f=e;break}console.error("FC: Internal error or no solution found")}const c=new DataView(f.slice(-4).buffer).getUint32(0,!0),l=(Date.now()-e)/1e3;r+=c,o.set(f.slice(-8),8*i),self.postMessage({type:"progress",n:n.n,h:c,t:l,i:i})}const f=(Date.now()-e)/1e3,u={type:"done",solution:o,h:r,t:f,diagnostics:c(l,f)};self.postMessage(u),self.close()})})}}}();\n'],{type:"text/javascript"});this.worker=new Worker(s.createObjectURL(A)),this.worker.onmessage=A=>{var t;const e=A.data;if(e)if("progress"===e.type)!function(A,t){const e=A.querySelector(".frc-progress"),r=(t.i+1)/t.n;e?(e.value=r,e.innerText=r.toFixed(2)+"%",e.title=t.i+1+"/"+t.n+" ("+(t.h/t.t*.001).toFixed(0)+"K/s)"):console.log("Progress bar not found")}(this.element,e);else if("ready"===e.type)this.element.innerHTML=i('<path d="M17,11c0.34,0,0.67,0.04,1,0.09V6.27L10.5,3L3,6.27v4.91c0,4.54,3.2,8.79,7.5,9.82c0.55-0.13,1.08-0.32,1.6-0.55 C11.41,19.47,11,18.28,11,17C11,13.69,13.69,11,17,11z"/><path d="M17,13c-2.21,0-4,1.79-4,4c0,2.21,1.79,4,4,4s4-1.79,4-4C21,14.79,19.21,13,17,13z M17,14.38"/>',"Anti-Robot Verification","Press to Start"),null===(t=this.element.querySelector("button"))||void 0===t||t.addEventListener("click",()=>{},{once:!0,passive:!0}),this.opts.readyCallback();else if("started"===e.type)this.element.innerHTML=i('<circle cx="12" cy="12" r="8" stroke-width="3" stroke-dasharray="15 10" fill="none" stroke-linecap="round" transform="rotate(0 12 12)"><animateTransform attributeName="transform" type="rotate" repeatCount="indefinite" dur="0.9s" values="0 12 12;360 12 12"/></circle>',"Verifying you are not a robot..",void 0,!0),this.opts.startedCallback();else if("done"===e.type){const A=this.handleDone(e);this.opts.doneCallback(A)}else console.log("Received: "+JSON.stringify(e))}}async start(){const A=this.element.dataset.sitekey;if(!A)return console.error("FriendlyCaptcha: sitekey not set on frc-captcha element"),void(this.element.innerHTML=o("Website problem: sitekey not set"));try{this.puzzle=function(A){const t=A.split("."),e=t[1],r=n(e),i=r[14],o=((s=r[15])>255?s=255:s<0&&(s=0),Math.pow(2,(255.999-s)/8)>>>0);var s;return{signature:t[0],base64:e,buffer:r,n:i,threshold:o}}(await async function(A,t){const e=await async function A(t,e,r){let n=20;return fetch(t,e).catch(async i=>{if(1===r)throw i;return await new Promise(A=>setTimeout(A,n)),n*=4,A(t,e,r-1)})}(A+"?sitekey="+t,{headers:[["X-FRC-Client","0.0.1"]]},5);if(e.ok)return(await e.json()).data.puzzle;throw Error(`Failure in getting puzzle: ${e.status} ${e.statusText}`)}(this.opts.puzzleEndpoint,A))}catch(A){this.element.innerHTML=o(A),this.opts.errorCallback({code:"error_getting_puzzle",description:A.toString()})}this.worker.postMessage({type:"start",buffer:this.puzzle.buffer,n:this.puzzle.n,threshold:this.puzzle.threshold})}handleDone(A){this.valid=!0;const t=this.puzzle.signature+"."+this.puzzle.base64+"."+r(A.solution)+"."+r(A.diagnostics);return this.element.innerHTML=function(A,t){return i(`<title>Completed: ${t.t.toFixed(0)}s (${(t.h/t.t*.001).toFixed(0)}K/s)</title><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"><animate attributeName="opacity" dur="1.0s" values="0;1"/></path>`,"I'm not a robot",void 0,!1,A)}(t,A),t}}const g=function(){const A=document.querySelector(".frc-captcha");return A||console.error("FriendlyCaptcha: No div was found with .frc-captcha class"),A}();return g&&(function(){if(!document.querySelector("#frc-style")){const A=document.createElement("style");A.type="text/css",A.id="frc-style",A.innerText='.frc-captcha{position:relative;width:18rem;min-height:2.8rem;border:1px solid #ddd;border-radius:4px;color:#222;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background-color:#fff;padding-bottom:9px}.frc-container{display:flex;align-items:center}.frc-icon{fill:#222;stroke:#222;flex-shrink:0;margin:8px 8px 0}.frc-icon.frc-warning{fill:#c00}.frc-content{white-space:nowrap;display:flex;flex-direction:column;margin:.4rem .4rem 0 0;overflow-x:auto;flex-grow:1}.frc-banner{position:absolute;bottom:1px;right:6px;font-size:.65rem;opacity:.85}.frc-progress{-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:3px 0;height:4px;border:none;background-color:#eee;color:#222;width:100%;transition:.5s linear}.frc-progress::-webkit-progress-bar{background:#eee}.frc-progress::-webkit-progress-value{background:#222}.frc-progress::-moz-progress-bar{background:#222}.frc-button{cursor:pointer;padding:2px 6px;background-color:#eee;color:#222;border:1px solid transparent}.frc-button:focus{border:1px solid #333}.frc-button:hover{background-color:#e4e4e4}.dark.frc-captcha{color:#fff;background-color:#222}.dark .frc-icon{fill:#fff;stroke:#fff}.dark.frc-captcha a{color:#fff}.dark .frc-progress{background-color:#444}.dark .frc-progress::-webkit-progress-bar{background:#444}.dark .frc-progress::-webkit-progress-value{background:#ddd}.dark .frc-progress::-moz-progress-bar{background:#ddd}',document.head.appendChild(A)}}(),new a(g).init()),A.FriendlyCaptcha=a,A}({}); | ||
var friendlycaptcha=function(A){"use strict";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Uint8Array(256);for(let A=0;A<t.length;A++)e[t.charCodeAt(A)]=A;function r(A){const e=A.length;let r="";for(let n=0;n<e;n+=3)r+=t[A[n]>>2],r+=t[(3&A[n])<<4|A[n+1]>>4],r+=t[(15&A[n+1])<<2|A[n+2]>>6],r+=t[63&A[n+2]];return e%3==2?r=r.substring(0,r.length-1)+"=":e%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function n(A){let t=.75*A.length;const r=A.length;"="===A[r-1]&&t--,"="===A[r-2]&&t--;const n=new Uint8Array(t);let i=0;for(let t=0;t<r;t+=4){const r=e[A.charCodeAt(t)],o=e[A.charCodeAt(t+1)],s=e[A.charCodeAt(t+2)],a=e[A.charCodeAt(t+3)];n[i++]=r<<2|o>>4,n[i++]=(15&o)<<4|s>>2,n[i++]=(3&s)<<6|63&a}return n}function i(A,t,e,r=!1,n){return`<div class="frc-container">\n<svg class="frc-icon" role="img" xmlns="http://www.w3.org/2000/svg" height="32" width="32" viewBox="0 0 24 24">${A}</svg>\n<div class="frc-content">\n <span class="frc-text">${t}</span>\n ${e?`<button type="button" class="frc-button">${e}</button>`:""}\n ${r?'<progress class="frc-progress" value="0">0%</progress>':""}\n</div>\n</div><span class="frc-banner"><a href="https://friendlycaptcha.com/" style="text-decoration:none;" target="_blank"><b>Friendly</b>Captcha ⇗</a></span>\n<input name="frc-captcha-solution" class="g-captcha-solution" style="display: none;" type="hidden" value="${n||"UNFINISHED"}">`}function o(A){return i('<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',A,void 0)}const s=window.URL||window.webkitURL;class a{constructor(A,t={}){this.worker=null,this.valid=!1,this.opts=Object.assign({forceJSFallback:!1,startMode:"focus",puzzleEndpoint:"https:/dev.friendlycaptcha.com/api/v1/puzzle",startedCallback:()=>0,readyCallback:()=>0,doneCallback:()=>0,errorCallback:()=>0},t),this.element=A,A.innerText="FriendlyCaptcha initializing.."}init(){if(this.initWorker(),this.setupSolver(),"focus"===this.opts.startMode){const A=function(A){for(;"FORM"!==A.tagName;)if(!(A=A.parentElement))return null;return A}(this.element);A?function(A,t){A.addEventListener("focusin",t,{once:!0,passive:!0})}(A,()=>this.start()):console.log("FriendlyCaptcha div seems not to be contained in a form, autostart will not work")}else"auto"===this.opts.startMode&&this.start()}async setupSolver(){if(this.opts.forceJSFallback)this.worker.postMessage({type:"js"});else try{const A=WebAssembly.compile(n("AGFzbQEAAAABJgdgAABgAn9/AGADf39/AX9gAX8AYAR/f39/AGABfwF/YAJ/fwF/Ag0BA2VudgVhYm9ydAAEAwsKBgUDAAABAgECAAUDAQABBhYEfwFBAAt/AUEAC38AQQULfwBB0A0LB24JBm1lbW9yeQIAB19fYWxsb2MAAQhfX3JldGFpbgACCV9fcmVsZWFzZQADCV9fY29sbGVjdAAEB19fcmVzZXQABQtfX3J0dGlfYmFzZQMDDVVpbnQ4QXJyYXlfSUQDAgxzb2x2ZUJsYWtlMmIACQgBCgrgEwqSAQEFfyAAQfD///8DSwRAAAsjAUEQaiIEIABBD2pBcHEiAkEQIAJBEEsbIgZqIgI/ACIFQRB0IgNLBEAgBSACIANrQf//A2pBgIB8cUEQdiIDIAUgA0obQABBAEgEQCADQABBAEgEQAALCwsgAiQBIARBEGsiAiAGNgIAIAJBATYCBCACIAE2AgggAiAANgIMIAQLBAAgAAsDAAELAwABCwYAIwAkAQu7AgEBfwJAIAFFDQAgAEEAOgAAIAAgAWpBBGsiAkEAOgADIAFBAk0NACAAQQA6AAEgAEEAOgACIAJBADoAAiACQQA6AAEgAUEGTQ0AIABBADoAAyACQQA6AAAgAUEITQ0AIABBACAAa0EDcSICaiIAQQA2AgAgACABIAJrQXxxIgJqQRxrIgFBADYCGCACQQhNDQAgAEEANgIEIABBADYCCCABQQA2AhAgAUEANgIUIAJBGE0NACAAQQA2AgwgAEEANgIQIABBADYCFCAAQQA2AhggAUEANgIAIAFBADYCBCABQQA2AgggAUEANgIMIAAgAEEEcUEYaiIBaiEAIAIgAWshAQNAIAFBIE8EQCAAQgA3AwAgAEIANwMIIABCADcDECAAQgA3AxggAUEgayEBIABBIGohAAwBCwsLC3MBAX8gAEUEQEEMQQIQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCABQfD///8DIAJ2SwRAQbALQeALQRJBORAAAAsgASACdCIDQQAQASICIAMQBiAAKAIAGiAAIAIiATYCACAAIAI2AgQgACADNgIIIAALqgsCBn8EfiAAKAIYIQcgACgCHCEEIAAoAhghAiAAKAIcIQYDQCADQQhIBEAgByADQQN0IgVqIAUgACgCBCgCBGopAwA3AwAgByADQQhqQQN0aiAFQeQIKAIAaikDADcDACADQQFqIQMMAQsLIAIgAikDYCAAKQMIhTcDYCACIAIpA3BCf4U3A3BBACEDA0AgA0EQSARAIAYgA0EDdCIFaiABIAVqKQMANwMAIANBAWohAwwBCwtBACEDA0AgA0HAAUgEQCACKQMAIAIiAUEgaikDACIIIAQgA0HUCigCAGotAABBA3RqKQMAfHwiCiACQeAAaikDAIVCIIoiCyACQUBrIgUpAwB8IQkgAiAKIAggCYVCGIoiCCAEQdQKKAIA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AAAAAAEAAAAAIybzzZ+YJajunyoSFrme7K/iU/nLzbjzxNh1fOvVPpdGC5q1/Ug5RH2w+K4xoBZtrvUH7q9mDH3khfhMZzeBbAEHQCAsdEAAAAAEAAAADAAAAEAAAABAEAAAQBAAAQAAAAAgAQfAIC9ABwAAAAAEAAAAAAAAAwAAAAAABAgMEBQYHCAkKCwwNDg8OCgQICQ8NBgEMAAILBwUDCwgMAAUCDw0KDgMGBwEJBAcJAwENDAsOAgYFCgQADwgJAAUHAgQKDw4BCwwGCAMNAgwGCgALCAMEDQcFDw4BCQwFAQ8ODQQKAAcGAwkCCAsNCwcODAEDCQUADwQIBgIKBg8OCQsDAAgMAg0HAQQKBQoCCAQHBgEFDwsJDgMMDQAAAQIDBAUGBwgJCgsMDQ4PDgoECAkPDQYBDAACCwcFAwBBwAoLHRAAAAABAAAABAAAABAAAACABAAAgAQAAMAAAADAAEHgCgsxIgAAAAEAAAABAAAAIgAAAHMAcgBjAC8AcwBvAGwAdgBlAHIAVwBhAHMAbQAuAHQAcwBBoAsLKxwAAAABAAAAAQAAABwAAABJAG4AdgBhAGwAaQBkACAAbABlAG4AZwB0AGgAQdALCzUmAAAAAQAAAAEAAAAmAAAAfgBsAGkAYgAvAGEAcgByAGEAeQBiAHUAZgBmAGUAcgAuAHQAcwBBkAwLNSYAAAABAAAAAQAAACYAAAB+AGwAaQBiAC8AcwB0AGEAdABpAGMAYQByAHIAYQB5AC4AdABzAEHQDAszJAAAAAEAAAABAAAAJAAAAEkAbgBkAGUAeAAgAG8AdQB0ACAAbwBmACAAcgBhAG4AZwBlAEGQDQszJAAAAAEAAAABAAAAJAAAAH4AbABpAGIALwB0AHkAcABlAGQAYQByAHIAYQB5AC4AdABzAEHQDQs+CAAAACAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACICAAAAAAAAYgAAAAAAAABhAAAAAgAAACECAAACAAAAJAI="));this.worker.postMessage({type:"module",module:await A})}catch(A){console.log("FriendlyCaptcha failed to initialize WebAssembly, falling back to Javascript solver: "+A.toString()),this.worker.postMessage({type:"js"})}}initWorker(){const A=new Blob(['!function(){class t{constructor(t){this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.v=new Uint32Array(32),this.m=new Uint32Array(32),this.outlen=t}}function e(t,e,n){const r=t[e],s=t[e+1],o=t[n],i=t[n+1],a=r+o>>>0,f=(r&o|(r|o)&~a)>>>31;t[e]=a,t[e+1]=s+i+f>>>0}function n(t,e,n,r){const s=t[e],o=t[e+1],i=s+n>>>0,a=(s&n|(s|n)&~i)>>>31;t[e]=i,t[e+1]=o+r+a>>>0}function r(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function s(t,r,s,o,i,a,f,c){const l=r[f],u=r[f+1],y=r[c],h=r[c+1];e(t,s,o),n(t,s,l,u);let w=t[a]^t[s],_=t[a+1]^t[s+1];t[a]=_,t[a+1]=w,e(t,i,a),w=t[o]^t[i],_=t[o+1]^t[i+1],t[o]=w>>>24^_<<8,t[o+1]=_>>>24^w<<8,e(t,s,o),n(t,s,y,h),w=t[a]^t[s],_=t[a+1]^t[s+1],t[a]=w>>>16^_<<16,t[a+1]=_>>>16^w<<16,e(t,i,a),w=t[o]^t[i],_=t[o+1]^t[i+1],t[o]=_>>>31^w<<1,t[o+1]=w>>>31^_<<1}const o=new Uint32Array(16).map((t,e)=>[4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225][e]),i=[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6,22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8,14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16,18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26,4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18,24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22,26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20,12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10,20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6];function a(t,e){const n=t.v,a=t.m;for(let e=0;e<16;e++)n[e]=t.h[e],n[e+16]=o[e];n[24]=n[24]^t.t,n[25]=n[25]^t.t/4294967296,e&&(n[28]=~n[28],n[29]=~n[29]);for(let e=0;e<32;e++)a[e]=r(t.b,4*e);for(let t=0;t<12;t++)s(n,a,0,8,16,24,i[16*t+0],i[16*t+1]),s(n,a,2,10,18,26,i[16*t+2],i[16*t+3]),s(n,a,4,12,20,28,i[16*t+4],i[16*t+5]),s(n,a,6,14,22,30,i[16*t+6],i[16*t+7]),s(n,a,0,10,20,30,i[16*t+8],i[16*t+9]),s(n,a,2,12,22,24,i[16*t+10],i[16*t+11]),s(n,a,4,14,16,26,i[16*t+12],i[16*t+13]),s(n,a,6,8,18,28,i[16*t+14],i[16*t+15]);for(let e=0;e<16;e++)t.h[e]=t.h[e]^n[e]^n[e+16]}function f(t,e){for(let e=0;e<16;e++)t.h[e]=o[e];t.b.set(e),t.h[0]^=16842752^t.outlen}function c(t,e){const n=new Uint8Array(3),r=new DataView(n.buffer);return r.setUint8(0,t),r.setUint16(1,e),n}let l,u;self.ASC_TARGET=0;let y=new Promise(t=>u=t),h=!1;self.onerror=t=>{self.postMessage({type:"error",error:JSON.stringify(t)})},self.onmessage=e=>{const n=e.data,r=n.type;if("module"===r)(async function(t){const e=await async function(t){const e={env:{abort(){throw Error("Wasm aborted")}}},n=await WebAssembly.instantiate(t,e),r=function(t){const e={},n=t.exports,r=n.memory,s=n.__alloc,o=n.__retain,i=n.__rtti_base||-1;return e.__allocArray=(t,e)=>{const n=function(t){return new Uint32Array(r.buffer)[(i+4>>>2)+2*t]}(t),a=31-Math.clz32(n>>>6&31),f=e.length,c=s(f<<a,0),l=s(12,t),u=new Uint32Array(r.buffer);u[l+0>>>2]=o(c),u[l+4>>>2]=c,u[l+8>>>2]=f<<a;const y=r.buffer,h=new Uint8Array(y);if(16384&n)for(let t=0;t<f;++t)h[(c>>>a)+t]=o(e[t]);else h.set(e,c>>>a);return l},e.__getUint8Array=t=>{const e=new Uint32Array(r.buffer),n=e[t+4>>>2];return new Uint8Array(r.buffer,n,e[n-4>>>2]>>>0)},function(t,e={}){const n=t.__argumentsLength?e=>{t.__argumentsLength.value=e}:t.__setArgumentsLength||t.__setargc||(()=>({}));for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const s=t[r],o=r.split(".")[0];"function"==typeof s&&s!==n?(e[o]=(...t)=>(n(t.length),s(...t))).original=s:e[o]=s}return e}(n,e)}(n);return{...n,exports:r}}(t),n=e.exports.__retain(e.exports.__allocArray(e.exports.Uint8Array_ID,new Uint8Array(128)));let r=e.exports.__getUint8Array(n);return(t,s,o=4294967295)=>{r.set(t);const i=e.exports.solveBlake2b(n,s,o);r=e.exports.__getUint8Array(n);const a=e.exports.__getUint8Array(i);return e.exports.__release(i),[r,a]}})(n.module).then(t=>{self.postMessage({type:"ready",solver:1}),l=1,u(t)});else if("js"===r)(async function(){return(e,n,r=4294967295)=>[e,function(e,n,r){if(128!=e.length)throw Error("Invalid input");const s=e.buffer,o=new DataView(s),i=new t(32);i.t=128;const c=o.getUint32(124,!0),l=c+r;for(let t=c;t<l;t++)if(o.setUint32(124,t,!0),f(i,e),a(i,!0),i.h[0]<n)return 0==ASC_TARGET?new Uint8Array(i.h.buffer):Uint8Array.wrap(i.h.buffer);return new Uint8Array(0)}(e,n,r)]})().then(t=>{self.postMessage({type:"ready",solver:2}),l=2,u(t)});else if("start"===r){if(h)return;h=!0,y.then(t=>{setTimeout(()=>{self.postMessage({type:"started"});let e=Date.now(),r=0;const s=function(t,e){const n=[];for(let r=0;r<e;r++){const e=new Uint8Array(128);e.set(t),e[120]=r,n.push(e)}return n}(n.buffer,n.n),o=new Uint8Array(8*n.n);for(var i=0;i<s.length;i++){const e=Date.now();let f;for(var a=0;a<256;a++){s[i][123]=a;const[e,r]=t(s[i],n.threshold);if(0!==e.length){f=e;break}console.error("FC: Internal error or no solution found")}const c=new DataView(f.slice(-4).buffer).getUint32(0,!0),l=(Date.now()-e)/1e3;r+=c,o.set(f.slice(-8),8*i),self.postMessage({type:"progress",n:n.n,h:c,t:l,i:i})}const f=(Date.now()-e)/1e3,u={type:"done",solution:o,h:r,t:f,diagnostics:c(l,f)};self.postMessage(u),self.close()})})}}}();\n'],{type:"text/javascript"});this.worker=new Worker(s.createObjectURL(A)),this.worker.onmessage=A=>{var t;const e=A.data;if(e)if("progress"===e.type)!function(A,t){const e=A.querySelector(".frc-progress"),r=(t.i+1)/t.n;e?(e.value=r,e.innerText=r.toFixed(2)+"%",e.title=t.i+1+"/"+t.n+" ("+(t.h/t.t*.001).toFixed(0)+"K/s)"):console.log("Progress bar not found")}(this.element,e);else if("ready"===e.type)this.element.innerHTML=i('<path d="M17,11c0.34,0,0.67,0.04,1,0.09V6.27L10.5,3L3,6.27v4.91c0,4.54,3.2,8.79,7.5,9.82c0.55-0.13,1.08-0.32,1.6-0.55 C11.41,19.47,11,18.28,11,17C11,13.69,13.69,11,17,11z"/><path d="M17,13c-2.21,0-4,1.79-4,4c0,2.21,1.79,4,4,4s4-1.79,4-4C21,14.79,19.21,13,17,13z M17,14.38"/>',"Anti-Robot Verification","Press to Start"),null===(t=this.element.querySelector("button"))||void 0===t||t.addEventListener("click",()=>{},{once:!0,passive:!0}),this.opts.readyCallback();else if("started"===e.type)this.element.innerHTML=i('<circle cx="12" cy="12" r="8" stroke-width="3" stroke-dasharray="15 10" fill="none" stroke-linecap="round" transform="rotate(0 12 12)"><animateTransform attributeName="transform" type="rotate" repeatCount="indefinite" dur="0.9s" values="0 12 12;360 12 12"/></circle>',"Verifying you are not a robot..",void 0,!0),this.opts.startedCallback();else if("done"===e.type){const A=this.handleDone(e);this.opts.doneCallback(A)}else console.log("Received: "+JSON.stringify(e))}}async start(){const A=this.element.dataset.sitekey;if(!A)return console.error("FriendlyCaptcha: sitekey not set on frc-captcha element"),void(this.element.innerHTML=o("Website problem: sitekey not set"));try{this.puzzle=function(A){const t=A.split("."),e=t[1],r=n(e),i=r[14],o=((s=r[15])>255?s=255:s<0&&(s=0),Math.pow(2,(255.999-s)/8)>>>0);var s;return{signature:t[0],base64:e,buffer:r,n:i,threshold:o}}(await async function(A,t){const e=await async function A(t,e,r){let n=20;return fetch(t,e).catch(async i=>{if(1===r)throw i;return await new Promise(A=>setTimeout(A,n)),n*=4,A(t,e,r-1)})}(A+"?sitekey="+t,{headers:[["X-FRC-Client","0.0.1"]]},5);if(e.ok)return(await e.json()).data.puzzle;throw Error(`Failure in getting puzzle: ${e.status} ${e.statusText}`)}(this.opts.puzzleEndpoint,A))}catch(A){this.element.innerHTML=o(A),this.opts.errorCallback({code:"error_getting_puzzle",description:A.toString()})}this.worker.postMessage({type:"start",buffer:this.puzzle.buffer,n:this.puzzle.n,threshold:this.puzzle.threshold})}handleDone(A){this.valid=!0;const t=this.puzzle.signature+"."+this.puzzle.base64+"."+r(A.solution)+"."+r(A.diagnostics);return this.element.innerHTML=function(A,t){return i(`<title>Completed: ${t.t.toFixed(0)}s (${(t.h/t.t*.001).toFixed(0)}K/s)</title><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"><animate attributeName="opacity" dur="1.0s" values="0;1"/></path>`,"I'm not a robot",void 0,!1,A)}(t,A),t}}const g=function(){const A=document.querySelector(".frc-captcha");return A||console.error("FriendlyCaptcha: No div was found with .frc-captcha class"),A}();return g&&(function(){if(!document.querySelector("#frc-style")){const A=document.createElement("style");A.type="text/css",A.id="frc-style",A.innerText='.frc-captcha *{margin:0;padding:0;border:0;font-size:100%;font:inherit;background-color:#fff;color:#222}.frc-captcha.dark *{background-color:#222;color:#fff}.frc-captcha{position:relative;width:18rem;min-height:2.8rem;border:1px solid #ddd;border-radius:4px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;padding-bottom:9px}.frc-container{display:flex;align-items:center}.frc-icon{fill:#222;stroke:#222;flex-shrink:0;margin:8px 8px 0}.frc-icon.frc-warning{fill:#c00}.frc-content{white-space:nowrap;display:flex;flex-direction:column;margin:.4rem .4rem 0 0;overflow-x:auto;flex-grow:1}.frc-banner{position:absolute;bottom:1px;right:6px;font-size:.65rem;opacity:.85}.frc-progress{-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:3px 0;height:4px;border:none;background-color:#eee;color:#222;width:100%;transition:.5s linear}.frc-progress::-webkit-progress-bar{background:#eee}.frc-progress::-webkit-progress-value{background:#222}.frc-progress::-moz-progress-bar{background:#222}.frc-button{cursor:pointer;padding:2px 6px;background-color:#eee;color:#222;border:1px solid transparent}.frc-button:focus{border:1px solid #333}.frc-button:hover{background-color:#e4e4e4}.dark.frc-captcha{color:#fff;background-color:#222}.dark .frc-icon{fill:#fff;stroke:#fff}.dark.frc-captcha a{color:#fff}.dark .frc-progress{background-color:#444}.dark .frc-progress::-webkit-progress-bar{background:#444}.dark .frc-progress::-webkit-progress-value{background:#ddd}.dark .frc-progress::-moz-progress-bar{background:#ddd}',document.head.appendChild(A)}}(),new a(g).init()),A.FriendlyCaptcha=a,A}({}); | ||
//# sourceMappingURL=friendlycaptcha.min.js.map |
{ | ||
"name": "friendly-challenge", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "The client code used for FriendlyCaptcha (widget html, styling and webworker solver)", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68884