altcha 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/altcha.iife.js +1 -1
- package/dist/altcha.js +171 -171
- package/dist/altcha.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/altcha.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var altcha=function(G){"use strict";var jt=Object.defineProperty;var At=(G,L,H)=>L in G?jt(G,L,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[L]=H;var j=(G,L,H)=>(At(G,typeof L!="symbol"?L+"":L,H),H);function L(){}function H(t){return t()}function ae(){return Object.create(null)}function B(t){t.forEach(H)}function fe(t){return typeof t=="function"}function Se(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Ge(t){return Object.keys(t).length===0}function v(t,e){t.appendChild(e)}function Ve(t,e,r){const n=Ze(t);if(!n.getElementById(e)){const o=_("style");o.id=e,o.textContent=r,He(n,o)}}function Ze(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function He(t,e){return v(t.head||t,e),e.sheet}function R(t,e,r){t.insertBefore(e,r||null)}function I(t){t.parentNode&&t.parentNode.removeChild(t)}function _(t){return document.createElement(t)}function V(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Oe(t){return document.createTextNode(t)}function O(){return Oe(" ")}function te(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function c(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Fe(t){return Array.from(t.childNodes)}function he(t,e,r){t.classList.toggle(e,!!r)}function Pe(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}function Ue(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}let W;function J(t){W=t}function re(){if(!W)throw new Error("Function called outside component initialization");return W}function De(t){re().$$.on_mount.push(t)}function Xe(t){re().$$.on_destroy.push(t)}function Ye(){const t=re();return(e,r,{cancelable:n=!1}={})=>{const o=t.$$.callbacks[e];if(o){const l=Pe(e,r,{cancelable:n});return o.slice().forEach(s=>{s.call(t,l)}),!l.defaultPrevented}return!0}}const P=[],ne=[];let U=[];const de=[],ge=Promise.resolve();let ie=!1;function be(){ie||(ie=!0,ge.then(x))}function Ke(){return be(),ge}function oe(t){U.push(t)}const le=new Set;let D=0;function x(){if(D!==0)return;const t=W;do{try{for(;D<P.length;){const e=P[D];D++,J(e),Be(e.$$)}}catch(e){throw P.length=0,D=0,e}for(J(null),P.length=0,D=0;ne.length;)ne.pop()();for(let e=0;e<U.length;e+=1){const r=U[e];le.has(r)||(le.add(r),r())}U.length=0}while(P.length);for(;de.length;)de.pop()();ie=!1,le.clear(),J(t)}function Be(t){if(t.fragment!==null){t.update(),B(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(oe)}}function We(t){const e=[],r=[];U.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),U=e}const Je=new Set;function Qe(t,e){t&&t.i&&(Je.delete(t),t.i(e))}function ze(t,e,r){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,r),oe(()=>{const l=t.$$.on_mount.map(H).filter(fe);t.$$.on_destroy?t.$$.on_destroy.push(...l):B(l),t.$$.on_mount=[]}),o.forEach(oe)}function qe(t,e){const r=t.$$;r.fragment!==null&&(We(r.after_update),B(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function et(t,e){t.$$.dirty[0]===-1&&(P.push(t),be(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function tt(t,e,r,n,o,l,s=null,u=[-1]){const f=W;J(t);const a=t.$$={fragment:null,ctx:[],props:l,update:L,not_equal:o,bound:ae(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(f?f.$$.context:[])),callbacks:ae(),dirty:u,skip_bound:!1,root:e.target||f.$$.root};s&&s(a.root);let $=!1;if(a.ctx=r?r(t,e.props||{},(w,N,...T)=>{const A=T.length?T[0]:N;return a.ctx&&o(a.ctx[w],a.ctx[w]=A)&&(!a.skip_bound&&a.bound[w]&&a.bound[w](A),$&&et(t,w)),N}):[],a.update(),$=!0,B(a.before_update),a.fragment=n?n(a.ctx):!1,e.target){if(e.hydrate){const w=Fe(e.target);a.fragment&&a.fragment.l(w),w.forEach(I)}else a.fragment&&a.fragment.c();e.intro&&Qe(t.$$.fragment),ze(t,e.target,e.anchor),x()}J(f)}let me;typeof HTMLElement=="function"&&(me=class extends HTMLElement{constructor(e,r,n){super();j(this,"$$ctor");j(this,"$$s");j(this,"$$c");j(this,"$$cn",!1);j(this,"$$d",{});j(this,"$$r",!1);j(this,"$$p_d",{});j(this,"$$l",{});j(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=r,n&&this.attachShadow({mode:"open"})}addEventListener(e,r,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){const o=this.$$c.$on(e,r);this.$$l_u.set(r,o)}super.addEventListener(e,r,n)}removeEventListener(e,r,n){if(super.removeEventListener(e,r,n),this.$$c){const o=this.$$l_u.get(r);o&&(o(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let s;return{c:function(){s=_("slot"),l!=="default"&&c(s,"name",l)},m:function(a,$){R(a,s,$)},d:function(a){a&&I(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},n=Ue(this);for(const l of this.$$s)l in n&&(r[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=Q(s,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const s=Q(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const s of this.$$l[l]){const u=this.$$c.$on(l,s);this.$$l_u.set(s,u)}this.$$l={}}}attributeChangedCallback(e,r,n){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Q(e,n,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function Q(t,e,r,n){var l;const o=(l=r[t])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function rt(t,e,r,n,o,l){let s=class extends me{constructor(){super(t,r,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(u=>(e[u].attribute||u).toLowerCase())}};return Object.keys(e).forEach(u=>{Object.defineProperty(s.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(f){var a;f=Q(u,f,e),this.$$d[u]=f,(a=this.$$c)==null||a.$set({[u]:f})}})}),n.forEach(u=>{Object.defineProperty(s.prototype,u,{get(){var f;return(f=this.$$c)==null?void 0:f[u]}})}),l&&(s=l(s)),t.element=s,s}class nt{constructor(){j(this,"$$");j(this,"$$set")}$destroy(){qe(this,1),this.$destroy=L}$on(e,r){if(!fe(r))return L;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const o=n.indexOf(r);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!Ge(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const it="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(it);const ve="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGcodCl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KHQpXS5tYXAoZT0+ZS50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBoKHQsZSxvKXtyZXR1cm4gZyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUodCtlKSkpfWZ1bmN0aW9uIG0odCxlLG89IlNIQS0yNTYiLGk9MWU2LHA9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyO3JldHVybntwcm9taXNlOm5ldyBQcm9taXNlKChzLGMpPT57Y29uc3Qgcj1EYXRlLm5vdygpLGQ9bD0+e2Euc2lnbmFsLmFib3J0ZWR8fGw+PWk/cyhudWxsKTpoKGUsbCxvKS50aGVuKHc9Pnt3PT09dD9zKHtudW1iZXI6bCx0b29rOkRhdGUubm93KCktcn0pOmQobCsxKX0pLmNhdGNoKGMpfTtkKHApfSksY29udHJvbGxlcjphfX1sZXQgbjtvbm1lc3NhZ2U9YXN5bmMgdD0+e2NvbnN0e3R5cGU6ZSxwYXlsb2FkOm99PXQuZGF0YTtpZihlPT09ImFib3J0IiluPT1udWxsfHxuLmFib3J0KCksbj12b2lkIDA7ZWxzZSBpZihlPT09IndvcmsiKXtjb25zdHthbGc6aSxjaGFsbGVuZ2U6cCxtYXg6YSxzYWx0OnUsc3RhcnQ6c309b3x8e30sYz1tKHAsdSxpLGEscyk7bj1jLmNvbnRyb2xsZXIsYy5wcm9taXNlLnRoZW4ocj0+e3NlbGYucG9zdE1lc3NhZ2UociYmey4uLnIsd29ya2VyOiEwfSl9KX19fSkoKTsK",ot=t=>Uint8Array.from(atob(t),e=>e.charCodeAt(0)),we=typeof window<"u"&&window.Blob&&new Blob([ot(ve)],{type:"text/javascript;charset=utf-8"});function lt(t){let e;try{if(e=we&&(window.URL||window.webkitURL).createObjectURL(we),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;base64,"+ve,{name:t==null?void 0:t.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const st=new TextEncoder;function ct(t){return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function ut(t,e="SHA-256",r=1e5){const n=Date.now().toString(16);t||(t=Math.round(Math.random()*r));const o=await _e(n,t,e);return{algorithm:e,challenge:o,salt:n,signature:""}}async function _e(t,e,r){return ct(await crypto.subtle.digest(r.toUpperCase(),st.encode(t+e)))}function at(t,e,r="SHA-256",n=1e6,o=0){const l=new AbortController;return{promise:new Promise((u,f)=>{const a=Date.now(),$=w=>{l.signal.aborted||w>=n?u(null):_e(e,w,r).then(N=>{N===t?u({number:w,took:Date.now()-a}):$(w+1)}).catch(f)};$(o)}),controller:l}}var b=(t=>(t.ERROR="error",t.VERIFIED="verified",t.VERIFYING="verifying",t.UNVERIFIED="unverified",t.EXPIRED="expired",t))(b||{});function ft(t){Ve(t,"svelte-vuofbg",".altcha.svelte-vuofbg.svelte-vuofbg{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-vuofbg.svelte-vuofbg:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-vuofbg.svelte-vuofbg{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-vuofbg.svelte-vuofbg{flex-grow:1}.altcha-label.svelte-vuofbg label.svelte-vuofbg{cursor:pointer}.altcha-logo.svelte-vuofbg.svelte-vuofbg{color:currentColor;opacity:0.3}.altcha-logo.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-error.svelte-vuofbg.svelte-vuofbg{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-vuofbg.svelte-vuofbg{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-footer.svelte-vuofbg>.svelte-vuofbg:first-child{flex-grow:1}.altcha-footer.svelte-vuofbg a{color:currentColor}.altcha-checkbox.svelte-vuofbg.svelte-vuofbg{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-vuofbg input.svelte-vuofbg{width:18px;height:18px;margin:0}.altcha-hidden.svelte-vuofbg.svelte-vuofbg{display:none}.altcha-spinner.svelte-vuofbg.svelte-vuofbg{animation:svelte-vuofbg-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-vuofbg-altcha-spinner{100%{transform:rotate(360deg)}}")}function pe(t){let e,r,n;return{c(){e=V("svg"),r=V("path"),n=V("path"),c(r,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),c(r,"fill","currentColor"),c(r,"opacity",".25"),c(n,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),c(n,"fill","currentColor"),c(n,"class","altcha-spinner svelte-vuofbg"),c(e,"width","24"),c(e,"height","24"),c(e,"viewBox","0 0 24 24"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){R(o,e,l),v(e,r),v(e,n)},d(o){o&&I(e)}}}function ht(t){let e,r=t[9].label+"",n;return{c(){e=_("label"),c(e,"for",n=t[3]+"_checkbox"),c(e,"class","svelte-vuofbg")},m(o,l){R(o,e,l),e.innerHTML=r},p(o,l){l[0]&512&&r!==(r=o[9].label+"")&&(e.innerHTML=r),l[0]&8&&n!==(n=o[3]+"_checkbox")&&c(e,"for",n)},d(o){o&&I(e)}}}function dt(t){let e,r=t[9].verifying+"";return{c(){e=_("span")},m(n,o){R(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].verifying+"")&&(e.innerHTML=r)},d(n){n&&I(e)}}}function gt(t){let e,r=t[9].verified+"",n,o;return{c(){e=_("span"),n=O(),o=_("input"),c(o,"type","hidden"),c(o,"name",t[3]),o.value=t[4]},m(l,s){R(l,e,s),e.innerHTML=r,R(l,n,s),R(l,o,s)},p(l,s){s[0]&512&&r!==(r=l[9].verified+"")&&(e.innerHTML=r),s[0]&8&&c(o,"name",l[3]),s[0]&16&&(o.value=l[4])},d(l){l&&(I(e),I(n),I(o))}}}function ke(t){let e,r,n,o,l,s;return{c(){e=_("div"),r=_("a"),n=V("svg"),o=V("path"),l=V("path"),s=V("path"),c(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),c(o,"fill","currentColor"),c(l,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),c(l,"fill","currentColor"),c(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),c(s,"fill","currentColor"),c(n,"width","22"),c(n,"height","22"),c(n,"viewBox","0 0 20 20"),c(n,"fill","none"),c(n,"xmlns","http://www.w3.org/2000/svg"),c(r,"href",Ee),c(r,"target","_blank"),c(r,"class","altcha-logo svelte-vuofbg")},m(u,f){R(u,e,f),v(e,r),v(r,n),v(n,o),v(n,l),v(n,s)},p:L,d(u){u&&I(e)}}}function ye(t){let e,r,n,o;function l(f,a){return f[5]===b.EXPIRED?mt:bt}let s=l(t),u=s(t);return{c(){e=_("div"),r=V("svg"),n=V("path"),o=O(),u.c(),c(n,"stroke-linecap","round"),c(n,"stroke-linejoin","round"),c(n,"d","M6 18L18 6M6 6l12 12"),c(r,"width","14"),c(r,"height","14"),c(r,"xmlns","http://www.w3.org/2000/svg"),c(r,"fill","none"),c(r,"viewBox","0 0 24 24"),c(r,"stroke-width","1.5"),c(r,"stroke","currentColor"),c(e,"class","altcha-error svelte-vuofbg")},m(f,a){R(f,e,a),v(e,r),v(r,n),v(e,o),u.m(e,null)},p(f,a){s===(s=l(f))&&u?u.p(f,a):(u.d(1),u=s(f),u&&(u.c(),u.m(e,null)))},d(f){f&&I(e),u.d()}}}function bt(t){let e,r=t[9].error+"";return{c(){e=_("div"),c(e,"title",t[8])},m(n,o){R(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].error+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&I(e)}}}function mt(t){let e,r=t[9].expired+"";return{c(){e=_("div"),c(e,"title",t[8])},m(n,o){R(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].expired+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&I(e)}}}function $e(t){let e,r,n=t[9].footer+"";return{c(){e=_("div"),r=_("div"),c(r,"class","svelte-vuofbg"),c(e,"class","altcha-footer svelte-vuofbg")},m(o,l){R(o,e,l),v(e,r),r.innerHTML=n},p(o,l){l[0]&512&&n!==(n=o[9].footer+"")&&(r.innerHTML=n)},d(o){o&&I(e)}}}function vt(t){let e,r,n,o,l,s,u,f,a,$,w,N,T,A,p=t[5]===b.VERIFYING&&pe();function F(h,d){return h[5]===b.VERIFIED?gt:h[5]===b.VERIFYING?dt:ht}let M=F(t),E=M(t),k=t[2]!==!0&&ke(),y=(t[8]||t[5]===b.EXPIRED)&&ye(t),m=t[9].footer&&t[1]!==!0&&$e(t);return{c(){e=_("div"),r=_("div"),p&&p.c(),n=O(),o=_("div"),l=_("input"),f=O(),a=_("div"),E.c(),$=O(),k&&k.c(),w=O(),y&&y.c(),N=O(),m&&m.c(),c(l,"type","checkbox"),c(l,"id",s=t[3]+"_checkbox"),l.required=u=t[0]!=="onsubmit",c(l,"class","svelte-vuofbg"),c(o,"class","altcha-checkbox svelte-vuofbg"),he(o,"altcha-hidden",t[5]===b.VERIFYING),c(a,"class","altcha-label svelte-vuofbg"),c(r,"class","altcha-main svelte-vuofbg"),c(e,"class","altcha svelte-vuofbg"),c(e,"data-state",t[5])},m(h,d){R(h,e,d),v(e,r),p&&p.m(r,null),v(r,n),v(r,o),v(o,l),l.checked=t[6],v(r,f),v(r,a),E.m(a,null),v(r,$),k&&k.m(r,null),v(e,w),y&&y.m(e,null),v(e,N),m&&m.m(e,null),t[26](e),T||(A=[te(l,"change",t[25]),te(l,"change",t[10]),te(l,"invalid",t[11])],T=!0)},p(h,d){h[5]===b.VERIFYING?p||(p=pe(),p.c(),p.m(r,n)):p&&(p.d(1),p=null),d[0]&8&&s!==(s=h[3]+"_checkbox")&&c(l,"id",s),d[0]&1&&u!==(u=h[0]!=="onsubmit")&&(l.required=u),d[0]&64&&(l.checked=h[6]),d[0]&32&&he(o,"altcha-hidden",h[5]===b.VERIFYING),M===(M=F(h))&&E?E.p(h,d):(E.d(1),E=M(h),E&&(E.c(),E.m(a,null))),h[2]!==!0?k?k.p(h,d):(k=ke(),k.c(),k.m(r,null)):k&&(k.d(1),k=null),h[8]||h[5]===b.EXPIRED?y?y.p(h,d):(y=ye(h),y.c(),y.m(e,N)):y&&(y.d(1),y=null),h[9].footer&&h[1]!==!0?m?m.p(h,d):(m=$e(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null),d[0]&32&&c(e,"data-state",h[5])},i:L,o:L,d(h){h&&I(e),p&&p.d(),E.d(),k&&k.d(),y&&y.d(),m&&m.d(),t[26](null),T=!1,B(A)}}}const Ee="https://altcha.org/";function xe(t){return JSON.parse(t)}function wt(t,e,r){let n,o,l,{auto:s=void 0}=e,{challengeurl:u=void 0}=e,{challengejson:f=void 0}=e,{debug:a=!1}=e,{expire:$=void 0}=e,{hidefooter:w=!1}=e,{hidelogo:N=!1}=e,{name:T="altcha"}=e,{maxnumber:A=1e6}=e,{mockerror:p=!1}=e,{strings:F=void 0}=e,{test:M=!1}=e,{workers:E=navigator.hardwareConcurrency||8}=e;const k=Ye(),y=["SHA-256","SHA-384","SHA-512"];let m=!1,h,d=null,se=null,X=null,Z=b.UNVERIFIED,ce;Xe(()=>{d&&(d.removeEventListener("submit",Le),d.removeEventListener("reset",Ie),d=null)}),De(()=>{C("mounted","0.2.0"),C("workers",E),M&&C("using test mode"),$&&ue($),s!==void 0&&C("auto",s),d=h.closest("form"),d&&(d.addEventListener("submit",Le),d.addEventListener("reset",Ie)),s==="onload"&&Y()});function C(...i){(a||i.some(g=>g instanceof Error))&&console[i[0]instanceof Error?"error":"log"]("ALTCHA",...i)}function Le(i){d&&s==="onsubmit"&&Z===b.UNVERIFIED&&(i.preventDefault(),i.stopPropagation(),Y().then(()=>{d==null||d.requestSubmit()}))}function Ie(){z()}function _t(i,g){return btoa(JSON.stringify({algorithm:i.algorithm,challenge:i.challenge,number:g.number,salt:i.salt,signature:i.signature,test:M?!0:void 0,took:g.took}))}function Re(i){if(!i.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(i.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!y.includes(i.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${y.join(", ")}`);if(!i.challenge||i.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!i.salt||i.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function pt(){if(p)throw C("mocking error"),new Error("Mocked error.");if(n)return C("using provided json data"),n;if(M)return C("generating test challenge"),ut();{if(!u)throw new Error("Attribute challengeurl not set.");C("fetching challenge from",u);const i=await fetch(u);if(i.status!==200)throw new Error(`Server responded with ${i.status}.`);const g=i.headers.get("Expires");if(g!=null&&g.length){const K=Date.parse(g);isNaN(K)||ue(K-Date.now())}return i.json()}}function Ne(){u&&Z===b.VERIFIED?Y():z(b.EXPIRED,l.expired)}async function kt(i){let g=null;if("Worker"in window){try{g=await yt(i.challenge,i.salt,i.algorithm)}catch(K){C(K)}if((g==null?void 0:g.number)!==void 0)return{data:i,solution:g}}return{data:i,solution:await at(i.challenge,i.salt,i.algorithm,A).promise}}async function yt(i,g,K,q=Math.ceil(E)){const ee=[];if(q<1)throw new Error("Wrong number of workers configured.");if(q>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let S=0;S<q;S++)ee.push(new lt);const je=Math.ceil(A/q),It=await Promise.all(ee.map((S,Rt)=>{const Ae=Rt*je;return new Promise(Nt=>{S.addEventListener("message",Me=>{if(Me.data)for(const Te of ee)Te!==S&&Te.postMessage({type:"abort"});Nt(Me.data)}),S.postMessage({payload:{alg:K,challenge:i,max:Ae+je,salt:g,start:Ae},type:"work"})})}));for(const S of ee)S.terminate();return It.find(S=>!!S)||null}function $t(){[b.UNVERIFIED,b.ERROR,b.EXPIRED].includes(Z)?Y():r(6,m=!0)}function Et(){Z===b.VERIFYING&&alert(l.waitAlert)}function ue(i){console.log(">>>"),C("expire",i),clearTimeout(ce),i<1?Ne():ce=setTimeout(Ne,i)}function xt(i){i.auto!==void 0&&(r(0,s=i.auto),s==="onload"&&Y()),i.expire!==void 0&&(ue(i.expire),r(13,$=i.expire)),i.challenge&&(Re(i.challenge),n=i.challenge),i.debug!==void 0&&r(12,a=!!i.debug),i.hidefooter!==void 0&&r(1,w=!!i.hidefooter),i.hidelogo!==void 0&&r(2,N=!!i.hidelogo),i.maxnumber!==void 0&&r(14,A=+i.maxnumber),i.mockerror!==void 0&&r(15,p=!!i.mockerror),i.name!==void 0&&r(3,T=i.name),i.test!==void 0&&r(16,M=!!i.test),i.strings&&r(24,o=i.strings),i.workers!==void 0&&r(17,E=+i.workers)}function z(i=b.UNVERIFIED,g=null){clearTimeout(ce),r(6,m=!1),r(8,se=g),r(4,X=null),r(5,Z=i)}async function Y(){return z(b.VERIFYING),pt().then(i=>(Re(i),C("challenge",i),kt(i))).then(({data:i,solution:g})=>{if(C("solution",g),(g==null?void 0:g.number)!==void 0)C("verified"),r(5,Z=b.VERIFIED),r(6,m=!0),r(4,X=_t(i,g)),C("payload",X),Ke().then(()=>{k("verified",{payload:X})});else throw new Error("Unexpected result returned.")}).catch(i=>{C(i),r(5,Z=b.ERROR),r(6,m=!1),r(8,se=i.message)})}function Ct(){m=this.checked,r(6,m)}function Lt(i){ne[i?"unshift":"push"](()=>{h=i,r(7,h)})}return t.$$set=i=>{"auto"in i&&r(0,s=i.auto),"challengeurl"in i&&r(18,u=i.challengeurl),"challengejson"in i&&r(19,f=i.challengejson),"debug"in i&&r(12,a=i.debug),"expire"in i&&r(13,$=i.expire),"hidefooter"in i&&r(1,w=i.hidefooter),"hidelogo"in i&&r(2,N=i.hidelogo),"name"in i&&r(3,T=i.name),"maxnumber"in i&&r(14,A=i.maxnumber),"mockerror"in i&&r(15,p=i.mockerror),"strings"in i&&r(20,F=i.strings),"test"in i&&r(16,M=i.test),"workers"in i&&r(17,E=i.workers)},t.$$.update=()=>{t.$$.dirty[0]&524288&&(n=f?xe(f):void 0),t.$$.dirty[0]&1048576&&r(24,o=F?xe(F):{}),t.$$.dirty[0]&16777216&&r(9,l={error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${Ee}" target="_blank">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),t.$$.dirty[0]&48&&k("statechange",{payload:X,state:Z})},[s,w,N,T,X,Z,m,h,se,l,$t,Et,a,$,A,p,M,E,u,f,F,xt,z,Y,o,Ct,Lt]}class Ce extends nt{constructor(e){super(),tt(this,e,wt,vt,Se,{auto:0,challengeurl:18,challengejson:19,debug:12,expire:13,hidefooter:1,hidelogo:2,name:3,maxnumber:14,mockerror:15,strings:20,test:16,workers:17,configure:21,reset:22,verify:23},ft,[-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),x()}get challengeurl(){return this.$$.ctx[18]}set challengeurl(e){this.$$set({challengeurl:e}),x()}get challengejson(){return this.$$.ctx[19]}set challengejson(e){this.$$set({challengejson:e}),x()}get debug(){return this.$$.ctx[12]}set debug(e){this.$$set({debug:e}),x()}get expire(){return this.$$.ctx[13]}set expire(e){this.$$set({expire:e}),x()}get hidefooter(){return this.$$.ctx[1]}set hidefooter(e){this.$$set({hidefooter:e}),x()}get hidelogo(){return this.$$.ctx[2]}set hidelogo(e){this.$$set({hidelogo:e}),x()}get name(){return this.$$.ctx[3]}set name(e){this.$$set({name:e}),x()}get maxnumber(){return this.$$.ctx[14]}set maxnumber(e){this.$$set({maxnumber:e}),x()}get mockerror(){return this.$$.ctx[15]}set mockerror(e){this.$$set({mockerror:e}),x()}get strings(){return this.$$.ctx[20]}set strings(e){this.$$set({strings:e}),x()}get test(){return this.$$.ctx[16]}set test(e){this.$$set({test:e}),x()}get workers(){return this.$$.ctx[17]}set workers(e){this.$$set({workers:e}),x()}get configure(){return this.$$.ctx[21]}get reset(){return this.$$.ctx[22]}get verify(){return this.$$.ctx[23]}}return customElements.define("altcha-widget",rt(Ce,{auto:{},challengeurl:{},challengejson:{},debug:{type:"Boolean"},expire:{},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},name:{},maxnumber:{},mockerror:{type:"Boolean"},strings:{},test:{type:"Boolean"},workers:{}},[],["configure","reset","verify"],!1)),G.Altcha=Ce,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),G}({});
|
|
1
|
+
var altcha=function(j){"use strict";var Tt=Object.defineProperty;var Mt=(j,L,H)=>L in j?Tt(j,L,{enumerable:!0,configurable:!0,writable:!0,value:H}):j[L]=H;var T=(j,L,H)=>(Mt(j,typeof L!="symbol"?L+"":L,H),H);function L(){}function H(t){return t()}function ae(){return Object.create(null)}function X(t){t.forEach(H)}function fe(t){return typeof t=="function"}function Ge(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function je(t){return Object.keys(t).length===0}function v(t,e){t.appendChild(e)}function Ve(t,e,r){const n=Ze(t);if(!n.getElementById(e)){const o=_("style");o.id=e,o.textContent=r,He(n,o)}}function Ze(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function He(t,e){return v(t.head||t,e),e.sheet}function I(t,e,r){t.insertBefore(e,r||null)}function R(t){t.parentNode&&t.parentNode.removeChild(t)}function _(t){return document.createElement(t)}function V(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Pe(t){return document.createTextNode(t)}function P(){return Pe(" ")}function te(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function c(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Fe(t){return Array.from(t.childNodes)}function he(t,e,r){t.classList.toggle(e,!!r)}function Oe(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}function We(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}let K;function J(t){K=t}function re(){if(!K)throw new Error("Function called outside component initialization");return K}function De(t){re().$$.on_mount.push(t)}function Ye(t){re().$$.on_destroy.push(t)}function Be(){const t=re();return(e,r,{cancelable:n=!1}={})=>{const o=t.$$.callbacks[e];if(o){const l=Oe(e,r,{cancelable:n});return o.slice().forEach(s=>{s.call(t,l)}),!l.defaultPrevented}return!0}}const O=[],ne=[];let W=[];const de=[],ge=Promise.resolve();let ie=!1;function be(){ie||(ie=!0,ge.then(x))}function Ue(){return be(),ge}function oe(t){W.push(t)}const le=new Set;let D=0;function x(){if(D!==0)return;const t=K;do{try{for(;D<O.length;){const e=O[D];D++,J(e),Xe(e.$$)}}catch(e){throw O.length=0,D=0,e}for(J(null),O.length=0,D=0;ne.length;)ne.pop()();for(let e=0;e<W.length;e+=1){const r=W[e];le.has(r)||(le.add(r),r())}W.length=0}while(O.length);for(;de.length;)de.pop()();ie=!1,le.clear(),J(t)}function Xe(t){if(t.fragment!==null){t.update(),X(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(oe)}}function Ke(t){const e=[],r=[];W.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),W=e}const Je=new Set;function ze(t,e){t&&t.i&&(Je.delete(t),t.i(e))}function Qe(t,e,r){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,r),oe(()=>{const l=t.$$.on_mount.map(H).filter(fe);t.$$.on_destroy?t.$$.on_destroy.push(...l):X(l),t.$$.on_mount=[]}),o.forEach(oe)}function qe(t,e){const r=t.$$;r.fragment!==null&&(Ke(r.after_update),X(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function et(t,e){t.$$.dirty[0]===-1&&(O.push(t),be(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function tt(t,e,r,n,o,l,s=null,u=[-1]){const f=K;J(t);const a=t.$$={fragment:null,ctx:[],props:l,update:L,not_equal:o,bound:ae(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(f?f.$$.context:[])),callbacks:ae(),dirty:u,skip_bound:!1,root:e.target||f.$$.root};s&&s(a.root);let k=!1;if(a.ctx=r?r(t,e.props||{},(w,N,...A)=>{const M=A.length?A[0]:N;return a.ctx&&o(a.ctx[w],a.ctx[w]=M)&&(!a.skip_bound&&a.bound[w]&&a.bound[w](M),k&&et(t,w)),N}):[],a.update(),k=!0,X(a.before_update),a.fragment=n?n(a.ctx):!1,e.target){if(e.hydrate){const w=Fe(e.target);a.fragment&&a.fragment.l(w),w.forEach(R)}else a.fragment&&a.fragment.c();e.intro&&ze(t.$$.fragment),Qe(t,e.target,e.anchor),x()}J(f)}let me;typeof HTMLElement=="function"&&(me=class extends HTMLElement{constructor(e,r,n){super();T(this,"$$ctor");T(this,"$$s");T(this,"$$c");T(this,"$$cn",!1);T(this,"$$d",{});T(this,"$$r",!1);T(this,"$$p_d",{});T(this,"$$l",{});T(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=r,n&&this.attachShadow({mode:"open"})}addEventListener(e,r,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){const o=this.$$c.$on(e,r);this.$$l_u.set(r,o)}super.addEventListener(e,r,n)}removeEventListener(e,r,n){if(super.removeEventListener(e,r,n),this.$$c){const o=this.$$l_u.get(r);o&&(o(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let s;return{c:function(){s=_("slot"),l!=="default"&&c(s,"name",l)},m:function(a,k){I(a,s,k)},d:function(a){a&&R(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},n=We(this);for(const l of this.$$s)l in n&&(r[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=z(s,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const s=z(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const s of this.$$l[l]){const u=this.$$c.$on(l,s);this.$$l_u.set(s,u)}this.$$l={}}}attributeChangedCallback(e,r,n){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=z(e,n,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function z(t,e,r,n){var l;const o=(l=r[t])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function rt(t,e,r,n,o,l){let s=class extends me{constructor(){super(t,r,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(u=>(e[u].attribute||u).toLowerCase())}};return Object.keys(e).forEach(u=>{Object.defineProperty(s.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(f){var a;f=z(u,f,e),this.$$d[u]=f,(a=this.$$c)==null||a.$set({[u]:f})}})}),n.forEach(u=>{Object.defineProperty(s.prototype,u,{get(){var f;return(f=this.$$c)==null?void 0:f[u]}})}),l&&(s=l(s)),t.element=s,s}class nt{constructor(){T(this,"$$");T(this,"$$set")}$destroy(){qe(this,1),this.$destroy=L}$on(e,r){if(!fe(r))return L;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const o=n.indexOf(r);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!je(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const it="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(it);const ve="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGcodCl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KHQpXS5tYXAoZT0+ZS50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBoKHQsZSxvKXtyZXR1cm4gZyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUodCtlKSkpfWZ1bmN0aW9uIG0odCxlLG89IlNIQS0yNTYiLGk9MWU2LHA9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyO3JldHVybntwcm9taXNlOm5ldyBQcm9taXNlKChzLGMpPT57Y29uc3Qgcj1EYXRlLm5vdygpLGQ9bD0+e2Euc2lnbmFsLmFib3J0ZWR8fGw+aT9zKG51bGwpOmgoZSxsLG8pLnRoZW4odz0+e3c9PT10P3Moe251bWJlcjpsLHRvb2s6RGF0ZS5ub3coKS1yfSk6ZChsKzEpfSkuY2F0Y2goYyl9O2QocCl9KSxjb250cm9sbGVyOmF9fWxldCBuO29ubWVzc2FnZT1hc3luYyB0PT57Y29uc3R7dHlwZTplLHBheWxvYWQ6b309dC5kYXRhO2lmKGU9PT0iYWJvcnQiKW49PW51bGx8fG4uYWJvcnQoKSxuPXZvaWQgMDtlbHNlIGlmKGU9PT0id29yayIpe2NvbnN0e2FsZzppLGNoYWxsZW5nZTpwLG1heDphLHNhbHQ6dSxzdGFydDpzfT1vfHx7fSxjPW0ocCx1LGksYSxzKTtuPWMuY29udHJvbGxlcixjLnByb21pc2UudGhlbihyPT57c2VsZi5wb3N0TWVzc2FnZShyJiZ7Li4ucix3b3JrZXI6ITB9KX0pfX19KSgpOwo=",ot=t=>Uint8Array.from(atob(t),e=>e.charCodeAt(0)),we=typeof window<"u"&&window.Blob&&new Blob([ot(ve)],{type:"text/javascript;charset=utf-8"});function lt(t){let e;try{if(e=we&&(window.URL||window.webkitURL).createObjectURL(we),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;base64,"+ve,{name:t==null?void 0:t.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const st=new TextEncoder;function ct(t){return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function ut(t,e="SHA-256",r=1e5){const n=Date.now().toString(16);t||(t=Math.round(Math.random()*r));const o=await _e(n,t,e);return{algorithm:e,challenge:o,salt:n,signature:""}}async function _e(t,e,r){return ct(await crypto.subtle.digest(r.toUpperCase(),st.encode(t+e)))}function at(t,e,r="SHA-256",n=1e6,o=0){const l=new AbortController;return{promise:new Promise((u,f)=>{const a=Date.now(),k=w=>{l.signal.aborted||w>n?u(null):_e(e,w,r).then(N=>{N===t?u({number:w,took:Date.now()-a}):k(w+1)}).catch(f)};k(o)}),controller:l}}var b=(t=>(t.ERROR="error",t.VERIFIED="verified",t.VERIFYING="verifying",t.UNVERIFIED="unverified",t.EXPIRED="expired",t))(b||{});function ft(t){Ve(t,"svelte-vuofbg",".altcha.svelte-vuofbg.svelte-vuofbg{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-vuofbg.svelte-vuofbg:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-vuofbg.svelte-vuofbg{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-vuofbg.svelte-vuofbg{flex-grow:1}.altcha-label.svelte-vuofbg label.svelte-vuofbg{cursor:pointer}.altcha-logo.svelte-vuofbg.svelte-vuofbg{color:currentColor;opacity:0.3}.altcha-logo.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-error.svelte-vuofbg.svelte-vuofbg{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-vuofbg.svelte-vuofbg{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-footer.svelte-vuofbg>.svelte-vuofbg:first-child{flex-grow:1}.altcha-footer.svelte-vuofbg a{color:currentColor}.altcha-checkbox.svelte-vuofbg.svelte-vuofbg{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-vuofbg input.svelte-vuofbg{width:18px;height:18px;margin:0}.altcha-hidden.svelte-vuofbg.svelte-vuofbg{display:none}.altcha-spinner.svelte-vuofbg.svelte-vuofbg{animation:svelte-vuofbg-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-vuofbg-altcha-spinner{100%{transform:rotate(360deg)}}")}function pe(t){let e,r,n;return{c(){e=V("svg"),r=V("path"),n=V("path"),c(r,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),c(r,"fill","currentColor"),c(r,"opacity",".25"),c(n,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),c(n,"fill","currentColor"),c(n,"class","altcha-spinner svelte-vuofbg"),c(e,"width","24"),c(e,"height","24"),c(e,"viewBox","0 0 24 24"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){I(o,e,l),v(e,r),v(e,n)},d(o){o&&R(e)}}}function ht(t){let e,r=t[9].label+"",n;return{c(){e=_("label"),c(e,"for",n=t[3]+"_checkbox"),c(e,"class","svelte-vuofbg")},m(o,l){I(o,e,l),e.innerHTML=r},p(o,l){l[0]&512&&r!==(r=o[9].label+"")&&(e.innerHTML=r),l[0]&8&&n!==(n=o[3]+"_checkbox")&&c(e,"for",n)},d(o){o&&R(e)}}}function dt(t){let e,r=t[9].verifying+"";return{c(){e=_("span")},m(n,o){I(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].verifying+"")&&(e.innerHTML=r)},d(n){n&&R(e)}}}function gt(t){let e,r=t[9].verified+"",n,o;return{c(){e=_("span"),n=P(),o=_("input"),c(o,"type","hidden"),c(o,"name",t[3]),o.value=t[4]},m(l,s){I(l,e,s),e.innerHTML=r,I(l,n,s),I(l,o,s)},p(l,s){s[0]&512&&r!==(r=l[9].verified+"")&&(e.innerHTML=r),s[0]&8&&c(o,"name",l[3]),s[0]&16&&(o.value=l[4])},d(l){l&&(R(e),R(n),R(o))}}}function ye(t){let e,r,n,o,l,s;return{c(){e=_("div"),r=_("a"),n=V("svg"),o=V("path"),l=V("path"),s=V("path"),c(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),c(o,"fill","currentColor"),c(l,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),c(l,"fill","currentColor"),c(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),c(s,"fill","currentColor"),c(n,"width","22"),c(n,"height","22"),c(n,"viewBox","0 0 20 20"),c(n,"fill","none"),c(n,"xmlns","http://www.w3.org/2000/svg"),c(r,"href",Ee),c(r,"target","_blank"),c(r,"class","altcha-logo svelte-vuofbg")},m(u,f){I(u,e,f),v(e,r),v(r,n),v(n,o),v(n,l),v(n,s)},p:L,d(u){u&&R(e)}}}function $e(t){let e,r,n,o;function l(f,a){return f[5]===b.EXPIRED?mt:bt}let s=l(t),u=s(t);return{c(){e=_("div"),r=V("svg"),n=V("path"),o=P(),u.c(),c(n,"stroke-linecap","round"),c(n,"stroke-linejoin","round"),c(n,"d","M6 18L18 6M6 6l12 12"),c(r,"width","14"),c(r,"height","14"),c(r,"xmlns","http://www.w3.org/2000/svg"),c(r,"fill","none"),c(r,"viewBox","0 0 24 24"),c(r,"stroke-width","1.5"),c(r,"stroke","currentColor"),c(e,"class","altcha-error svelte-vuofbg")},m(f,a){I(f,e,a),v(e,r),v(r,n),v(e,o),u.m(e,null)},p(f,a){s===(s=l(f))&&u?u.p(f,a):(u.d(1),u=s(f),u&&(u.c(),u.m(e,null)))},d(f){f&&R(e),u.d()}}}function bt(t){let e,r=t[9].error+"";return{c(){e=_("div"),c(e,"title",t[8])},m(n,o){I(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].error+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&R(e)}}}function mt(t){let e,r=t[9].expired+"";return{c(){e=_("div"),c(e,"title",t[8])},m(n,o){I(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].expired+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&R(e)}}}function ke(t){let e,r,n=t[9].footer+"";return{c(){e=_("div"),r=_("div"),c(r,"class","svelte-vuofbg"),c(e,"class","altcha-footer svelte-vuofbg")},m(o,l){I(o,e,l),v(e,r),r.innerHTML=n},p(o,l){l[0]&512&&n!==(n=o[9].footer+"")&&(r.innerHTML=n)},d(o){o&&R(e)}}}function vt(t){let e,r,n,o,l,s,u,f,a,k,w,N,A,M,p=t[5]===b.VERIFYING&&pe();function F(h,d){return h[5]===b.VERIFIED?gt:h[5]===b.VERIFYING?dt:ht}let S=F(t),E=S(t),y=t[2]!==!0&&ye(),$=(t[8]||t[5]===b.EXPIRED)&&$e(t),m=t[9].footer&&t[1]!==!0&&ke(t);return{c(){e=_("div"),r=_("div"),p&&p.c(),n=P(),o=_("div"),l=_("input"),f=P(),a=_("div"),E.c(),k=P(),y&&y.c(),w=P(),$&&$.c(),N=P(),m&&m.c(),c(l,"type","checkbox"),c(l,"id",s=t[3]+"_checkbox"),l.required=u=t[0]!=="onsubmit",c(l,"class","svelte-vuofbg"),c(o,"class","altcha-checkbox svelte-vuofbg"),he(o,"altcha-hidden",t[5]===b.VERIFYING),c(a,"class","altcha-label svelte-vuofbg"),c(r,"class","altcha-main svelte-vuofbg"),c(e,"class","altcha svelte-vuofbg"),c(e,"data-state",t[5])},m(h,d){I(h,e,d),v(e,r),p&&p.m(r,null),v(r,n),v(r,o),v(o,l),l.checked=t[6],v(r,f),v(r,a),E.m(a,null),v(r,k),y&&y.m(r,null),v(e,w),$&&$.m(e,null),v(e,N),m&&m.m(e,null),t[26](e),A||(M=[te(l,"change",t[25]),te(l,"change",t[10]),te(l,"invalid",t[11])],A=!0)},p(h,d){h[5]===b.VERIFYING?p||(p=pe(),p.c(),p.m(r,n)):p&&(p.d(1),p=null),d[0]&8&&s!==(s=h[3]+"_checkbox")&&c(l,"id",s),d[0]&1&&u!==(u=h[0]!=="onsubmit")&&(l.required=u),d[0]&64&&(l.checked=h[6]),d[0]&32&&he(o,"altcha-hidden",h[5]===b.VERIFYING),S===(S=F(h))&&E?E.p(h,d):(E.d(1),E=S(h),E&&(E.c(),E.m(a,null))),h[2]!==!0?y?y.p(h,d):(y=ye(),y.c(),y.m(r,null)):y&&(y.d(1),y=null),h[8]||h[5]===b.EXPIRED?$?$.p(h,d):($=$e(h),$.c(),$.m(e,N)):$&&($.d(1),$=null),h[9].footer&&h[1]!==!0?m?m.p(h,d):(m=ke(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null),d[0]&32&&c(e,"data-state",h[5])},i:L,o:L,d(h){h&&R(e),p&&p.d(),E.d(),y&&y.d(),$&&$.d(),m&&m.d(),t[26](null),A=!1,X(M)}}}const Ee="https://altcha.org/";function xe(t){return JSON.parse(t)}function wt(t,e,r){let n,o,l,{auto:s=void 0}=e,{challengeurl:u=void 0}=e,{challengejson:f=void 0}=e,{debug:a=!1}=e,{expire:k=void 0}=e,{hidefooter:w=!1}=e,{hidelogo:N=!1}=e,{name:A="altcha"}=e,{maxnumber:M=1e6}=e,{mockerror:p=!1}=e,{strings:F=void 0}=e,{test:S=!1}=e,{workers:E=navigator.hardwareConcurrency||8}=e;const y=Be(),$=["SHA-256","SHA-384","SHA-512"];let m=!1,h,d=null,se=null,Y=null,Z=b.UNVERIFIED,ce;Ye(()=>{d&&(d.removeEventListener("submit",Le),d.removeEventListener("reset",Re),d=null)}),De(()=>{C("mounted","0.2.1"),C("workers",E),S&&C("using test mode"),k&&ue(k),s!==void 0&&C("auto",s),d=h.closest("form"),d&&(d.addEventListener("submit",Le),d.addEventListener("reset",Re)),s==="onload"&&B()});function C(...i){(a||i.some(g=>g instanceof Error))&&console[i[0]instanceof Error?"error":"log"]("ALTCHA",...i)}function Le(i){d&&s==="onsubmit"&&Z===b.UNVERIFIED&&(i.preventDefault(),i.stopPropagation(),B().then(()=>{d==null||d.requestSubmit()}))}function Re(){Q()}function _t(i,g){return btoa(JSON.stringify({algorithm:i.algorithm,challenge:i.challenge,number:g.number,salt:i.salt,signature:i.signature,test:S?!0:void 0,took:g.took}))}function Ie(i){if(!i.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(i.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!$.includes(i.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${$.join(", ")}`);if(!i.challenge||i.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!i.salt||i.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function pt(){if(p)throw C("mocking error"),new Error("Mocked error.");if(n)return C("using provided json data"),n;if(S)return C("generating test challenge"),ut();{if(!u)throw new Error("Attribute challengeurl not set.");C("fetching challenge from",u);const i=await fetch(u);if(i.status!==200)throw new Error(`Server responded with ${i.status}.`);const g=i.headers.get("Expires");if(g!=null&&g.length){const U=Date.parse(g);isNaN(U)||ue(U-Date.now())}return i.json()}}function Ne(){u&&Z===b.VERIFIED?B():Q(b.EXPIRED,l.expired)}async function yt(i){let g=null;if("Worker"in window){try{g=await $t(i.challenge,i.salt,i.algorithm)}catch(U){C(U)}if((g==null?void 0:g.number)!==void 0)return{data:i,solution:g}}return{data:i,solution:await at(i.challenge,i.salt,i.algorithm,M).promise}}async function $t(i,g,U,q=Math.ceil(E)){const ee=[];if(q<1)throw new Error("Wrong number of workers configured.");if(q>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let G=0;G<q;G++)ee.push(new lt);const Te=Math.ceil(M/q),Rt=await Promise.all(ee.map((G,It)=>{const Me=It*Te;return new Promise(Nt=>{G.addEventListener("message",Se=>{if(Se.data)for(const Ae of ee)Ae!==G&&Ae.postMessage({type:"abort"});Nt(Se.data)}),G.postMessage({payload:{alg:U,challenge:i,max:Me+Te,salt:g,start:Me},type:"work"})})}));for(const G of ee)G.terminate();return Rt.find(G=>!!G)||null}function kt(){[b.UNVERIFIED,b.ERROR,b.EXPIRED].includes(Z)?B():r(6,m=!0)}function Et(){Z===b.VERIFYING&&alert(l.waitAlert)}function ue(i){console.log(">>>"),C("expire",i),clearTimeout(ce),i<1?Ne():ce=setTimeout(Ne,i)}function xt(i){i.auto!==void 0&&(r(0,s=i.auto),s==="onload"&&B()),i.expire!==void 0&&(ue(i.expire),r(13,k=i.expire)),i.challenge&&(Ie(i.challenge),n=i.challenge),i.debug!==void 0&&r(12,a=!!i.debug),i.hidefooter!==void 0&&r(1,w=!!i.hidefooter),i.hidelogo!==void 0&&r(2,N=!!i.hidelogo),i.maxnumber!==void 0&&r(14,M=+i.maxnumber),i.mockerror!==void 0&&r(15,p=!!i.mockerror),i.name!==void 0&&r(3,A=i.name),i.test!==void 0&&r(16,S=!!i.test),i.strings&&r(24,o=i.strings),i.workers!==void 0&&r(17,E=+i.workers)}function Q(i=b.UNVERIFIED,g=null){clearTimeout(ce),r(6,m=!1),r(8,se=g),r(4,Y=null),r(5,Z=i)}async function B(){return Q(b.VERIFYING),pt().then(i=>(Ie(i),C("challenge",i),yt(i))).then(({data:i,solution:g})=>{if(C("solution",g),(g==null?void 0:g.number)!==void 0)C("verified"),r(5,Z=b.VERIFIED),r(6,m=!0),r(4,Y=_t(i,g)),C("payload",Y),Ue().then(()=>{y("verified",{payload:Y})});else throw new Error("Unexpected result returned.")}).catch(i=>{C(i),r(5,Z=b.ERROR),r(6,m=!1),r(8,se=i.message)})}function Ct(){m=this.checked,r(6,m)}function Lt(i){ne[i?"unshift":"push"](()=>{h=i,r(7,h)})}return t.$$set=i=>{"auto"in i&&r(0,s=i.auto),"challengeurl"in i&&r(18,u=i.challengeurl),"challengejson"in i&&r(19,f=i.challengejson),"debug"in i&&r(12,a=i.debug),"expire"in i&&r(13,k=i.expire),"hidefooter"in i&&r(1,w=i.hidefooter),"hidelogo"in i&&r(2,N=i.hidelogo),"name"in i&&r(3,A=i.name),"maxnumber"in i&&r(14,M=i.maxnumber),"mockerror"in i&&r(15,p=i.mockerror),"strings"in i&&r(20,F=i.strings),"test"in i&&r(16,S=i.test),"workers"in i&&r(17,E=i.workers)},t.$$.update=()=>{t.$$.dirty[0]&524288&&(n=f?xe(f):void 0),t.$$.dirty[0]&1048576&&r(24,o=F?xe(F):{}),t.$$.dirty[0]&16777216&&r(9,l={error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${Ee}" target="_blank">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),t.$$.dirty[0]&48&&y("statechange",{payload:Y,state:Z})},[s,w,N,A,Y,Z,m,h,se,l,kt,Et,a,k,M,p,S,E,u,f,F,xt,Q,B,o,Ct,Lt]}class Ce extends nt{constructor(e){super(),tt(this,e,wt,vt,Ge,{auto:0,challengeurl:18,challengejson:19,debug:12,expire:13,hidefooter:1,hidelogo:2,name:3,maxnumber:14,mockerror:15,strings:20,test:16,workers:17,configure:21,reset:22,verify:23},ft,[-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),x()}get challengeurl(){return this.$$.ctx[18]}set challengeurl(e){this.$$set({challengeurl:e}),x()}get challengejson(){return this.$$.ctx[19]}set challengejson(e){this.$$set({challengejson:e}),x()}get debug(){return this.$$.ctx[12]}set debug(e){this.$$set({debug:e}),x()}get expire(){return this.$$.ctx[13]}set expire(e){this.$$set({expire:e}),x()}get hidefooter(){return this.$$.ctx[1]}set hidefooter(e){this.$$set({hidefooter:e}),x()}get hidelogo(){return this.$$.ctx[2]}set hidelogo(e){this.$$set({hidelogo:e}),x()}get name(){return this.$$.ctx[3]}set name(e){this.$$set({name:e}),x()}get maxnumber(){return this.$$.ctx[14]}set maxnumber(e){this.$$set({maxnumber:e}),x()}get mockerror(){return this.$$.ctx[15]}set mockerror(e){this.$$set({mockerror:e}),x()}get strings(){return this.$$.ctx[20]}set strings(e){this.$$set({strings:e}),x()}get test(){return this.$$.ctx[16]}set test(e){this.$$set({test:e}),x()}get workers(){return this.$$.ctx[17]}set workers(e){this.$$set({workers:e}),x()}get configure(){return this.$$.ctx[21]}get reset(){return this.$$.ctx[22]}get verify(){return this.$$.ctx[23]}}return customElements.define("altcha-widget",rt(Ce,{auto:{},challengeurl:{},challengejson:{},debug:{type:"Boolean"},expire:{},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},name:{},maxnumber:{},mockerror:{type:"Boolean"},strings:{},test:{type:"Boolean"},workers:{}},[],["configure","reset","verify"],!1)),j.Altcha=Ce,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),j}({});
|
package/dist/altcha.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var N = (t, e, r) => (
|
|
4
|
-
function
|
|
1
|
+
var Ye = Object.defineProperty;
|
|
2
|
+
var Be = (t, e, r) => e in t ? Ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var N = (t, e, r) => (Be(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
function Y() {
|
|
5
5
|
}
|
|
6
6
|
function xe(t) {
|
|
7
7
|
return t();
|
|
@@ -9,26 +9,26 @@ function xe(t) {
|
|
|
9
9
|
function me() {
|
|
10
10
|
return /* @__PURE__ */ Object.create(null);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function X(t) {
|
|
13
13
|
t.forEach(xe);
|
|
14
14
|
}
|
|
15
15
|
function Ce(t) {
|
|
16
16
|
return typeof t == "function";
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Ue(t, e) {
|
|
19
19
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Xe(t) {
|
|
22
22
|
return Object.keys(t).length === 0;
|
|
23
23
|
}
|
|
24
24
|
function v(t, e) {
|
|
25
25
|
t.appendChild(e);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Ke(t, e, r) {
|
|
28
28
|
const n = Je(t);
|
|
29
29
|
if (!n.getElementById(e)) {
|
|
30
30
|
const o = p("style");
|
|
31
|
-
o.id = e, o.textContent = r,
|
|
31
|
+
o.id = e, o.textContent = r, ze(n, o);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
function Je(t) {
|
|
@@ -41,14 +41,14 @@ function Je(t) {
|
|
|
41
41
|
e
|
|
42
42
|
) : t.ownerDocument;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function ze(t, e) {
|
|
45
45
|
return v(
|
|
46
46
|
/** @type {Document} */
|
|
47
47
|
t.head || t,
|
|
48
48
|
e
|
|
49
49
|
), e.sheet;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function R(t, e, r) {
|
|
52
52
|
t.insertBefore(e, r || null);
|
|
53
53
|
}
|
|
54
54
|
function L(t) {
|
|
@@ -57,14 +57,14 @@ function L(t) {
|
|
|
57
57
|
function p(t) {
|
|
58
58
|
return document.createElement(t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function j(t) {
|
|
61
61
|
return document.createElementNS("http://www.w3.org/2000/svg", t);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Qe(t) {
|
|
64
64
|
return document.createTextNode(t);
|
|
65
65
|
}
|
|
66
66
|
function Z() {
|
|
67
|
-
return
|
|
67
|
+
return Qe(" ");
|
|
68
68
|
}
|
|
69
69
|
function re(t, e, r, n) {
|
|
70
70
|
return t.addEventListener(e, r, n), () => t.removeEventListener(e, r, n);
|
|
@@ -90,14 +90,14 @@ function tt(t) {
|
|
|
90
90
|
}
|
|
91
91
|
), e;
|
|
92
92
|
}
|
|
93
|
-
let
|
|
94
|
-
function
|
|
95
|
-
|
|
93
|
+
let U;
|
|
94
|
+
function B(t) {
|
|
95
|
+
U = t;
|
|
96
96
|
}
|
|
97
97
|
function se() {
|
|
98
|
-
if (!
|
|
98
|
+
if (!U)
|
|
99
99
|
throw new Error("Function called outside component initialization");
|
|
100
|
-
return
|
|
100
|
+
return U;
|
|
101
101
|
}
|
|
102
102
|
function rt(t) {
|
|
103
103
|
se().$$.on_mount.push(t);
|
|
@@ -123,56 +123,56 @@ function it() {
|
|
|
123
123
|
return !0;
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
const
|
|
127
|
-
let
|
|
126
|
+
const W = [], ie = [];
|
|
127
|
+
let D = [];
|
|
128
128
|
const we = [], Le = /* @__PURE__ */ Promise.resolve();
|
|
129
129
|
let oe = !1;
|
|
130
|
-
function
|
|
130
|
+
function Re() {
|
|
131
131
|
oe || (oe = !0, Le.then(C));
|
|
132
132
|
}
|
|
133
133
|
function ot() {
|
|
134
|
-
return
|
|
134
|
+
return Re(), Le;
|
|
135
135
|
}
|
|
136
136
|
function le(t) {
|
|
137
|
-
|
|
137
|
+
D.push(t);
|
|
138
138
|
}
|
|
139
139
|
const ne = /* @__PURE__ */ new Set();
|
|
140
|
-
let
|
|
140
|
+
let O = 0;
|
|
141
141
|
function C() {
|
|
142
|
-
if (
|
|
142
|
+
if (O !== 0)
|
|
143
143
|
return;
|
|
144
|
-
const t =
|
|
144
|
+
const t = U;
|
|
145
145
|
do {
|
|
146
146
|
try {
|
|
147
|
-
for (;
|
|
148
|
-
const e =
|
|
149
|
-
|
|
147
|
+
for (; O < W.length; ) {
|
|
148
|
+
const e = W[O];
|
|
149
|
+
O++, B(e), lt(e.$$);
|
|
150
150
|
}
|
|
151
151
|
} catch (e) {
|
|
152
|
-
throw
|
|
152
|
+
throw W.length = 0, O = 0, e;
|
|
153
153
|
}
|
|
154
|
-
for (
|
|
154
|
+
for (B(null), W.length = 0, O = 0; ie.length; )
|
|
155
155
|
ie.pop()();
|
|
156
|
-
for (let e = 0; e <
|
|
157
|
-
const r =
|
|
156
|
+
for (let e = 0; e < D.length; e += 1) {
|
|
157
|
+
const r = D[e];
|
|
158
158
|
ne.has(r) || (ne.add(r), r());
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
} while (
|
|
160
|
+
D.length = 0;
|
|
161
|
+
} while (W.length);
|
|
162
162
|
for (; we.length; )
|
|
163
163
|
we.pop()();
|
|
164
|
-
oe = !1, ne.clear(),
|
|
164
|
+
oe = !1, ne.clear(), B(t);
|
|
165
165
|
}
|
|
166
166
|
function lt(t) {
|
|
167
167
|
if (t.fragment !== null) {
|
|
168
|
-
t.update(),
|
|
168
|
+
t.update(), X(t.before_update);
|
|
169
169
|
const e = t.dirty;
|
|
170
170
|
t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(le);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
function st(t) {
|
|
174
174
|
const e = [], r = [];
|
|
175
|
-
|
|
175
|
+
D.forEach((n) => t.indexOf(n) === -1 ? e.push(n) : r.push(n)), r.forEach((n) => n()), D = e;
|
|
176
176
|
}
|
|
177
177
|
const ct = /* @__PURE__ */ new Set();
|
|
178
178
|
function ut(t, e) {
|
|
@@ -182,25 +182,25 @@ function at(t, e, r) {
|
|
|
182
182
|
const { fragment: n, after_update: o } = t.$$;
|
|
183
183
|
n && n.m(e, r), le(() => {
|
|
184
184
|
const l = t.$$.on_mount.map(xe).filter(Ce);
|
|
185
|
-
t.$$.on_destroy ? t.$$.on_destroy.push(...l) :
|
|
185
|
+
t.$$.on_destroy ? t.$$.on_destroy.push(...l) : X(l), t.$$.on_mount = [];
|
|
186
186
|
}), o.forEach(le);
|
|
187
187
|
}
|
|
188
188
|
function ft(t, e) {
|
|
189
189
|
const r = t.$$;
|
|
190
|
-
r.fragment !== null && (st(r.after_update),
|
|
190
|
+
r.fragment !== null && (st(r.after_update), X(r.on_destroy), r.fragment && r.fragment.d(e), r.on_destroy = r.fragment = null, r.ctx = []);
|
|
191
191
|
}
|
|
192
192
|
function ht(t, e) {
|
|
193
|
-
t.$$.dirty[0] === -1 && (
|
|
193
|
+
t.$$.dirty[0] === -1 && (W.push(t), Re(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
194
194
|
}
|
|
195
195
|
function dt(t, e, r, n, o, l, s = null, u = [-1]) {
|
|
196
|
-
const f =
|
|
197
|
-
|
|
196
|
+
const f = U;
|
|
197
|
+
B(t);
|
|
198
198
|
const a = t.$$ = {
|
|
199
199
|
fragment: null,
|
|
200
200
|
ctx: [],
|
|
201
201
|
// state
|
|
202
202
|
props: l,
|
|
203
|
-
update:
|
|
203
|
+
update: Y,
|
|
204
204
|
not_equal: o,
|
|
205
205
|
bound: me(),
|
|
206
206
|
// lifecycle
|
|
@@ -217,11 +217,11 @@ function dt(t, e, r, n, o, l, s = null, u = [-1]) {
|
|
|
217
217
|
root: e.target || f.$$.root
|
|
218
218
|
};
|
|
219
219
|
s && s(a.root);
|
|
220
|
-
let
|
|
221
|
-
if (a.ctx = r ? r(t, e.props || {}, (w,
|
|
222
|
-
const
|
|
223
|
-
return a.ctx && o(a.ctx[w], a.ctx[w] =
|
|
224
|
-
}) : [], a.update(),
|
|
220
|
+
let k = !1;
|
|
221
|
+
if (a.ctx = r ? r(t, e.props || {}, (w, I, ...G) => {
|
|
222
|
+
const T = G.length ? G[0] : I;
|
|
223
|
+
return a.ctx && o(a.ctx[w], a.ctx[w] = T) && (!a.skip_bound && a.bound[w] && a.bound[w](T), k && ht(t, w)), I;
|
|
224
|
+
}) : [], a.update(), k = !0, X(a.before_update), a.fragment = n ? n(a.ctx) : !1, e.target) {
|
|
225
225
|
if (e.hydrate) {
|
|
226
226
|
const w = qe(e.target);
|
|
227
227
|
a.fragment && a.fragment.l(w), w.forEach(L);
|
|
@@ -229,10 +229,10 @@ function dt(t, e, r, n, o, l, s = null, u = [-1]) {
|
|
|
229
229
|
a.fragment && a.fragment.c();
|
|
230
230
|
e.intro && ut(t.$$.fragment), at(t, e.target, e.anchor), C();
|
|
231
231
|
}
|
|
232
|
-
|
|
232
|
+
B(f);
|
|
233
233
|
}
|
|
234
|
-
let
|
|
235
|
-
typeof HTMLElement == "function" && (
|
|
234
|
+
let Ie;
|
|
235
|
+
typeof HTMLElement == "function" && (Ie = class extends HTMLElement {
|
|
236
236
|
constructor(e, r, n) {
|
|
237
237
|
super();
|
|
238
238
|
/** The Svelte component constructor */
|
|
@@ -281,8 +281,8 @@ typeof HTMLElement == "function" && (Re = class extends HTMLElement {
|
|
|
281
281
|
* @param {HTMLElement} target
|
|
282
282
|
* @param {HTMLElement} [anchor]
|
|
283
283
|
*/
|
|
284
|
-
m: function(a,
|
|
285
|
-
|
|
284
|
+
m: function(a, k) {
|
|
285
|
+
R(a, s, k);
|
|
286
286
|
},
|
|
287
287
|
d: function(a) {
|
|
288
288
|
a && L(s);
|
|
@@ -297,7 +297,7 @@ typeof HTMLElement == "function" && (Re = class extends HTMLElement {
|
|
|
297
297
|
l in n && (r[l] = [e(l)]);
|
|
298
298
|
for (const l of this.attributes) {
|
|
299
299
|
const s = this.$$g_p(l.name);
|
|
300
|
-
s in this.$$d || (this.$$d[s] =
|
|
300
|
+
s in this.$$d || (this.$$d[s] = Q(s, l.value, this.$$p_d, "toProp"));
|
|
301
301
|
}
|
|
302
302
|
for (const l in this.$$p_d)
|
|
303
303
|
!(l in this.$$d) && this[l] !== void 0 && (this.$$d[l] = this[l], delete this[l]);
|
|
@@ -315,7 +315,7 @@ typeof HTMLElement == "function" && (Re = class extends HTMLElement {
|
|
|
315
315
|
this.$$r = !0;
|
|
316
316
|
for (const l in this.$$p_d)
|
|
317
317
|
if (this.$$d[l] = this.$$c.$$.ctx[this.$$c.$$.props[l]], this.$$p_d[l].reflect) {
|
|
318
|
-
const s =
|
|
318
|
+
const s = Q(
|
|
319
319
|
l,
|
|
320
320
|
this.$$d[l],
|
|
321
321
|
this.$$p_d,
|
|
@@ -338,7 +338,7 @@ typeof HTMLElement == "function" && (Re = class extends HTMLElement {
|
|
|
338
338
|
// and setting attributes through setAttribute etc, this is helpful
|
|
339
339
|
attributeChangedCallback(e, r, n) {
|
|
340
340
|
var o;
|
|
341
|
-
this.$$r || (e = this.$$g_p(e), this.$$d[e] =
|
|
341
|
+
this.$$r || (e = this.$$g_p(e), this.$$d[e] = Q(e, n, this.$$p_d, "toProp"), (o = this.$$c) == null || o.$set({ [e]: this.$$d[e] }));
|
|
342
342
|
}
|
|
343
343
|
disconnectedCallback() {
|
|
344
344
|
this.$$cn = !1, Promise.resolve().then(() => {
|
|
@@ -351,7 +351,7 @@ typeof HTMLElement == "function" && (Re = class extends HTMLElement {
|
|
|
351
351
|
) || e;
|
|
352
352
|
}
|
|
353
353
|
});
|
|
354
|
-
function
|
|
354
|
+
function Q(t, e, r, n) {
|
|
355
355
|
var l;
|
|
356
356
|
const o = (l = r[t]) == null ? void 0 : l.type;
|
|
357
357
|
if (e = o === "Boolean" && typeof e != "boolean" ? e != null : e, !n || !r[t])
|
|
@@ -382,7 +382,7 @@ function z(t, e, r, n) {
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
function gt(t, e, r, n, o, l) {
|
|
385
|
-
let s = class extends
|
|
385
|
+
let s = class extends Ie {
|
|
386
386
|
constructor() {
|
|
387
387
|
super(t, r, o), this.$$p_d = e;
|
|
388
388
|
}
|
|
@@ -399,7 +399,7 @@ function gt(t, e, r, n, o, l) {
|
|
|
399
399
|
},
|
|
400
400
|
set(f) {
|
|
401
401
|
var a;
|
|
402
|
-
f =
|
|
402
|
+
f = Q(u, f, e), this.$$d[u] = f, (a = this.$$c) == null || a.$set({ [u]: f });
|
|
403
403
|
}
|
|
404
404
|
});
|
|
405
405
|
}), n.forEach((u) => {
|
|
@@ -433,7 +433,7 @@ class bt {
|
|
|
433
433
|
}
|
|
434
434
|
/** @returns {void} */
|
|
435
435
|
$destroy() {
|
|
436
|
-
ft(this, 1), this.$destroy =
|
|
436
|
+
ft(this, 1), this.$destroy = Y;
|
|
437
437
|
}
|
|
438
438
|
/**
|
|
439
439
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -443,7 +443,7 @@ class bt {
|
|
|
443
443
|
*/
|
|
444
444
|
$on(e, r) {
|
|
445
445
|
if (!Ce(r))
|
|
446
|
-
return
|
|
446
|
+
return Y;
|
|
447
447
|
const n = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
448
448
|
return n.push(r), () => {
|
|
449
449
|
const o = n.indexOf(r);
|
|
@@ -455,12 +455,12 @@ class bt {
|
|
|
455
455
|
* @returns {void}
|
|
456
456
|
*/
|
|
457
457
|
$set(e) {
|
|
458
|
-
this.$$set && !
|
|
458
|
+
this.$$set && !Xe(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
const mt = "4";
|
|
462
462
|
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(mt);
|
|
463
|
-
const Ne = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGcodCl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KHQpXS5tYXAoZT0+ZS50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBoKHQsZSxvKXtyZXR1cm4gZyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUodCtlKSkpfWZ1bmN0aW9uIG0odCxlLG89IlNIQS0yNTYiLGk9MWU2LHA9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyO3JldHVybntwcm9taXNlOm5ldyBQcm9taXNlKChzLGMpPT57Y29uc3Qgcj1EYXRlLm5vdygpLGQ9bD0+e2Euc2lnbmFsLmFib3J0ZWR8fGw+
|
|
463
|
+
const Ne = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGcodCl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KHQpXS5tYXAoZT0+ZS50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBoKHQsZSxvKXtyZXR1cm4gZyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUodCtlKSkpfWZ1bmN0aW9uIG0odCxlLG89IlNIQS0yNTYiLGk9MWU2LHA9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyO3JldHVybntwcm9taXNlOm5ldyBQcm9taXNlKChzLGMpPT57Y29uc3Qgcj1EYXRlLm5vdygpLGQ9bD0+e2Euc2lnbmFsLmFib3J0ZWR8fGw+aT9zKG51bGwpOmgoZSxsLG8pLnRoZW4odz0+e3c9PT10P3Moe251bWJlcjpsLHRvb2s6RGF0ZS5ub3coKS1yfSk6ZChsKzEpfSkuY2F0Y2goYyl9O2QocCl9KSxjb250cm9sbGVyOmF9fWxldCBuO29ubWVzc2FnZT1hc3luYyB0PT57Y29uc3R7dHlwZTplLHBheWxvYWQ6b309dC5kYXRhO2lmKGU9PT0iYWJvcnQiKW49PW51bGx8fG4uYWJvcnQoKSxuPXZvaWQgMDtlbHNlIGlmKGU9PT0id29yayIpe2NvbnN0e2FsZzppLGNoYWxsZW5nZTpwLG1heDphLHNhbHQ6dSxzdGFydDpzfT1vfHx7fSxjPW0ocCx1LGksYSxzKTtuPWMuY29udHJvbGxlcixjLnByb21pc2UudGhlbihyPT57c2VsZi5wb3N0TWVzc2FnZShyJiZ7Li4ucix3b3JrZXI6ITB9KX0pfX19KSgpOwo=", vt = (t) => Uint8Array.from(atob(t), (e) => e.charCodeAt(0)), _e = typeof window < "u" && window.Blob && new Blob([vt(Ne)], { type: "text/javascript;charset=utf-8" });
|
|
464
464
|
function wt(t) {
|
|
465
465
|
let e;
|
|
466
466
|
try {
|
|
@@ -487,10 +487,10 @@ const _t = new TextEncoder();
|
|
|
487
487
|
function pt(t) {
|
|
488
488
|
return [...new Uint8Array(t)].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
489
489
|
}
|
|
490
|
-
async function
|
|
490
|
+
async function yt(t, e = "SHA-256", r = 1e5) {
|
|
491
491
|
const n = Date.now().toString(16);
|
|
492
492
|
t || (t = Math.round(Math.random() * r));
|
|
493
|
-
const o = await
|
|
493
|
+
const o = await Te(n, t, e);
|
|
494
494
|
return {
|
|
495
495
|
algorithm: e,
|
|
496
496
|
challenge: o,
|
|
@@ -498,38 +498,38 @@ async function kt(t, e = "SHA-256", r = 1e5) {
|
|
|
498
498
|
signature: ""
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
|
-
async function
|
|
501
|
+
async function Te(t, e, r) {
|
|
502
502
|
return pt(await crypto.subtle.digest(r.toUpperCase(), _t.encode(t + e)));
|
|
503
503
|
}
|
|
504
504
|
function $t(t, e, r = "SHA-256", n = 1e6, o = 0) {
|
|
505
505
|
const l = new AbortController();
|
|
506
506
|
return {
|
|
507
507
|
promise: new Promise((u, f) => {
|
|
508
|
-
const a = Date.now(),
|
|
509
|
-
l.signal.aborted || w
|
|
510
|
-
|
|
508
|
+
const a = Date.now(), k = (w) => {
|
|
509
|
+
l.signal.aborted || w > n ? u(null) : Te(e, w, r).then((I) => {
|
|
510
|
+
I === t ? u({
|
|
511
511
|
number: w,
|
|
512
512
|
took: Date.now() - a
|
|
513
|
-
}) :
|
|
513
|
+
}) : k(w + 1);
|
|
514
514
|
}).catch(f);
|
|
515
515
|
};
|
|
516
|
-
|
|
516
|
+
k(o);
|
|
517
517
|
}),
|
|
518
518
|
controller: l
|
|
519
519
|
};
|
|
520
520
|
}
|
|
521
521
|
var m = /* @__PURE__ */ ((t) => (t.ERROR = "error", t.VERIFIED = "verified", t.VERIFYING = "verifying", t.UNVERIFIED = "unverified", t.EXPIRED = "expired", t))(m || {});
|
|
522
|
-
function
|
|
523
|
-
|
|
522
|
+
function kt(t) {
|
|
523
|
+
Ke(t, "svelte-vuofbg", ".altcha.svelte-vuofbg.svelte-vuofbg{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-vuofbg.svelte-vuofbg:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-vuofbg.svelte-vuofbg{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-vuofbg.svelte-vuofbg{flex-grow:1}.altcha-label.svelte-vuofbg label.svelte-vuofbg{cursor:pointer}.altcha-logo.svelte-vuofbg.svelte-vuofbg{color:currentColor;opacity:0.3}.altcha-logo.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-error.svelte-vuofbg.svelte-vuofbg{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-vuofbg.svelte-vuofbg{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-footer.svelte-vuofbg>.svelte-vuofbg:first-child{flex-grow:1}.altcha-footer.svelte-vuofbg a{color:currentColor}.altcha-checkbox.svelte-vuofbg.svelte-vuofbg{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-vuofbg input.svelte-vuofbg{width:18px;height:18px;margin:0}.altcha-hidden.svelte-vuofbg.svelte-vuofbg{display:none}.altcha-spinner.svelte-vuofbg.svelte-vuofbg{animation:svelte-vuofbg-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-vuofbg-altcha-spinner{100%{transform:rotate(360deg)}}");
|
|
524
524
|
}
|
|
525
525
|
function pe(t) {
|
|
526
526
|
let e, r, n;
|
|
527
527
|
return {
|
|
528
528
|
c() {
|
|
529
|
-
e =
|
|
529
|
+
e = j("svg"), r = j("path"), n = j("path"), c(r, "d", "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"), c(r, "fill", "currentColor"), c(r, "opacity", ".25"), c(n, "d", "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"), c(n, "fill", "currentColor"), c(n, "class", "altcha-spinner svelte-vuofbg"), c(e, "width", "24"), c(e, "height", "24"), c(e, "viewBox", "0 0 24 24"), c(e, "xmlns", "http://www.w3.org/2000/svg");
|
|
530
530
|
},
|
|
531
531
|
m(o, l) {
|
|
532
|
-
|
|
532
|
+
R(o, e, l), v(e, r), v(e, n);
|
|
533
533
|
},
|
|
534
534
|
d(o) {
|
|
535
535
|
o && L(e);
|
|
@@ -547,7 +547,7 @@ function Et(t) {
|
|
|
547
547
|
t[3] + "_checkbox"), c(e, "class", "svelte-vuofbg");
|
|
548
548
|
},
|
|
549
549
|
m(o, l) {
|
|
550
|
-
|
|
550
|
+
R(o, e, l), e.innerHTML = r;
|
|
551
551
|
},
|
|
552
552
|
p(o, l) {
|
|
553
553
|
l[0] & /*_strings*/
|
|
@@ -571,7 +571,7 @@ function xt(t) {
|
|
|
571
571
|
e = p("span");
|
|
572
572
|
},
|
|
573
573
|
m(n, o) {
|
|
574
|
-
|
|
574
|
+
R(n, e, o), e.innerHTML = r;
|
|
575
575
|
},
|
|
576
576
|
p(n, o) {
|
|
577
577
|
o[0] & /*_strings*/
|
|
@@ -599,7 +599,7 @@ function Ct(t) {
|
|
|
599
599
|
t[4];
|
|
600
600
|
},
|
|
601
601
|
m(l, s) {
|
|
602
|
-
|
|
602
|
+
R(l, e, s), e.innerHTML = r, R(l, n, s), R(l, o, s);
|
|
603
603
|
},
|
|
604
604
|
p(l, s) {
|
|
605
605
|
s[0] & /*_strings*/
|
|
@@ -619,16 +619,16 @@ function Ct(t) {
|
|
|
619
619
|
}
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function ye(t) {
|
|
623
623
|
let e, r, n, o, l, s;
|
|
624
624
|
return {
|
|
625
625
|
c() {
|
|
626
|
-
e = p("div"), r = p("a"), n =
|
|
626
|
+
e = p("div"), r = p("a"), n = j("svg"), o = j("path"), l = j("path"), s = j("path"), c(o, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), c(o, "fill", "currentColor"), c(l, "d", "M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"), c(l, "fill", "currentColor"), c(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), c(s, "fill", "currentColor"), c(n, "width", "22"), c(n, "height", "22"), c(n, "viewBox", "0 0 20 20"), c(n, "fill", "none"), c(n, "xmlns", "http://www.w3.org/2000/svg"), c(r, "href", Me), c(r, "target", "_blank"), c(r, "class", "altcha-logo svelte-vuofbg");
|
|
627
627
|
},
|
|
628
628
|
m(u, f) {
|
|
629
|
-
|
|
629
|
+
R(u, e, f), v(e, r), v(r, n), v(n, o), v(n, l), v(n, s);
|
|
630
630
|
},
|
|
631
|
-
p:
|
|
631
|
+
p: Y,
|
|
632
632
|
d(u) {
|
|
633
633
|
u && L(e);
|
|
634
634
|
}
|
|
@@ -639,16 +639,16 @@ function $e(t) {
|
|
|
639
639
|
function l(f, a) {
|
|
640
640
|
return (
|
|
641
641
|
/*state*/
|
|
642
|
-
f[5] === m.EXPIRED ?
|
|
642
|
+
f[5] === m.EXPIRED ? Rt : Lt
|
|
643
643
|
);
|
|
644
644
|
}
|
|
645
645
|
let s = l(t), u = s(t);
|
|
646
646
|
return {
|
|
647
647
|
c() {
|
|
648
|
-
e = p("div"), r =
|
|
648
|
+
e = p("div"), r = j("svg"), n = j("path"), o = Z(), u.c(), c(n, "stroke-linecap", "round"), c(n, "stroke-linejoin", "round"), c(n, "d", "M6 18L18 6M6 6l12 12"), c(r, "width", "14"), c(r, "height", "14"), c(r, "xmlns", "http://www.w3.org/2000/svg"), c(r, "fill", "none"), c(r, "viewBox", "0 0 24 24"), c(r, "stroke-width", "1.5"), c(r, "stroke", "currentColor"), c(e, "class", "altcha-error svelte-vuofbg");
|
|
649
649
|
},
|
|
650
650
|
m(f, a) {
|
|
651
|
-
|
|
651
|
+
R(f, e, a), v(e, r), v(r, n), v(e, o), u.m(e, null);
|
|
652
652
|
},
|
|
653
653
|
p(f, a) {
|
|
654
654
|
s === (s = l(f)) && u ? u.p(f, a) : (u.d(1), u = s(f), u && (u.c(), u.m(e, null)));
|
|
@@ -673,7 +673,7 @@ function Lt(t) {
|
|
|
673
673
|
);
|
|
674
674
|
},
|
|
675
675
|
m(n, o) {
|
|
676
|
-
|
|
676
|
+
R(n, e, o), e.innerHTML = r;
|
|
677
677
|
},
|
|
678
678
|
p(n, o) {
|
|
679
679
|
o[0] & /*_strings*/
|
|
@@ -691,7 +691,7 @@ function Lt(t) {
|
|
|
691
691
|
}
|
|
692
692
|
};
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function Rt(t) {
|
|
695
695
|
let e, r = (
|
|
696
696
|
/*_strings*/
|
|
697
697
|
t[9].expired + ""
|
|
@@ -706,7 +706,7 @@ function It(t) {
|
|
|
706
706
|
);
|
|
707
707
|
},
|
|
708
708
|
m(n, o) {
|
|
709
|
-
|
|
709
|
+
R(n, e, o), e.innerHTML = r;
|
|
710
710
|
},
|
|
711
711
|
p(n, o) {
|
|
712
712
|
o[0] & /*_strings*/
|
|
@@ -724,7 +724,7 @@ function It(t) {
|
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function ke(t) {
|
|
728
728
|
let e, r, n = (
|
|
729
729
|
/*_strings*/
|
|
730
730
|
t[9].footer + ""
|
|
@@ -734,7 +734,7 @@ function ye(t) {
|
|
|
734
734
|
e = p("div"), r = p("div"), c(r, "class", "svelte-vuofbg"), c(e, "class", "altcha-footer svelte-vuofbg");
|
|
735
735
|
},
|
|
736
736
|
m(o, l) {
|
|
737
|
-
|
|
737
|
+
R(o, e, l), v(e, r), r.innerHTML = n;
|
|
738
738
|
},
|
|
739
739
|
p(o, l) {
|
|
740
740
|
l[0] & /*_strings*/
|
|
@@ -746,8 +746,8 @@ function ye(t) {
|
|
|
746
746
|
}
|
|
747
747
|
};
|
|
748
748
|
}
|
|
749
|
-
function
|
|
750
|
-
let e, r, n, o, l, s, u, f, a,
|
|
749
|
+
function It(t) {
|
|
750
|
+
let e, r, n, o, l, s, u, f, a, k, w, I, G, T, _ = (
|
|
751
751
|
/*state*/
|
|
752
752
|
t[5] === m.VERIFYING && pe()
|
|
753
753
|
);
|
|
@@ -760,9 +760,9 @@ function Rt(t) {
|
|
|
760
760
|
)
|
|
761
761
|
);
|
|
762
762
|
}
|
|
763
|
-
let
|
|
763
|
+
let M = V(t), E = M(t), y = (
|
|
764
764
|
/*hidelogo*/
|
|
765
|
-
t[2] !== !0 &&
|
|
765
|
+
t[2] !== !0 && ye()
|
|
766
766
|
), $ = (
|
|
767
767
|
/*error*/
|
|
768
768
|
(t[8] || /*state*/
|
|
@@ -770,11 +770,11 @@ function Rt(t) {
|
|
|
770
770
|
), b = (
|
|
771
771
|
/*_strings*/
|
|
772
772
|
t[9].footer && /*hidefooter*/
|
|
773
|
-
t[1] !== !0 &&
|
|
773
|
+
t[1] !== !0 && ke(t)
|
|
774
774
|
);
|
|
775
775
|
return {
|
|
776
776
|
c() {
|
|
777
|
-
e = p("div"), r = p("div"), _ && _.c(), n = Z(), o = p("div"), l = p("input"), f = Z(), a = p("div"), E.c(),
|
|
777
|
+
e = p("div"), r = p("div"), _ && _.c(), n = Z(), o = p("div"), l = p("input"), f = Z(), a = p("div"), E.c(), k = Z(), y && y.c(), w = Z(), $ && $.c(), I = Z(), b && b.c(), c(l, "type", "checkbox"), c(l, "id", s = /*name*/
|
|
778
778
|
t[3] + "_checkbox"), l.required = u = /*auto*/
|
|
779
779
|
t[0] !== "onsubmit", c(l, "class", "svelte-vuofbg"), c(o, "class", "altcha-checkbox svelte-vuofbg"), ve(
|
|
780
780
|
o,
|
|
@@ -789,8 +789,8 @@ function Rt(t) {
|
|
|
789
789
|
);
|
|
790
790
|
},
|
|
791
791
|
m(h, d) {
|
|
792
|
-
|
|
793
|
-
t[6], v(r, f), v(r, a), E.m(a, null), v(r,
|
|
792
|
+
R(h, e, d), v(e, r), _ && _.m(r, null), v(r, n), v(r, o), v(o, l), l.checked = /*checked*/
|
|
793
|
+
t[6], v(r, f), v(r, a), E.m(a, null), v(r, k), y && y.m(r, null), v(e, w), $ && $.m(e, null), v(e, I), b && b.m(e, null), t[26](e), G || (T = [
|
|
794
794
|
re(
|
|
795
795
|
l,
|
|
796
796
|
"change",
|
|
@@ -809,7 +809,7 @@ function Rt(t) {
|
|
|
809
809
|
/*onInvalid*/
|
|
810
810
|
t[11]
|
|
811
811
|
)
|
|
812
|
-
],
|
|
812
|
+
], G = !0);
|
|
813
813
|
},
|
|
814
814
|
p(h, d) {
|
|
815
815
|
/*state*/
|
|
@@ -825,12 +825,12 @@ function Rt(t) {
|
|
|
825
825
|
"altcha-hidden",
|
|
826
826
|
/*state*/
|
|
827
827
|
h[5] === m.VERIFYING
|
|
828
|
-
),
|
|
829
|
-
h[2] !== !0 ?
|
|
828
|
+
), M === (M = V(h)) && E ? E.p(h, d) : (E.d(1), E = M(h), E && (E.c(), E.m(a, null))), /*hidelogo*/
|
|
829
|
+
h[2] !== !0 ? y ? y.p(h, d) : (y = ye(), y.c(), y.m(r, null)) : y && (y.d(1), y = null), /*error*/
|
|
830
830
|
h[8] || /*state*/
|
|
831
|
-
h[5] === m.EXPIRED ? $ ? $.p(h, d) : ($ = $e(h), $.c(), $.m(e,
|
|
831
|
+
h[5] === m.EXPIRED ? $ ? $.p(h, d) : ($ = $e(h), $.c(), $.m(e, I)) : $ && ($.d(1), $ = null), /*_strings*/
|
|
832
832
|
h[9].footer && /*hidefooter*/
|
|
833
|
-
h[1] !== !0 ? b ? b.p(h, d) : (b =
|
|
833
|
+
h[1] !== !0 ? b ? b.p(h, d) : (b = ke(h), b.c(), b.m(e, null)) : b && (b.d(1), b = null), d[0] & /*state*/
|
|
834
834
|
32 && c(
|
|
835
835
|
e,
|
|
836
836
|
"data-state",
|
|
@@ -838,45 +838,45 @@ function Rt(t) {
|
|
|
838
838
|
h[5]
|
|
839
839
|
);
|
|
840
840
|
},
|
|
841
|
-
i:
|
|
842
|
-
o:
|
|
841
|
+
i: Y,
|
|
842
|
+
o: Y,
|
|
843
843
|
d(h) {
|
|
844
|
-
h && L(e), _ && _.d(), E.d(),
|
|
844
|
+
h && L(e), _ && _.d(), E.d(), y && y.d(), $ && $.d(), b && b.d(), t[26](null), G = !1, X(T);
|
|
845
845
|
}
|
|
846
846
|
};
|
|
847
847
|
}
|
|
848
|
-
const
|
|
848
|
+
const Me = "https://altcha.org/";
|
|
849
849
|
function Ee(t) {
|
|
850
850
|
return JSON.parse(t);
|
|
851
851
|
}
|
|
852
852
|
function Nt(t, e, r) {
|
|
853
|
-
let n, o, l, { auto: s = void 0 } = e, { challengeurl: u = void 0 } = e, { challengejson: f = void 0 } = e, { debug: a = !1 } = e, { expire:
|
|
854
|
-
const
|
|
855
|
-
let b = !1, h, d = null, q = null, H = null,
|
|
853
|
+
let n, o, l, { auto: s = void 0 } = e, { challengeurl: u = void 0 } = e, { challengejson: f = void 0 } = e, { debug: a = !1 } = e, { expire: k = void 0 } = e, { hidefooter: w = !1 } = e, { hidelogo: I = !1 } = e, { name: G = "altcha" } = e, { maxnumber: T = 1e6 } = e, { mockerror: _ = !1 } = e, { strings: V = void 0 } = e, { test: M = !1 } = e, { workers: E = navigator.hardwareConcurrency || 8 } = e;
|
|
854
|
+
const y = it(), $ = ["SHA-256", "SHA-384", "SHA-512"];
|
|
855
|
+
let b = !1, h, d = null, q = null, H = null, A = m.UNVERIFIED, ee;
|
|
856
856
|
nt(() => {
|
|
857
857
|
d && (d.removeEventListener("submit", ce), d.removeEventListener("reset", ue), d = null);
|
|
858
858
|
}), rt(() => {
|
|
859
|
-
x("mounted", "0.2.
|
|
859
|
+
x("mounted", "0.2.1"), x("workers", E), M && x("using test mode"), k && te(k), s !== void 0 && x("auto", s), d = h.closest("form"), d && (d.addEventListener("submit", ce), d.addEventListener("reset", ue)), s === "onload" && F();
|
|
860
860
|
});
|
|
861
861
|
function x(...i) {
|
|
862
862
|
(a || i.some((g) => g instanceof Error)) && console[i[0] instanceof Error ? "error" : "log"]("ALTCHA", ...i);
|
|
863
863
|
}
|
|
864
864
|
function ce(i) {
|
|
865
|
-
d && s === "onsubmit" &&
|
|
865
|
+
d && s === "onsubmit" && A === m.UNVERIFIED && (i.preventDefault(), i.stopPropagation(), F().then(() => {
|
|
866
866
|
d == null || d.requestSubmit();
|
|
867
867
|
}));
|
|
868
868
|
}
|
|
869
869
|
function ue() {
|
|
870
|
-
|
|
870
|
+
K();
|
|
871
871
|
}
|
|
872
|
-
function
|
|
872
|
+
function Ge(i, g) {
|
|
873
873
|
return btoa(JSON.stringify({
|
|
874
874
|
algorithm: i.algorithm,
|
|
875
875
|
challenge: i.challenge,
|
|
876
876
|
number: g.number,
|
|
877
877
|
salt: i.salt,
|
|
878
878
|
signature: i.signature,
|
|
879
|
-
test:
|
|
879
|
+
test: M ? !0 : void 0,
|
|
880
880
|
took: g.took
|
|
881
881
|
}));
|
|
882
882
|
}
|
|
@@ -892,13 +892,13 @@ function Nt(t, e, r) {
|
|
|
892
892
|
if (!i.salt || i.salt.length < 10)
|
|
893
893
|
throw new Error("Salt is too short. Min. 10 chars.");
|
|
894
894
|
}
|
|
895
|
-
async function
|
|
895
|
+
async function Se() {
|
|
896
896
|
if (_)
|
|
897
897
|
throw x("mocking error"), new Error("Mocked error.");
|
|
898
898
|
if (n)
|
|
899
899
|
return x("using provided json data"), n;
|
|
900
|
-
if (
|
|
901
|
-
return x("generating test challenge"),
|
|
900
|
+
if (M)
|
|
901
|
+
return x("generating test challenge"), yt();
|
|
902
902
|
{
|
|
903
903
|
if (!u)
|
|
904
904
|
throw new Error("Attribute challengeurl not set.");
|
|
@@ -908,50 +908,50 @@ function Nt(t, e, r) {
|
|
|
908
908
|
throw new Error(`Server responded with ${i.status}.`);
|
|
909
909
|
const g = i.headers.get("Expires");
|
|
910
910
|
if (g != null && g.length) {
|
|
911
|
-
const
|
|
912
|
-
isNaN(
|
|
911
|
+
const P = Date.parse(g);
|
|
912
|
+
isNaN(P) || te(P - Date.now());
|
|
913
913
|
}
|
|
914
914
|
return i.json();
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
917
|
function fe() {
|
|
918
|
-
u &&
|
|
918
|
+
u && A === m.VERIFIED ? F() : K(m.EXPIRED, l.expired);
|
|
919
919
|
}
|
|
920
|
-
async function
|
|
920
|
+
async function Ae(i) {
|
|
921
921
|
let g = null;
|
|
922
922
|
if ("Worker" in window) {
|
|
923
923
|
try {
|
|
924
|
-
g = await
|
|
925
|
-
} catch (
|
|
926
|
-
x(
|
|
924
|
+
g = await je(i.challenge, i.salt, i.algorithm);
|
|
925
|
+
} catch (P) {
|
|
926
|
+
x(P);
|
|
927
927
|
}
|
|
928
928
|
if ((g == null ? void 0 : g.number) !== void 0)
|
|
929
929
|
return { data: i, solution: g };
|
|
930
930
|
}
|
|
931
931
|
return {
|
|
932
932
|
data: i,
|
|
933
|
-
solution: await $t(i.challenge, i.salt, i.algorithm,
|
|
933
|
+
solution: await $t(i.challenge, i.salt, i.algorithm, T).promise
|
|
934
934
|
};
|
|
935
935
|
}
|
|
936
|
-
async function
|
|
937
|
-
const
|
|
936
|
+
async function je(i, g, P, J = Math.ceil(E)) {
|
|
937
|
+
const z = [];
|
|
938
938
|
if (J < 1)
|
|
939
939
|
throw new Error("Wrong number of workers configured.");
|
|
940
940
|
if (J > 16)
|
|
941
941
|
throw new Error("Too many workers. Max. 16 allowed workers.");
|
|
942
|
-
for (let
|
|
943
|
-
|
|
944
|
-
const he = Math.ceil(
|
|
945
|
-
const de =
|
|
946
|
-
return new Promise((
|
|
947
|
-
|
|
942
|
+
for (let S = 0; S < J; S++)
|
|
943
|
+
z.push(new wt());
|
|
944
|
+
const he = Math.ceil(T / J), Oe = await Promise.all(z.map((S, We) => {
|
|
945
|
+
const de = We * he;
|
|
946
|
+
return new Promise((De) => {
|
|
947
|
+
S.addEventListener("message", (ge) => {
|
|
948
948
|
if (ge.data)
|
|
949
|
-
for (const be of
|
|
950
|
-
be !==
|
|
951
|
-
|
|
952
|
-
}),
|
|
949
|
+
for (const be of z)
|
|
950
|
+
be !== S && be.postMessage({ type: "abort" });
|
|
951
|
+
De(ge.data);
|
|
952
|
+
}), S.postMessage({
|
|
953
953
|
payload: {
|
|
954
|
-
alg:
|
|
954
|
+
alg: P,
|
|
955
955
|
challenge: i,
|
|
956
956
|
max: de + he,
|
|
957
957
|
salt: g,
|
|
@@ -961,47 +961,47 @@ function Nt(t, e, r) {
|
|
|
961
961
|
});
|
|
962
962
|
});
|
|
963
963
|
}));
|
|
964
|
-
for (const
|
|
965
|
-
|
|
966
|
-
return
|
|
964
|
+
for (const S of z)
|
|
965
|
+
S.terminate();
|
|
966
|
+
return Oe.find((S) => !!S) || null;
|
|
967
967
|
}
|
|
968
968
|
function Ve() {
|
|
969
|
-
[m.UNVERIFIED, m.ERROR, m.EXPIRED].includes(
|
|
969
|
+
[m.UNVERIFIED, m.ERROR, m.EXPIRED].includes(A) ? F() : r(6, b = !0);
|
|
970
970
|
}
|
|
971
971
|
function Ze() {
|
|
972
|
-
|
|
972
|
+
A === m.VERIFYING && alert(l.waitAlert);
|
|
973
973
|
}
|
|
974
974
|
function te(i) {
|
|
975
975
|
console.log(">>>"), x("expire", i), clearTimeout(ee), i < 1 ? fe() : ee = setTimeout(fe, i);
|
|
976
976
|
}
|
|
977
977
|
function He(i) {
|
|
978
|
-
i.auto !== void 0 && (r(0, s = i.auto), s === "onload" && F()), i.expire !== void 0 && (te(i.expire), r(13,
|
|
978
|
+
i.auto !== void 0 && (r(0, s = i.auto), s === "onload" && F()), i.expire !== void 0 && (te(i.expire), r(13, k = i.expire)), i.challenge && (ae(i.challenge), n = i.challenge), i.debug !== void 0 && r(12, a = !!i.debug), i.hidefooter !== void 0 && r(1, w = !!i.hidefooter), i.hidelogo !== void 0 && r(2, I = !!i.hidelogo), i.maxnumber !== void 0 && r(14, T = +i.maxnumber), i.mockerror !== void 0 && r(15, _ = !!i.mockerror), i.name !== void 0 && r(3, G = i.name), i.test !== void 0 && r(16, M = !!i.test), i.strings && r(24, o = i.strings), i.workers !== void 0 && r(17, E = +i.workers);
|
|
979
979
|
}
|
|
980
|
-
function
|
|
981
|
-
clearTimeout(ee), r(6, b = !1), r(8, q = g), r(4, H = null), r(5,
|
|
980
|
+
function K(i = m.UNVERIFIED, g = null) {
|
|
981
|
+
clearTimeout(ee), r(6, b = !1), r(8, q = g), r(4, H = null), r(5, A = i);
|
|
982
982
|
}
|
|
983
983
|
async function F() {
|
|
984
|
-
return
|
|
984
|
+
return K(m.VERIFYING), Se().then((i) => (ae(i), x("challenge", i), Ae(i))).then(({ data: i, solution: g }) => {
|
|
985
985
|
if (x("solution", g), (g == null ? void 0 : g.number) !== void 0)
|
|
986
|
-
x("verified"), r(5,
|
|
987
|
-
|
|
986
|
+
x("verified"), r(5, A = m.VERIFIED), r(6, b = !0), r(4, H = Ge(i, g)), x("payload", H), ot().then(() => {
|
|
987
|
+
y("verified", { payload: H });
|
|
988
988
|
});
|
|
989
989
|
else
|
|
990
990
|
throw new Error("Unexpected result returned.");
|
|
991
991
|
}).catch((i) => {
|
|
992
|
-
x(i), r(5,
|
|
992
|
+
x(i), r(5, A = m.ERROR), r(6, b = !1), r(8, q = i.message);
|
|
993
993
|
});
|
|
994
994
|
}
|
|
995
995
|
function Fe() {
|
|
996
996
|
b = this.checked, r(6, b);
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function Pe(i) {
|
|
999
999
|
ie[i ? "unshift" : "push"](() => {
|
|
1000
1000
|
h = i, r(7, h);
|
|
1001
1001
|
});
|
|
1002
1002
|
}
|
|
1003
1003
|
return t.$$set = (i) => {
|
|
1004
|
-
"auto" in i && r(0, s = i.auto), "challengeurl" in i && r(18, u = i.challengeurl), "challengejson" in i && r(19, f = i.challengejson), "debug" in i && r(12, a = i.debug), "expire" in i && r(13,
|
|
1004
|
+
"auto" in i && r(0, s = i.auto), "challengeurl" in i && r(18, u = i.challengeurl), "challengejson" in i && r(19, f = i.challengejson), "debug" in i && r(12, a = i.debug), "expire" in i && r(13, k = i.expire), "hidefooter" in i && r(1, w = i.hidefooter), "hidelogo" in i && r(2, I = i.hidelogo), "name" in i && r(3, G = i.name), "maxnumber" in i && r(14, T = i.maxnumber), "mockerror" in i && r(15, _ = i.mockerror), "strings" in i && r(20, V = i.strings), "test" in i && r(16, M = i.test), "workers" in i && r(17, E = i.workers);
|
|
1005
1005
|
}, t.$$.update = () => {
|
|
1006
1006
|
t.$$.dirty[0] & /*challengejson*/
|
|
1007
1007
|
524288 && (n = f ? Ee(f) : void 0), t.$$.dirty[0] & /*strings*/
|
|
@@ -1009,21 +1009,21 @@ function Nt(t, e, r) {
|
|
|
1009
1009
|
16777216 && r(9, l = {
|
|
1010
1010
|
error: "Verification failed. Try again later.",
|
|
1011
1011
|
expired: "Verification expired. Try again.",
|
|
1012
|
-
footer: `Protected by <a href="${
|
|
1012
|
+
footer: `Protected by <a href="${Me}" target="_blank">ALTCHA</a>`,
|
|
1013
1013
|
label: "I'm not a robot",
|
|
1014
1014
|
verified: "Verified",
|
|
1015
1015
|
verifying: "Verifying...",
|
|
1016
1016
|
waitAlert: "Verifying... please wait.",
|
|
1017
1017
|
...o
|
|
1018
1018
|
}), t.$$.dirty[0] & /*payload, state*/
|
|
1019
|
-
48 &&
|
|
1019
|
+
48 && y("statechange", { payload: H, state: A });
|
|
1020
1020
|
}, [
|
|
1021
1021
|
s,
|
|
1022
1022
|
w,
|
|
1023
|
-
|
|
1024
|
-
M,
|
|
1025
|
-
H,
|
|
1023
|
+
I,
|
|
1026
1024
|
G,
|
|
1025
|
+
H,
|
|
1026
|
+
A,
|
|
1027
1027
|
b,
|
|
1028
1028
|
h,
|
|
1029
1029
|
q,
|
|
@@ -1031,30 +1031,30 @@ function Nt(t, e, r) {
|
|
|
1031
1031
|
Ve,
|
|
1032
1032
|
Ze,
|
|
1033
1033
|
a,
|
|
1034
|
-
|
|
1035
|
-
|
|
1034
|
+
k,
|
|
1035
|
+
T,
|
|
1036
1036
|
_,
|
|
1037
|
-
|
|
1037
|
+
M,
|
|
1038
1038
|
E,
|
|
1039
1039
|
u,
|
|
1040
1040
|
f,
|
|
1041
1041
|
V,
|
|
1042
1042
|
He,
|
|
1043
|
-
|
|
1043
|
+
K,
|
|
1044
1044
|
F,
|
|
1045
1045
|
o,
|
|
1046
1046
|
Fe,
|
|
1047
|
-
|
|
1047
|
+
Pe
|
|
1048
1048
|
];
|
|
1049
1049
|
}
|
|
1050
|
-
class
|
|
1050
|
+
class Tt extends bt {
|
|
1051
1051
|
constructor(e) {
|
|
1052
1052
|
super(), dt(
|
|
1053
1053
|
this,
|
|
1054
1054
|
e,
|
|
1055
1055
|
Nt,
|
|
1056
|
-
|
|
1057
|
-
|
|
1056
|
+
It,
|
|
1057
|
+
Ue,
|
|
1058
1058
|
{
|
|
1059
1059
|
auto: 0,
|
|
1060
1060
|
challengeurl: 18,
|
|
@@ -1073,7 +1073,7 @@ class jt extends bt {
|
|
|
1073
1073
|
reset: 22,
|
|
1074
1074
|
verify: 23
|
|
1075
1075
|
},
|
|
1076
|
-
|
|
1076
|
+
kt,
|
|
1077
1077
|
[-1, -1]
|
|
1078
1078
|
);
|
|
1079
1079
|
}
|
|
@@ -1165,7 +1165,7 @@ class jt extends bt {
|
|
|
1165
1165
|
return this.$$.ctx[23];
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
|
-
customElements.define("altcha-widget", gt(
|
|
1168
|
+
customElements.define("altcha-widget", gt(Tt, { auto: {}, challengeurl: {}, challengejson: {}, debug: { type: "Boolean" }, expire: {}, hidefooter: { type: "Boolean" }, hidelogo: { type: "Boolean" }, name: {}, maxnumber: {}, mockerror: { type: "Boolean" }, strings: {}, test: { type: "Boolean" }, workers: {} }, [], ["configure", "reset", "verify"], !1));
|
|
1169
1169
|
export {
|
|
1170
|
-
|
|
1170
|
+
Tt as Altcha
|
|
1171
1171
|
};
|
package/dist/altcha.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(N,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(N=typeof globalThis<"u"?globalThis:N||self,_(N.altcha={}))})(this,function(N){"use strict";var jt=Object.defineProperty;var At=(N,_,H)=>_ in N?jt(N,_,{enumerable:!0,configurable:!0,writable:!0,value:H}):N[_]=H;var A=(N,_,H)=>(At(N,typeof _!="symbol"?_+"":_,H),H);function _(){}function H(t){return t()}function fe(){return Object.create(null)}function B(t){t.forEach(H)}function ae(t){return typeof t=="function"}function Se(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Ge(t){return Object.keys(t).length===0}function v(t,e){t.appendChild(e)}function Ve(t,e,r){const n=Ze(t);if(!n.getElementById(e)){const o=p("style");o.id=e,o.textContent=r,He(n,o)}}function Ze(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function He(t,e){return v(t.head||t,e),e.sheet}function R(t,e,r){t.insertBefore(e,r||null)}function I(t){t.parentNode&&t.parentNode.removeChild(t)}function p(t){return document.createElement(t)}function V(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Oe(t){return document.createTextNode(t)}function O(){return Oe(" ")}function te(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function c(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Fe(t){return Array.from(t.childNodes)}function he(t,e,r){t.classList.toggle(e,!!r)}function Pe(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}function Ue(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}let W;function J(t){W=t}function re(){if(!W)throw new Error("Function called outside component initialization");return W}function De(t){re().$$.on_mount.push(t)}function Xe(t){re().$$.on_destroy.push(t)}function Ye(){const t=re();return(e,r,{cancelable:n=!1}={})=>{const o=t.$$.callbacks[e];if(o){const l=Pe(e,r,{cancelable:n});return o.slice().forEach(s=>{s.call(t,l)}),!l.defaultPrevented}return!0}}const P=[],ne=[];let U=[];const de=[],ge=Promise.resolve();let ie=!1;function be(){ie||(ie=!0,ge.then(C))}function Ke(){return be(),ge}function oe(t){U.push(t)}const le=new Set;let D=0;function C(){if(D!==0)return;const t=W;do{try{for(;D<P.length;){const e=P[D];D++,J(e),Be(e.$$)}}catch(e){throw P.length=0,D=0,e}for(J(null),P.length=0,D=0;ne.length;)ne.pop()();for(let e=0;e<U.length;e+=1){const r=U[e];le.has(r)||(le.add(r),r())}U.length=0}while(P.length);for(;de.length;)de.pop()();ie=!1,le.clear(),J(t)}function Be(t){if(t.fragment!==null){t.update(),B(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(oe)}}function We(t){const e=[],r=[];U.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),U=e}const Je=new Set;function Qe(t,e){t&&t.i&&(Je.delete(t),t.i(e))}function ze(t,e,r){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,r),oe(()=>{const l=t.$$.on_mount.map(H).filter(ae);t.$$.on_destroy?t.$$.on_destroy.push(...l):B(l),t.$$.on_mount=[]}),o.forEach(oe)}function qe(t,e){const r=t.$$;r.fragment!==null&&(We(r.after_update),B(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function et(t,e){t.$$.dirty[0]===-1&&(P.push(t),be(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function tt(t,e,r,n,o,l,s=null,u=[-1]){const a=W;J(t);const f=t.$$={fragment:null,ctx:[],props:l,update:_,not_equal:o,bound:fe(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:fe(),dirty:u,skip_bound:!1,root:e.target||a.$$.root};s&&s(f.root);let E=!1;if(f.ctx=r?r(t,e.props||{},(w,j,...S)=>{const M=S.length?S[0]:j;return f.ctx&&o(f.ctx[w],f.ctx[w]=M)&&(!f.skip_bound&&f.bound[w]&&f.bound[w](M),E&&et(t,w)),j}):[],f.update(),E=!0,B(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const w=Fe(e.target);f.fragment&&f.fragment.l(w),w.forEach(I)}else f.fragment&&f.fragment.c();e.intro&&Qe(t.$$.fragment),ze(t,e.target,e.anchor),C()}J(a)}let me;typeof HTMLElement=="function"&&(me=class extends HTMLElement{constructor(e,r,n){super();A(this,"$$ctor");A(this,"$$s");A(this,"$$c");A(this,"$$cn",!1);A(this,"$$d",{});A(this,"$$r",!1);A(this,"$$p_d",{});A(this,"$$l",{});A(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=r,n&&this.attachShadow({mode:"open"})}addEventListener(e,r,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){const o=this.$$c.$on(e,r);this.$$l_u.set(r,o)}super.addEventListener(e,r,n)}removeEventListener(e,r,n){if(super.removeEventListener(e,r,n),this.$$c){const o=this.$$l_u.get(r);o&&(o(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let s;return{c:function(){s=p("slot"),l!=="default"&&c(s,"name",l)},m:function(f,E){R(f,s,E)},d:function(f){f&&I(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},n=Ue(this);for(const l of this.$$s)l in n&&(r[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=Q(s,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const s=Q(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const s of this.$$l[l]){const u=this.$$c.$on(l,s);this.$$l_u.set(s,u)}this.$$l={}}}attributeChangedCallback(e,r,n){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Q(e,n,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function Q(t,e,r,n){var l;const o=(l=r[t])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function rt(t,e,r,n,o,l){let s=class extends me{constructor(){super(t,r,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(u=>(e[u].attribute||u).toLowerCase())}};return Object.keys(e).forEach(u=>{Object.defineProperty(s.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(a){var f;a=Q(u,a,e),this.$$d[u]=a,(f=this.$$c)==null||f.$set({[u]:a})}})}),n.forEach(u=>{Object.defineProperty(s.prototype,u,{get(){var a;return(a=this.$$c)==null?void 0:a[u]}})}),l&&(s=l(s)),t.element=s,s}class nt{constructor(){A(this,"$$");A(this,"$$set")}$destroy(){qe(this,1),this.$destroy=_}$on(e,r){if(!ae(r))return _;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const o=n.indexOf(r);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!Ge(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const it="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(it);const ve="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGcodCl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KHQpXS5tYXAoZT0+ZS50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBoKHQsZSxvKXtyZXR1cm4gZyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUodCtlKSkpfWZ1bmN0aW9uIG0odCxlLG89IlNIQS0yNTYiLGk9MWU2LHA9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyO3JldHVybntwcm9taXNlOm5ldyBQcm9taXNlKChzLGMpPT57Y29uc3Qgcj1EYXRlLm5vdygpLGQ9bD0+e2Euc2lnbmFsLmFib3J0ZWR8fGw+PWk/cyhudWxsKTpoKGUsbCxvKS50aGVuKHc9Pnt3PT09dD9zKHtudW1iZXI6bCx0b29rOkRhdGUubm93KCktcn0pOmQobCsxKX0pLmNhdGNoKGMpfTtkKHApfSksY29udHJvbGxlcjphfX1sZXQgbjtvbm1lc3NhZ2U9YXN5bmMgdD0+e2NvbnN0e3R5cGU6ZSxwYXlsb2FkOm99PXQuZGF0YTtpZihlPT09ImFib3J0IiluPT1udWxsfHxuLmFib3J0KCksbj12b2lkIDA7ZWxzZSBpZihlPT09IndvcmsiKXtjb25zdHthbGc6aSxjaGFsbGVuZ2U6cCxtYXg6YSxzYWx0OnUsc3RhcnQ6c309b3x8e30sYz1tKHAsdSxpLGEscyk7bj1jLmNvbnRyb2xsZXIsYy5wcm9taXNlLnRoZW4ocj0+e3NlbGYucG9zdE1lc3NhZ2UociYmey4uLnIsd29ya2VyOiEwfSl9KX19fSkoKTsK",ot=t=>Uint8Array.from(atob(t),e=>e.charCodeAt(0)),we=typeof window<"u"&&window.Blob&&new Blob([ot(ve)],{type:"text/javascript;charset=utf-8"});function lt(t){let e;try{if(e=we&&(window.URL||window.webkitURL).createObjectURL(we),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;base64,"+ve,{name:t==null?void 0:t.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const st=new TextEncoder;function ct(t){return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function ut(t,e="SHA-256",r=1e5){const n=Date.now().toString(16);t||(t=Math.round(Math.random()*r));const o=await _e(n,t,e);return{algorithm:e,challenge:o,salt:n,signature:""}}async function _e(t,e,r){return ct(await crypto.subtle.digest(r.toUpperCase(),st.encode(t+e)))}function ft(t,e,r="SHA-256",n=1e6,o=0){const l=new AbortController;return{promise:new Promise((u,a)=>{const f=Date.now(),E=w=>{l.signal.aborted||w>=n?u(null):_e(e,w,r).then(j=>{j===t?u({number:w,took:Date.now()-f}):E(w+1)}).catch(a)};E(o)}),controller:l}}var b=(t=>(t.ERROR="error",t.VERIFIED="verified",t.VERIFYING="verifying",t.UNVERIFIED="unverified",t.EXPIRED="expired",t))(b||{});function at(t){Ve(t,"svelte-vuofbg",".altcha.svelte-vuofbg.svelte-vuofbg{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-vuofbg.svelte-vuofbg:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-vuofbg.svelte-vuofbg{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-vuofbg.svelte-vuofbg{flex-grow:1}.altcha-label.svelte-vuofbg label.svelte-vuofbg{cursor:pointer}.altcha-logo.svelte-vuofbg.svelte-vuofbg{color:currentColor;opacity:0.3}.altcha-logo.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-error.svelte-vuofbg.svelte-vuofbg{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-vuofbg.svelte-vuofbg{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-footer.svelte-vuofbg>.svelte-vuofbg:first-child{flex-grow:1}.altcha-footer.svelte-vuofbg a{color:currentColor}.altcha-checkbox.svelte-vuofbg.svelte-vuofbg{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-vuofbg input.svelte-vuofbg{width:18px;height:18px;margin:0}.altcha-hidden.svelte-vuofbg.svelte-vuofbg{display:none}.altcha-spinner.svelte-vuofbg.svelte-vuofbg{animation:svelte-vuofbg-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-vuofbg-altcha-spinner{100%{transform:rotate(360deg)}}")}function pe(t){let e,r,n;return{c(){e=V("svg"),r=V("path"),n=V("path"),c(r,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),c(r,"fill","currentColor"),c(r,"opacity",".25"),c(n,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),c(n,"fill","currentColor"),c(n,"class","altcha-spinner svelte-vuofbg"),c(e,"width","24"),c(e,"height","24"),c(e,"viewBox","0 0 24 24"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){R(o,e,l),v(e,r),v(e,n)},d(o){o&&I(e)}}}function ht(t){let e,r=t[9].label+"",n;return{c(){e=p("label"),c(e,"for",n=t[3]+"_checkbox"),c(e,"class","svelte-vuofbg")},m(o,l){R(o,e,l),e.innerHTML=r},p(o,l){l[0]&512&&r!==(r=o[9].label+"")&&(e.innerHTML=r),l[0]&8&&n!==(n=o[3]+"_checkbox")&&c(e,"for",n)},d(o){o&&I(e)}}}function dt(t){let e,r=t[9].verifying+"";return{c(){e=p("span")},m(n,o){R(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].verifying+"")&&(e.innerHTML=r)},d(n){n&&I(e)}}}function gt(t){let e,r=t[9].verified+"",n,o;return{c(){e=p("span"),n=O(),o=p("input"),c(o,"type","hidden"),c(o,"name",t[3]),o.value=t[4]},m(l,s){R(l,e,s),e.innerHTML=r,R(l,n,s),R(l,o,s)},p(l,s){s[0]&512&&r!==(r=l[9].verified+"")&&(e.innerHTML=r),s[0]&8&&c(o,"name",l[3]),s[0]&16&&(o.value=l[4])},d(l){l&&(I(e),I(n),I(o))}}}function ye(t){let e,r,n,o,l,s;return{c(){e=p("div"),r=p("a"),n=V("svg"),o=V("path"),l=V("path"),s=V("path"),c(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),c(o,"fill","currentColor"),c(l,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),c(l,"fill","currentColor"),c(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),c(s,"fill","currentColor"),c(n,"width","22"),c(n,"height","22"),c(n,"viewBox","0 0 20 20"),c(n,"fill","none"),c(n,"xmlns","http://www.w3.org/2000/svg"),c(r,"href",Ee),c(r,"target","_blank"),c(r,"class","altcha-logo svelte-vuofbg")},m(u,a){R(u,e,a),v(e,r),v(r,n),v(n,o),v(n,l),v(n,s)},p:_,d(u){u&&I(e)}}}function ke(t){let e,r,n,o;function l(a,f){return a[5]===b.EXPIRED?mt:bt}let s=l(t),u=s(t);return{c(){e=p("div"),r=V("svg"),n=V("path"),o=O(),u.c(),c(n,"stroke-linecap","round"),c(n,"stroke-linejoin","round"),c(n,"d","M6 18L18 6M6 6l12 12"),c(r,"width","14"),c(r,"height","14"),c(r,"xmlns","http://www.w3.org/2000/svg"),c(r,"fill","none"),c(r,"viewBox","0 0 24 24"),c(r,"stroke-width","1.5"),c(r,"stroke","currentColor"),c(e,"class","altcha-error svelte-vuofbg")},m(a,f){R(a,e,f),v(e,r),v(r,n),v(e,o),u.m(e,null)},p(a,f){s===(s=l(a))&&u?u.p(a,f):(u.d(1),u=s(a),u&&(u.c(),u.m(e,null)))},d(a){a&&I(e),u.d()}}}function bt(t){let e,r=t[9].error+"";return{c(){e=p("div"),c(e,"title",t[8])},m(n,o){R(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].error+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&I(e)}}}function mt(t){let e,r=t[9].expired+"";return{c(){e=p("div"),c(e,"title",t[8])},m(n,o){R(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].expired+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&I(e)}}}function $e(t){let e,r,n=t[9].footer+"";return{c(){e=p("div"),r=p("div"),c(r,"class","svelte-vuofbg"),c(e,"class","altcha-footer svelte-vuofbg")},m(o,l){R(o,e,l),v(e,r),r.innerHTML=n},p(o,l){l[0]&512&&n!==(n=o[9].footer+"")&&(r.innerHTML=n)},d(o){o&&I(e)}}}function vt(t){let e,r,n,o,l,s,u,a,f,E,w,j,S,M,y=t[5]===b.VERIFYING&&pe();function F(h,d){return h[5]===b.VERIFIED?gt:h[5]===b.VERIFYING?dt:ht}let T=F(t),x=T(t),k=t[2]!==!0&&ye(),$=(t[8]||t[5]===b.EXPIRED)&&ke(t),m=t[9].footer&&t[1]!==!0&&$e(t);return{c(){e=p("div"),r=p("div"),y&&y.c(),n=O(),o=p("div"),l=p("input"),a=O(),f=p("div"),x.c(),E=O(),k&&k.c(),w=O(),$&&$.c(),j=O(),m&&m.c(),c(l,"type","checkbox"),c(l,"id",s=t[3]+"_checkbox"),l.required=u=t[0]!=="onsubmit",c(l,"class","svelte-vuofbg"),c(o,"class","altcha-checkbox svelte-vuofbg"),he(o,"altcha-hidden",t[5]===b.VERIFYING),c(f,"class","altcha-label svelte-vuofbg"),c(r,"class","altcha-main svelte-vuofbg"),c(e,"class","altcha svelte-vuofbg"),c(e,"data-state",t[5])},m(h,d){R(h,e,d),v(e,r),y&&y.m(r,null),v(r,n),v(r,o),v(o,l),l.checked=t[6],v(r,a),v(r,f),x.m(f,null),v(r,E),k&&k.m(r,null),v(e,w),$&&$.m(e,null),v(e,j),m&&m.m(e,null),t[26](e),S||(M=[te(l,"change",t[25]),te(l,"change",t[10]),te(l,"invalid",t[11])],S=!0)},p(h,d){h[5]===b.VERIFYING?y||(y=pe(),y.c(),y.m(r,n)):y&&(y.d(1),y=null),d[0]&8&&s!==(s=h[3]+"_checkbox")&&c(l,"id",s),d[0]&1&&u!==(u=h[0]!=="onsubmit")&&(l.required=u),d[0]&64&&(l.checked=h[6]),d[0]&32&&he(o,"altcha-hidden",h[5]===b.VERIFYING),T===(T=F(h))&&x?x.p(h,d):(x.d(1),x=T(h),x&&(x.c(),x.m(f,null))),h[2]!==!0?k?k.p(h,d):(k=ye(),k.c(),k.m(r,null)):k&&(k.d(1),k=null),h[8]||h[5]===b.EXPIRED?$?$.p(h,d):($=ke(h),$.c(),$.m(e,j)):$&&($.d(1),$=null),h[9].footer&&h[1]!==!0?m?m.p(h,d):(m=$e(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null),d[0]&32&&c(e,"data-state",h[5])},i:_,o:_,d(h){h&&I(e),y&&y.d(),x.d(),k&&k.d(),$&&$.d(),m&&m.d(),t[26](null),S=!1,B(M)}}}const Ee="https://altcha.org/";function xe(t){return JSON.parse(t)}function wt(t,e,r){let n,o,l,{auto:s=void 0}=e,{challengeurl:u=void 0}=e,{challengejson:a=void 0}=e,{debug:f=!1}=e,{expire:E=void 0}=e,{hidefooter:w=!1}=e,{hidelogo:j=!1}=e,{name:S="altcha"}=e,{maxnumber:M=1e6}=e,{mockerror:y=!1}=e,{strings:F=void 0}=e,{test:T=!1}=e,{workers:x=navigator.hardwareConcurrency||8}=e;const k=Ye(),$=["SHA-256","SHA-384","SHA-512"];let m=!1,h,d=null,se=null,X=null,Z=b.UNVERIFIED,ce;Xe(()=>{d&&(d.removeEventListener("submit",Le),d.removeEventListener("reset",Ie),d=null)}),De(()=>{L("mounted","0.2.0"),L("workers",x),T&&L("using test mode"),E&&ue(E),s!==void 0&&L("auto",s),d=h.closest("form"),d&&(d.addEventListener("submit",Le),d.addEventListener("reset",Ie)),s==="onload"&&Y()});function L(...i){(f||i.some(g=>g instanceof Error))&&console[i[0]instanceof Error?"error":"log"]("ALTCHA",...i)}function Le(i){d&&s==="onsubmit"&&Z===b.UNVERIFIED&&(i.preventDefault(),i.stopPropagation(),Y().then(()=>{d==null||d.requestSubmit()}))}function Ie(){z()}function _t(i,g){return btoa(JSON.stringify({algorithm:i.algorithm,challenge:i.challenge,number:g.number,salt:i.salt,signature:i.signature,test:T?!0:void 0,took:g.took}))}function Re(i){if(!i.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(i.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!$.includes(i.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${$.join(", ")}`);if(!i.challenge||i.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!i.salt||i.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function pt(){if(y)throw L("mocking error"),new Error("Mocked error.");if(n)return L("using provided json data"),n;if(T)return L("generating test challenge"),ut();{if(!u)throw new Error("Attribute challengeurl not set.");L("fetching challenge from",u);const i=await fetch(u);if(i.status!==200)throw new Error(`Server responded with ${i.status}.`);const g=i.headers.get("Expires");if(g!=null&&g.length){const K=Date.parse(g);isNaN(K)||ue(K-Date.now())}return i.json()}}function Ne(){u&&Z===b.VERIFIED?Y():z(b.EXPIRED,l.expired)}async function yt(i){let g=null;if("Worker"in window){try{g=await kt(i.challenge,i.salt,i.algorithm)}catch(K){L(K)}if((g==null?void 0:g.number)!==void 0)return{data:i,solution:g}}return{data:i,solution:await ft(i.challenge,i.salt,i.algorithm,M).promise}}async function kt(i,g,K,q=Math.ceil(x)){const ee=[];if(q<1)throw new Error("Wrong number of workers configured.");if(q>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let G=0;G<q;G++)ee.push(new lt);const je=Math.ceil(M/q),It=await Promise.all(ee.map((G,Rt)=>{const Ae=Rt*je;return new Promise(Nt=>{G.addEventListener("message",Me=>{if(Me.data)for(const Te of ee)Te!==G&&Te.postMessage({type:"abort"});Nt(Me.data)}),G.postMessage({payload:{alg:K,challenge:i,max:Ae+je,salt:g,start:Ae},type:"work"})})}));for(const G of ee)G.terminate();return It.find(G=>!!G)||null}function $t(){[b.UNVERIFIED,b.ERROR,b.EXPIRED].includes(Z)?Y():r(6,m=!0)}function Et(){Z===b.VERIFYING&&alert(l.waitAlert)}function ue(i){console.log(">>>"),L("expire",i),clearTimeout(ce),i<1?Ne():ce=setTimeout(Ne,i)}function xt(i){i.auto!==void 0&&(r(0,s=i.auto),s==="onload"&&Y()),i.expire!==void 0&&(ue(i.expire),r(13,E=i.expire)),i.challenge&&(Re(i.challenge),n=i.challenge),i.debug!==void 0&&r(12,f=!!i.debug),i.hidefooter!==void 0&&r(1,w=!!i.hidefooter),i.hidelogo!==void 0&&r(2,j=!!i.hidelogo),i.maxnumber!==void 0&&r(14,M=+i.maxnumber),i.mockerror!==void 0&&r(15,y=!!i.mockerror),i.name!==void 0&&r(3,S=i.name),i.test!==void 0&&r(16,T=!!i.test),i.strings&&r(24,o=i.strings),i.workers!==void 0&&r(17,x=+i.workers)}function z(i=b.UNVERIFIED,g=null){clearTimeout(ce),r(6,m=!1),r(8,se=g),r(4,X=null),r(5,Z=i)}async function Y(){return z(b.VERIFYING),pt().then(i=>(Re(i),L("challenge",i),yt(i))).then(({data:i,solution:g})=>{if(L("solution",g),(g==null?void 0:g.number)!==void 0)L("verified"),r(5,Z=b.VERIFIED),r(6,m=!0),r(4,X=_t(i,g)),L("payload",X),Ke().then(()=>{k("verified",{payload:X})});else throw new Error("Unexpected result returned.")}).catch(i=>{L(i),r(5,Z=b.ERROR),r(6,m=!1),r(8,se=i.message)})}function Ct(){m=this.checked,r(6,m)}function Lt(i){ne[i?"unshift":"push"](()=>{h=i,r(7,h)})}return t.$$set=i=>{"auto"in i&&r(0,s=i.auto),"challengeurl"in i&&r(18,u=i.challengeurl),"challengejson"in i&&r(19,a=i.challengejson),"debug"in i&&r(12,f=i.debug),"expire"in i&&r(13,E=i.expire),"hidefooter"in i&&r(1,w=i.hidefooter),"hidelogo"in i&&r(2,j=i.hidelogo),"name"in i&&r(3,S=i.name),"maxnumber"in i&&r(14,M=i.maxnumber),"mockerror"in i&&r(15,y=i.mockerror),"strings"in i&&r(20,F=i.strings),"test"in i&&r(16,T=i.test),"workers"in i&&r(17,x=i.workers)},t.$$.update=()=>{t.$$.dirty[0]&524288&&(n=a?xe(a):void 0),t.$$.dirty[0]&1048576&&r(24,o=F?xe(F):{}),t.$$.dirty[0]&16777216&&r(9,l={error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${Ee}" target="_blank">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),t.$$.dirty[0]&48&&k("statechange",{payload:X,state:Z})},[s,w,j,S,X,Z,m,h,se,l,$t,Et,f,E,M,y,T,x,u,a,F,xt,z,Y,o,Ct,Lt]}class Ce extends nt{constructor(e){super(),tt(this,e,wt,vt,Se,{auto:0,challengeurl:18,challengejson:19,debug:12,expire:13,hidefooter:1,hidelogo:2,name:3,maxnumber:14,mockerror:15,strings:20,test:16,workers:17,configure:21,reset:22,verify:23},at,[-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),C()}get challengeurl(){return this.$$.ctx[18]}set challengeurl(e){this.$$set({challengeurl:e}),C()}get challengejson(){return this.$$.ctx[19]}set challengejson(e){this.$$set({challengejson:e}),C()}get debug(){return this.$$.ctx[12]}set debug(e){this.$$set({debug:e}),C()}get expire(){return this.$$.ctx[13]}set expire(e){this.$$set({expire:e}),C()}get hidefooter(){return this.$$.ctx[1]}set hidefooter(e){this.$$set({hidefooter:e}),C()}get hidelogo(){return this.$$.ctx[2]}set hidelogo(e){this.$$set({hidelogo:e}),C()}get name(){return this.$$.ctx[3]}set name(e){this.$$set({name:e}),C()}get maxnumber(){return this.$$.ctx[14]}set maxnumber(e){this.$$set({maxnumber:e}),C()}get mockerror(){return this.$$.ctx[15]}set mockerror(e){this.$$set({mockerror:e}),C()}get strings(){return this.$$.ctx[20]}set strings(e){this.$$set({strings:e}),C()}get test(){return this.$$.ctx[16]}set test(e){this.$$set({test:e}),C()}get workers(){return this.$$.ctx[17]}set workers(e){this.$$set({workers:e}),C()}get configure(){return this.$$.ctx[21]}get reset(){return this.$$.ctx[22]}get verify(){return this.$$.ctx[23]}}customElements.define("altcha-widget",rt(Ce,{auto:{},challengeurl:{},challengejson:{},debug:{type:"Boolean"},expire:{},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},name:{},maxnumber:{},mockerror:{type:"Boolean"},strings:{},test:{type:"Boolean"},workers:{}},[],["configure","reset","verify"],!1)),N.Altcha=Ce,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(N,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(N=typeof globalThis<"u"?globalThis:N||self,_(N.altcha={}))})(this,function(N){"use strict";var Tt=Object.defineProperty;var Mt=(N,_,H)=>_ in N?Tt(N,_,{enumerable:!0,configurable:!0,writable:!0,value:H}):N[_]=H;var M=(N,_,H)=>(Mt(N,typeof _!="symbol"?_+"":_,H),H);function _(){}function H(t){return t()}function fe(){return Object.create(null)}function X(t){t.forEach(H)}function ae(t){return typeof t=="function"}function Ae(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Ge(t){return Object.keys(t).length===0}function v(t,e){t.appendChild(e)}function Ve(t,e,r){const n=Ze(t);if(!n.getElementById(e)){const o=p("style");o.id=e,o.textContent=r,He(n,o)}}function Ze(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function He(t,e){return v(t.head||t,e),e.sheet}function I(t,e,r){t.insertBefore(e,r||null)}function R(t){t.parentNode&&t.parentNode.removeChild(t)}function p(t){return document.createElement(t)}function V(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Pe(t){return document.createTextNode(t)}function P(){return Pe(" ")}function te(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function c(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Fe(t){return Array.from(t.childNodes)}function he(t,e,r){t.classList.toggle(e,!!r)}function Oe(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}function We(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}let K;function J(t){K=t}function re(){if(!K)throw new Error("Function called outside component initialization");return K}function De(t){re().$$.on_mount.push(t)}function Ye(t){re().$$.on_destroy.push(t)}function Be(){const t=re();return(e,r,{cancelable:n=!1}={})=>{const o=t.$$.callbacks[e];if(o){const l=Oe(e,r,{cancelable:n});return o.slice().forEach(s=>{s.call(t,l)}),!l.defaultPrevented}return!0}}const O=[],ne=[];let W=[];const de=[],ge=Promise.resolve();let ie=!1;function be(){ie||(ie=!0,ge.then(C))}function Ue(){return be(),ge}function oe(t){W.push(t)}const le=new Set;let D=0;function C(){if(D!==0)return;const t=K;do{try{for(;D<O.length;){const e=O[D];D++,J(e),Xe(e.$$)}}catch(e){throw O.length=0,D=0,e}for(J(null),O.length=0,D=0;ne.length;)ne.pop()();for(let e=0;e<W.length;e+=1){const r=W[e];le.has(r)||(le.add(r),r())}W.length=0}while(O.length);for(;de.length;)de.pop()();ie=!1,le.clear(),J(t)}function Xe(t){if(t.fragment!==null){t.update(),X(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(oe)}}function Ke(t){const e=[],r=[];W.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),W=e}const Je=new Set;function ze(t,e){t&&t.i&&(Je.delete(t),t.i(e))}function Qe(t,e,r){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,r),oe(()=>{const l=t.$$.on_mount.map(H).filter(ae);t.$$.on_destroy?t.$$.on_destroy.push(...l):X(l),t.$$.on_mount=[]}),o.forEach(oe)}function qe(t,e){const r=t.$$;r.fragment!==null&&(Ke(r.after_update),X(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function et(t,e){t.$$.dirty[0]===-1&&(O.push(t),be(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function tt(t,e,r,n,o,l,s=null,u=[-1]){const a=K;J(t);const f=t.$$={fragment:null,ctx:[],props:l,update:_,not_equal:o,bound:fe(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:fe(),dirty:u,skip_bound:!1,root:e.target||a.$$.root};s&&s(f.root);let E=!1;if(f.ctx=r?r(t,e.props||{},(w,T,...A)=>{const S=A.length?A[0]:T;return f.ctx&&o(f.ctx[w],f.ctx[w]=S)&&(!f.skip_bound&&f.bound[w]&&f.bound[w](S),E&&et(t,w)),T}):[],f.update(),E=!0,X(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const w=Fe(e.target);f.fragment&&f.fragment.l(w),w.forEach(R)}else f.fragment&&f.fragment.c();e.intro&&ze(t.$$.fragment),Qe(t,e.target,e.anchor),C()}J(a)}let me;typeof HTMLElement=="function"&&(me=class extends HTMLElement{constructor(e,r,n){super();M(this,"$$ctor");M(this,"$$s");M(this,"$$c");M(this,"$$cn",!1);M(this,"$$d",{});M(this,"$$r",!1);M(this,"$$p_d",{});M(this,"$$l",{});M(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=r,n&&this.attachShadow({mode:"open"})}addEventListener(e,r,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){const o=this.$$c.$on(e,r);this.$$l_u.set(r,o)}super.addEventListener(e,r,n)}removeEventListener(e,r,n){if(super.removeEventListener(e,r,n),this.$$c){const o=this.$$l_u.get(r);o&&(o(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let s;return{c:function(){s=p("slot"),l!=="default"&&c(s,"name",l)},m:function(f,E){I(f,s,E)},d:function(f){f&&R(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},n=We(this);for(const l of this.$$s)l in n&&(r[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=z(s,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const s=z(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const s of this.$$l[l]){const u=this.$$c.$on(l,s);this.$$l_u.set(s,u)}this.$$l={}}}attributeChangedCallback(e,r,n){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=z(e,n,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function z(t,e,r,n){var l;const o=(l=r[t])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function rt(t,e,r,n,o,l){let s=class extends me{constructor(){super(t,r,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(u=>(e[u].attribute||u).toLowerCase())}};return Object.keys(e).forEach(u=>{Object.defineProperty(s.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(a){var f;a=z(u,a,e),this.$$d[u]=a,(f=this.$$c)==null||f.$set({[u]:a})}})}),n.forEach(u=>{Object.defineProperty(s.prototype,u,{get(){var a;return(a=this.$$c)==null?void 0:a[u]}})}),l&&(s=l(s)),t.element=s,s}class nt{constructor(){M(this,"$$");M(this,"$$set")}$destroy(){qe(this,1),this.$destroy=_}$on(e,r){if(!ae(r))return _;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const o=n.indexOf(r);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!Ge(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const it="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(it);const ve="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGcodCl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KHQpXS5tYXAoZT0+ZS50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBoKHQsZSxvKXtyZXR1cm4gZyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUodCtlKSkpfWZ1bmN0aW9uIG0odCxlLG89IlNIQS0yNTYiLGk9MWU2LHA9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyO3JldHVybntwcm9taXNlOm5ldyBQcm9taXNlKChzLGMpPT57Y29uc3Qgcj1EYXRlLm5vdygpLGQ9bD0+e2Euc2lnbmFsLmFib3J0ZWR8fGw+aT9zKG51bGwpOmgoZSxsLG8pLnRoZW4odz0+e3c9PT10P3Moe251bWJlcjpsLHRvb2s6RGF0ZS5ub3coKS1yfSk6ZChsKzEpfSkuY2F0Y2goYyl9O2QocCl9KSxjb250cm9sbGVyOmF9fWxldCBuO29ubWVzc2FnZT1hc3luYyB0PT57Y29uc3R7dHlwZTplLHBheWxvYWQ6b309dC5kYXRhO2lmKGU9PT0iYWJvcnQiKW49PW51bGx8fG4uYWJvcnQoKSxuPXZvaWQgMDtlbHNlIGlmKGU9PT0id29yayIpe2NvbnN0e2FsZzppLGNoYWxsZW5nZTpwLG1heDphLHNhbHQ6dSxzdGFydDpzfT1vfHx7fSxjPW0ocCx1LGksYSxzKTtuPWMuY29udHJvbGxlcixjLnByb21pc2UudGhlbihyPT57c2VsZi5wb3N0TWVzc2FnZShyJiZ7Li4ucix3b3JrZXI6ITB9KX0pfX19KSgpOwo=",ot=t=>Uint8Array.from(atob(t),e=>e.charCodeAt(0)),we=typeof window<"u"&&window.Blob&&new Blob([ot(ve)],{type:"text/javascript;charset=utf-8"});function lt(t){let e;try{if(e=we&&(window.URL||window.webkitURL).createObjectURL(we),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;base64,"+ve,{name:t==null?void 0:t.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const st=new TextEncoder;function ct(t){return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function ut(t,e="SHA-256",r=1e5){const n=Date.now().toString(16);t||(t=Math.round(Math.random()*r));const o=await _e(n,t,e);return{algorithm:e,challenge:o,salt:n,signature:""}}async function _e(t,e,r){return ct(await crypto.subtle.digest(r.toUpperCase(),st.encode(t+e)))}function ft(t,e,r="SHA-256",n=1e6,o=0){const l=new AbortController;return{promise:new Promise((u,a)=>{const f=Date.now(),E=w=>{l.signal.aborted||w>n?u(null):_e(e,w,r).then(T=>{T===t?u({number:w,took:Date.now()-f}):E(w+1)}).catch(a)};E(o)}),controller:l}}var b=(t=>(t.ERROR="error",t.VERIFIED="verified",t.VERIFYING="verifying",t.UNVERIFIED="unverified",t.EXPIRED="expired",t))(b||{});function at(t){Ve(t,"svelte-vuofbg",".altcha.svelte-vuofbg.svelte-vuofbg{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-vuofbg.svelte-vuofbg:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-vuofbg.svelte-vuofbg{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-vuofbg.svelte-vuofbg{flex-grow:1}.altcha-label.svelte-vuofbg label.svelte-vuofbg{cursor:pointer}.altcha-logo.svelte-vuofbg.svelte-vuofbg{color:currentColor;opacity:0.3}.altcha-logo.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-error.svelte-vuofbg.svelte-vuofbg{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-vuofbg.svelte-vuofbg{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-footer.svelte-vuofbg>.svelte-vuofbg:first-child{flex-grow:1}.altcha-footer.svelte-vuofbg a{color:currentColor}.altcha-checkbox.svelte-vuofbg.svelte-vuofbg{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-vuofbg input.svelte-vuofbg{width:18px;height:18px;margin:0}.altcha-hidden.svelte-vuofbg.svelte-vuofbg{display:none}.altcha-spinner.svelte-vuofbg.svelte-vuofbg{animation:svelte-vuofbg-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-vuofbg-altcha-spinner{100%{transform:rotate(360deg)}}")}function pe(t){let e,r,n;return{c(){e=V("svg"),r=V("path"),n=V("path"),c(r,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),c(r,"fill","currentColor"),c(r,"opacity",".25"),c(n,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),c(n,"fill","currentColor"),c(n,"class","altcha-spinner svelte-vuofbg"),c(e,"width","24"),c(e,"height","24"),c(e,"viewBox","0 0 24 24"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){I(o,e,l),v(e,r),v(e,n)},d(o){o&&R(e)}}}function ht(t){let e,r=t[9].label+"",n;return{c(){e=p("label"),c(e,"for",n=t[3]+"_checkbox"),c(e,"class","svelte-vuofbg")},m(o,l){I(o,e,l),e.innerHTML=r},p(o,l){l[0]&512&&r!==(r=o[9].label+"")&&(e.innerHTML=r),l[0]&8&&n!==(n=o[3]+"_checkbox")&&c(e,"for",n)},d(o){o&&R(e)}}}function dt(t){let e,r=t[9].verifying+"";return{c(){e=p("span")},m(n,o){I(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].verifying+"")&&(e.innerHTML=r)},d(n){n&&R(e)}}}function gt(t){let e,r=t[9].verified+"",n,o;return{c(){e=p("span"),n=P(),o=p("input"),c(o,"type","hidden"),c(o,"name",t[3]),o.value=t[4]},m(l,s){I(l,e,s),e.innerHTML=r,I(l,n,s),I(l,o,s)},p(l,s){s[0]&512&&r!==(r=l[9].verified+"")&&(e.innerHTML=r),s[0]&8&&c(o,"name",l[3]),s[0]&16&&(o.value=l[4])},d(l){l&&(R(e),R(n),R(o))}}}function ye(t){let e,r,n,o,l,s;return{c(){e=p("div"),r=p("a"),n=V("svg"),o=V("path"),l=V("path"),s=V("path"),c(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),c(o,"fill","currentColor"),c(l,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),c(l,"fill","currentColor"),c(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),c(s,"fill","currentColor"),c(n,"width","22"),c(n,"height","22"),c(n,"viewBox","0 0 20 20"),c(n,"fill","none"),c(n,"xmlns","http://www.w3.org/2000/svg"),c(r,"href",Ee),c(r,"target","_blank"),c(r,"class","altcha-logo svelte-vuofbg")},m(u,a){I(u,e,a),v(e,r),v(r,n),v(n,o),v(n,l),v(n,s)},p:_,d(u){u&&R(e)}}}function $e(t){let e,r,n,o;function l(a,f){return a[5]===b.EXPIRED?mt:bt}let s=l(t),u=s(t);return{c(){e=p("div"),r=V("svg"),n=V("path"),o=P(),u.c(),c(n,"stroke-linecap","round"),c(n,"stroke-linejoin","round"),c(n,"d","M6 18L18 6M6 6l12 12"),c(r,"width","14"),c(r,"height","14"),c(r,"xmlns","http://www.w3.org/2000/svg"),c(r,"fill","none"),c(r,"viewBox","0 0 24 24"),c(r,"stroke-width","1.5"),c(r,"stroke","currentColor"),c(e,"class","altcha-error svelte-vuofbg")},m(a,f){I(a,e,f),v(e,r),v(r,n),v(e,o),u.m(e,null)},p(a,f){s===(s=l(a))&&u?u.p(a,f):(u.d(1),u=s(a),u&&(u.c(),u.m(e,null)))},d(a){a&&R(e),u.d()}}}function bt(t){let e,r=t[9].error+"";return{c(){e=p("div"),c(e,"title",t[8])},m(n,o){I(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].error+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&R(e)}}}function mt(t){let e,r=t[9].expired+"";return{c(){e=p("div"),c(e,"title",t[8])},m(n,o){I(n,e,o),e.innerHTML=r},p(n,o){o[0]&512&&r!==(r=n[9].expired+"")&&(e.innerHTML=r),o[0]&256&&c(e,"title",n[8])},d(n){n&&R(e)}}}function ke(t){let e,r,n=t[9].footer+"";return{c(){e=p("div"),r=p("div"),c(r,"class","svelte-vuofbg"),c(e,"class","altcha-footer svelte-vuofbg")},m(o,l){I(o,e,l),v(e,r),r.innerHTML=n},p(o,l){l[0]&512&&n!==(n=o[9].footer+"")&&(r.innerHTML=n)},d(o){o&&R(e)}}}function vt(t){let e,r,n,o,l,s,u,a,f,E,w,T,A,S,y=t[5]===b.VERIFYING&&pe();function F(h,d){return h[5]===b.VERIFIED?gt:h[5]===b.VERIFYING?dt:ht}let j=F(t),x=j(t),$=t[2]!==!0&&ye(),k=(t[8]||t[5]===b.EXPIRED)&&$e(t),m=t[9].footer&&t[1]!==!0&&ke(t);return{c(){e=p("div"),r=p("div"),y&&y.c(),n=P(),o=p("div"),l=p("input"),a=P(),f=p("div"),x.c(),E=P(),$&&$.c(),w=P(),k&&k.c(),T=P(),m&&m.c(),c(l,"type","checkbox"),c(l,"id",s=t[3]+"_checkbox"),l.required=u=t[0]!=="onsubmit",c(l,"class","svelte-vuofbg"),c(o,"class","altcha-checkbox svelte-vuofbg"),he(o,"altcha-hidden",t[5]===b.VERIFYING),c(f,"class","altcha-label svelte-vuofbg"),c(r,"class","altcha-main svelte-vuofbg"),c(e,"class","altcha svelte-vuofbg"),c(e,"data-state",t[5])},m(h,d){I(h,e,d),v(e,r),y&&y.m(r,null),v(r,n),v(r,o),v(o,l),l.checked=t[6],v(r,a),v(r,f),x.m(f,null),v(r,E),$&&$.m(r,null),v(e,w),k&&k.m(e,null),v(e,T),m&&m.m(e,null),t[26](e),A||(S=[te(l,"change",t[25]),te(l,"change",t[10]),te(l,"invalid",t[11])],A=!0)},p(h,d){h[5]===b.VERIFYING?y||(y=pe(),y.c(),y.m(r,n)):y&&(y.d(1),y=null),d[0]&8&&s!==(s=h[3]+"_checkbox")&&c(l,"id",s),d[0]&1&&u!==(u=h[0]!=="onsubmit")&&(l.required=u),d[0]&64&&(l.checked=h[6]),d[0]&32&&he(o,"altcha-hidden",h[5]===b.VERIFYING),j===(j=F(h))&&x?x.p(h,d):(x.d(1),x=j(h),x&&(x.c(),x.m(f,null))),h[2]!==!0?$?$.p(h,d):($=ye(),$.c(),$.m(r,null)):$&&($.d(1),$=null),h[8]||h[5]===b.EXPIRED?k?k.p(h,d):(k=$e(h),k.c(),k.m(e,T)):k&&(k.d(1),k=null),h[9].footer&&h[1]!==!0?m?m.p(h,d):(m=ke(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null),d[0]&32&&c(e,"data-state",h[5])},i:_,o:_,d(h){h&&R(e),y&&y.d(),x.d(),$&&$.d(),k&&k.d(),m&&m.d(),t[26](null),A=!1,X(S)}}}const Ee="https://altcha.org/";function xe(t){return JSON.parse(t)}function wt(t,e,r){let n,o,l,{auto:s=void 0}=e,{challengeurl:u=void 0}=e,{challengejson:a=void 0}=e,{debug:f=!1}=e,{expire:E=void 0}=e,{hidefooter:w=!1}=e,{hidelogo:T=!1}=e,{name:A="altcha"}=e,{maxnumber:S=1e6}=e,{mockerror:y=!1}=e,{strings:F=void 0}=e,{test:j=!1}=e,{workers:x=navigator.hardwareConcurrency||8}=e;const $=Be(),k=["SHA-256","SHA-384","SHA-512"];let m=!1,h,d=null,se=null,Y=null,Z=b.UNVERIFIED,ce;Ye(()=>{d&&(d.removeEventListener("submit",Le),d.removeEventListener("reset",Re),d=null)}),De(()=>{L("mounted","0.2.1"),L("workers",x),j&&L("using test mode"),E&&ue(E),s!==void 0&&L("auto",s),d=h.closest("form"),d&&(d.addEventListener("submit",Le),d.addEventListener("reset",Re)),s==="onload"&&B()});function L(...i){(f||i.some(g=>g instanceof Error))&&console[i[0]instanceof Error?"error":"log"]("ALTCHA",...i)}function Le(i){d&&s==="onsubmit"&&Z===b.UNVERIFIED&&(i.preventDefault(),i.stopPropagation(),B().then(()=>{d==null||d.requestSubmit()}))}function Re(){Q()}function _t(i,g){return btoa(JSON.stringify({algorithm:i.algorithm,challenge:i.challenge,number:g.number,salt:i.salt,signature:i.signature,test:j?!0:void 0,took:g.took}))}function Ie(i){if(!i.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(i.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!k.includes(i.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${k.join(", ")}`);if(!i.challenge||i.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!i.salt||i.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function pt(){if(y)throw L("mocking error"),new Error("Mocked error.");if(n)return L("using provided json data"),n;if(j)return L("generating test challenge"),ut();{if(!u)throw new Error("Attribute challengeurl not set.");L("fetching challenge from",u);const i=await fetch(u);if(i.status!==200)throw new Error(`Server responded with ${i.status}.`);const g=i.headers.get("Expires");if(g!=null&&g.length){const U=Date.parse(g);isNaN(U)||ue(U-Date.now())}return i.json()}}function Ne(){u&&Z===b.VERIFIED?B():Q(b.EXPIRED,l.expired)}async function yt(i){let g=null;if("Worker"in window){try{g=await $t(i.challenge,i.salt,i.algorithm)}catch(U){L(U)}if((g==null?void 0:g.number)!==void 0)return{data:i,solution:g}}return{data:i,solution:await ft(i.challenge,i.salt,i.algorithm,S).promise}}async function $t(i,g,U,q=Math.ceil(x)){const ee=[];if(q<1)throw new Error("Wrong number of workers configured.");if(q>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let G=0;G<q;G++)ee.push(new lt);const Te=Math.ceil(S/q),Rt=await Promise.all(ee.map((G,It)=>{const Me=It*Te;return new Promise(Nt=>{G.addEventListener("message",Se=>{if(Se.data)for(const je of ee)je!==G&&je.postMessage({type:"abort"});Nt(Se.data)}),G.postMessage({payload:{alg:U,challenge:i,max:Me+Te,salt:g,start:Me},type:"work"})})}));for(const G of ee)G.terminate();return Rt.find(G=>!!G)||null}function kt(){[b.UNVERIFIED,b.ERROR,b.EXPIRED].includes(Z)?B():r(6,m=!0)}function Et(){Z===b.VERIFYING&&alert(l.waitAlert)}function ue(i){console.log(">>>"),L("expire",i),clearTimeout(ce),i<1?Ne():ce=setTimeout(Ne,i)}function xt(i){i.auto!==void 0&&(r(0,s=i.auto),s==="onload"&&B()),i.expire!==void 0&&(ue(i.expire),r(13,E=i.expire)),i.challenge&&(Ie(i.challenge),n=i.challenge),i.debug!==void 0&&r(12,f=!!i.debug),i.hidefooter!==void 0&&r(1,w=!!i.hidefooter),i.hidelogo!==void 0&&r(2,T=!!i.hidelogo),i.maxnumber!==void 0&&r(14,S=+i.maxnumber),i.mockerror!==void 0&&r(15,y=!!i.mockerror),i.name!==void 0&&r(3,A=i.name),i.test!==void 0&&r(16,j=!!i.test),i.strings&&r(24,o=i.strings),i.workers!==void 0&&r(17,x=+i.workers)}function Q(i=b.UNVERIFIED,g=null){clearTimeout(ce),r(6,m=!1),r(8,se=g),r(4,Y=null),r(5,Z=i)}async function B(){return Q(b.VERIFYING),pt().then(i=>(Ie(i),L("challenge",i),yt(i))).then(({data:i,solution:g})=>{if(L("solution",g),(g==null?void 0:g.number)!==void 0)L("verified"),r(5,Z=b.VERIFIED),r(6,m=!0),r(4,Y=_t(i,g)),L("payload",Y),Ue().then(()=>{$("verified",{payload:Y})});else throw new Error("Unexpected result returned.")}).catch(i=>{L(i),r(5,Z=b.ERROR),r(6,m=!1),r(8,se=i.message)})}function Ct(){m=this.checked,r(6,m)}function Lt(i){ne[i?"unshift":"push"](()=>{h=i,r(7,h)})}return t.$$set=i=>{"auto"in i&&r(0,s=i.auto),"challengeurl"in i&&r(18,u=i.challengeurl),"challengejson"in i&&r(19,a=i.challengejson),"debug"in i&&r(12,f=i.debug),"expire"in i&&r(13,E=i.expire),"hidefooter"in i&&r(1,w=i.hidefooter),"hidelogo"in i&&r(2,T=i.hidelogo),"name"in i&&r(3,A=i.name),"maxnumber"in i&&r(14,S=i.maxnumber),"mockerror"in i&&r(15,y=i.mockerror),"strings"in i&&r(20,F=i.strings),"test"in i&&r(16,j=i.test),"workers"in i&&r(17,x=i.workers)},t.$$.update=()=>{t.$$.dirty[0]&524288&&(n=a?xe(a):void 0),t.$$.dirty[0]&1048576&&r(24,o=F?xe(F):{}),t.$$.dirty[0]&16777216&&r(9,l={error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${Ee}" target="_blank">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),t.$$.dirty[0]&48&&$("statechange",{payload:Y,state:Z})},[s,w,T,A,Y,Z,m,h,se,l,kt,Et,f,E,S,y,j,x,u,a,F,xt,Q,B,o,Ct,Lt]}class Ce extends nt{constructor(e){super(),tt(this,e,wt,vt,Ae,{auto:0,challengeurl:18,challengejson:19,debug:12,expire:13,hidefooter:1,hidelogo:2,name:3,maxnumber:14,mockerror:15,strings:20,test:16,workers:17,configure:21,reset:22,verify:23},at,[-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),C()}get challengeurl(){return this.$$.ctx[18]}set challengeurl(e){this.$$set({challengeurl:e}),C()}get challengejson(){return this.$$.ctx[19]}set challengejson(e){this.$$set({challengejson:e}),C()}get debug(){return this.$$.ctx[12]}set debug(e){this.$$set({debug:e}),C()}get expire(){return this.$$.ctx[13]}set expire(e){this.$$set({expire:e}),C()}get hidefooter(){return this.$$.ctx[1]}set hidefooter(e){this.$$set({hidefooter:e}),C()}get hidelogo(){return this.$$.ctx[2]}set hidelogo(e){this.$$set({hidelogo:e}),C()}get name(){return this.$$.ctx[3]}set name(e){this.$$set({name:e}),C()}get maxnumber(){return this.$$.ctx[14]}set maxnumber(e){this.$$set({maxnumber:e}),C()}get mockerror(){return this.$$.ctx[15]}set mockerror(e){this.$$set({mockerror:e}),C()}get strings(){return this.$$.ctx[20]}set strings(e){this.$$set({strings:e}),C()}get test(){return this.$$.ctx[16]}set test(e){this.$$set({test:e}),C()}get workers(){return this.$$.ctx[17]}set workers(e){this.$$set({workers:e}),C()}get configure(){return this.$$.ctx[21]}get reset(){return this.$$.ctx[22]}get verify(){return this.$$.ctx[23]}}customElements.define("altcha-widget",rt(Ce,{auto:{},challengeurl:{},challengejson:{},debug:{type:"Boolean"},expire:{},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},name:{},maxnumber:{},mockerror:{type:"Boolean"},strings:{},test:{type:"Boolean"},workers:{}},[],["configure","reset","verify"],!1)),N.Altcha=Ce,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
|