PageSourceSearch

https://brickfilms.com/assets/Login-DWur8nKe.js

js brickfilms.com collected 2026-09-24 09:23:55 UTC 57,326 bytes, 6 lines download raw bytes

1import{n as e,o as t,t as n}from"./rolldown-runtime-C0FnF6B9.js";import{T as r,a as i,t as a}from"./jsx-runtime-Bbmj7Sro.js";import{r as o}from"./i18next-BEiP5vCO.js";import{t as s}from"./react-C21x__mS.js";import{t as c}from"./Trans-C39MckW5.js";import{t as l}from"./withTranslation-B3sbfl5p.js";import{d as u}from"./chunk-BV7QT456-CmTLkSzp.js";import{t as d}from"./useStableSearchParams-B46XOoB2.js";import{lr as f,mr as p}from"./pro-solid-svg-icons-fwFcmN_U.js";import{at as m,ft as h,g as ee,mt as g,pt as _,r as v,s as te,st as ne,t as y,y as b}from"./index-_WGeRyKy.js";import{t as x}from"./UserName-B9DUP3bv.js";import{t as S}from"./Card-Btw4zJWl.js";import{t as C}from"./useLayoutUpdate-hY0ArPJ-.js";import{t as w}from"./ExternalAction-fyqvV_UM.js";import{t as T}from"./Input-BxDB3KTF.js";import{t as E}from"./FormGroup-DYhG67Gb.js";import{t as D}from"./Switch-xji8DAZr.js";import{t as O}from"./DateDisplay-CLLb8uOx.js";import{t as k}from"./Tabs-KMAp5dXv.js";var A=t(s()),j={APP_INVALID_RESET_TOKEN:e=>e(`Reset password token invalid or expired`),APP_INVALID_ACTIVITY:e=>e(`Reset password token already used or the user is logged on another device`),APP_INVALID_CAPTCHA:e=>e(`Captcha verification failed`),APP_USER_BANNED:e=>e(`The user is banned`),APP_INVALID_CREDENTIALS:e=>e(`Invalid login or password`),APP_LOGIN_ALREADY_USED:e=>e(`This username is already used by another user`),APP_EMAIL_ALREADY_USED:e=>e(`This email is already used by another user`),APP_INVALID_LOGIN:e=>e(`The username contains forbidden characters`),BAD_USER_INPUT:e=>e(`API failed to validate the data`),INTERNAL_SERVER_ERROR:e=>e(`There is an issue on our side, please retry later`)},M=class extends Error{};M.prototype.name=`InvalidTokenError`;function N(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n=`0`+n),`%`+n}))}function P(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw Error(`base64 string is not of the correct length`)}try{return N(t)}catch{return atob(t)}}function F(e,t){if(typeof e!=`string`)throw new M(`Invalid token specified: must be a string`);t||(t={});let n=t.header===!0?0:1,r=e.split(`.`)[n];if(typeof r!=`string`)throw new M(`Invalid token specified: missing part #${n+1}`);let i;try{i=P(r)}catch(e){throw new M(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new M(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}function I(e){let t=null;try{t=F(decodeURIComponent(e))}catch{}return t}function L(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}var R=e((()=>{}));function z(e,t){L(e,t),t.add(e)}var B=e((()=>{R()}));function V(e,t,n){L(e,t),t.set(e,n)}var H=e((()=>{R()}));function U(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}var W=e((()=>{}));function G(e,t,n){return e.set(U(e,t),n),n}var re=e((()=>{W()}));function K(e,t){return e.get(U(e,t))}var q=e((()=>{W()}));n(((e,t)=>{B(),H(),g(),re(),W(),q(),(()=>{var n;let r=`vibrate`in navigator&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof window>`u`)return;let i=[`#f5c2e7`,`#cba6f7`,`#f38ba8`,`#fab387`,`#f9e2af`,`#a6e3a1`,`#94e2d5`,`#89dceb`,`#b4befe`],a=(e,t,n)=>{let r=t===0?`9999px`:`0`,a=t===n-1?`9999px`:`0`;return`color:#1e1e2e;background:${(e=>{if(e===`cap`)return`#89b4fa`;let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return i[Math.abs(t)%i.length]})(e)};margin-left:${t?`-6px`:0};padding:0 6px;border-radius:${r} ${a} ${a} ${r};font-weight:600`},o={};for(let e of[`debug`,`info`,`warn`,`error`])o[e]=(t,...n)=>{if(window.CAP_SILENT||e===`debug`&&!window.CAP_DEBUG)return;let r=t.map(e=>`%c${e}`).join(` `),i=t.map((e,n)=>a(e,n,t.length));console[e===`debug`?`log`:e](r,...i,...n)};let s=e=>e?[`cap`,e]:[`cap`],c=e=>`${Math.round(performance.now()-e)}ms`,l=(e,t)=>Object.assign(Error(t),{code:e}),u=(e,t={})=>{var n;return(n=window)!=null&&n.CAP_CUSTOM_FETCH?window.CAP_CUSTOM_FETCH(e,t):fetch(e,t)},d=(e,t)=>t?t.aborted?Promise.reject(l(`aborted`,`aborted`)):Promise.race([e,new Promise((e,n
1)=>t.addEventListener(`abort`,()=>n(l(`aborted`,`aborted`)),{once:!0}))]):e,f=`initial-state,verifying-label,solved-label,error-label,required-label,troubleshooting-label,group-aria-label,verify-aria-label,verifying-aria-label,verified-aria-label,error-aria-label`.split(`,`),p={"zh-cn":`确认你是真人/正在验证.../你是真人/出错了。请重试。/请确认你是真人/故障排除/Cap 验证/点击以确认你是真人/正在验证你是真人,请稍候/我们已确认你是真人,你可以继续了/发生错误,请重试`,es:`Verifica que eres humano/Verificando.../Eres humano/Error. Inténtalo de nuevo./Verifica que eres humano/Solucionar problemas/Verificación de Cap/Haz clic para verificar que eres humano/Verificando que eres humano, espera/Hemos verificado que eres humano, ya puedes continuar/Se produjo un error, inténtalo de nuevo`,hi:`पुष्टि करें कि आप मानव हैं/सत्यापित हो रहा है.../आप मानव हैं/त्रुटि। पुनः प्रयास करें।/कृपया पुष्टि करें कि आप मानव हैं/समस्या निवारण/Cap सत्यापन/पुष्टि करने के लिए क्लिक करें कि आप मानव हैं/सत्यापित किया जा रहा है कि आप मानव हैं, प्रतीक्षा करें/हमने पुष्टि कर दी है कि आप मानव हैं, अब आप जारी रख सकते हैं/एक त्रुटि हुई, पुनः प्रयास करें`,ar:`تحقق من أنك إنسان/جارٍ التحقق.../أنت إنسان/خطأ. حاول مرة أخرى./يرجى التحقق من أنك إنسان/استكشاف الأخطاء وإصلاحها/تحقق Cap/انقر للتحقق من أنك إنسان/جارٍ التحقق من أنك إنسان، يرجى الانتظار/لقد تحققنا من أنك إنسان، يمكنك المتابعة الآن/حدث خطأ، يرجى المحاولة مرة أخرى`,pt:`Sou humano/Verificando.../Você é humano/Erro. Tente novamente./Verifique que você é humano/Solução de problemas/Verificação Cap/Clique para verificar que você é humano/Verificando que você é humano, aguarde/Verificamos que você é humano, você pode continuar/Ocorreu um erro, tente novamente`,ru:`Я человек/Проверка.../Вы человек/Ошибка. Повторите./Подтвердите, что вы человек/Устранение неполадок/Проверка Cap/Нажмите, чтобы подтвердить, что вы человек/Проверяем, что вы человек, подождите/Мы подтвердили, что вы человек, можете продолжить/Произошла ошибка, повторите попытку`,ja:`私は人間です/確認中.../あなたは人間です/エラー。再試行を。/あなたが人間であることを確認してください/トラブルシューティング/Cap 認証/クリックして人間であることを確認/あなたが人間であることを確認しています。お待ちください/あなたが人間であることを確認しました。続行できます/エラーが発生しました。もう一度お試しください`,de:`Ich bin ein Mensch/Wird überprüft.../Sie sind ein Mensch/Fehler. Erneut versuchen./Bitte bestätigen Sie, dass Sie ein Mensch sind/Fehlerbehebung/Cap-Verifizierung/Klicken, um zu bestätigen, dass Sie ein Mensch sind/Überprüfung, ob Sie ein Mensch sind, bitte warten/Wir haben bestätigt, dass Sie ein Mensch sind, Sie können fortfahren/Ein Fehler ist aufgetreten, bitte erneut versuchen`,fr:`Je suis humain/Vérification.../Vous êtes humain/Erreur. Réessayez./Veuillez vérifier que vous êtes humain/Dépannage/Vérification Cap/Cliquez pour vérifier que vous êtes humain/Vérification que vous êtes humain, veuillez patienter/Nous avons vérifié que vous êtes humain, vou
1s pouvez continuer/Une erreur s'est produite, veuillez réessayer`};function m(e,t){let n=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}(e),r=``;function i(){return n^=n<<13,n^=n>>>17,n^=n<<5,n>>>0}for(;r.length<t;)r+=i().toString(16).padStart(8,`0`);return r.substring(0,t)}let h=null;async function ee(e){let t=(e=>{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n})(e),n=new TextDecoder().decode(await async function(e){if(typeof DecompressionStream<`u`)try{let t=new DecompressionStream(`deflate-raw`),n=t.writable.getWriter(),r=t.readable.getReader();n.write(e).then(()=>n.close()).catch(()=>{});let i=[];for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t)}let a=0;for(let e of i)a+=e.length;let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return o}catch{}return h||(h=new Promise((e,t)=>{let n=window.CAP_PAKO_URL||`https://cdn.jsdelivr.net/npm/[email protected]/dist/pako_inflate.min.js`;o.debug(s(`instr`),`DecompressionStream unavailable, loading pako from`,n);let r=document.createElement(`script`);r.src=n;let i=window.CAP_SCRIPT_NONCE||window.CAP_CSS_NONCE;i&&r.setAttribute(`nonce`,i),r.onload=()=>{var n;(n=window.pako)!=null&&n.inflateRaw?e(window.pako):t(Error(`pako loaded but inflateRaw is missing`))},r.onerror=()=>{h=null,t(Error(`failed to load pako fallback from ${n}`))},document.head.appendChild(r)})),(await h).inflateRaw(e)}(t));return new Promise(e=>{var t=setTimeout(()=>{a(),e({__timeout:!0})},2e4),r=document.createElement(`iframe`);r.setAttribute(`sandbox`,`allow-scripts`),r.setAttribute(`aria-hidden`,`true`),r.style.cssText=`position:absolute;width:1px;height:1px;top:-9999px;left:-9999px;border:none;opacity:0;pointer-events:none;`;var i=!1;function a(){i||(i=!0,clearTimeout(t),window.removeEventListener(`message`,o),r.parentNode&&r.parentNode.removeChild(r))}function o(t){if(r.contentWindow&&t.source===r.contentWindow){var n=t.data;n&&typeof n==`object`&&(n.type===`cap:instr`?(a(),n.blocked?e({__blocked:!0,blockReason:n.blockReason||`automated_browser`}):n.result?e(n.result):e({__timeout:!0})):n.type===`cap:error`&&(a(),e({__timeout:!0})))}}window.addEventListener(`message`,o);let s=window.CAP_SCRIPT_NONCE||window.CAP_CSS_NONCE;r.srcdoc=`<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body><script`+(s?` nonce="${String(s).replace(/"/g,`&quot;`)}"`:``)+`>`+n+`
2<\/script></body></html>`,document.body.appendChild(r)})}let g=null,v=()=>{if(g)return g;let e=window.CAP_CUSTOM_WASM_URL||`https://cdn.jsdelivr.net/npm/@cap.js/[email protected]/browser/cap_wasm_bg.wasm`,t=performance.now();return o.debug(s(`wasm`),`fetching`,e),g=fetch(e).then(e=>{if(!e.ok)throw Error(`Failed to fetch wasm: ${e.status}`);return e.arrayBuffer()}).then(e=>WebAssembly.compile(e)).then(e=>(o.debug(s(`wasm`),`ready in ${c(t)}`),e)).catch(e=>{throw g=null,o.warn(s(`wasm`),`load failed (${c(t)}):`,e.message||e),e}),g};typeof WebAssembly==`object`&&typeof WebAssembly.compile==`function`&&v().catch(()=>{});let te=null;function ne(){return te||(te=URL.createObjectURL(new Blob(['(()=>{const e=(e,...t)=>{self.CAP_SILENT||console[e]("[cap worker]",...t)},t=async({salt:t,target:n})=>{let s=0;const r=new TextEncoder,o=4*n.length,a=Math.floor(o/8),l=o%8,i=n.length%2==0?n:`${n}0`,c=i.length/2,f=new Uint8Array(c);for(let e=0;e<c;e++)f[e]=parseInt(i.substring(2*e,2*e+2),16);const g=l>0?255<<8-l&255:0;for(;;)try{for(let e=0;e<5e4;e++){const e=t+s,n=r.encode(e),o=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(o);let c=!0;for(let e=0;e<a;e++)if(i[e]!==f[e]){c=!1;break}if(c&&l>0&&(i[a]&g)!==(f[a]&g)&&(c=!1),c)return void self.postMessage({nonce:s,found:!0});s++}}catch(t){return e("error","fallback solver crashed:",t.message||t),void self.postMessage({found:!1,error:t.message})}},n=e=>{const t=BigInt("0x"+e.N);let n=BigInt("0x"+e.x);const s=0|e.t,r=Math.max(64,Math.floor(s/50)),o=performance.now();for(let e=0;e<s;e+=r){const o=Math.min(s,e+r);for(let s=e;s<o;s++)n=n*n%t;o<s&&self.postMessage({progress:o/s})}
2self.postMessage({found:!0,y:n.toString(16),durationMs:(performance.now()-o).toFixed(2)})};if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly?.instantiate)return e("warn","WebAssembly unavailable, using JS fallback solver (significantly slower)"),void(self.onmessage=async({data:e})=>"rsw"===e?.kind?n(e):t({salt:e.salt,target:e.target}));let s=null;self.onmessage=async({data:r})=>{if("rsw"===r?.kind)return n(r);const{salt:o,target:a,wasmModule:l}=r;if(l instanceof WebAssembly.Module&&null===s){const n=(t=>{try{let e,n=0,r=null;const o=()=>(null!==r&&0!==r.byteLength||(r=new Uint8Array(e.memory.buffer)),r),a=new TextEncoder,l=(e,t,s)=>{if(void 0===s){const s=a.encode(e),r=t(s.length,1)>>>0;return o().subarray(r,r+s.length).set(s),n=s.length,r}let r=e.length,l=t(r,1)>>>0;const i=o();let c=0;for(;c<r;c++){const t=e.charCodeAt(c);if(t>127)break;i[l+c]=t}if(c!==r){0!==c&&(e=e.slice(c));const t=c+3*e.length;l=s(l,r,t,1)>>>0,r=t;const n=o().subarray(l+c,l+r),{written:i}=a.encodeInto(e,n);c+=i,l=s(l,r,c,1)>>>0}return n=c,l},i={wbg:{}};i.wbg.__wbindgen_init_externref_table=()=>{const t=e.__wbindgen_export_0,n=t.grow(4);t.set(0,void 0),t.set(n+0,void 0),t.set(n+1,null),t.set(n+2,!0),t.set(n+3,!1)};const c=new WebAssembly.Instance(t,i);return e=c.exports,e.__wbindgen_start&&e.__wbindgen_start(),s=(t,s)=>{const r=l(t,e.__wbindgen_malloc,e.__wbindgen_realloc),o=n,a=l(s,e.__wbindgen_malloc,e.__wbindgen_realloc),i=n;return BigInt.asUintN(64,e.solve_pow(r,o,a,i))},!0}catch(t){return e("error","wasm init failed:",t.message||t),!1}})(l);
2if(!n)return e("warn","wasm init failed, falling back to JS solver"),t({salt:o,target:a})}if(null===s)return e("warn","no wasm module provided, falling back to JS solver"),t({salt:o,target:a});try{const e=performance.now(),t=s(o,a),n=performance.now();self.postMessage({nonce:Number(t),found:!0,durationMs:(n-e).toFixed(2)})}catch(t){e("error","solve_pow threw:",t.message||t),self.postMessage({found:!1,error:t.message||String(t)})}},self.onerror=e=>{self.postMessage({found:!1,error:e})}})();'],{type:`application/javascript`})),te)}class y{constructor(e){this._size=e,this._workers=[],this._idle=[],this._queue=[],this._wasmModule=null,this._spawnFailures=0}setWasm(e){this._wasmModule=e}_spawn(){let e=ne(),t=new Worker(e);return t._busy=!1,this._workers.push(t),this._idle.push(t),t}_replaceWorker(e){let t=this._workers.indexOf(e);t!==-1&&this._workers.splice(t,1);let n=this._idle.indexOf(e);n!==-1&&this._idle.splice(n,1);try{e.terminate()}catch{}return this._spawnFailures++,o.warn(s(`pool`),`worker died, replacing (attempt ${this._spawnFailures}/3)`),this._spawnFailures>3?(o.error(s(`pool`),`worker spawn failed repeatedly, giving up`),null):this._spawn()}_ensureSize(e){for(;this._workers.length<e;)this._spawn()}run(e,t){return new Promise((n,r)=>{this._queue.push({salt:e,target:t,resolve:n,reject:r}),this._dispatch()})}runMsg(e,t){return new Promise((n,r)=>{this._queue.push({msg:e,onProgress:t,resolve:n,reject:r}),this._dispatch()})}_dispatch(){for(;this._idle.length>0&&this._queue.length>0;){let e=this._idle.shift(),t=this._queue.shift(),{resolve:n,reject:r}=t,i=t.msg!==void 0,a=!1,o=({data:c})=>{if(!a){if(!c||typeof c.progress!=`number`||c.found)a=!0,e.removeEventListener(`message`,o),e.removeEventListener(`error`,s),this._spawnFailures=0,this._idle.push(e),c.found?n(i?c:c.nonce):r(Error(c.error||`worker failed`)),this._dispatch();else if(t.onProgress)try{t.onProgress(c.progress)}catch{}}},s=t=>{if(a)return;a=!0,e.removeEventListener(`message`,o),e.removeEventListener(`error`,s);let n=this._replaceWorker(e);r(t),n&&this._dispatch()};e.addEventListener(`message`,o),e.addEventListener(`error`,s),i?e.postMessage(t.msg):this._wasmModule?e.postMessage({salt:t.salt,target:t.target,wasmModule:this._wasmModule},[]):e.postMessage({salt:t.salt,target:t.target})}}terminate(){for(let e of this._workers)try{e.terminate()}catch{}this._workers=[],this._idle=[],this._queue=[]}}var b=new WeakMap,x=new WeakMap,S=new WeakMap,C=new WeakMap,w=new WeakMap,T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,k=new WeakMap,A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakSet,R=new WeakMap;class B extends HTMLElement{getI18nText(e,t){var n;return this.getAttribute(`data-cap-i18n-${e}`)||((n=K(F,this))==null?void 0:n[e])||t}static get observedAttributes(){return[`onsolve`,`onprogress`,`onreset`,`onerror`,`data-cap-worker-count`,`data-cap-i18n-initial-state`,`required`]}constructor(){((...e)=>(super(...e),z(this,L),V(this,b,null),V(this,x,navigator.hardwareConcurrency||8),_(this,`token`,null),V(this,S,void 0),V(this,C,void 0),V(this,w,void 0),V(this,T,void 0),V(this,E,void 0),V(this,D,void 0),V(this,O,!1),V(this,k,void 0),V(this,A,void 0),V(this,j,null),V(this,M,null),V(this,N,null),V(this,P,null),V(this,F,null),V(this,I,null),V(this,R,()=>{if(K(C,this)){try{this.scrollIntoView({behavior:`smooth`,block:`center`})}catch{this.scrollIntoView()}K(C,this).classList.remove(`invalid`),K(C,this).offsetWidth,K(C,this).classList.add(`invalid`),setTimeout(()=>{var e;return(e=K(C,this))==null?void 0:e.classList.remove(`invalid`)},1500)}}),this))(),K(k,this)&&K(k,this).forEach((e,t)=>{this.removeEventListener(t.slice(2),e)}),G(k,this,new Map),this.boundHandleProgress=this.handleProgress.bind(this),this.boundHandleSolve=this.handleSolve.bind(this),this.boundHandleError=this.handleError.bind(this),this.boundHandleReset=this.handleReset.bind(this);try{G(A,this,this.attachInternals())}catch{}}initialize(){ne(),G(I,this,new AbortController),K(j,this)||G(j,this,U(L,this,W).call(this)),K(N,this)||(G(N,this,new y(1)),K(N,this)._spawn())}attributeChangedCallback(e,t,n){var r;if(e.startsWith(`on`)){let t=e.slice(2),r=K(k,this).get(e);if(r&&this.removeEventListener(t,r),n){let n=t=>{let n=this.getAttribute(e);typeof window[n]==`function`&&window[n].call(this,t)};K(k,this).set(e,n),this.addEventListener(t,n)}}e===`data-cap-worker-count`&&this.setWorkersCount(parseInt(n,10)),e===`data-cap-i18n-initial-state`&&K(C,this)&&(r=K(C,this))!=null&&r.querySelector(`.label.active`)&&this.animateLabel(this.getI18nText(`initial-state`,`Verify you're human`)),e===`required`&&U(L,this,ue).call(this)}async connectedCallback(){G(D,this,this),this.shadowRoot?G(S,this,this.shadowRoot):G(S,this,this.attachShadow({mode:`open`})),K(C,this)||G(C,this,document.createElement(`div`)),U(L,this,le).call(this),this.createUI(),this.addEventListeners(),this.initialize(),K(w,this).removeAttribute(`disabled`);let e=this.getAttribute(`data-cap-worker-count`),t=e?parseInt(e,10):null;this.setWorkersCount(t||navigator.hardwareConcurrency||8),K(D,this).innerHTML=`<input type="hidden" name="${Q.call(U(L,this))}">`,o.debug(s(),`widget ready (workers=${K(x,this)}
2, haptics=${H.call(U(L,this))})`),U(L,this,J).call(this),U(L,this,ue).call(this),this.addEventListener(`invalid`,K(R,this))}async solve(){var e;if(K(O,this))return;U(L,this,fe).call(this);let t=performance.now(),n=(e=K(I,this))==null?void 0:e.signal;o.debug(s(`solve`),`starting`);try{G(O,this,!0),this.updateUI(`verifying`,this.getI18nText(`verifying-label`,`Verifying...`),!0),K(w,this).setAttribute(`aria-label`,this.getI18nText(`verifying-aria-label`,`Verifying you're a human, please wait`)),this.dispatchEvent(`progress`,{progress:0});try{var r;let e,a,d=this.getAttribute(`data-cap-api-endpoint`);if(!d&&(r=window)!=null&&r.CAP_CUSTOM_FETCH)d=`/`;else if(!d)throw l(`missing_endpoint`,`Missing API endpoint. Either custom fetch or an API endpoint must be provided.`);if(d.endsWith(`/`)||(d+=`/`),K(j,this).state===`done`&&K(j,this).token&&K(j,this).tokenExpires&&Date.now()<K(j,this).tokenExpires)return U(L,this,ce).call(this);if(K(j,this).state===`done`)e=K(j,this).results,a=K(j,this).challengeResp,this.dispatchEvent(`progress`,{progress:100});else if(K(j,this).state===`solving`||K(j,this).state===`redeeming`||K(j,this).state===`fetching`||K(j,this).state===`waiting`){var i;K(j,this).state===`waiting`&&(K(M,this)&&(clearTimeout(K(M,this)),G(M,this,null)),K(j,this).state=`waiting`,U(L,this,Z).call(this)),K(j,this).pendingPromotion=K(x,this),K(j,this).promoteFn&&K(j,this).promoteFn(K(x,this));let t=setInterval(()=>{if(n!=null&&n.aborted||!K(j,this))return void clearInterval(t);let e=K(j,this).state;if(e===`done`||e===`error`)return void clearInterval(t);let r=K(j,this).challenges?K(j,this).challenges.length:1,i=K(j,this).completedCount,a=e===`redeeming`?99:e===`fetching`||e===`waiting`?0:Math.min(98,Math.round(i/r*100));this.dispatchEvent(`progress`,{progress:a})},150);if(await new Promise(e=>K(j,this).onSettled(e)),clearInterval(t),n!=null&&n.aborted||!K(j,this))return;if(K(j,this).state===`idle`&&((i=K(j,this).challengeResp)==null?void 0:i.format)===2&&Array.isArray(K(j,this).challengeResp.challenges))a=K(j,this).challengeResp,K(j,this).challengeResp=null,e=await this.solveChallengesV2(a.challenges,n);else{if(K(j,this).state!==`done`)throw l(`solve_failed`,`Unable to solve challenge, self-hosted instance likely down. This is not an issue with Cap.`);if(K(j,this).token&&K(j,this).tokenExpires&&Date.now()<K(j,this).tokenExpires)return U(L,this,ce).call(this);e=K(j,this).results,a=K(j,this).challengeResp,this.dispatchEvent(`progress`,{progress:100})}}else{let t=K(j,this).challengeResp;if((t==null?void 0:t.format)===2&&Array.isArray(t.challenges))a=t,K(j,this).challengeResp=null;else{let e=await u(`${d}challenge`,{method:`POST`,signal:n});try{a=await e.json()}catch{throw l(`challenge_parse_error`,`Failed to parse challenge response from server`)}if(a.error)throw l(`network_error`,a.error)}if(a.format===2&&Array.isArray(a.challenges))e=await this.solveChallengesV2(a.challenges,n);else{let{challenge:t,token:r}=a,i=t;if(!Array.isArray(i)){let e=0;i=Array.from({length:t.c},()=>(e++,[m(`${r}${e}`,t.s),m(`${r}${e}d`,t.d)]))}e=await this.solveChallenges(i,n)}}let f=await(a.instrumentation?ee(a.instrumentation):Promise.resolve(null));if(n!=null&&n.aborted||!K(j,this))return;if(f!=null&&f.__timeout||f!=null&&f.__blocked){u(`${d}redeem`,{method:`POST`,body:JSON.stringify({token:a.token,solutions:e,...f.__blocked&&{instr_blocked:!0},...f.__timeout&&{instr_timeout:!0}}),headers:{"Content-Type":`application/json`},signal:n}).catch(()=>{}),this.updateUIBlocked(this.getI18nText(`error-label`,`Error`),f==null?void 0:f.__blocked),K(w,this).setAttribute(`aria-label`,this.getI18nText(`error-aria-label`,`An error occurred, please try again`));let t=f!=null&&f.__blocked?`instr_blocked`:`instr_timeout`,r=f!=null&&f.__blocked?`Instrumentation blocked (${f.blockReason||`automated_browser`})`:`Instrumentation timed out`;this.removeEventListener(`error`,this.boundHandleError);let i=new CustomEvent(`error`,{bubbles:!0,composed:!0,detail:{isCap:!0,code:t,message:r}});super.dispatchEvent(i),this.addEventListener(`error`,this.boundHandleError),this.executeAttributeCode(`onerror`,i),o.error(s(`instr`),`[${t}] ${r}
2`),G(O,this,!1);return}let{token:p}=a,h=await u(`${d}redeem`,{method:`POST`,body:JSON.stringify({token:p,solutions:e,...f&&{instr:f}}),headers:{"Content-Type":`application/json`},signal:n}),g;try{g=await h.json()}catch{throw l(`redeem_failed`,`Failed to parse server response`)}if(n!=null&&n.aborted||!K(j,this))return;if(this.dispatchEvent(`progress`,{progress:100}),!g.success)throw l(`invalid_solution`,g.error||`Invalid solution`);U(L,this,se).call(this,g.token),this.dispatchEvent(`solve`,{token:g.token}),this.token=g.token,U(L,this,re).call(this),K(b,this)&&clearTimeout(K(b,this));let _=new Date(g.expires).getTime()-Date.now();return _>0&&_<864e5?G(b,this,setTimeout(()=>this.reset(),_)):this.error(`Invalid expiration time`,`invalid_expires`),K(w,this).setAttribute(`aria-label`,this.getI18nText(`verified-aria-label`,`We have verified you're a human, you may now continue`)),H.call(U(L,this))&&navigator.vibrate([10,50,20,30,40]),o.debug(s(`solve`),`verified in ${c(t)}`),U(L,this,ie).call(this),{success:!0,token:this.token}}catch(e){if(n!=null&&n.aborted||!K(j,this))return;throw K(w,this).setAttribute(`aria-label`,this.getI18nText(`error-aria-label`,`An error occurred, please try again`)),this.error(e.message,e.code||`solve_failed`),e}}finally{G(O,this,!1)}}async solveChallengesV2(e,t){let n=e.length,r=0,i=Array(e.length);for(let t=0;t<e.length;t++){let n=e[t];if(!n||typeof n!=`object`||n.protocol!==`sha256-pow`&&n.protocol!==`rsw`&&n.protocol!==`instrumentation`)throw l(`challenge_unsupported`,`unsupported format-2 protocol '${n==null?void 0:n.protocol}'`)}let a=null;if(typeof WebAssembly==`object`&&typeof WebAssembly.instantiate==`function`)try{a=await v()}
2catch(e){o.warn(s(`wasm`),`unavailable, falling back to JS solver:`,e.message||e)}let c=Math.max(1,Math.min(K(x,this),e.length)),u=new y(c);u.setWasm(a),u._ensureSize(c);let f=(e,t)=>Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(`[cap] ${t} timed out after 60000ms`)),6e4))]),p=Array(e.length).fill(0),m=()=>{let e=p.reduce((e,t)=>e+t,0)+r,t=Math.min(99,Math.round(e/n*100));this.dispatchEvent(`progress`,{progress:t})};try{await d(Promise.all(e.map((e,t)=>e.protocol===`sha256-pow`?f(u.run(e.payload.salt,e.payload.target),`sha256-pow worker #${t}`).then(e=>{i[t]={nonce:Number(e)},p[t]=0,r++,m()}):e.protocol===`rsw`?f(u.runMsg({kind:`rsw`,N:e.payload.N,x:e.payload.x,t:0|e.payload.t},e=>{p[t]=e,m()}),`rsw worker #${t}`).then(e=>{i[t]={y:e.y},p[t]=0,r++,m()}):ee(e.payload.blob).then(e=>{i[t]=e!=null&&e.__timeout?{timeout:!0}:e!=null&&e.__blocked?{blocked:!0}:{instr:e},p[t]=0,r++,m()}))),t)}finally{u.terminate()}return i}async solveChallenges(e,t){let n=e.length,r=0,i=null,a=typeof WebAssembly==`object`&&typeof WebAssembly.instantiate==`function`;if(a)try{i=await v()}
2catch(e){o.warn(s(`wasm`),`unavailable, falling back to JS solver:`,e.message||e)}if(!a&&(o.warn(s(`wasm`),`WebAssembly disabled in this browser, solver will be ~10x slower`),!K(S,this).querySelector(`.warning`))){let e=document.createElement(`div`);e.className=`warning`,e.style.cssText=`width:var(--cap-widget-width,230px);background:rgb(237,56,46);color:white;padding:4px 6px;padding-bottom:calc(var(--cap-border-radius,14px) + 5px);font-size:10px;box-sizing:border-box;font-family:system-ui;border-top-left-radius:8px;border-top-right-radius:8px;text-align:center;user-select:none;margin-bottom:-35.5px;opacity:0;transition:margin-bottom .3s,opacity .3s;`,e.innerText=this.getI18nText(`wasm-disabled`,`Enable WASM for significantly faster solving`),K(S,this).insertBefore(e,K(S,this).firstChild),setTimeout(()=>{e.style.marginBottom=`calc(-1 * var(--cap-border-radius, 14px))`,e.style.opacity=1},10)}let c=new y(K(x,this));c.setWasm(i),c._ensureSize(K(x,this));let l=[];try{for(let i=0;i<e.length;i+=K(x,this)){let a=e.slice(i,Math.min(i+K(x,this),e.length)),o=await d(Promise.all(a.map(([e,t])=>c.run(e,t).then(e=>{r++;let t=Math.min(99,Math.round((0+r)/n*100));return this.dispatchEvent(`progress`,{progress:t}),e}))),t);l.push(...o)}}finally{c.terminate()}return l}setWorkersCount(e){let t=parseInt(e,10),n=Math.min(navigator.hardwareConcurrency||8,16);G(x,this,!Number.isNaN(t)&&t>0&&t<=n?t:navigator.hardwareConcurrency||8)}createUI(){K(C,this).classList.add(`captcha`),K(C,this).setAttribute(`role`,`group`),K(C,this).setAttribute(`aria-label`,this.getI18nText(`group-aria-label`,`Cap verification`)),G(w,this,document.createElement(`div`)),K(w,this).className=`captcha-trigger`,K(w,this).setAttribute(`part`,`trigger`),K(w,this).setAttribute(`role`,`button`),K(w,this).setAttribute(`tabindex`,`0`),K(w,this).setAttribute(`aria-label`,this.getI18nText(`verify-aria-label`,`Click to verify you're a human`)),K(w,this).setAttribute(`aria-live`,`polite`),K(w,this).setAttribute(`disabled`,`true`),K(w,this).innerHTML=`<div class="checkbox" part="checkbox" aria-hidden="true"><svg class="progress-ring" viewBox="0 0 32 32" aria-hidden="true"><circle class="progress-ring-bg" cx="16" cy="16" r="14"></circle><circle class="progress-ring-circle" cx="16" cy="16" r="14"></circle></svg></div><p part="label" class="label-wrapper"><span class="label active">${this.getI18nText(`initial-state`,`Verify you're human`)}</span></p>`,K(C,this).appendChild(K(w,this)),G(E,this,document.createElement(`a`)),K(E,this).className=`cap-troubleshoot-link`,K(E,this).setAttribute(`part`,`troubleshoot`),K(E,this).setAttribute(`target`,`_blank`),K(E,this).setAttribute(`rel`,`noopener`),K(E,this).hidden=!0,K(C,this).appendChild(K(E,this)),G(T,this,document.createElement(`a`)),K(T,this).className=`credits`,K(T,this).setAttribute(`aria-label`,`Secured by Cap`),K(T,this).setAttribute(`href`,`https://trycap.dev`),K(T,this).setAttribute(`target`,`_blank`),K(T,this).setAttribute(`title`,`Secured by Cap: The self-hosted CAPTCHA for the modern web.`),K(T,this).textContent=`Cap`,K(C,this).appendChild(K(T,this)),K(S,this).innerHTML=`<style${window.CAP_CSS_NONCE?` nonce=${window.CAP_CSS_NONCE}`:``
vendor: 6,797 bytes, line 2
2}>:host{display:inline-block}@media (prefers-reduced-motion:reduce){.captcha,.captcha *{transition:none!important;animation:none!important}.label{filter:none!important;opacity:1!important;transition:none!important;transform:none!important}.label:not(.active),.label.exit{display:none!important}}.captcha,.captcha *{box-sizing:border-box}.captcha{width:var(--cap-widget-width,260px);height:var(--cap-widget-height,58px);background-color:var(--cap-background,#fdfdfd);border:1px solid var(--cap-border-color,#dddddd8f);border-radius:var(--cap-border-radius,14px);-webkit-user-select:none;user-select:none;cursor:pointer;-webkit-tap-highlight-color:#fff0;color:var(--cap-color,#212121);font-family:var(--cap-font,system, -apple-system, "BlinkMacSystemFont", ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", "Ubuntu", "arial", sans-serif);transition:filter .2s,transform .2s,height .2s;display:inline-block;position:relative;overflow:hidden}.captcha.has-troubleshoot{height:calc(var(--cap-widget-height,58px) + 26px)}.captcha.has-troubleshoot .captcha-trigger{inset-block-end:26px}.captcha:not([data-state]):active{transform:scale(.97)}.captcha:hover{filter:brightness(98%)}.captcha-trigger{padding:var(--cap-widget-padding,14px);align-items:center;gap:var(--cap-gap,15px);border-radius:inherit;transition:inset .2s;display:flex;position:absolute;inset:0}.captcha-trigger:focus-visible{outline:2px solid var(--cap-focus-ring,#06c);outline-offset:-3px}.checkbox{width:var(--cap-checkbox-size,25px);height:var(--cap-checkbox-size,25px);border:var(--cap-checkbox-border,1px solid #aaaaaad1);border-radius:var(--cap-checkbox-border-radius,6px);background-color:var(--cap-checkbox-background,#fafafa91);margin-top:var(--cap-checkbox-margin,2px);margin-bottom:var(--cap-checkbox-margin,2px);flex-shrink:0;transition:opacity .2s}.captcha p{-webkit-user-select:none;user-select:none;margin:0;font-size:15px;font-weight:500}.label-wrapper{flex:1;align-items:center;min-width:0;height:2em;display:flex;position:relative;overflow:hidden}.label-wrapper:before,.label-wrapper:after{content:"";pointer-events:none;z-index:1;width:100%;height:.6em;position:absolute;inset-inline-start:0}.label-wrapper:before{background:linear-gradient(to bottom, var(--cap-background,#fdfdfd), transparent);top:0}.label-wrapper:after{background:linear-gradient(to top, var(--cap-background,#fdfdfd), transparent);bottom:0}.label{white-space:nowrap;opacity:0;filter:blur(2px);transition:transform .5s cubic-bezier(.25,1,.5,1),opacity .5s,filter .5s;position:absolute;transform:translateY(100%)}.label.active{opacity:1;filter:none;transform:translateY(0)}.label.exit{opacity:0;filter:blur(2px);transform:translateY(-100%)}.checkbox .progress-ring{width:100%;height:100%;display:none;transform:rotate(-90deg)}.checkbox .progress-ring-bg{fill:none;stroke:var(--cap-spinner-background-color,#eee);stroke-width:var(--cap-spinner-thickness,3)}.checkbox .progress-ring-circle{fill:none;stroke:var(--cap-spinner-color,#000);stroke-width:var(--cap-spinner-thickness,3);stroke-linecap:round;stroke-dasharray:87.96;stroke-dashoffset:87.96px;transition:stroke-dashoffset .3s}.captcha[data-state=verifying] .checkbox{background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;display:flex;transform:scale(1.1)}.captcha[data-state=verifying] .checkbox .progress-ring{display:block}.captcha[data-state=done] .checkbox{background-image:var(--cap-checkmark,url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cstyle%3E%40keyframes%20anim%7B0%25%7Bstroke-dashoffset%3A23.21320343017578px%7Dto%7Bstroke-dashoffset%3A0%7D%7D%3C%2Fstyle%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%2300a67d%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20d%3D%22m5%2012%205%205L20%207%22%20style%3D%22stroke-dashoffset%3A0%3Bstroke-dasharray%3A23.21320343017578px%3Banimation%3Aanim%20.5s%20ease%22%2F%3E%3C%2Fsvg%3E));background-size:cover;border:1px solid #0000}.captcha[data-state=done] .checkbox .progress-ring{display:none}.captcha[data-state=error] .checkbox{background-image:var(--cap-error-cross,url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 24 24'%3E%3Cpath fill='%23f55b50' d='M11 15h2v2h-2zm0-8h2v6h-2zm1-5C6.47 2 2 6.5 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 18a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8'/%3E%3C%2Fsvg%3E"));background-size:cover;border:1px solid #0000}.captcha[data-state=error] .checkbox .progress-ring{display:none}.captcha.invalid{border-color:var(--cap-invalid-border-color,#f55b50);box-shadow:0 0 0 3px var(--cap-invalid-ring-color,#f55b5033);animation:.5s cubic-bezier(.36,.07,.19,.97) cap-shake}@keyframes cap-shake{10%,90%{transform:translate(-1px)}20%,80%{transform:translate(2px)}30%,50%,70%{transform:translate(-4px)}40%,60%{transform:translate(4px)}}@media (prefers-reduced-motion:reduce){.captcha.invalid{animation:none!important}}.captcha-trigger[disabled]{cursor:not-allowed}.captcha[data-state=verifying] .captcha-trigger{cursor:progress}.captcha[data-state=done] .captcha-trigger{cursor:default}.credits{color:var(--cap-color,#212121);text-underline-offset:.18em;z-index:2;border-radius:4px;justify-content:flex-end;align-items:center;min-width:24px;min-height:24px;padding:4px 6px;text-decoration:underline;text-decoration-thickness:.08em;position:absolute;inset-block-end:4px;inset-inline-end:4px;opacity:.8!important;font-size:12px!important;display:inline-flex!important}.captcha .credits{visibility:visible!important;pointer-events:all!important;display:inline-flex!important}.credits:focus-visible{outline:2px solid var(--cap-focus-ring,#06c);outline-offset:2px;opacity:1!important}.cap-troubleshoot-link{min-width:24px;min-height:24px;color:var(--cap-troubleshoot-color,#0050a0);text-underline-offset:.15em;cursor:pointer;z-index:2;border-radius:4px;align-items:center;padding:4px 6px;font-size:13px;font-weight:500;text-decoration:underline;text-decoration-thickness:.08em;display:inline-flex;position:absolute;inset-block-end:4px;inset-inline-start:14px}.cap-troubleshoot-link[hidden]{display:none}.cap-troubleshoot-link:hover{opacity:.85}.cap-troubleshoot-link:focus-visible{outline:2px solid var(--cap-focus-ring,#06c);outline-offset:2px}@media (forced-colors:active){.captcha,.checkbox{border-color:canvastext}:is(.captcha-trigger:focus-visible,.credits:focus-visible,.cap-troubleshoot-link:focus-visible){outline-color:highlight}.progress-ring-bg{stroke:graytext}.progress-ring-circle{stroke:canvastext}.captcha.invalid{box-shadow:none;border-color:mark}.credits{opacity:1!important}}</style>`,
2K(S,this).appendChild(K(C,this)),U(L,this,fe).call(this),setTimeout(()=>U(L,this,fe).call(this),100)}addEventListeners(){K(w,this)&&(K(T,this).addEventListener(`click`,e=>{e.preventDefault(),window.open(`https://trycap.dev/?${new URLSearchParams({utm_source:`cap_widget`,utm_medium:`referral`,utm_campaign:`widget`,utm_content:window.CAP_DISABLE_WIDGET_REF?``:location.hostname,ref:window.CAP_DISABLE_WIDGET_REF?``:location.href||``,sub:window.CAP_DISABLE_WIDGET_REF?``:document.referrer||``}).toString()}`,`_blank`)}),K(w,this).addEventListener(`click`,()=>{K(w,this).hasAttribute(`disabled`)||this.solve()}),K(w,this).addEventListener(`mousedown`,()=>{!K(w,this).hasAttribute(`disabled`)&&H.call(U(L,this))&&navigator.vibrate(5)}),K(w,this).addEventListener(`keydown`,e=>{e.target===K(w,this)&&(e.key!==`Enter`&&e.key!==` `||K(w,this).hasAttribute(`disabled`)||(e.preventDefault(),e.stopPropagation(),this.solve()))}),this.addEventListener(`progress`,this.boundHandleProgress),this.addEventListener(`solve`,this.boundHandleSolve),this.addEventListener(`error`,this.boundHandleError),this.addEventListener(`reset`,this.boundHandleReset))}animateLabel(e){var t,n;if(!K(w,this))return;let r=K(w,this).querySelector(`.label-wrapper`);if(!r)return;if((t=(n=window).matchMedia)!=null&&t.call(n,`(prefers-reduced-motion: reduce)`).matches){let t=r.querySelector(`.label.active`);if(t)t.textContent=e;else{let t=document.createElement(`span`);t.className=`label active`,t.textContent=e,r.appendChild(t)}return}let i=r.querySelector(`.label.active`),a=document.createElement(`span`);a.className=`label`,a.textContent=e,r.appendChild(a),a.offsetWidth,a.classList.add(`active`),i&&(i.classList.remove(`active`),i.classList.add(`exit`),i.addEventListener(`transitionend`,()=>i.remove(),{once:!0}))}updateUI(e,t,n=!1){K(C,this)&&K(w,this)&&(K(C,this).setAttribute(`data-state`,e),K(C,this).classList.remove(`has-troubleshoot`),this.animateLabel(t),K(E,this)&&(K(E,this).hidden=!0),n?K(w,this).setAttribute(`disabled`,`true`):K(w,this).removeAttribute(`disabled`))}updateUIBlocked(e,t=!1){if(K(C,this)&&K(w,this)&&(K(C,this).setAttribute(`data-state`,`error`),K(w,this).removeAttribute(`disabled`),this.animateLabel(e),K(E,this))){if(t){let e=this.getAttribute(`data-cap-troubleshooting-url`)||`https://trycap.dev/guide/troubleshooting/instrumentation.html`;K(E,this).setAttribute(`href`,e),K(E,this).textContent=this.getI18nText(`troubleshooting-label`,`Troubleshoot`),K(E,this).hidden=!1,K(C,this).classList.add(`has-troubleshoot`)}else K(E,this).hidden=!0,K(C,this).classList.remove(`has-troubleshoot`)}}handleProgress(e){if(!K(w,this))return;let t=K(w,this).querySelector(`.progress-ring-circle`);if(t){let n=2*Math.PI*14,r=n-e.detail.progress/100*n;t.style.strokeDashoffset=r}let n=K(w,this).querySelector(`.label-wrapper`);if(n){let e=n.querySelector(`.label.active`);e&&(e.textContent=`${this.getI18nText(`verifying-label`,`Verifying...`)}`)}this.executeAttributeCode(`onprogress`,e)}handleSolve(e){var t,n,r;this.updateUI(`done`,this.getI18nText(`solved-label`,`You're a human`),!0),this.executeAttributeCode(`onsolve`,e),(t=K(A,this))==null||(n=t.setValidity)==null||n.call(t,{}),(r=K(C,this))==null||r.classList.remove(`invalid`)}handleError(e){this.updateUI(`error`,this.getI18nText(`error-label`,`Error. Try again.`)),this.executeAttributeCode(`onerror`,e),H.call(U(L,this))&&navigator.vibrate([10,40,10])}handleReset(e){this.updateUI(``,this.getI18nText(`initial-state`,`I'm a human`)),this.executeAttributeCode(`onreset`,e),U(L,this,ue).call(this)}executeAttributeCode(e,t){let n=this.getAttribute(e);n&&(o.warn(s(),"inline `onxxx='…'` handlers are deprecated. use `addEventListener` callbacks instead."),Function(`event`,n).call(this,t))}error(e=`Unknown error`,t=`unknown`){o.error(s(`solve`),`[${t}] ${e}`),this.dispatchEvent(`error`,{isCap:!0,code:t,message:e})}dispatchEvent(e,t={}){let n=new CustomEvent(e,{bubbles:!0,composed:!0,detail:t});super.dispatchEvent(n)}reset(){K(b,this)&&(clearTimeout(K(b,this)),G(b,this,null)),this.token=null,this.dispatchEvent(`reset`),U(L,this,se).call(this,``)}get tokenValue(){return this.token}disconnectedCallback(){var e;(e=K(I,this))==null||e.abort(),this.removeEventListener(`progress`,this.boundHandleProgress),this.removeEventListener(`s
2olve`,this.boundHandleSolve),this.removeEventListener(`error`,this.boundHandleError),this.removeEventListener(`reset`,this.boundHandleReset),K(k,this).forEach((e,t)=>{this.removeEventListener(t.slice(2),e)}),K(k,this).clear(),K(S,this)&&(K(S,this).innerHTML=``),this.reset(),this.cleanup()}cleanup(){K(b,this)&&(clearTimeout(K(b,this)),G(b,this,null)),U(L,this,q).call(this),K(M,this)&&(clearTimeout(K(M,this)),G(M,this,null)),K(N,this)&&(K(N,this).terminate(),G(N,this,null)),K(j,this)&&(K(j,this).state=`error`,K(j,this).notify(),G(j,this,null))}}function H(){return r&&!window.CAP_DISABLE_HAPTICS&&!this.hasAttribute(`data-cap-disable-haptics`)}function W(){return{state:`idle`,challengeResp:null,challenges:null,results:[],completedCount:0,solvePromise:null,promoteFn:null,_listeners:[],pendingPromotion:null,token:null,tokenExpires:null,notify(){for(let e of this._listeners)e();this._listeners=[]},onSettled(e){this.state===`done`||this.state===`error`?e():this._listeners.push(e)}}}function re(){G(j,this,U(L,this,W).call(this)),U(L,this,J).call(this)}function q(){K(P,this)&&(window.removeEventListener(`mousemove`,K(P,this)),window.removeEventListener(`touchstart`,K(P,this)),window.removeEventListener(`keydown`,K(P,this)),G(P,this,null))}function J(){U(L,this,q).call(this);let e=()=>{U(L,this,q).call(this),U(L,this,X).call(this)};G(P,this,e),window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`touchstart`,e,{passive:!0}),window.addEventListener(`keydown`,e,{passive:!0})}function Y(){return typeof this.checkVisibility==`function`?this.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):!!(this.offsetParent||this.getClientRects().length>0)}function ie(){U(L,this,Y).call(this)||o.info(s(`challenges`),`solved invisible challenge`)}function X(){K(j,this).state===`idle`&&U(L,this,Y).call(this)&&(K(j,this).state=`waiting`,G(M,this,setTimeout(()=>{U(L,this,Z).call(this)},2500)))}async function Z(){var e;if(K(j,this).state!==`waiting`)return;K(j,this).state=`fetching`,K(j,this)._t0=performance.now();let t=this.getAttribute(`data-cap-api-endpoint`);if(!t&&(e=window)!=null&&e.CAP_CUSTOM_FETCH&&(t=`/`),t){t.endsWith(`/`)||(t+=`/`);try{var n;let e=await u(`${t}challenge`,{method:`POST`,signal:(n=K(I,this))==null?void 0:n.signal}),r;try{r=await e.json()}catch{throw Error(`Failed to parse speculative challenge response`)}if(r.error)throw Error(r.error);if(!K(j,this))return;if(r._apiEndpoint=t,K(j,this).challengeResp=r,r.format===2&&Array.isArray(r.challenges))return K(j,this).state=`idle`,void K(j,this).notify();let{challenge:i,token:a}=r,o=i;if(!Array.isArray(o)){let e=0;o=Array.from({length:i.c},()=>(e++,[m(`${a}${e}`,i.s),m(`${a}${e}d`,i.d)]))}K(j,this).challenges=o,K(j,this).state=`solving`,K(j,this).solvePromise=U(L,this,ae).call(this,o).catch(()=>{K(j,this)&&(K(j,this).state=`error`,K(j,this).notify())})}catch{if(!K(j,this))return;K(j,this).state=`error`,K(j,this).notify()}}else K(j,this).state=`idle`}async function ae(e){ne();let t=null;try{t=await v()}catch{}if(!K(j,this))return[];K(N,this)||(G(N,this,new y(1)),K(N,this)._spawn()),K(N,this).setWasm(t);let n=e.length,r=Array(n),i=1,a=!1;K(j,this).promoteFn=e=>{!a&&K(N,this)&&(a=!0,i=e,K(N,this)._size=e,K(N,this)._ensureSize(e))},K(j,this).pendingPromotion!==null&&(K(j,this).promoteFn(K(j,this).pendingPromotion),K(j,this).pendingPromotion=null);let o=0;for(;o<n;){if(!K(j,this)||!K(N,this))return r;let t=i,s=[],c=[];for(let r=0;r<t&&o<n;r++)c.push(o),s.push(e[o]),o++;K(N,this)._ensureSize(Math.max(i,t));let l=await Promise.all(s.map(e=>K(N,this).run(e[0],e[1]).then(e=>(K(j,this)&&K(j,this).completedCount++,e))));for(let e=0;e<c.length;e++)r[c[e]]=l[e];!a&&o<n&&await new Promise(e=>setTimeout(e,120))}return K(j,this)?(K(j,this).results=r,K(j,this).state=`redeeming`,U(L,this,oe).call(this,r),r):r}async function oe(e){try{var t;if(!K(j,this))return;let n=K(j,this).challengeResp,r=n._apiEndpoint;if(!r)throw l(`missing_endpoint`,`speculative redeem: missing apiEndpoint`);let i=null;if(n.instrumentation){if(i=await ee(n.instrumentation),!K(j,this))return;if(i!=null&&i.__timeout||i!=null&&i.__blocked)return K(j,this).state=`done`,void K(j,this).notify()}let a=await u(`${r}redeem`,{method:`POST`,body:JSON.stringify({token:n.token,solutions:e,...i&&{instr:i}}),headers:{"Content-Type":`application/json`},signal:(t=K(I,this))==null?void 0:t.signal}),o;try{o=await a.json()}catch{throw Error(`Failed to parse speculative redeem response`)}if(!K(j,this))return;if(!o.success)throw Error(o.error||`Speculative redeem failed`);K(j,this).token=o.token,K(j,this).tokenExpires=new Date(o.expires).getTime(),K(j,this).state=`done`,K(j,this)._invisibleElapsed=K(j,this)._t0?c(K(j,this)._t0):`?`,K(j,this).notify()}catch{if(!K(j,this))return;K(j,this).state=`done`,K(j,this).notify()}}function Q(){return this.getAttribute(`data-cap-hidden-field-name`)||`cap-token`}function se(e){let t=this.querySelector(`input[name='${Q.call(U(L,this))}']`);t&&(t.value=e)}function ce(){o.debug(s(`solve`),`served from speculative cache (saved ${K(j,this)._invisibleElapsed||`?`})`),this.dispatchEvent(`progress`,{progress:100}),U(L,this,se).call(this,K(j,this).token),this.dispatchEvent(`solve`,{token:K(j,this).token}),this.token=K(j,this).token;let e=K(j,this).tokenExpires-Date.now();return K(b,this)&&clearTimeout(K(b,this)),G(b,this,setTimeout(()=>this.reset(),e)),K(w,this).setAttribute(`aria-label`,this.getI18nText(`verified-aria-label`,`We have verified you're a human, you may 
2now continue`)),H.call(U(L,this))&&navigator.vibrate([10,50,20,30,40]),U(L,this,ie).call(this),U(L,this,re).call(this),G(O,this,!1),{success:!0,token:this.token}}function le(){G(F,this,function(e){let t=e?[e]:navigator.languages||[navigator.language||``];for(let e of t){if(!e)continue;if(e=e.toLowerCase(),e===`en`||e.startsWith(`en-`))return null;let t=p[e]?e:p[e.split(`-`)[0]]?e.split(`-`)[0]:null;if(!t)return null;let n=p[t].split(`/`),r={};return f.forEach((e,t)=>{r[e]=n[t]}),r}return null}(window.CAP_LANG||this.getAttribute(`data-cap-lang`)))}function ue(){var e;(e=K(A,this))!=null&&e.setValidity&&(this.hasAttribute(`required`)&&!this.token?K(A,this).setValidity({valueMissing:!0},this.getI18nText(`required-label`,`Please verify you're human`),K(C,this)||this):K(A,this).setValidity({}))}function de(){if(!K(D,this))return!1;let e=K(D,this).getBoundingClientRect();if(e.width===0&&e.height===0)return!0;let t=window.getComputedStyle(K(D,this));return t.display===`none`||t.visibility===`hidden`}function fe(){K(T,this)&&K(C,this)&&!U(L,this,de).call(this)&&(K(T,this).isConnected&&K(T,this).parentNode===K(C,this)||K(C,this).appendChild(K(T,this)),K(T,this).textContent&&K(T,this).textContent.trim()||(K(T,this).textContent=`Cap`),K(T,this).getAttribute(`href`)!==`https://trycap.dev`&&K(T,this).setAttribute(`href`,`https://trycap.dev`),K(T,this).style.cssText=[`display: inline-flex !important`,`visibility: visible !important`,`opacity: 0.8 !important`,`pointer-events: all !important`,`font-size: 12px !important`,`transform: none !important`,`clip-path: none !important`,`filter: none !important`,`position: absolute !important`].join(`; `))}_(B,`formAssociated`,!0);class pe{constructor(e={},t){var n;let r=t||document.createElement(`cap-widget`);if(Object.entries(e).forEach(([e,t])=>{r.setAttribute(e,t)}),!e.apiEndpoint&&!((n=window)!=null&&n.CAP_CUSTOM_FETCH))throw r.remove(),Error(`Missing API endpoint. Either custom fetch or an API endpoint must be provided.`);e.apiEndpoint&&r.setAttribute(`data-cap-api-endpoint`,e.apiEndpoint),t||r.hasAttribute(`data-cap-disable-haptics`)||r.setAttribute(`data-cap-disable-haptics`,``),this.widget=r,this.solve=this.widget.solve.bind(this.widget),this.reset=this.widget.reset.bind(this.widget),this.addEventListener=this.widget.addEventListener.bind(this.widget),Object.defineProperty(this,"token",{get:()=>r.token,configurable:!0,enumerable:!0}),t||(r.style.display=`none`,document.documentElement.appendChild(r))}}window.Cap=pe,customElements.get(`cap-widget`)||(n=window)!=null&&n.CAP_DONT_SKIP_REDEFINE?customElements.get(`cap-widget`)&&o.warn(s(),`cap-widget custom element already defined, skipping re-define. set window.CAP_DONT_SKIP_REDEFINE = true to override`):customElements.define(`cap-widget`,B),typeof e==`object`&&t!==void 0?t.exports=pe:typeof define==`function`&&define.amd&&define([],()=>pe),e!==void 0&&(e.default=pe)})()}))();var J=a(),Y=r;Y.endsWith(`/`)||(Y+=`/`),window.CAP_CUSTOM_WASM_URL=`${Y}captcha/cap_wasm.js`;var ie=l()(({onSolve:e=()=>{},onError:t=()=>{},onReset:n=()=>{},onProgress:r=()=>{},t:a})=>{let o=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let i=(...t)=>{typeof e==`function`&&e(...t)},a=(...e)=>{typeof t==`function`&&t(...e)},s=(...e)=>{typeof n==`function`&&n(...e)},c=(...e)=>{typeof r==`function`&&r(...e)};o.current&&(o.current.addEventListener(`solve`,i),o.current.addEventListener(`error`,a),o.current.addEventListener(`reset`,s),o.current.addEventListener(`progress`,c));let l=o.current;return()=>{l&&(l.removeEventListener(`solve`,i),l.removeEventListener(`error`,a),l.removeEventListener(`reset`,s),l.removeEventListener(`progress`,c))}},[o,t,n,e,r]),(0,J.jsx)(`cap-widget`,{style:{"--cap-widget-width":`280px`,display:`inline-block`,maxWidth:`280px`},ref:o,"data-cap-api-endpoint":`${i}captcha/`,"data-cap-i18n-verifying-label":a(`Verifying...`),"data-cap-i18n-initial-state":a(`I'm not a LEGO minifigure`),"data-cap-i18n-solved-label":a(`I'm not a LEGO minifigure`),"data-cap-i18n-error-label":a(`Error`),"data-cap-i18n-wasm-disabled":a(`Enable WASM for significantly faster solving`)})}),X=`_block_1nfiz_1`,Z=`_activity_1nfiz_13`,ae=l()(({lastActivityAt:e=0,...t})=>(0,J.jsxs)(`div`,{className:X,children:[(0,J.jsx)(x,{...t||{}}),(0,J.jsx)(b,{...t||{}}),(0,J.jsxs)(`div`,{className:Z,children:[(0,J.jsx)(`span`,{children:o(`Last activity:`)}),` `,(0,J.jsx)(O,{timestamp:e})]})]})),oe=`mutation ResetPasswordMutation($input: ResetPasswordInput!) {
3  resetPassword(input: $input)
4}
5`,Q={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`N
5ame`,value:`ResetPasswordMutation`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`ResetPasswordInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`resetPassword`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}]}]}}],loc:{start:0,end:133}};Q.loc.source={name:`GraphQL request`,locationOffset:{line:1,column:1}},Q.loc.source.body=oe;var se=`_action_maiaw_5`,ce=`_alternate_maiaw_13`,le=l()(({t:e,routeId:t})=>{var n,r;let[i]=d(),[a,o]=(0,A.useState)(null),[s,l]=(0,A.useState)(!1),[g,_]=(0,A.useState)(null),[b,x]=(0,A.useState)(new Date().getTime()),{currentInterfaceLanguage:O}=m(),{signIn:M,signUp:N,resetPassword:P}=ee(),F=i.get(`token`)||null,L=F?I(F):null,R=L&&t===`PasswordRecovery`,z=()=>{x(new Date().getTime()),o(null)},[B,V]=(0,A.useState)((R?`password-recovery-apply`:{SignIn:`sign-in`,SignUp:`sign-up`,PasswordRecovery:`password-recovery`}[t])||`sign-in`);C({title:e(B===`sign-in`?`Sign in`:`Sign up`),history:[{title:e(B===`sign-in`?`Sign in`:`Sign up`)}]});let[H]=h(Q),U=u(),{clearErrors:W,register:G,handleSubmit:re,formState:{errors:K,isDirty:q,isValid:Y}}=te({mode:`all`,defaultValues:{identifier:``,email:``,password:``,agreeToReceiveEmails:!0}}),X=e(`Required field`),Z={"sign-in":e(`Sign in`),"sign-up":e(`Sign up`),"password-recovery":e(`Password recovery`),"password-recovery-apply":e(`Password change`,{name:L==null?void 0:L.login})},oe={"sign-in":e(`Sign in`),"sign-up":e(`Sign up`),"password-recovery":e(`Send a recovery email`),"password-recovery-apply":e(`Change and sign in`)},le=[{i:0,id:`sign-in`,title:Z[`sign-in`],icon:f},{i:1,id:`sign-up`,title:Z[`sign-up`],icon:p}],ue=async e=>{let t=await M(e.identifier,e.password,a);if(!t){U(`/`);return}return z(),t},de=async e=>{let t=await N(e.identifier,e.email,e.password,O,e.agreeToReceiveEmails,a);if(!t){U(`/`);return}return z(),t},fe=async e=>(await H({variables:{input:{email:e.email,token:a}}}),l(!0),z(),null),pe=async e=>{let t=await P(e.password,F);if(!t){U(`/`);return}return z(),t},me=async e=>{_(null);let t=await{"sign-in":ue,"sign-up":de,"password-recovery":fe,"password-recovery-apply":pe}[B](e);_(t||null)},he=e=>{W(),V(e),_(null)},$=(0,A.useMemo)(()=>({"sign-in":()=>({identifier:G(`identifier`,{required:X}),password:G(`password`,{required:X})}),"sign-up":()=>({identifier:G(`identifier`,{required:X,minLength:{value:3,message:e(`Username need to be at least 3 characters long`)},pattern:{value:/^((?!@).)*$/i,message:e(`Invalid username format`)}}),email:G(`email`,{required:X,pattern:{value:/^\S+@\S+$/i,message:e(`Invalid email format`)}}),password:G(`password`,{required:X,minLength:{value:8,message:e(`Password need to be at least 8 characters long`)}}),agreeToReceiveEmails:G(`agreeToReceiveEmails`)}),"password-recovery":()=>({email:G(`email`,{required:X,pattern:{value:/^\S+@\S+$/i,message:e(`Invalid email format`)}})}),"password-recovery-apply":()=>({password:G(`password`,{required:X,minLength:{value:8,message:e(`Password need to be at least 8 characters long`)}})})})[B](),[B,G,X,e]);return(0,J.jsxs)(J.Fragment,{children:[[`sign-in`,`sign-up`].includes(B)&&(0,J.jsx)(k,{choices:le,currentChoice:le==null||(n=le.find(e=>e.id===B))==null?void 0:n.i,onUserChoiceChange:(e,t)=>
5he(t.id)}),(0,J.jsx)(S,{children:(0,J.jsxs)(`form`,{id:B,children:[(0,J.jsx)(y,{h:`1`,children:Z[B]}),B===`sign-up`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(E,{label:e(`Username`),id:`identifier`,error:K.identifier,required:!0,children:(0,J.jsx)(T,{id:`identifier`,spellCheck:`false`,register:$.identifier})}),(0,J.jsx)(E,{label:e(`Email`),id:`email`,error:K.email,required:!0,children:(0,J.jsx)(T,{id:`email`,spellCheck:`false`,type:`email`,register:$.email})}),(0,J.jsx)(E,{label:e(`Password`),id:`password`,error:K.password,required:!0,children:(0,J.jsx)(T,{id:`password`,autoComplete:`new-password`,spellCheck:`false`,type:`password`,register:$.password})}),(0,J.jsx)(E,{label:e(`I agree to receive emails from Brickfilms.com about contests and events`),id:`agreeToReceiveEmails`,error:K.agreeToReceiveEmails,children:(0,J.jsx)(D,{id:`agreeToReceiveEmails`,register:$.agreeToReceiveEmails})})]}),B===`sign-in`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(E,{label:e(`Username / Email`),id:`identifier`,error:K.identifier,required:!0,children:(0,J.jsx)(T,{id:`identifier`,spellCheck:`false`,register:$.identifier})}),(0,J.jsxs)(E,{label:e(`Password`),id:`password`,error:K.password,required:!0,children:[(0,J.jsx)(T,{type:`password`,spellCheck:`false`,id:`password`,register:$.password}),(0,J.jsx)(`div`,{className:`_lostPassword_maiaw_1`,children:(0,J.jsx)(w,{action:`/password-recovery/`,children:e(`Forgot your password?`)})})]})]}),B===`password-recovery`&&(0,J.jsx)(J.Fragment,{children:(0,J.jsx)(E,{label:e(`Email`),id:`email`,error:K.email,required:!0,children:(0,J.jsx)(T,{id:`email`,spellCheck:`false`,register:$.email})})}),B===`password-recovery-apply`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ae,{...L||{}}),(0,J.jsx)(E,{label:e(`New password`),id:`password`,error:K.password,required:!0,children:(0,J.jsx)(T,{type:`password`,spellCheck:`false`,id:`password`,register:$.password})})]}),B!==`password-recovery-apply`&&(0,J.jsx)(`div`,{className:`_captcha_maiaw_20`,children:(0,J.jsx)(ie,{onSolve:e=>{var t;return o(e==null||(t=e.detail)==null?void 0:t.token)},onError:console.error},b)}),(0,J.jsxs)(`div`,{className:se,children:[g&&(0,J.jsx)(v,{type:`ERROR`,transparent:!0,children:j==null||(r=j[g])==null?void 0:r.call(j,e)}),s&&(0,J.jsx)(v,{type:`INFORMATION`,transparent:!0,children:e(`If the address email is correct, you'll receive an email in a few moments`)}),(0,J.jsx)(ne,{disabled:!q||!Y||s||B!==`password-recovery-apply`&&!a,type:`submit`,form:B,action:re(me),loading:!1,label:oe[B]})]})]})}),(0,J.jsxs)(`div`,{className:ce,children:[B===`sign-up`&&(0,J.jsxs)(c,{i18nKey:`By registering you agree to the <1>terms and conditions of use</1>.`,children:[`By registering you agree to the `,(0,J.jsx)(w,{action:`/rules/`,children:`terms and conditions of use`}),`.`]}),B===`sign-in`&&(0,J.jsxs)(c,{i18nKey:`Can't sign in? Contact us at <1>{{email}}</1>, we will help you to recover your account.`,values:{email:`[email protected]`},children:[`Can't sign in? Contact us at `,(0,J.jsx)(w,{action:`[email protected]`,children:`[email protected]`}),`, we will help you to recover your account.`]})]})]})});export{le as default};
6//# sourceMappingURL=Login-DWur8nKe.js.map

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.