altcha 0.6.7 → 0.8.0
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/README.md +33 -19
- package/dist/altcha.d.ts +16 -2
- package/dist/altcha.js +1046 -682
- package/dist/altcha.umd.cjs +2 -2
- package/dist_external/altcha.d.ts +16 -2
- package/dist_external/altcha.js +1046 -682
- package/dist_external/altcha.umd.cjs +2 -2
- package/dist_external/worker.js +1 -1
- package/package.json +1 -1
package/dist/altcha.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(U,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(U=typeof globalThis<"u"?globalThis:U||self,Z(U.altcha={}))})(this,function(U){"use strict";var cr=Object.defineProperty;var ar=(U,Z,ne)=>Z in U?cr(U,Z,{enumerable:!0,configurable:!0,writable:!0,value:ne}):U[Z]=ne;var O=(U,Z,ne)=>ar(U,typeof Z!="symbol"?Z+"":Z,ne);const Z="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK",ne=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Se=typeof self<"u"&&self.Blob&&new Blob([ne(Z)],{type:"text/javascript;charset=utf-8"});function dt(r){let e;try{if(e=Se&&(self.URL||self.webkitURL).createObjectURL(Se),!e)throw"";const t=new Worker(e,{name:r==null?void 0:r.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Z,{name:r==null?void 0:r.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}function ie(){}function Ne(r){return r()}function je(){return Object.create(null)}function ce(r){r.forEach(Ne)}function Te(r){return typeof r=="function"}function ht(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function gt(r){return Object.keys(r).length===0}function p(r,e){r.appendChild(e)}function mt(r,e,t){const i=bt(r);if(!i.getElementById(e)){const o=R("style");o.id=e,o.textContent=t,vt(i,o)}}function bt(r){if(!r)return document;const e=r.getRootNode?r.getRootNode():r.ownerDocument;return e&&e.host?e:r.ownerDocument}function vt(r,e){return p(r.head||r,e),e.sheet}function M(r,e,t){r.insertBefore(e,t||null)}function T(r){r.parentNode&&r.parentNode.removeChild(r)}function R(r){return document.createElement(r)}function P(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function wt(r){return document.createTextNode(r)}function Y(){return wt(" ")}function ke(r,e,t,i){return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function s(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function yt(r){return Array.from(r.childNodes)}function Ze(r,e,t){r.classList.toggle(e,!!t)}function pt(r,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:i})}function _t(r){const e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let ae;function fe(r){ae=r}function xe(){if(!ae)throw new Error("Function called outside component initialization");return ae}function kt(r){xe().$$.on_mount.push(r)}function xt(r){xe().$$.on_destroy.push(r)}function Et(){const r=xe();return(e,t,{cancelable:i=!1}={})=>{const o=r.$$.callbacks[e];if(o){const l=pt(e,t,{cancelable:i});return o.slice().forEach(c=>{c.call(r,l)}),!l.defaultPrevented}return!0}}const oe=[],ge=[];let le=[];const Me=[],Ve=Promise.resolve();let Ee=!1;function $e(){Ee||(Ee=!0,Ve.then(w))}function Ct(){return $e(),Ve}function Ce(r){le.push(r)}const Le=new Set;let se=0;function w(){if(se!==0)return;const r=ae;do{try{for(;se<oe.length;){const e=oe[se];se++,fe(e),Lt(e.$$)}}catch(e){throw oe.length=0,se=0,e}for(fe(null),oe.length=0,se=0;ge.length;)ge.pop()();for(let e=0;e<le.length;e+=1){const t=le[e];Le.has(t)||(Le.add(t),t())}le.length=0}while(oe.length);for(;Me.length;)Me.pop()();Ee=!1,Le.clear(),fe(r)}function Lt(r){if(r.fragment!==null){r.update(),ce(r.before_update);const e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Ce)}}function Rt(r){const e=[],t=[];le.forEach(i=>r.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),le=e}const It=new Set;function zt(r,e){r&&r.i&&(It.delete(r),r.i(e))}function At(r,e,t){const{fragment:i,after_update:o}=r.$$;i&&i.m(e,t),Ce(()=>{const l=r.$$.on_mount.map(Ne).filter(Te);r.$$.on_destroy?r.$$.on_destroy.push(...l):ce(l),r.$$.on_mount=[]}),o.forEach(Ce)}function St(r,e){const t=r.$$;t.fragment!==null&&(Rt(t.after_update),ce(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Nt(r,e){r.$$.dirty[0]===-1&&(oe.push(r),$e(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function jt(r,e,t,i,o,l,c=null,a=[-1]){const d=ae;fe(r);const f=r.$$={fragment:null,ctx:[],props:l,update:ie,not_equal:o,bound:je(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:je(),dirty:a,skip_bound:!1,root:e.target||d.$$.root};c&&c(f.root);let G=!1;if(f.ctx=t?t(r,e.props||{},(N,X,...F)=>{const k=F.length?F[0]:X;return f.ctx&&o(f.ctx[N],f.ctx[N]=k)&&(!f.skip_bound&&f.bound[N]&&f.bound[N](k),G&&Nt(r,N)),X}):[],f.update(),G=!0,ce(f.before_update),f.fragment=i?i(f.ctx):!1,e.target){if(e.hydrate){const N=yt(e.target);f.fragment&&f.fragment.l(N),N.forEach(T)}else f.fragment&&f.fragment.c();e.intro&&zt(r.$$.fragment),At(r,e.target,e.anchor),w()}fe(d)}let De;typeof HTMLElement=="function"&&(De=class extends HTMLElement{constructor(e,t,i){super();O(this,"$$ctor");O(this,"$$s");O(this,"$$c");O(this,"$$cn",!1);O(this,"$$d",{});O(this,"$$r",!1);O(this,"$$p_d",{});O(this,"$$l",{});O(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,i&&this.attachShadow({mode:"open"})}addEventListener(e,t,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,i)}removeEventListener(e,t,i){if(super.removeEventListener(e,t,i),this.$$c){const o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let c;return{c:function(){c=R("slot"),l!=="default"&&s(c,"name",l)},m:function(f,G){M(f,c,G)},d:function(f){f&&T(c)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=_t(this);for(const l of this.$$s)l in i&&(t[l]=[e(l)]);for(const l of this.attributes){const c=this.$$g_p(l.name);c in this.$$d||(this.$$d[c]=me(c,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:t,$$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 c=me(l,this.$$d[l],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,c)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const c of this.$$l[l]){const a=this.$$c.$on(l,c);this.$$l_u.set(c,a)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=me(e,i,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&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function me(r,e,t,i){var l;const o=(l=t[r])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!t[r])return e;if(i==="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 Tt(r,e,t,i,o,l){let c=class extends De{constructor(){super(r,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(c.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(d){var f;d=me(a,d,e),this.$$d[a]=d,(f=this.$$c)==null||f.$set({[a]:d})}})}),i.forEach(a=>{Object.defineProperty(c.prototype,a,{get(){var d;return(d=this.$$c)==null?void 0:d[a]}})}),r.element=c,c}class Zt{constructor(){O(this,"$$");O(this,"$$set")}$destroy(){St(this,1),this.$destroy=ie}$on(e,t){if(!Te(t))return ie;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}$set(e){this.$$set&&!gt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Mt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Mt);const Vt=new TextEncoder;function $t(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Dt(r,e="SHA-256",t=1e5){const i=Date.now().toString(16);r||(r=Math.round(Math.random()*t));const o=await Fe(i,r,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function Fe(r,e,t){return $t(await crypto.subtle.digest(t.toUpperCase(),Vt.encode(r+e)))}function Ft(r,e,t="SHA-256",i=1e6,o=0){const l=new AbortController,c=Date.now();return{promise:(async()=>{for(let d=o;d<=i;d+=1){if(l.signal.aborted)return null;if(await Fe(e,d,t)===r)return{number:d,took:Date.now()-c}}return null})(),controller:l}}var m=(r=>(r.ERROR="error",r.VERIFIED="verified",r.VERIFYING="verifying",r.UNVERIFIED="unverified",r.EXPIRED="expired",r))(m||{});function Ut(r){mt(r,"svelte-ddsc3z",'.altcha.svelte-ddsc3z.svelte-ddsc3z{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);position:relative;text-align:left}.altcha.svelte-ddsc3z.svelte-ddsc3z:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z{background:var(--altcha-color-base, white);display:none;filter:drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.2));left:-100%;position:fixed;top:-100%;width:var(--altcha-max-width, 260px);z-index:999999}.altcha[data-floating=top].svelte-ddsc3z .altcha-anchor-arrow.svelte-ddsc3z{border-bottom-color:transparent;border-top-color:var(--altcha-color-border, #a0a0a0);bottom:-12px;top:auto}.altcha[data-floating=bottom].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-bottom-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating=top].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-top-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z:not([data-state=unverified]){display:block}.altcha-anchor-arrow.svelte-ddsc3z.svelte-ddsc3z{border:6px solid transparent;border-bottom-color:var(--altcha-color-border, #a0a0a0);content:"";height:0;left:12px;position:absolute;top:-12px;width:0}.altcha-main.svelte-ddsc3z.svelte-ddsc3z{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-ddsc3z.svelte-ddsc3z{flex-grow:1}.altcha-label.svelte-ddsc3z label.svelte-ddsc3z{cursor:pointer}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z{color:currentColor;opacity:0.3}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-error.svelte-ddsc3z.svelte-ddsc3z{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-ddsc3z.svelte-ddsc3z{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-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-footer.svelte-ddsc3z>.svelte-ddsc3z:first-child{flex-grow:1}.altcha-footer.svelte-ddsc3z a{color:currentColor}.altcha-checkbox.svelte-ddsc3z.svelte-ddsc3z{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-ddsc3z input.svelte-ddsc3z{width:18px;height:18px;margin:0}.altcha-hidden.svelte-ddsc3z.svelte-ddsc3z{display:none}.altcha-spinner.svelte-ddsc3z.svelte-ddsc3z{animation:svelte-ddsc3z-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-ddsc3z-altcha-spinner{100%{transform:rotate(360deg)}}')}function Ue(r){let e,t,i;return{c(){e=P("svg"),t=P("path"),i=P("path"),s(t,"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"),s(t,"fill","currentColor"),s(t,"opacity",".25"),s(i,"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"),s(i,"fill","currentColor"),s(i,"class","altcha-spinner svelte-ddsc3z"),s(e,"width","24"),s(e,"height","24"),s(e,"viewBox","0 0 24 24"),s(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){M(o,e,l),p(e,t),p(e,i)},d(o){o&&T(e)}}}function Gt(r){let e,t=r[11].label+"",i;return{c(){e=R("label"),s(e,"for",i=r[4]+"_checkbox"),s(e,"class","svelte-ddsc3z")},m(o,l){M(o,e,l),e.innerHTML=t},p(o,l){l[0]&2048&&t!==(t=o[11].label+"")&&(e.innerHTML=t),l[0]&16&&i!==(i=o[4]+"_checkbox")&&s(e,"for",i)},d(o){o&&T(e)}}}function Ot(r){let e,t=r[11].verifying+"";return{c(){e=R("span")},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].verifying+"")&&(e.innerHTML=t)},d(i){i&&T(e)}}}function Xt(r){let e,t=r[11].verified+"",i,o;return{c(){e=R("span"),i=Y(),o=R("input"),s(o,"type","hidden"),s(o,"name",r[4]),o.value=r[5]},m(l,c){M(l,e,c),e.innerHTML=t,M(l,i,c),M(l,o,c)},p(l,c){c[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),c[0]&16&&s(o,"name",l[4]),c[0]&32&&(o.value=l[5])},d(l){l&&(T(e),T(i),T(o))}}}function Ge(r){let e,t,i,o,l,c,a;return{c(){e=R("div"),t=R("a"),i=P("svg"),o=P("path"),l=P("path"),c=P("path"),s(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"),s(o,"fill","currentColor"),s(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"),s(l,"fill","currentColor"),s(c,"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"),s(c,"fill","currentColor"),s(i,"width","22"),s(i,"height","22"),s(i,"viewBox","0 0 20 20"),s(i,"fill","none"),s(i,"xmlns","http://www.w3.org/2000/svg"),s(t,"href",Pe),s(t,"target","_blank"),s(t,"class","altcha-logo svelte-ddsc3z"),s(t,"aria-label",a=r[11].ariaLinkLabel)},m(d,f){M(d,e,f),p(e,t),p(t,i),p(i,o),p(i,l),p(i,c)},p(d,f){f[0]&2048&&a!==(a=d[11].ariaLinkLabel)&&s(t,"aria-label",a)},d(d){d&&T(e)}}}function Oe(r){let e,t,i,o;function l(d,f){return d[6]===m.EXPIRED?Ht:Bt}let c=l(r),a=c(r);return{c(){e=R("div"),t=P("svg"),i=P("path"),o=Y(),a.c(),s(i,"stroke-linecap","round"),s(i,"stroke-linejoin","round"),s(i,"d","M6 18L18 6M6 6l12 12"),s(t,"width","14"),s(t,"height","14"),s(t,"xmlns","http://www.w3.org/2000/svg"),s(t,"fill","none"),s(t,"viewBox","0 0 24 24"),s(t,"stroke-width","1.5"),s(t,"stroke","currentColor"),s(e,"class","altcha-error svelte-ddsc3z")},m(d,f){M(d,e,f),p(e,t),p(t,i),p(e,o),a.m(e,null)},p(d,f){c===(c=l(d))&&a?a.p(d,f):(a.d(1),a=c(d),a&&(a.c(),a.m(e,null)))},d(d){d&&T(e),a.d()}}}function Bt(r){let e,t=r[11].error+"";return{c(){e=R("div"),s(e,"title",r[10])},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].error+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",i[10])},d(i){i&&T(e)}}}function Ht(r){let e,t=r[11].expired+"";return{c(){e=R("div"),s(e,"title",r[10])},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",i[10])},d(i){i&&T(e)}}}function Xe(r){let e,t,i=r[11].footer+"";return{c(){e=R("div"),t=R("div"),s(t,"class","svelte-ddsc3z"),s(e,"class","altcha-footer svelte-ddsc3z")},m(o,l){M(o,e,l),p(e,t),t.innerHTML=i},p(o,l){l[0]&2048&&i!==(i=o[11].footer+"")&&(t.innerHTML=i)},d(o){o&&T(e)}}}function Be(r){let e;return{c(){e=R("div"),s(e,"class","altcha-anchor-arrow svelte-ddsc3z")},m(t,i){M(t,e,i),r[37](e)},p:ie,d(t){t&&T(e),r[37](null)}}}function Pt(r){let e,t,i,o,l,c,a,d,f,G,N,X,F,k,K,S=r[6]===m.VERIFYING&&Ue();function q(h,v){return h[6]===m.VERIFIED?Xt:h[6]===m.VERIFYING?Ot:Gt}let W=q(r),V=W(r),E=(r[3]!==!0||r[12])&&Ge(r),I=(r[10]||r[6]===m.EXPIRED)&&Oe(r),z=r[11].footer&&(r[2]!==!0||r[12])&&Xe(r),y=r[1]&&Be(r);return{c(){e=R("div"),t=R("div"),S&&S.c(),i=Y(),o=R("div"),l=R("input"),d=Y(),f=R("div"),V.c(),G=Y(),E&&E.c(),N=Y(),I&&I.c(),X=Y(),z&&z.c(),F=Y(),y&&y.c(),s(l,"type","checkbox"),s(l,"id",c=r[4]+"_checkbox"),l.required=a=r[0]!=="onsubmit",s(l,"class","svelte-ddsc3z"),s(o,"class","altcha-checkbox svelte-ddsc3z"),Ze(o,"altcha-hidden",r[6]===m.VERIFYING),s(f,"class","altcha-label svelte-ddsc3z"),s(t,"class","altcha-main svelte-ddsc3z"),s(e,"class","altcha svelte-ddsc3z"),s(e,"data-state",r[6]),s(e,"data-floating",r[1])},m(h,v){M(h,e,v),p(e,t),S&&S.m(t,null),p(t,i),p(t,o),p(o,l),l.checked=r[7],p(t,d),p(t,f),V.m(f,null),p(t,G),E&&E.m(t,null),p(e,N),I&&I.m(e,null),p(e,X),z&&z.m(e,null),p(e,F),y&&y.m(e,null),r[38](e),k||(K=[ke(l,"change",r[36]),ke(l,"change",r[13]),ke(l,"invalid",r[14])],k=!0)},p(h,v){h[6]===m.VERIFYING?S||(S=Ue(),S.c(),S.m(t,i)):S&&(S.d(1),S=null),v[0]&16&&c!==(c=h[4]+"_checkbox")&&s(l,"id",c),v[0]&1&&a!==(a=h[0]!=="onsubmit")&&(l.required=a),v[0]&128&&(l.checked=h[7]),v[0]&64&&Ze(o,"altcha-hidden",h[6]===m.VERIFYING),W===(W=q(h))&&V?V.p(h,v):(V.d(1),V=W(h),V&&(V.c(),V.m(f,null))),h[3]!==!0||h[12]?E?E.p(h,v):(E=Ge(h),E.c(),E.m(t,null)):E&&(E.d(1),E=null),h[10]||h[6]===m.EXPIRED?I?I.p(h,v):(I=Oe(h),I.c(),I.m(e,X)):I&&(I.d(1),I=null),h[11].footer&&(h[2]!==!0||h[12])?z?z.p(h,v):(z=Xe(h),z.c(),z.m(e,F)):z&&(z.d(1),z=null),h[1]?y?y.p(h,v):(y=Be(h),y.c(),y.m(e,null)):y&&(y.d(1),y=null),v[0]&64&&s(e,"data-state",h[6]),v[0]&2&&s(e,"data-floating",h[1])},i:ie,o:ie,d(h){h&&T(e),S&&S.d(),V.d(),E&&E.d(),I&&I.d(),z&&z.d(),y&&y.d(),r[38](null),k=!1,ce(K)}}}const He="Visit Altcha.org",Pe="https://altcha.org/";function We(r){return JSON.parse(r)}function Wt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Yt(r,e,t){var ft,ut;let i,o,l,c,{auto:a=void 0}=e,{blockspam:d=void 0}=e,{challengeurl:f=void 0}=e,{challengejson:G=void 0}=e,{debug:N=!1}=e,{delay:X=0}=e,{expire:F=void 0}=e,{floating:k=void 0}=e,{floatinganchor:K=void 0}=e,{floatingoffset:S=void 0}=e,{hidefooter:q=!1}=e,{hidelogo:W=!1}=e,{name:V="altcha"}=e,{maxnumber:E=1e6}=e,{mockerror:I=!1}=e,{refetchonexpire:z=!0}=e,{spamfilter:y=!1}=e,{strings:h=void 0}=e,{test:v=!1}=e,{verifyurl:Q=void 0}=e,{workers:ue=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:be=void 0}=e;const Re=Et(),Ke=["SHA-256","SHA-384","SHA-512"],Je=(ut=(ft=document.documentElement.lang)==null?void 0:ft.split("-"))==null?void 0:ut[0];let J=!1,C,ee=null,ve=null,b=null,Ie=null,te=null,$=m.UNVERIFIED,B=null;xt(()=>{b&&(b.removeEventListener("submit",Qe),b.removeEventListener("reset",et),b.removeEventListener("focusin",qe),b=null),B&&(clearTimeout(B),B=null),document.removeEventListener("click",it),document.removeEventListener("scroll",ot),window.removeEventListener("resize",st)}),kt(()=>{x("mounted","0.6.7"),x("workers",ue),v&&x("using test mode"),F&&we(F),a!==void 0&&x("auto",a),k!==void 0&&ct(k),b=C.closest("form"),b&&(b.addEventListener("submit",Qe,{capture:!0}),b.addEventListener("reset",et),a==="onfocus"&&b.addEventListener("focusin",qe)),a==="onload"&&re(),i&&(q||W)&&x("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function x(...n){(N||n.some(u=>u instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",...n)}function qe(n){$===m.UNVERIFIED&&re()}function Qe(n){b&&a==="onsubmit"&&($===m.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),re().then(()=>{b==null||b.requestSubmit()})):$!==m.VERIFIED&&(n.preventDefault(),n.stopPropagation(),$===m.VERIFYING&<()))}function et(){ye()}function tt(n,u){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:u.number,salt:n.salt,signature:n.signature,test:v?!0:void 0,took:u.took}))}function rt(n){if(!n.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(n.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!Ke.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${Ke.join(", ")}`);if(!n.challenge||n.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!n.salt||n.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Kt(){var n;if(I)throw x("mocking error"),new Error("Mocked error.");if(o)return x("using provided json data"),o;if(v)return x("generating test challenge",{test:v}),Dt(typeof v!="boolean"?+v:void 0);{if(!f)throw new Error("Attribute challengeurl not set.");x("fetching challenge from",f);const u=await fetch(f,{headers:{"x-altcha-spam-filter":y?"1":"0"}});if(u.status!==200)throw new Error(`Server responded with ${u.status}.`);const g=u.headers.get("Expires"),A=u.headers.get("X-Altcha-Config"),D=await u.json(),j=new URLSearchParams((n=D.salt.split("?"))==null?void 0:n[1]),H=j.get("expires")||j.get("expire");if(H){const _=new Date(+H*1e3),L=isNaN(_.getTime())?0:_.getTime()-Date.now();L>0&&we(L)}if(A)try{const _=JSON.parse(A);_&&typeof _=="object"&&(_.verifyurl&&(_.verifyurl=new URL(_.verifyurl,new URL(f)).toString()),at(_))}catch(_){x("unable to configure from X-Altcha-Config",_)}if(!F&&(g!=null&&g.length)){const _=Date.parse(g);if(_){const L=_-Date.now();L>0&&we(L)}}return D}}function nt(){f&&z&&$===m.VERIFIED?re():ye(m.EXPIRED,c.expired)}async function Jt(n){let u=null;if("Worker"in window){try{u=await qt(n.challenge,n.salt,n.algorithm,n.maxnumber)}catch(g){x(g)}if((u==null?void 0:u.number)!==void 0)return{data:n,solution:u}}return{data:n,solution:await Ft(n.challenge,n.salt,n.algorithm,n.maxnumber||E).promise}}async function qt(n,u,g,A=typeof v=="number"?v:E,D=Math.ceil(ue)){const j=[];D=Math.min(16,Math.max(1,D));for(let L=0;L<D;L++)j.push(createAltchaWorker(be));const H=Math.ceil(A/D),_=await Promise.all(j.map((L,Ae)=>{const de=Ae*H;return new Promise(pe=>{L.addEventListener("message",_e=>{if(_e.data)for(const he of j)he!==L&&he.postMessage({type:"abort"});pe(_e.data)}),L.postMessage({payload:{alg:g,challenge:n,max:de+H,salt:u,start:de},type:"work"})})}));for(const L of j)L.terminate();return _.find(L=>!!L)||null}function Qt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes($)?y&&(b==null?void 0:b.reportValidity())===!1?t(7,J=!1):re():t(7,J=!0)}function it(n){const u=n.target;k&&u&&!C.contains(u)&&$===m.VERIFIED&&t(8,C.style.display="none",C)}function ot(){k&&ze()}function lt(){$===m.VERIFYING&&c.waitAlert&&alert(c.waitAlert)}function er(n){k&&$!==m.UNVERIFIED&&requestAnimationFrame(()=>{ze()})}function st(){k&&ze()}function we(n){x("expire",n),B&&(clearTimeout(B),B=null),n<1?nt():B=setTimeout(nt,n)}function ct(n){x("floating",n),k!==n&&(t(8,C.style.left="",C),t(8,C.style.top="",C)),t(1,k=n===!0||n===""?"auto":n===!1||n==="false"?void 0:k),k?(a||t(0,a="onsubmit"),document.addEventListener("scroll",ot),document.addEventListener("click",it),window.addEventListener("resize",st)):a==="onsubmit"&&t(0,a=void 0)}function tr(n){var g;const u=b==null?void 0:b.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=u==null?void 0:u.value)==null?void 0:g.slice(u.value.indexOf("@")))||void 0}function rr(n){return[...(b==null?void 0:b.querySelectorAll(n!=null&&n.length?n.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,A)=>{const D=A.name,j=A.value;return D&&j&&(g[D]=/\n/.test(j)?j.replace(new RegExp("(?<!\\r)\\n","g"),`\r
|
|
2
|
-
`):
|
|
1
|
+
(function(w,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(w=typeof globalThis<"u"?globalThis:w||self,p(w.altcha={}))})(this,function(w){"use strict";var Pn=Object.defineProperty;var Dt=w=>{throw TypeError(w)};var On=(w,p,M)=>p in w?Pn(w,p,{enumerable:!0,configurable:!0,writable:!0,value:M}):w[p]=M;var X=(w,p,M)=>On(w,typeof p!="symbol"?p+"":p,M),Yt=(w,p,M)=>p.has(w)||Dt("Cannot "+M);var P=(w,p,M)=>(Yt(w,p,"read from private field"),M?M.call(w):p.get(w)),he=(w,p,M)=>p.has(w)?Dt("Cannot add the same private member more than once"):p instanceof WeakSet?p.add(w):p.set(w,M),Ut=(w,p,M,we)=>(Yt(w,p,"write to private field"),we?we.call(w,M):p.set(w,M),M);var ye,ve,Ee,xe,Ce,Re;const p="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIHAoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiB3KGUsdCxyKXtyZXR1cm4gcChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChyLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGIoZSx0LHI9IlNIQS0yNTYiLG49MWU2LHM9MCl7Y29uc3Qgbz1uZXcgQWJvcnRDb250cm9sbGVyLGE9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgYz1zO2M8PW47Yys9MSl7aWYoby5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCB3KHQsYyxyKT09PWUpcmV0dXJue251bWJlcjpjLHRvb2s6RGF0ZS5ub3coKS1hfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjpvfX1mdW5jdGlvbiBoKGUpe2NvbnN0IHQ9YXRvYihlKSxyPW5ldyBVaW50OEFycmF5KHQubGVuZ3RoKTtmb3IobGV0IG49MDtuPHQubGVuZ3RoO24rKylyW25dPXQuY2hhckNvZGVBdChuKTtyZXR1cm4gcn1mdW5jdGlvbiBnKGUsdD0xMil7Y29uc3Qgcj1uZXcgVWludDhBcnJheSh0KTtmb3IobGV0IG49MDtuPHQ7bisrKXJbbl09ZSUyNTYsZT1NYXRoLmZsb29yKGUvMjU2KTtyZXR1cm4gcn1hc3luYyBmdW5jdGlvbiBtKGUsdD0iIixyPTFlNixuPTApe2NvbnN0IHM9IkFFUy1HQ00iLG89bmV3IEFib3J0Q29udHJvbGxlcixhPURhdGUubm93KCksbD1hc3luYygpPT57Zm9yKGxldCB1PW47dTw9cjt1Kz0xKXtpZihvLnNpZ25hbC5hYm9ydGVkfHwhY3x8IXkpcmV0dXJuIG51bGw7dHJ5e2NvbnN0IGQ9YXdhaXQgY3J5cHRvLnN1YnRsZS5kZWNyeXB0KHtuYW1lOnMsaXY6Zyh1KX0sYyx5KTtpZihkKXJldHVybntjbGVhclRleHQ6bmV3IFRleHREZWNvZGVyKCkuZGVjb2RlKGQpLHRvb2s6RGF0ZS5ub3coKS1hfX1jYXRjaHt9fXJldHVybiBudWxsfTtsZXQgYz1udWxsLHk9bnVsbDt0cnl7eT1oKGUpO2NvbnN0IHU9YXdhaXQgY3J5cHRvLnN1YnRsZS5kaWdlc3QoIlNIQS0yNTYiLGYuZW5jb2RlKHQpKTtjPWF3YWl0IGNyeXB0by5zdWJ0bGUuaW1wb3J0S2V5KCJyYXciLHUscywhMSxbImRlY3J5cHQiXSl9Y2F0Y2h7cmV0dXJue3Byb21pc2U6UHJvbWlzZS5yZWplY3QoKSxjb250cm9sbGVyOm99fXJldHVybntwcm9taXNlOmwoKSxjb250cm9sbGVyOm99fWxldCBpO29ubWVzc2FnZT1hc3luYyBlPT57Y29uc3R7dHlwZTp0LHBheWxvYWQ6cixzdGFydDpuLG1heDpzfT1lLmRhdGE7bGV0IG89bnVsbDtpZih0PT09ImFib3J0IilpPT1udWxsfHxpLmFib3J0KCksaT12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtpZigib2JmdXNjYXRlZCJpbiByKXtjb25zdHtrZXk6YSxvYmZ1c2NhdGVkOmx9PXJ8fHt9O289YXdhaXQgbShsLGEscyxuKX1lbHNle2NvbnN0e2FsZ29yaXRobTphLGNoYWxsZW5nZTpsLHNhbHQ6Y309cnx8e307bz1iKGwsYyxhLHMsbil9aT1vLmNvbnRyb2xsZXIsby5wcm9taXNlLnRoZW4oYT0+e3NlbGYucG9zdE1lc3NhZ2UoYSYmey4uLmEsd29ya2VyOiEwfSl9KX19fSkoKTsK",M=n=>Uint8Array.from(atob(n),e=>e.charCodeAt(0)),we=typeof self<"u"&&self.Blob&&new Blob([M(p)],{type:"text/javascript;charset=utf-8"});function Xt(n){let e;try{if(e=we&&(self.URL||self.webkitURL).createObjectURL(we),!e)throw"";const t=new Worker(e,{name:n==null?void 0:n.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+p,{name:n==null?void 0:n.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}function Se(){}function Mt(n,e){for(const t in e)n[t]=e[t];return n}function Pe(n){return n()}function Oe(){return Object.create(null)}function pe(n){n.forEach(Pe)}function Je(n){return typeof n=="function"}function jt(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Wt(n){return Object.keys(n).length===0}function Bt(n,e,t,i){if(n){const o=Qe(n,e,t,i);return n[0](o)}}function Qe(n,e,t,i){return n[1]&&i?Mt(t.ctx.slice(),n[1](i(e))):t.ctx}function Kt(n,e,t,i){if(n[2]&&i){const o=n[2](i(t));if(e.dirty===void 0)return o;if(typeof o=="object"){const l=[],s=Math.max(e.dirty.length,o.length);for(let a=0;a<s;a+=1)l[a]=e.dirty[a]|o[a];return l}return e.dirty|o}return e.dirty}function Pt(n,e,t,i,o,l){if(o){const s=Qe(e,t,i,l);n.p(s,o)}}function Ot(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let i=0;i<t;i++)e[i]=-1;return e}return-1}function I(n,e){n.appendChild(e)}function Jt(n,e,t){const i=Qt(n);if(!i.getElementById(e)){const o=A("style");o.id=e,o.textContent=t,qt(i,o)}}function Qt(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function qt(n,e){return I(n.head||n,e),e.sheet}function H(n,e,t){n.insertBefore(e,t||null)}function S(n){n.parentNode&&n.parentNode.removeChild(n)}function A(n){return document.createElement(n)}function ne(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function qe(n){return document.createTextNode(n)}function q(){return qe(" ")}function $t(){return qe("")}function Ye(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function c(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function en(n){return Array.from(n.childNodes)}function $e(n,e,t){n.classList.toggle(e,!!t)}function tn(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function nn(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let _e;function ke(n){_e=n}function Ue(){if(!_e)throw new Error("Function called outside component initialization");return _e}function rn(n){Ue().$$.on_mount.push(n)}function on(n){Ue().$$.on_destroy.push(n)}function ln(){const n=Ue();return(e,t,{cancelable:i=!1}={})=>{const o=n.$$.callbacks[e];if(o){const l=tn(e,t,{cancelable:i});return o.slice().forEach(s=>{s.call(n,l)}),!l.defaultPrevented}return!0}}const me=[],Fe=[];let be=[];const et=[],tt=Promise.resolve();let Xe=!1;function nt(){Xe||(Xe=!0,tt.then(_))}function sn(){return nt(),tt}function Me(n){be.push(n)}const je=new Set;let ge=0;function _(){if(ge!==0)return;const n=_e;do{try{for(;ge<me.length;){const e=me[ge];ge++,ke(e),cn(e.$$)}}catch(e){throw me.length=0,ge=0,e}for(ke(null),me.length=0,ge=0;Fe.length;)Fe.pop()();for(let e=0;e<be.length;e+=1){const t=be[e];je.has(t)||(je.add(t),t())}be.length=0}while(me.length);for(;et.length;)et.pop()();Xe=!1,je.clear(),ke(n)}function cn(n){if(n.fragment!==null){n.update(),pe(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Me)}}function an(n){const e=[],t=[];be.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),be=e}const Ze=new Set;let fn;function rt(n,e){n&&n.i&&(Ze.delete(n),n.i(e))}function un(n,e,t,i){if(n&&n.o){if(Ze.has(n))return;Ze.add(n),fn.c.push(()=>{Ze.delete(n)}),n.o(e)}}function dn(n,e,t){const{fragment:i,after_update:o}=n.$$;i&&i.m(e,t),Me(()=>{const l=n.$$.on_mount.map(Pe).filter(Je);n.$$.on_destroy?n.$$.on_destroy.push(...l):pe(l),n.$$.on_mount=[]}),o.forEach(Me)}function hn(n,e){const t=n.$$;t.fragment!==null&&(an(t.after_update),pe(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function mn(n,e){n.$$.dirty[0]===-1&&(me.push(n),nt(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function bn(n,e,t,i,o,l,s=null,a=[-1]){const f=_e;ke(n);const d=n.$$={fragment:null,ctx:[],props:l,update:Se,not_equal:o,bound:Oe(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(f?f.$$.context:[])),callbacks:Oe(),dirty:a,skip_bound:!1,root:e.target||f.$$.root};s&&s(d.root);let v=!1;if(d.ctx=t?t(n,e.props||{},(T,re,...x)=>{const J=x.length?x[0]:re;return d.ctx&&o(d.ctx[T],d.ctx[T]=J)&&(!d.skip_bound&&d.bound[T]&&d.bound[T](J),v&&mn(n,T)),re}):[],d.update(),v=!0,pe(d.before_update),d.fragment=i?i(d.ctx):!1,e.target){if(e.hydrate){const T=en(e.target);d.fragment&&d.fragment.l(T),T.forEach(S)}else d.fragment&&d.fragment.c();e.intro&&rt(n.$$.fragment),dn(n,e.target,e.anchor),_()}ke(f)}let it;typeof HTMLElement=="function"&&(it=class extends HTMLElement{constructor(e,t,i){super();X(this,"$$ctor");X(this,"$$s");X(this,"$$c");X(this,"$$cn",!1);X(this,"$$d",{});X(this,"$$r",!1);X(this,"$$p_d",{});X(this,"$$l",{});X(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,i&&this.attachShadow({mode:"open"})}addEventListener(e,t,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,i)}removeEventListener(e,t,i){if(super.removeEventListener(e,t,i),this.$$c){const o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let s;return{c:function(){s=A("slot"),l!=="default"&&c(s,"name",l)},m:function(d,v){H(d,s,v)},d:function(d){d&&S(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=nn(this);for(const l of this.$$s)l in i&&(t[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=Ve(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:t,$$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=Ve(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 a=this.$$c.$on(l,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Ve(e,i,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&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Ve(n,e,t,i){var l;const o=(l=t[n])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!t[n])return e;if(i==="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 gn(n,e,t,i,o,l){let s=class extends it{constructor(){super(n,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(s.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(f){var d;f=Ve(a,f,e),this.$$d[a]=f,(d=this.$$c)==null||d.$set({[a]:f})}})}),i.forEach(a=>{Object.defineProperty(s.prototype,a,{get(){var f;return(f=this.$$c)==null?void 0:f[a]}})}),n.element=s,s}class yn{constructor(){X(this,"$$");X(this,"$$set")}$destroy(){hn(this,1),this.$destroy=Se}$on(e,t){if(!Je(t))return Se;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}$set(e){this.$$set&&!Wt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const vn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(vn);const ot=new TextEncoder;function wn(n){return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function pn(n,e="SHA-256",t=1e5){const i=Date.now().toString(16);n||(n=Math.round(Math.random()*t));const o=await lt(i,n,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function lt(n,e,t){return wn(await crypto.subtle.digest(t.toUpperCase(),ot.encode(n+e)))}function _n(n,e,t="SHA-256",i=1e6,o=0){const l=new AbortController,s=Date.now();return{promise:(async()=>{for(let f=o;f<=i;f+=1){if(l.signal.aborted)return null;if(await lt(e,f,t)===n)return{number:f,took:Date.now()-s}}return null})(),controller:l}}function st(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function kn(n){const e=atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function En(n,e=12){const t=new Uint8Array(e);for(let i=0;i<e;i++)t[i]=n%256,n=Math.floor(n/256);return t}async function xn(n,e="",t=1e6,i=0){const o="AES-GCM",l=new AbortController,s=Date.now(),a=async()=>{for(let v=i;v<=t;v+=1){if(l.signal.aborted||!f||!d)return null;try{const T=await crypto.subtle.decrypt({name:o,iv:En(v)},f,d);if(T)return{clearText:new TextDecoder().decode(T),took:Date.now()-s}}catch{}}return null};let f=null,d=null;try{d=kn(n);const v=await crypto.subtle.digest("SHA-256",ot.encode(e));f=await crypto.subtle.importKey("raw",v,o,!1,["decrypt"])}catch{return{promise:Promise.reject(),controller:l}}return{promise:a(),controller:l}}class Cn{constructor(e){X(this,"beaconUrl",null);X(this,"error",null);X(this,"loadTime",Date.now());X(this,"submitTime",null);X(this,"startTime",null);X(this,"viewTimeThresholdMs",1500);he(this,ye,{});he(this,ve,null);he(this,Ee,this.onFormChange.bind(this));he(this,xe,this.onFormFocus.bind(this));he(this,Ce,this.onFormSubmit.bind(this));he(this,Re,this.onUnload.bind(this));this.elForm=e,window.addEventListener("unload",P(this,Re)),this.elForm.addEventListener("change",P(this,Ee)),this.elForm.addEventListener("focusin",P(this,xe)),this.elForm.addEventListener("submit",P(this,Ce))}data(){const e=Object.entries(P(this,ye));return{correction:e.length&&e.filter(([t,i])=>i>1).length/e.length||0,dropoff:!this.submitTime&&!this.error&&P(this,ve)?P(this,ve):null,error:this.error,mobile:this.isMobile(),start:this.startTime,submit:this.submitTime,tz:st()}}dataAsBase64(){try{return btoa(JSON.stringify(this.data()))}catch(e){console.error("failed to encode ALTCHA session data to base64",e)}return""}destroy(){window.removeEventListener("unload",P(this,Re)),this.elForm.removeEventListener("change",P(this,Ee)),this.elForm.removeEventListener("focusin",P(this,xe)),this.elForm.removeEventListener("submit",P(this,Ce))}end(){this.submitTime||(this.submitTime=Date.now())}getFieldName(e,t=40){const i=e.getAttribute("data-group-label"),o=e.getAttribute("name")||e.getAttribute("aria-label");return((i?i+": ":"")+o).slice(0,t)}isMobile(){const e="userAgentData"in navigator&&navigator.userAgentData?navigator.userAgentData:{};return"mobile"in e?e.mobile===!0:/Mobi/i.test(window.navigator.userAgent)}isInput(e){return["INPUT","SELECT","TEXTAREA"].includes(e.tagName)}onFormFieldChange(e){const t=this.getFieldName(e);t&&this.trackFieldChange(t)}onFormChange(e){const t=e.target;t&&this.isInput(t)&&this.onFormFieldChange(t)}onFormFocus(e){const t=e.target;if(this.startTime||this.start(),t&&this.isInput(t)){const i=this.getFieldName(t);i&&Ut(this,ve,i)}}onFormSubmit(){this.end()}onUnload(){this.loadTime<=Date.now()-this.viewTimeThresholdMs&&!this.submitTime&&this.sendBeacon()}async sendBeacon(){if(this.beaconUrl&&"sendBeacon"in navigator)try{navigator.sendBeacon(new URL(this.beaconUrl,location.origin),JSON.stringify(this.data()))}catch{}}start(){this.startTime=Date.now()}trackError(e){this.error=e===null?null:String(e)}trackFieldChange(e){P(this,ye)[e]=(P(this,ye)[e]||0)+1}}ye=new WeakMap,ve=new WeakMap,Ee=new WeakMap,xe=new WeakMap,Ce=new WeakMap,Re=new WeakMap;var g=(n=>(n.ERROR="error",n.VERIFIED="verified",n.VERIFYING="verifying",n.UNVERIFIED="unverified",n.EXPIRED="expired",n))(g||{});function Rn(n){Jt(n,"svelte-ddsc3z",'.altcha.svelte-ddsc3z.svelte-ddsc3z{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);position:relative;text-align:left}.altcha.svelte-ddsc3z.svelte-ddsc3z:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z{background:var(--altcha-color-base, white);display:none;filter:drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.2));left:-100%;position:fixed;top:-100%;width:var(--altcha-max-width, 260px);z-index:999999}.altcha[data-floating=top].svelte-ddsc3z .altcha-anchor-arrow.svelte-ddsc3z{border-bottom-color:transparent;border-top-color:var(--altcha-color-border, #a0a0a0);bottom:-12px;top:auto}.altcha[data-floating=bottom].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-bottom-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating=top].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-top-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z:not([data-state=unverified]){display:block}.altcha-anchor-arrow.svelte-ddsc3z.svelte-ddsc3z{border:6px solid transparent;border-bottom-color:var(--altcha-color-border, #a0a0a0);content:"";height:0;left:12px;position:absolute;top:-12px;width:0}.altcha-main.svelte-ddsc3z.svelte-ddsc3z{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-ddsc3z.svelte-ddsc3z{flex-grow:1}.altcha-label.svelte-ddsc3z label.svelte-ddsc3z{cursor:pointer}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z{color:currentColor;opacity:0.3}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-error.svelte-ddsc3z.svelte-ddsc3z{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-ddsc3z.svelte-ddsc3z{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-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-footer.svelte-ddsc3z>.svelte-ddsc3z:first-child{flex-grow:1}.altcha-footer.svelte-ddsc3z a{color:currentColor}.altcha-checkbox.svelte-ddsc3z.svelte-ddsc3z{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-ddsc3z input.svelte-ddsc3z{width:18px;height:18px;margin:0}.altcha-hidden.svelte-ddsc3z.svelte-ddsc3z{display:none}.altcha-spinner.svelte-ddsc3z.svelte-ddsc3z{animation:svelte-ddsc3z-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-ddsc3z-altcha-spinner{100%{transform:rotate(360deg)}}')}function ct(n){let e,t,i;return{c(){e=ne("svg"),t=ne("path"),i=ne("path"),c(t,"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(t,"fill","currentColor"),c(t,"opacity",".25"),c(i,"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(i,"fill","currentColor"),c(i,"class","altcha-spinner svelte-ddsc3z"),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){H(o,e,l),I(e,t),I(e,i)},d(o){o&&S(e)}}}function Ln(n){let e,t=n[13].label+"",i;return{c(){e=A("label"),c(e,"for",i=n[4]+"_checkbox"),c(e,"class","svelte-ddsc3z")},m(o,l){H(o,e,l),e.innerHTML=t},p(o,l){l[0]&8192&&t!==(t=o[13].label+"")&&(e.innerHTML=t),l[0]&16&&i!==(i=o[4]+"_checkbox")&&c(e,"for",i)},d(o){o&&S(e)}}}function In(n){let e,t=n[13].verifying+"";return{c(){e=A("span")},m(i,o){H(i,e,o),e.innerHTML=t},p(i,o){o[0]&8192&&t!==(t=i[13].verifying+"")&&(e.innerHTML=t)},d(i){i&&S(e)}}}function Tn(n){let e,t=n[13].verified+"",i,o,l,s,a=n[11]&&at(n);return{c(){e=A("span"),i=q(),o=A("input"),l=q(),a&&a.c(),s=$t(),c(o,"type","hidden"),c(o,"name",n[4]),o.value=n[6]},m(f,d){H(f,e,d),e.innerHTML=t,H(f,i,d),H(f,o,d),H(f,l,d),a&&a.m(f,d),H(f,s,d)},p(f,d){d[0]&8192&&t!==(t=f[13].verified+"")&&(e.innerHTML=t),d[0]&16&&c(o,"name",f[4]),d[0]&64&&(o.value=f[6]),f[11]?a?a.p(f,d):(a=at(f),a.c(),a.m(s.parentNode,s)):a&&(a.d(1),a=null)},d(f){f&&(S(e),S(i),S(o),S(l),S(s)),a&&a.d(f)}}}function at(n){let e;return{c(){e=A("input"),c(e,"type","hidden"),c(e,"name","__session"),e.value=n[12]},m(t,i){H(t,e,i)},p(t,i){i[0]&4096&&(e.value=t[12])},d(t){t&&S(e)}}}function ft(n){let e,t,i,o,l,s,a;return{c(){e=A("div"),t=A("a"),i=ne("svg"),o=ne("path"),l=ne("path"),s=ne("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(i,"width","22"),c(i,"height","22"),c(i,"viewBox","0 0 20 20"),c(i,"fill","none"),c(i,"xmlns","http://www.w3.org/2000/svg"),c(t,"href",bt),c(t,"target","_blank"),c(t,"class","altcha-logo svelte-ddsc3z"),c(t,"aria-label",a=n[13].ariaLinkLabel)},m(f,d){H(f,e,d),I(e,t),I(t,i),I(i,o),I(i,l),I(i,s)},p(f,d){d[0]&8192&&a!==(a=f[13].ariaLinkLabel)&&c(t,"aria-label",a)},d(f){f&&S(e)}}}function ut(n){let e,t,i,o;function l(f,d){return f[7]===g.EXPIRED?An:Nn}let s=l(n),a=s(n);return{c(){e=A("div"),t=ne("svg"),i=ne("path"),o=q(),a.c(),c(i,"stroke-linecap","round"),c(i,"stroke-linejoin","round"),c(i,"d","M6 18L18 6M6 6l12 12"),c(t,"width","14"),c(t,"height","14"),c(t,"xmlns","http://www.w3.org/2000/svg"),c(t,"fill","none"),c(t,"viewBox","0 0 24 24"),c(t,"stroke-width","1.5"),c(t,"stroke","currentColor"),c(e,"class","altcha-error svelte-ddsc3z")},m(f,d){H(f,e,d),I(e,t),I(t,i),I(e,o),a.m(e,null)},p(f,d){s===(s=l(f))&&a?a.p(f,d):(a.d(1),a=s(f),a&&(a.c(),a.m(e,null)))},d(f){f&&S(e),a.d()}}}function Nn(n){let e,t=n[13].error+"";return{c(){e=A("div"),c(e,"title",n[5])},m(i,o){H(i,e,o),e.innerHTML=t},p(i,o){o[0]&8192&&t!==(t=i[13].error+"")&&(e.innerHTML=t),o[0]&32&&c(e,"title",i[5])},d(i){i&&S(e)}}}function An(n){let e,t=n[13].expired+"";return{c(){e=A("div"),c(e,"title",n[5])},m(i,o){H(i,e,o),e.innerHTML=t},p(i,o){o[0]&8192&&t!==(t=i[13].expired+"")&&(e.innerHTML=t),o[0]&32&&c(e,"title",i[5])},d(i){i&&S(e)}}}function dt(n){let e,t,i=n[13].footer+"";return{c(){e=A("div"),t=A("div"),c(t,"class","svelte-ddsc3z"),c(e,"class","altcha-footer svelte-ddsc3z")},m(o,l){H(o,e,l),I(e,t),t.innerHTML=i},p(o,l){l[0]&8192&&i!==(i=o[13].footer+"")&&(t.innerHTML=i)},d(o){o&&S(e)}}}function ht(n){let e;return{c(){e=A("div"),c(e,"class","altcha-anchor-arrow svelte-ddsc3z")},m(t,i){H(t,e,i),n[46](e)},p:Se,d(t){t&&S(e),n[46](null)}}}function zn(n){let e,t,i,o,l,s,a,f,d,v,T,re,x,J,W,ie,oe;const F=n[44].default,j=Bt(F,n,n[43],null);let G=n[7]===g.VERIFYING&&ct();function ce(h,R){return h[7]===g.VERIFIED?Tn:h[7]===g.VERIFYING?In:Ln}let le=ce(n),K=le(n),N=(n[3]!==!0||n[14])&&ft(n),Z=(n[5]||n[7]===g.EXPIRED)&&ut(n),C=n[13].footer&&(n[2]!==!0||n[14])&&dt(n),V=n[1]&&ht(n);return{c(){j&&j.c(),e=q(),t=A("div"),i=A("div"),G&&G.c(),o=q(),l=A("div"),s=A("input"),d=q(),v=A("div"),K.c(),T=q(),N&&N.c(),re=q(),Z&&Z.c(),x=q(),C&&C.c(),J=q(),V&&V.c(),c(s,"type","checkbox"),c(s,"id",a=n[4]+"_checkbox"),s.required=f=n[0]!=="onsubmit",c(s,"class","svelte-ddsc3z"),c(l,"class","altcha-checkbox svelte-ddsc3z"),$e(l,"altcha-hidden",n[7]===g.VERIFYING),c(v,"class","altcha-label svelte-ddsc3z"),c(i,"class","altcha-main svelte-ddsc3z"),c(t,"class","altcha svelte-ddsc3z"),c(t,"data-state",n[7]),c(t,"data-floating",n[1])},m(h,R){j&&j.m(h,R),H(h,e,R),H(h,t,R),I(t,i),G&&G.m(i,null),I(i,o),I(i,l),I(l,s),s.checked=n[8],I(i,d),I(i,v),K.m(v,null),I(i,T),N&&N.m(i,null),I(t,re),Z&&Z.m(t,null),I(t,x),C&&C.m(t,null),I(t,J),V&&V.m(t,null),n[47](t),W=!0,ie||(oe=[Ye(s,"change",n[45]),Ye(s,"change",n[15]),Ye(s,"invalid",n[16])],ie=!0)},p(h,R){j&&j.p&&(!W||R[1]&4096)&&Pt(j,F,h,h[43],W?Kt(F,h[43],R,null):Ot(h[43]),null),h[7]===g.VERIFYING?G||(G=ct(),G.c(),G.m(i,o)):G&&(G.d(1),G=null),(!W||R[0]&16&&a!==(a=h[4]+"_checkbox"))&&c(s,"id",a),(!W||R[0]&1&&f!==(f=h[0]!=="onsubmit"))&&(s.required=f),R[0]&256&&(s.checked=h[8]),(!W||R[0]&128)&&$e(l,"altcha-hidden",h[7]===g.VERIFYING),le===(le=ce(h))&&K?K.p(h,R):(K.d(1),K=le(h),K&&(K.c(),K.m(v,null))),h[3]!==!0||h[14]?N?N.p(h,R):(N=ft(h),N.c(),N.m(i,null)):N&&(N.d(1),N=null),h[5]||h[7]===g.EXPIRED?Z?Z.p(h,R):(Z=ut(h),Z.c(),Z.m(t,x)):Z&&(Z.d(1),Z=null),h[13].footer&&(h[2]!==!0||h[14])?C?C.p(h,R):(C=dt(h),C.c(),C.m(t,J)):C&&(C.d(1),C=null),h[1]?V?V.p(h,R):(V=ht(h),V.c(),V.m(t,null)):V&&(V.d(1),V=null),(!W||R[0]&128)&&c(t,"data-state",h[7]),(!W||R[0]&2)&&c(t,"data-floating",h[1])},i(h){W||(rt(j,h),W=!0)},o(h){un(j,h),W=!1},d(h){h&&(S(e),S(t)),j&&j.d(h),G&&G.d(),K.d(),N&&N.d(),Z&&Z.d(),C&&C.d(),V&&V.d(),n[47](null),ie=!1,pe(oe)}}}const mt="Visit Altcha.org",bt="https://altcha.org/";function gt(n){return JSON.parse(n)}function Sn(n,e,t){var Vt,Ht;let i,o,l,s,{$$slots:a={},$$scope:f}=e,{analytics:d=!1}=e,{auto:v=void 0}=e,{beaconurl:T=void 0}=e,{blockspam:re=void 0}=e,{challengeurl:x=void 0}=e,{challengejson:J=void 0}=e,{debug:W=!1}=e,{delay:ie=0}=e,{expire:oe=void 0}=e,{floating:F=void 0}=e,{floatinganchor:j=void 0}=e,{floatingoffset:G=void 0}=e,{hidefooter:ce=!1}=e,{hidelogo:le=!1}=e,{name:K="altcha"}=e,{maxnumber:N=1e6}=e,{mockerror:Z=!1}=e,{obfuscated:C=void 0}=e,{refetchonexpire:V=!0}=e,{spamfilter:h=!1}=e,{strings:R=void 0}=e,{test:Q=!1}=e,{verifyurl:ae=void 0}=e,{workers:Le=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:He=void 0}=e;const We=ln(),vt=["SHA-256","SHA-384","SHA-512"],wt=(Ht=(Vt=document.documentElement.lang)==null?void 0:Vt.split("-"))==null?void 0:Ht[0];let $=!1,ee=null,E,fe=null,Ge=null,y=null,se=null,Ie=null,te=null,ue=null,B=null,pt=null,z=g.UNVERIFIED;on(()=>{y&&(y.removeEventListener("submit",Et),y.removeEventListener("reset",xt),y.removeEventListener("focusin",kt),y=null),se&&E.removeEventListener("click",_t),B&&B.destroy(),te&&(clearTimeout(te),te=null),document.removeEventListener("click",Nt),document.removeEventListener("scroll",At),window.removeEventListener("resize",St)}),rn(()=>{var r,u;L("mounted","0.8.0"),L("workers",Le),Q&&L("using test mode"),oe&&De(oe),v!==void 0&&L("auto",v),F!==void 0&&Ft(F),y=E.closest("form"),y&&(y.addEventListener("submit",Et,{capture:!0}),y.addEventListener("reset",xt),v==="onfocus"&&y.addEventListener("focusin",kt)),se=((r=E.parentElement)==null?void 0:r.querySelector("[data-clarify-button]"))||((u=E.parentElement)==null?void 0:u.querySelector("button, a")),se&&se.addEventListener("click",_t),d&&Lt(),v==="onload"&&(C?Ne():de()),i&&(ce||le)&&L("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function L(...r){(W||r.some(u=>u instanceof Error))&&console[r[0]instanceof Error?"error":"log"]("ALTCHA",...r)}function _t(r){r.preventDefault(),z===g.UNVERIFIED&&Ne()}function kt(r){z===g.UNVERIFIED&&de()}function Et(r){y&&B&&z===g.VERIFIED&&(B.end(),t(12,pt=B.dataAsBase64())),y&&v==="onsubmit"&&(z===g.UNVERIFIED?(r.preventDefault(),r.stopPropagation(),de().then(()=>{y==null||y.requestSubmit()})):z!==g.VERIFIED&&(r.preventDefault(),r.stopPropagation(),z===g.VERIFYING&&zt()))}function xt(){Te()}function Ct(r,u){return btoa(JSON.stringify({algorithm:r.algorithm,challenge:r.challenge,number:u.number,salt:r.salt,signature:r.signature,test:Q?!0:void 0,took:u.took}))}function Rt(r){if(!r.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(r.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!vt.includes(r.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${vt.join(", ")}`);if(!r.challenge||r.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!r.salt||r.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Fn(){var r;if(Z)throw L("mocking error"),new Error("Mocked error.");if(o)return L("using provided json data"),o;if(Q)return L("generating test challenge",{test:Q}),pn(typeof Q!="boolean"?+Q:void 0);{if(!x&&y){const k=y.getAttribute("action");k!=null&&k.includes("/form/")&&t(17,x=k+"/altcha")}if(!x)throw new Error("Attribute challengeurl not set.");L("fetching challenge from",x);const u=await fetch(x,{headers:h?{"x-altcha-spam-filter":"1"}:{}});if(u.status!==200)throw new Error(`Server responded with ${u.status}.`);const m=u.headers.get("Expires"),b=u.headers.get("X-Altcha-Config"),D=await u.json(),Y=new URLSearchParams((r=D.salt.split("?"))==null?void 0:r[1]),U=Y.get("expires")||Y.get("expire");if(U){const k=new Date(+U*1e3),O=isNaN(k.getTime())?0:k.getTime()-Date.now();O>0&&De(O)}if(b)try{const k=JSON.parse(b);k&&typeof k=="object"&&(k.verifyurl&&(k.verifyurl=new URL(k.verifyurl,new URL(x)).toString()),Zt(k))}catch(k){L("unable to configure from X-Altcha-Config",k)}if(!oe&&(m!=null&&m.length)){const k=Date.parse(m);if(k){const O=k-Date.now();O>0&&De(O)}}return D}}function Lt(){if(!B)if(y){if(L("analytics enabled"),t(11,B=new Cn(y)),T===void 0){const r=y.getAttribute("action");r&&t(19,T=r+"/beacon")}t(11,B.beaconUrl=T||null,B)}else L("analytics cannot be enabled - form element not found")}function It(){x&&V&&z===g.VERIFIED?de():Te(g.EXPIRED,s.expired)}async function Tt(r){let u=null;if("Worker"in window){try{u=await Zn(r,r.maxnumber)}catch(m){L(m)}if((u==null?void 0:u.number)!==void 0||"obfuscated"in r)return{data:r,solution:u}}if("obfuscated"in r){const m=await xn(r.obfuscated,r.key,r.maxnumber);return{data:r,solution:await m.promise}}return{data:r,solution:await _n(r.challenge,r.salt,r.algorithm,r.maxnumber||N).promise}}async function Zn(r,u=typeof Q=="number"?Q:N,m=Math.ceil(Le)){const b=[];m=Math.min(16,Math.max(1,m));for(let U=0;U<m;U++)b.push(createAltchaWorker(He));const D=Math.ceil(u/m),Y=await Promise.all(b.map((U,k)=>{const O=k*D;return new Promise(Ke=>{U.addEventListener("message",Ae=>{if(Ae.data)for(const ze of b)ze!==U&&ze.postMessage({type:"abort"});Ke(Ae.data)}),U.postMessage({payload:r,max:O+D,start:O,type:"work"})})}));for(const U of b)U.terminate();return Y.find(U=>!!U)||null}function Vn(){[g.UNVERIFIED,g.ERROR,g.EXPIRED].includes(z)?h&&(y==null?void 0:y.reportValidity())===!1?t(8,$=!1):C?Ne():de():t(8,$=!0)}function Nt(r){const u=r.target;F&&u&&!E.contains(u)&&z===g.VERIFIED&&t(9,E.style.display="none",E)}function At(){F&&Be()}function zt(){z===g.VERIFYING&&s.waitAlert&&alert(s.waitAlert)}function Hn(r){var u;if(ee){const m=ee.match(/^(mailto|tel|sms|https?):/);let b;if(m){const[D]=ee.slice(ee.indexOf(":")+1).replace(/^\/\//,"").split("?");b=document.createElement("a"),b.href=ee,b.innerHTML=D}else b=document.createTextNode(ee);se&&b&&(se.after(b),(u=se.parentElement)==null||u.removeChild(se))}}function Gn(r){B&&B.trackError(Ie)}function Dn(r){F&&z!==g.UNVERIFIED&&requestAnimationFrame(()=>{Be()})}function St(){F&&Be()}function De(r){L("expire",r),te&&(clearTimeout(te),te=null),r<1?It():te=setTimeout(It,r)}function Ft(r){L("floating",r),F!==r&&(t(9,E.style.left="",E),t(9,E.style.top="",E)),t(1,F=r===!0||r===""?"auto":r===!1||r==="false"?void 0:F),F?(v||t(0,v="onsubmit"),document.addEventListener("scroll",At),document.addEventListener("click",Nt),window.addEventListener("resize",St)):v==="onsubmit"&&t(0,v=void 0)}function Yn(r){var m;const u=y==null?void 0:y.querySelector(typeof r=="string"?`input[name="${r}"]`:'input[type="email"]:not([data-no-spamfilter])');return((m=u==null?void 0:u.value)==null?void 0:m.slice(u.value.indexOf("@")))||void 0}function Un(r){return[...(y==null?void 0:y.querySelectorAll(r!=null&&r.length?r.map(m=>`input[name="${m}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((m,b)=>{const D=b.name,Y=b.value;return D&&Y&&(m[D]=/\n/.test(Y)?Y.replace(new RegExp("(?<!\\r)\\n","g"),`\r
|
|
2
|
+
`):Y),m},{})}async function Xn(r){if(!ae)throw new Error("Attribute verifyurl not set.");L("requesting server verification from",ae);const u={payload:r};if(h){const{blockedCountries:D,classifier:Y,disableRules:U,email:k,expectedLanguages:O,expectedCountries:Ke,fields:Ae,ipAddress:ze,text:Kn,timeZone:Gt}=Mn();u.blockedCountries=D,u.classifier=Y,u.disableRules=U,u.email=k===!1?void 0:Yn(k),u.expectedCountries=Ke,u.expectedLanguages=O||(wt?[wt]:void 0),u.fields=Ae===!1?void 0:Un(Ae),u.ipAddress=ze===!1?void 0:ze||"auto",u.text=Kn,u.timeZone=Gt===!1?void 0:Gt||st()}const m=await fetch(ae,{body:JSON.stringify(u),headers:{"content-type":"application/json"},method:"POST"});if(m.status!==200)throw new Error(`Server responded with ${m.status}.`);const b=await m.json();if(b!=null&&b.payload&&t(6,ue=b.payload),We("serververification",b),re&&b.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function Mn(){return h==="ipAddress"?{blockedCountries:void 0,classifier:void 0,disableRules:void 0,email:!1,expectedCountries:void 0,expectedLanguages:void 0,fields:!1,ipAddress:void 0,text:void 0,timeZone:void 0}:typeof h=="object"?h:{blockedCountries:void 0,classifier:void 0,disableRules:void 0,email:void 0,expectedCountries:void 0,expectedLanguages:void 0,fields:void 0,ipAddress:void 0,text:void 0,timeZone:void 0}}function Be(r=20){if(E)if(Ge||(Ge=(j?document.querySelector(j):y==null?void 0:y.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||y||se),Ge){const u=parseInt(G,10)||12,m=Ge.getBoundingClientRect(),b=E.getBoundingClientRect(),D=document.documentElement.clientHeight,Y=document.documentElement.clientWidth,U=F==="auto"?m.bottom+b.height+u+r>D:F==="top",k=Math.max(r,Math.min(Y-r-b.width,m.left+m.width/2-b.width/2));if(U?t(9,E.style.top=`${m.top-(b.height+u)}px`,E):t(9,E.style.top=`${m.bottom+u}px`,E),t(9,E.style.left=`${k}px`,E),E.setAttribute("data-floating",U?"top":"bottom"),fe){const O=fe.getBoundingClientRect();t(10,fe.style.left=m.left-k+m.width/2-O.width/2+"px",fe)}}else L("unable to find floating anchor element")}function Zt(r){r.analytics&&(t(18,d=r.analytics),Lt()),r.obfuscated!==void 0&&t(27,C=r.obfuscated),r.auto!==void 0&&(t(0,v=r.auto),v==="onload"&&(C?Ne():de())),r.beaconurl&&(t(19,T=r.beaconurl),B&&t(11,B.beaconUrl=T,B)),r.floatinganchor!==void 0&&t(23,j=r.floatinganchor),r.delay!==void 0&&t(21,ie=r.delay),r.floatingoffset!==void 0&&t(24,G=r.floatingoffset),r.floating!==void 0&&Ft(r.floating),r.expire!==void 0&&(De(r.expire),t(22,oe=r.expire)),r.challenge&&(Rt(r.challenge),o=r.challenge),r.challengeurl!==void 0&&t(17,x=r.challengeurl),r.debug!==void 0&&t(20,W=!!r.debug),r.hidefooter!==void 0&&t(2,ce=!!r.hidefooter),r.hidelogo!==void 0&&t(3,le=!!r.hidelogo),r.maxnumber!==void 0&&t(25,N=+r.maxnumber),r.mockerror!==void 0&&t(26,Z=!!r.mockerror),r.name!==void 0&&t(4,K=r.name),r.refetchonexpire!==void 0&&t(28,V=!!r.refetchonexpire),r.spamfilter!==void 0&&t(29,h=typeof r.spamfilter=="object"?r.spamfilter:!!r.spamfilter),r.strings&&t(42,l=r.strings),r.test!==void 0&&t(30,Q=typeof r.test=="number"?r.test:!!r.test),r.verifyurl!==void 0&&t(31,ae=r.verifyurl),r.workers!==void 0&&t(32,Le=+r.workers),r.workerurl!==void 0&&t(33,He=r.workerurl)}function Te(r=g.UNVERIFIED,u=null){te&&(clearTimeout(te),te=null),t(8,$=!1),t(5,Ie=u),t(6,ue=null),t(7,z=r)}async function de(){return Te(g.VERIFYING),await new Promise(r=>setTimeout(r,ie||0)),Fn().then(r=>(Rt(r),L("challenge",r),Tt(r))).then(({data:r,solution:u})=>{if(L("solution",u),"challenge"in r&&u&&!("clearText"in u))if((u==null?void 0:u.number)!==void 0){if(ae)return Xn(Ct(r,u));t(6,ue=Ct(r,u)),L("payload",ue)}else throw L("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{sn().then(()=>{t(7,z=g.VERIFIED),t(8,$=!0),L("verified"),We("verified",{payload:ue})})}).catch(r=>{L(r),t(7,z=g.ERROR),t(8,$=!1),t(5,Ie=r.message)})}async function Ne(){if(!C){t(7,z=g.ERROR);return}Te(g.VERIFYING),await new Promise(Y=>setTimeout(Y,ie||0));const[r,u]=C.split("?");let b=new URLSearchParams(u||"").get("key")||void 0;if(b){const Y=b.match(/^\(prompt:?(.*)\)$/);Y&&(b=prompt(Y[1]||"Enter Key:")||void 0)}const{solution:D}=await Tt({obfuscated:r,key:b,maxnumber:N});D&&"clearText"in D?(t(41,ee=D.clearText),t(7,z=g.VERIFIED),t(8,$=!0),F&&E&&t(9,E.style.display="none",E)):(t(7,z=g.ERROR),t(8,$=!1),t(5,Ie="Unable to decrypt data."))}function jn(){$=this.checked,t(8,$)}function Wn(r){Fe[r?"unshift":"push"](()=>{fe=r,t(10,fe)})}function Bn(r){Fe[r?"unshift":"push"](()=>{E=r,t(9,E)})}return n.$$set=r=>{"analytics"in r&&t(18,d=r.analytics),"auto"in r&&t(0,v=r.auto),"beaconurl"in r&&t(19,T=r.beaconurl),"blockspam"in r&&t(34,re=r.blockspam),"challengeurl"in r&&t(17,x=r.challengeurl),"challengejson"in r&&t(35,J=r.challengejson),"debug"in r&&t(20,W=r.debug),"delay"in r&&t(21,ie=r.delay),"expire"in r&&t(22,oe=r.expire),"floating"in r&&t(1,F=r.floating),"floatinganchor"in r&&t(23,j=r.floatinganchor),"floatingoffset"in r&&t(24,G=r.floatingoffset),"hidefooter"in r&&t(2,ce=r.hidefooter),"hidelogo"in r&&t(3,le=r.hidelogo),"name"in r&&t(4,K=r.name),"maxnumber"in r&&t(25,N=r.maxnumber),"mockerror"in r&&t(26,Z=r.mockerror),"obfuscated"in r&&t(27,C=r.obfuscated),"refetchonexpire"in r&&t(28,V=r.refetchonexpire),"spamfilter"in r&&t(29,h=r.spamfilter),"strings"in r&&t(36,R=r.strings),"test"in r&&t(30,Q=r.test),"verifyurl"in r&&t(31,ae=r.verifyurl),"workers"in r&&t(32,Le=r.workers),"workerurl"in r&&t(33,He=r.workerurl),"$$scope"in r&&t(43,f=r.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&131072&&t(14,i=!!(x!=null&&x.includes(".altcha.org"))&&!!(x!=null&&x.includes("apiKey=ckey_"))),n.$$.dirty[1]&16&&(o=J?gt(J):void 0),n.$$.dirty[1]&32&&t(42,l=R?gt(R):{}),n.$$.dirty[1]&2048&&t(13,s={ariaLinkLabel:mt,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${bt}" target="_blank" aria-label="${l.ariaLinkLabel||mt}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...l}),n.$$.dirty[0]&192|n.$$.dirty[1]&1024&&We("statechange",ee?{clarifiedData:ee,state:z}:{payload:ue,state:z}),n.$$.dirty[0]&32&&Gn(),n.$$.dirty[0]&128&&Dn(),n.$$.dirty[1]&1024&&Hn()},[v,F,ce,le,K,Ie,ue,z,$,E,fe,B,pt,s,i,Vn,zt,x,d,T,W,ie,oe,j,G,N,Z,C,V,h,Q,ae,Le,He,re,J,R,Zt,Te,de,Ne,ee,l,f,a,jn,Wn,Bn]}class yt extends yn{constructor(e){super(),bn(this,e,Sn,zn,jt,{analytics:18,auto:0,beaconurl:19,blockspam:34,challengeurl:17,challengejson:35,debug:20,delay:21,expire:22,floating:1,floatinganchor:23,floatingoffset:24,hidefooter:2,hidelogo:3,name:4,maxnumber:25,mockerror:26,obfuscated:27,refetchonexpire:28,spamfilter:29,strings:36,test:30,verifyurl:31,workers:32,workerurl:33,configure:37,reset:38,verify:39,clarify:40},Rn,[-1,-1,-1])}get analytics(){return this.$$.ctx[18]}set analytics(e){this.$$set({analytics:e}),_()}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),_()}get beaconurl(){return this.$$.ctx[19]}set beaconurl(e){this.$$set({beaconurl:e}),_()}get blockspam(){return this.$$.ctx[34]}set blockspam(e){this.$$set({blockspam:e}),_()}get challengeurl(){return this.$$.ctx[17]}set challengeurl(e){this.$$set({challengeurl:e}),_()}get challengejson(){return this.$$.ctx[35]}set challengejson(e){this.$$set({challengejson:e}),_()}get debug(){return this.$$.ctx[20]}set debug(e){this.$$set({debug:e}),_()}get delay(){return this.$$.ctx[21]}set delay(e){this.$$set({delay:e}),_()}get expire(){return this.$$.ctx[22]}set expire(e){this.$$set({expire:e}),_()}get floating(){return this.$$.ctx[1]}set floating(e){this.$$set({floating:e}),_()}get floatinganchor(){return this.$$.ctx[23]}set floatinganchor(e){this.$$set({floatinganchor:e}),_()}get floatingoffset(){return this.$$.ctx[24]}set floatingoffset(e){this.$$set({floatingoffset:e}),_()}get hidefooter(){return this.$$.ctx[2]}set hidefooter(e){this.$$set({hidefooter:e}),_()}get hidelogo(){return this.$$.ctx[3]}set hidelogo(e){this.$$set({hidelogo:e}),_()}get name(){return this.$$.ctx[4]}set name(e){this.$$set({name:e}),_()}get maxnumber(){return this.$$.ctx[25]}set maxnumber(e){this.$$set({maxnumber:e}),_()}get mockerror(){return this.$$.ctx[26]}set mockerror(e){this.$$set({mockerror:e}),_()}get obfuscated(){return this.$$.ctx[27]}set obfuscated(e){this.$$set({obfuscated:e}),_()}get refetchonexpire(){return this.$$.ctx[28]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),_()}get spamfilter(){return this.$$.ctx[29]}set spamfilter(e){this.$$set({spamfilter:e}),_()}get strings(){return this.$$.ctx[36]}set strings(e){this.$$set({strings:e}),_()}get test(){return this.$$.ctx[30]}set test(e){this.$$set({test:e}),_()}get verifyurl(){return this.$$.ctx[31]}set verifyurl(e){this.$$set({verifyurl:e}),_()}get workers(){return this.$$.ctx[32]}set workers(e){this.$$set({workers:e}),_()}get workerurl(){return this.$$.ctx[33]}set workerurl(e){this.$$set({workerurl:e}),_()}get configure(){return this.$$.ctx[37]}get reset(){return this.$$.ctx[38]}get verify(){return this.$$.ctx[39]}get clarify(){return this.$$.ctx[40]}}customElements.define("altcha-widget",gn(yt,{analytics:{type:"Boolean"},auto:{},beaconurl:{},blockspam:{},challengeurl:{},challengejson:{},debug:{type:"Boolean"},delay:{},expire:{},floating:{},floatinganchor:{},floatingoffset:{},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},name:{},maxnumber:{},mockerror:{type:"Boolean"},obfuscated:{},refetchonexpire:{type:"Boolean"},spamfilter:{type:"Boolean"},strings:{},test:{type:"Boolean"},verifyurl:{},workers:{},workerurl:{}},["default"],["configure","reset","verify","clarify"],!1)),globalThis.createAltchaWorker=n=>n?new Worker(new URL(n)):new Xt,w.Altcha=yt,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -16,8 +16,10 @@ declare global {
|
|
|
16
16
|
|
|
17
17
|
interface AltchaServerVerificationEvent extends CustomEvent<Record<string, unknown>> {}
|
|
18
18
|
|
|
19
|
-
interface
|
|
19
|
+
interface AltchaWidgetOptions {
|
|
20
|
+
analytics?: boolean | string;
|
|
20
21
|
auto?: 'onfocus' | 'onload' | 'onsubmit';
|
|
22
|
+
beaconurl?: string;
|
|
21
23
|
blockspam?: boolean;
|
|
22
24
|
challengeurl?: string;
|
|
23
25
|
challengejson?: string;
|
|
@@ -29,9 +31,10 @@ declare global {
|
|
|
29
31
|
floatingoffset?: number;
|
|
30
32
|
hidefooter?: boolean;
|
|
31
33
|
hidelogo?: boolean;
|
|
32
|
-
name?: string;
|
|
33
34
|
maxnumber?: number;
|
|
34
35
|
mockerror?: boolean;
|
|
36
|
+
name?: string;
|
|
37
|
+
obfuscated?: string;
|
|
35
38
|
refetchonexpire?: boolean;
|
|
36
39
|
spamfilter?: boolean | 'ipAddress';
|
|
37
40
|
strings?: string;
|
|
@@ -41,6 +44,16 @@ declare global {
|
|
|
41
44
|
workerurl?: string;
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
interface AltchaWidgetMethods {
|
|
48
|
+
configure: (options: AltchaWidgetOptions) => void;
|
|
49
|
+
clarify: () => Promise<void>;
|
|
50
|
+
reset: (newState: AltchaState = 'unverified', err: string | null = null) => void;
|
|
51
|
+
verify: () => Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface AltchaWidget extends AltchaWidgetOptions extends AltchaWidgetMethods {
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
declare namespace svelteHTML {
|
|
45
58
|
interface IntrinsicElements {
|
|
46
59
|
'altcha-widget': AltchaWidgetSvelte;
|
|
@@ -72,6 +85,7 @@ declare global {
|
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
interface AltchaWidgetReact extends AltchaWidget extends React.HTMLAttributes<HTMLElement> {
|
|
88
|
+
children?: React.ReactNode;
|
|
75
89
|
ref?: React.RefObject<HTMLElement>;
|
|
76
90
|
style?: AltchaWidgetCSSProperties;
|
|
77
91
|
}
|