altcha 0.7.0 → 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 +11 -7
- package/dist/altcha.d.ts +14 -2
- package/dist/altcha.js +844 -644
- package/dist/altcha.umd.cjs +2 -2
- package/dist_external/altcha.d.ts +14 -2
- package/dist_external/altcha.js +812 -612
- 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(g,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(g=typeof globalThis<"u"?globalThis:g||self,p(g.altcha={}))})(this,function(g){"use strict";var An=Object.defineProperty;var It=g=>{throw TypeError(g)};var zn=(g,p,j)=>p in g?An(g,p,{enumerable:!0,configurable:!0,writable:!0,value:j}):g[p]=j;var M=(g,p,j)=>zn(g,typeof p!="symbol"?p+"":p,j),At=(g,p,j)=>p.has(g)||It("Cannot "+j);var O=(g,p,j)=>(At(g,p,"read from private field"),j?j.call(g):p.get(g)),le=(g,p,j)=>p.has(g)?It("Cannot add the same private member more than once"):p instanceof WeakSet?p.add(g):p.set(g,j),zt=(g,p,j,me)=>(At(g,p,"write to private field"),me?me.call(g,j):p.set(g,j),j);var de,he,we,ye,pe,_e;const p="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK",j=n=>Uint8Array.from(atob(n),e=>e.charCodeAt(0)),me=typeof self<"u"&&self.Blob&&new Blob([j(p)],{type:"text/javascript;charset=utf-8"});function Tt(n){let e;try{if(e=me&&(self.URL||self.webkitURL).createObjectURL(me),!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 ae(){}function Oe(n){return n()}function Pe(){return Object.create(null)}function ge(n){n.forEach(Oe)}function Xe(n){return typeof n=="function"}function Ft(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function St(n){return Object.keys(n).length===0}function C(n,e){n.appendChild(e)}function Nt(n,e,t){const i=Mt(n);if(!i.getElementById(e)){const o=L("style");o.id=e,o.textContent=t,jt(i,o)}}function Mt(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function jt(n,e){return C(n.head||n,e),e.sheet}function D(n,e,t){n.insertBefore(e,t||null)}function S(n){n.parentNode&&n.parentNode.removeChild(n)}function L(n){return document.createElement(n)}function $(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function He(n){return document.createTextNode(n)}function q(){return He(" ")}function Dt(){return He("")}function Me(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function a(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Ut(n){return Array.from(n.childNodes)}function We(n,e,t){n.classList.toggle(e,!!t)}function Zt(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function Vt(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let be;function ve(n){be=n}function je(){if(!be)throw new Error("Function called outside component initialization");return be}function Bt(n){je().$$.on_mount.push(n)}function Gt(n){je().$$.on_destroy.push(n)}function Ot(){const n=je();return(e,t,{cancelable:i=!1}={})=>{const o=n.$$.callbacks[e];if(o){const s=Zt(e,t,{cancelable:i});return o.slice().forEach(u=>{u.call(n,s)}),!s.defaultPrevented}return!0}}const ce=[],Ce=[];let fe=[];const Ye=[],Ke=Promise.resolve();let De=!1;function Je(){De||(De=!0,Ke.then(k))}function Pt(){return Je(),Ke}function Ue(n){fe.push(n)}const Ze=new Set;let ue=0;function k(){if(ue!==0)return;const n=be;do{try{for(;ue<ce.length;){const e=ce[ue];ue++,ve(e),Xt(e.$$)}}catch(e){throw ce.length=0,ue=0,e}for(ve(null),ce.length=0,ue=0;Ce.length;)Ce.pop()();for(let e=0;e<fe.length;e+=1){const t=fe[e];Ze.has(t)||(Ze.add(t),t())}fe.length=0}while(ce.length);for(;Ye.length;)Ye.pop()();De=!1,Ze.clear(),ve(n)}function Xt(n){if(n.fragment!==null){n.update(),ge(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Ue)}}function Ht(n){const e=[],t=[];fe.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),fe=e}const Wt=new Set;function Yt(n,e){n&&n.i&&(Wt.delete(n),n.i(e))}function Kt(n,e,t){const{fragment:i,after_update:o}=n.$$;i&&i.m(e,t),Ue(()=>{const s=n.$$.on_mount.map(Oe).filter(Xe);n.$$.on_destroy?n.$$.on_destroy.push(...s):ge(s),n.$$.on_mount=[]}),o.forEach(Ue)}function Jt(n,e){const t=n.$$;t.fragment!==null&&(Ht(t.after_update),ge(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function $t(n,e){n.$$.dirty[0]===-1&&(ce.push(n),Je(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function qt(n,e,t,i,o,s,u=null,c=[-1]){const l=be;ve(n);const f=n.$$={fragment:null,ctx:[],props:s,update:ae,not_equal:o,bound:Pe(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:Pe(),dirty:c,skip_bound:!1,root:e.target||l.$$.root};u&&u(f.root);let P=!1;if(f.ctx=t?t(n,e.props||{},(v,X,...H)=>{const W=H.length?H[0]:X;return f.ctx&&o(f.ctx[v],f.ctx[v]=W)&&(!f.skip_bound&&f.bound[v]&&f.bound[v](W),P&&$t(n,v)),X}):[],f.update(),P=!0,ge(f.before_update),f.fragment=i?i(f.ctx):!1,e.target){if(e.hydrate){const v=Ut(e.target);f.fragment&&f.fragment.l(v),v.forEach(S)}else f.fragment&&f.fragment.c();e.intro&&Yt(n.$$.fragment),Kt(n,e.target,e.anchor),k()}ve(l)}let $e;typeof HTMLElement=="function"&&($e=class extends HTMLElement{constructor(e,t,i){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=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(s){return()=>{let u;return{c:function(){u=L("slot"),s!=="default"&&a(u,"name",s)},m:function(f,P){D(f,u,P)},d:function(f){f&&S(u)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=Vt(this);for(const s of this.$$s)s in i&&(t[s]=[e(s)]);for(const s of this.attributes){const u=this.$$g_p(s.name);u in this.$$d||(this.$$d[u]=Le(u,s.value,this.$$p_d,"toProp"))}for(const s in this.$$p_d)!(s in this.$$d)&&this[s]!==void 0&&(this.$$d[s]=this[s],delete this[s]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const s in this.$$p_d)if(this.$$d[s]=this.$$c.$$.ctx[this.$$c.$$.props[s]],this.$$p_d[s].reflect){const u=Le(s,this.$$d[s],this.$$p_d,"toAttribute");u==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,u)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const s in this.$$l)for(const u of this.$$l[s]){const c=this.$$c.$on(s,u);this.$$l_u.set(u,c)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Le(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 Le(n,e,t,i){var s;const o=(s=t[n])==null?void 0:s.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 Qt(n,e,t,i,o,s){let u=class extends $e{constructor(){super(n,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(c=>(e[c].attribute||c).toLowerCase())}};return Object.keys(e).forEach(c=>{Object.defineProperty(u.prototype,c,{get(){return this.$$c&&c in this.$$c?this.$$c[c]:this.$$d[c]},set(l){var f;l=Le(c,l,e),this.$$d[c]=l,(f=this.$$c)==null||f.$set({[c]:l})}})}),i.forEach(c=>{Object.defineProperty(u.prototype,c,{get(){var l;return(l=this.$$c)==null?void 0:l[c]}})}),n.element=u,u}class en{constructor(){M(this,"$$");M(this,"$$set")}$destroy(){Jt(this,1),this.$destroy=ae}$on(e,t){if(!Xe(t))return ae;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&&!St(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const tn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(tn);const nn=new TextEncoder;function rn(n){return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function on(n,e="SHA-256",t=1e5){const i=Date.now().toString(16);n||(n=Math.round(Math.random()*t));const o=await qe(i,n,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function qe(n,e,t){return rn(await crypto.subtle.digest(t.toUpperCase(),nn.encode(n+e)))}function sn(n,e,t="SHA-256",i=1e6,o=0){const s=new AbortController,u=Date.now();return{promise:(async()=>{for(let l=o;l<=i;l+=1){if(s.signal.aborted)return null;if(await qe(e,l,t)===n)return{number:l,took:Date.now()-u}}return null})(),controller:s}}function Qe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}class ln{constructor(e){M(this,"beaconUrl",null);M(this,"error",null);M(this,"loadTime",Date.now());M(this,"submitTime",null);M(this,"startTime",null);M(this,"viewTimeThresholdMs",1500);le(this,de,{});le(this,he,null);le(this,we,this.onFormChange.bind(this));le(this,ye,this.onFormFocus.bind(this));le(this,pe,this.onFormSubmit.bind(this));le(this,_e,this.onUnload.bind(this));this.elForm=e,window.addEventListener("unload",O(this,_e)),this.elForm.addEventListener("change",O(this,we)),this.elForm.addEventListener("focusin",O(this,ye)),this.elForm.addEventListener("submit",O(this,pe))}data(){const e=Object.entries(O(this,de));return{correction:e.length&&e.filter(([t,i])=>i>1).length/e.length||0,dropoff:!this.submitTime&&!this.error&&O(this,he)?O(this,he):null,error:this.error,mobile:this.isMobile(),start:this.startTime,submit:this.submitTime,tz:Qe()}}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",O(this,_e)),this.elForm.removeEventListener("change",O(this,we)),this.elForm.removeEventListener("focusin",O(this,ye)),this.elForm.removeEventListener("submit",O(this,pe))}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&&zt(this,he,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){O(this,de)[e]=(O(this,de)[e]||0)+1}}de=new WeakMap,he=new WeakMap,we=new WeakMap,ye=new WeakMap,pe=new WeakMap,_e=new WeakMap;var b=(n=>(n.ERROR="error",n.VERIFIED="verified",n.VERIFYING="verifying",n.UNVERIFIED="unverified",n.EXPIRED="expired",n))(b||{});function an(n){Nt(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 et(n){let e,t,i;return{c(){e=$("svg"),t=$("path"),i=$("path"),a(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"),a(t,"fill","currentColor"),a(t,"opacity",".25"),a(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"),a(i,"fill","currentColor"),a(i,"class","altcha-spinner svelte-ddsc3z"),a(e,"width","24"),a(e,"height","24"),a(e,"viewBox","0 0 24 24"),a(e,"xmlns","http://www.w3.org/2000/svg")},m(o,s){D(o,e,s),C(e,t),C(e,i)},d(o){o&&S(e)}}}function cn(n){let e,t=n[13].label+"",i;return{c(){e=L("label"),a(e,"for",i=n[4]+"_checkbox"),a(e,"class","svelte-ddsc3z")},m(o,s){D(o,e,s),e.innerHTML=t},p(o,s){s[0]&8192&&t!==(t=o[13].label+"")&&(e.innerHTML=t),s[0]&16&&i!==(i=o[4]+"_checkbox")&&a(e,"for",i)},d(o){o&&S(e)}}}function fn(n){let e,t=n[13].verifying+"";return{c(){e=L("span")},m(i,o){D(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 un(n){let e,t=n[13].verified+"",i,o,s,u,c=n[11]&&tt(n);return{c(){e=L("span"),i=q(),o=L("input"),s=q(),c&&c.c(),u=Dt(),a(o,"type","hidden"),a(o,"name",n[4]),o.value=n[6]},m(l,f){D(l,e,f),e.innerHTML=t,D(l,i,f),D(l,o,f),D(l,s,f),c&&c.m(l,f),D(l,u,f)},p(l,f){f[0]&8192&&t!==(t=l[13].verified+"")&&(e.innerHTML=t),f[0]&16&&a(o,"name",l[4]),f[0]&64&&(o.value=l[6]),l[11]?c?c.p(l,f):(c=tt(l),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(l){l&&(S(e),S(i),S(o),S(s),S(u)),c&&c.d(l)}}}function tt(n){let e;return{c(){e=L("input"),a(e,"type","hidden"),a(e,"name","__session"),e.value=n[12]},m(t,i){D(t,e,i)},p(t,i){i[0]&4096&&(e.value=t[12])},d(t){t&&S(e)}}}function nt(n){let e,t,i,o,s,u,c;return{c(){e=L("div"),t=L("a"),i=$("svg"),o=$("path"),s=$("path"),u=$("path"),a(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"),a(o,"fill","currentColor"),a(s,"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"),a(s,"fill","currentColor"),a(u,"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"),a(u,"fill","currentColor"),a(i,"width","22"),a(i,"height","22"),a(i,"viewBox","0 0 20 20"),a(i,"fill","none"),a(i,"xmlns","http://www.w3.org/2000/svg"),a(t,"href",lt),a(t,"target","_blank"),a(t,"class","altcha-logo svelte-ddsc3z"),a(t,"aria-label",c=n[13].ariaLinkLabel)},m(l,f){D(l,e,f),C(e,t),C(t,i),C(i,o),C(i,s),C(i,u)},p(l,f){f[0]&8192&&c!==(c=l[13].ariaLinkLabel)&&a(t,"aria-label",c)},d(l){l&&S(e)}}}function rt(n){let e,t,i,o;function s(l,f){return l[7]===b.EXPIRED?hn:dn}let u=s(n),c=u(n);return{c(){e=L("div"),t=$("svg"),i=$("path"),o=q(),c.c(),a(i,"stroke-linecap","round"),a(i,"stroke-linejoin","round"),a(i,"d","M6 18L18 6M6 6l12 12"),a(t,"width","14"),a(t,"height","14"),a(t,"xmlns","http://www.w3.org/2000/svg"),a(t,"fill","none"),a(t,"viewBox","0 0 24 24"),a(t,"stroke-width","1.5"),a(t,"stroke","currentColor"),a(e,"class","altcha-error svelte-ddsc3z")},m(l,f){D(l,e,f),C(e,t),C(t,i),C(e,o),c.m(e,null)},p(l,f){u===(u=s(l))&&c?c.p(l,f):(c.d(1),c=u(l),c&&(c.c(),c.m(e,null)))},d(l){l&&S(e),c.d()}}}function dn(n){let e,t=n[13].error+"";return{c(){e=L("div"),a(e,"title",n[5])},m(i,o){D(i,e,o),e.innerHTML=t},p(i,o){o[0]&8192&&t!==(t=i[13].error+"")&&(e.innerHTML=t),o[0]&32&&a(e,"title",i[5])},d(i){i&&S(e)}}}function hn(n){let e,t=n[13].expired+"";return{c(){e=L("div"),a(e,"title",n[5])},m(i,o){D(i,e,o),e.innerHTML=t},p(i,o){o[0]&8192&&t!==(t=i[13].expired+"")&&(e.innerHTML=t),o[0]&32&&a(e,"title",i[5])},d(i){i&&S(e)}}}function it(n){let e,t,i=n[13].footer+"";return{c(){e=L("div"),t=L("div"),a(t,"class","svelte-ddsc3z"),a(e,"class","altcha-footer svelte-ddsc3z")},m(o,s){D(o,e,s),C(e,t),t.innerHTML=i},p(o,s){s[0]&8192&&i!==(i=o[13].footer+"")&&(t.innerHTML=i)},d(o){o&&S(e)}}}function ot(n){let e;return{c(){e=L("div"),a(e,"class","altcha-anchor-arrow svelte-ddsc3z")},m(t,i){D(t,e,i),n[41](e)},p:ae,d(t){t&&S(e),n[41](null)}}}function mn(n){let e,t,i,o,s,u,c,l,f,P,v,X,H,W,Q,w=n[7]===b.VERIFYING&&et();function te(h,E){return h[7]===b.VERIFIED?un:h[7]===b.VERIFYING?fn:cn}let ee=te(n),Z=ee(n),z=(n[3]!==!0||n[14])&&nt(n),N=(n[5]||n[7]===b.EXPIRED)&&rt(n),R=n[13].footer&&(n[2]!==!0||n[14])&&it(n),T=n[1]&&ot(n);return{c(){e=L("div"),t=L("div"),w&&w.c(),i=q(),o=L("div"),s=L("input"),l=q(),f=L("div"),Z.c(),P=q(),z&&z.c(),v=q(),N&&N.c(),X=q(),R&&R.c(),H=q(),T&&T.c(),a(s,"type","checkbox"),a(s,"id",u=n[4]+"_checkbox"),s.required=c=n[0]!=="onsubmit",a(s,"class","svelte-ddsc3z"),a(o,"class","altcha-checkbox svelte-ddsc3z"),We(o,"altcha-hidden",n[7]===b.VERIFYING),a(f,"class","altcha-label svelte-ddsc3z"),a(t,"class","altcha-main svelte-ddsc3z"),a(e,"class","altcha svelte-ddsc3z"),a(e,"data-state",n[7]),a(e,"data-floating",n[1])},m(h,E){D(h,e,E),C(e,t),w&&w.m(t,null),C(t,i),C(t,o),C(o,s),s.checked=n[8],C(t,l),C(t,f),Z.m(f,null),C(t,P),z&&z.m(t,null),C(e,v),N&&N.m(e,null),C(e,X),R&&R.m(e,null),C(e,H),T&&T.m(e,null),n[42](e),W||(Q=[Me(s,"change",n[40]),Me(s,"change",n[15]),Me(s,"invalid",n[16])],W=!0)},p(h,E){h[7]===b.VERIFYING?w||(w=et(),w.c(),w.m(t,i)):w&&(w.d(1),w=null),E[0]&16&&u!==(u=h[4]+"_checkbox")&&a(s,"id",u),E[0]&1&&c!==(c=h[0]!=="onsubmit")&&(s.required=c),E[0]&256&&(s.checked=h[8]),E[0]&128&&We(o,"altcha-hidden",h[7]===b.VERIFYING),ee===(ee=te(h))&&Z?Z.p(h,E):(Z.d(1),Z=ee(h),Z&&(Z.c(),Z.m(f,null))),h[3]!==!0||h[14]?z?z.p(h,E):(z=nt(h),z.c(),z.m(t,null)):z&&(z.d(1),z=null),h[5]||h[7]===b.EXPIRED?N?N.p(h,E):(N=rt(h),N.c(),N.m(e,X)):N&&(N.d(1),N=null),h[13].footer&&(h[2]!==!0||h[14])?R?R.p(h,E):(R=it(h),R.c(),R.m(e,H)):R&&(R.d(1),R=null),h[1]?T?T.p(h,E):(T=ot(h),T.c(),T.m(e,null)):T&&(T.d(1),T=null),E[0]&128&&a(e,"data-state",h[7]),E[0]&2&&a(e,"data-floating",h[1])},i:ae,o:ae,d(h){h&&S(e),w&&w.d(),Z.d(),z&&z.d(),N&&N.d(),R&&R.d(),T&&T.d(),n[42](null),W=!1,ge(Q)}}}const st="Visit Altcha.org",lt="https://altcha.org/";function at(n){return JSON.parse(n)}function gn(n,e,t){var Lt,Rt;let i,o,s,u,{analytics:c=!1}=e,{auto:l=void 0}=e,{beaconurl:f=void 0}=e,{blockspam:P=void 0}=e,{challengeurl:v=void 0}=e,{challengejson:X=void 0}=e,{debug:H=!1}=e,{delay:W=0}=e,{expire:Q=void 0}=e,{floating:w=void 0}=e,{floatinganchor:te=void 0}=e,{floatingoffset:ee=void 0}=e,{hidefooter:Z=!1}=e,{hidelogo:z=!1}=e,{name:N="altcha"}=e,{maxnumber:R=1e6}=e,{mockerror:T=!1}=e,{refetchonexpire:h=!0}=e,{spamfilter:E=!1}=e,{strings:Re=void 0}=e,{test:Y=!1}=e,{verifyurl:re=void 0}=e,{workers:ke=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:Ie=void 0}=e;const Ve=Ot(),ft=["SHA-256","SHA-384","SHA-512"],ut=(Rt=(Lt=document.documentElement.lang)==null?void 0:Lt.split("-"))==null?void 0:Rt[0];let ne=!1,I,ie=null,Ae=null,m=null,ze=null,K=null,oe=null,V=null,dt=null,B=b.UNVERIFIED;Gt(()=>{m&&(m.removeEventListener("submit",mt),m.removeEventListener("reset",gt),m.removeEventListener("focusin",ht),m=null),V&&V.destroy(),K&&(clearTimeout(K),K=null),document.removeEventListener("click",pt),document.removeEventListener("scroll",_t),window.removeEventListener("resize",Et)}),Bt(()=>{x("mounted","0.7.0"),x("workers",ke),Y&&x("using test mode"),Q&&Te(Q),l!==void 0&&x("auto",l),w!==void 0&&xt(w),m=I.closest("form"),m&&(m.addEventListener("submit",mt,{capture:!0}),m.addEventListener("reset",gt),l==="onfocus"&&m.addEventListener("focusin",ht)),c&&wt(),l==="onload"&&se(),i&&(Z||z)&&x("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function x(...r){(H||r.some(d=>d instanceof Error))&&console[r[0]instanceof Error?"error":"log"]("ALTCHA",...r)}function ht(r){B===b.UNVERIFIED&&se()}function mt(r){m&&V&&B===b.VERIFIED&&(V.end(),t(12,dt=V.dataAsBase64())),m&&l==="onsubmit"&&(B===b.UNVERIFIED?(r.preventDefault(),r.stopPropagation(),se().then(()=>{m==null||m.requestSubmit()})):B!==b.VERIFIED&&(r.preventDefault(),r.stopPropagation(),B===b.VERIFYING&&kt()))}function gt(){Fe()}function bt(r,d){return btoa(JSON.stringify({algorithm:r.algorithm,challenge:r.challenge,number:d.number,salt:r.salt,signature:r.signature,test:Y?!0:void 0,took:d.took}))}function vt(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(!ft.includes(r.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${ft.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 bn(){var r;if(T)throw x("mocking error"),new Error("Mocked error.");if(o)return x("using provided json data"),o;if(Y)return x("generating test challenge",{test:Y}),on(typeof Y!="boolean"?+Y:void 0);{if(!v&&m){const _=m.getAttribute("action");_!=null&&_.includes("/form/")&&t(17,v=_+"/altcha")}if(!v)throw new Error("Attribute challengeurl not set.");x("fetching challenge from",v);const d=await fetch(v,{headers:E?{"x-altcha-spam-filter":"1"}:{}});if(d.status!==200)throw new Error(`Server responded with ${d.status}.`);const y=d.headers.get("Expires"),F=d.headers.get("X-Altcha-Config"),G=await d.json(),U=new URLSearchParams((r=G.salt.split("?"))==null?void 0:r[1]),J=U.get("expires")||U.get("expire");if(J){const _=new Date(+J*1e3),A=isNaN(_.getTime())?0:_.getTime()-Date.now();A>0&&Te(A)}if(F)try{const _=JSON.parse(F);_&&typeof _=="object"&&(_.verifyurl&&(_.verifyurl=new URL(_.verifyurl,new URL(v)).toString()),Ct(_))}catch(_){x("unable to configure from X-Altcha-Config",_)}if(!Q&&(y!=null&&y.length)){const _=Date.parse(y);if(_){const A=_-Date.now();A>0&&Te(A)}}return G}}function wt(){if(!V)if(m){if(x("analytics enabled"),t(11,V=new ln(m)),f===void 0){const r=m.getAttribute("action");r&&t(19,f=r+"/beacon")}t(11,V.beaconUrl=f||null,V)}else x("analytics cannot be enabled - form element not found")}function yt(){v&&h&&B===b.VERIFIED?se():Fe(b.EXPIRED,u.expired)}async function vn(r){let d=null;if("Worker"in window){try{d=await wn(r.challenge,r.salt,r.algorithm,r.maxnumber)}catch(y){x(y)}if((d==null?void 0:d.number)!==void 0)return{data:r,solution:d}}return{data:r,solution:await sn(r.challenge,r.salt,r.algorithm,r.maxnumber||R).promise}}async function wn(r,d,y,F=typeof Y=="number"?Y:R,G=Math.ceil(ke)){const U=[];G=Math.min(16,Math.max(1,G));for(let A=0;A<G;A++)U.push(createAltchaWorker(Ie));const J=Math.ceil(F/G),_=await Promise.all(U.map((A,Ge)=>{const Ee=Ge*J;return new Promise(Se=>{A.addEventListener("message",Ne=>{if(Ne.data)for(const xe of U)xe!==A&&xe.postMessage({type:"abort"});Se(Ne.data)}),A.postMessage({payload:{alg:y,challenge:r,max:Ee+J,salt:d,start:Ee},type:"work"})})}));for(const A of U)A.terminate();return _.find(A=>!!A)||null}function yn(){[b.UNVERIFIED,b.ERROR,b.EXPIRED].includes(B)?E&&(m==null?void 0:m.reportValidity())===!1?t(8,ne=!1):se():t(8,ne=!0)}function pt(r){const d=r.target;w&&d&&!I.contains(d)&&B===b.VERIFIED&&t(9,I.style.display="none",I)}function _t(){w&&Be()}function kt(){B===b.VERIFYING&&u.waitAlert&&alert(u.waitAlert)}function pn(r){V&&V.trackError(ze)}function _n(r){w&&B!==b.UNVERIFIED&&requestAnimationFrame(()=>{Be()})}function Et(){w&&Be()}function Te(r){x("expire",r),K&&(clearTimeout(K),K=null),r<1?yt():K=setTimeout(yt,r)}function xt(r){x("floating",r),w!==r&&(t(9,I.style.left="",I),t(9,I.style.top="",I)),t(1,w=r===!0||r===""?"auto":r===!1||r==="false"?void 0:w),w?(l||t(0,l="onsubmit"),document.addEventListener("scroll",_t),document.addEventListener("click",pt),window.addEventListener("resize",Et)):l==="onsubmit"&&t(0,l=void 0)}function kn(r){var y;const d=m==null?void 0:m.querySelector(typeof r=="string"?`input[name="${r}"]`:'input[type="email"]:not([data-no-spamfilter])');return((y=d==null?void 0:d.value)==null?void 0:y.slice(d.value.indexOf("@")))||void 0}function En(r){return[...(m==null?void 0:m.querySelectorAll(r!=null&&r.length?r.map(y=>`input[name="${y}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((y,F)=>{const G=F.name,U=F.value;return G&&U&&(y[G]=/\n/.test(U)?U.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,7 +16,7 @@ declare global {
|
|
|
16
16
|
|
|
17
17
|
interface AltchaServerVerificationEvent extends CustomEvent<Record<string, unknown>> {}
|
|
18
18
|
|
|
19
|
-
interface
|
|
19
|
+
interface AltchaWidgetOptions {
|
|
20
20
|
analytics?: boolean | string;
|
|
21
21
|
auto?: 'onfocus' | 'onload' | 'onsubmit';
|
|
22
22
|
beaconurl?: string;
|
|
@@ -31,9 +31,10 @@ declare global {
|
|
|
31
31
|
floatingoffset?: number;
|
|
32
32
|
hidefooter?: boolean;
|
|
33
33
|
hidelogo?: boolean;
|
|
34
|
-
name?: string;
|
|
35
34
|
maxnumber?: number;
|
|
36
35
|
mockerror?: boolean;
|
|
36
|
+
name?: string;
|
|
37
|
+
obfuscated?: string;
|
|
37
38
|
refetchonexpire?: boolean;
|
|
38
39
|
spamfilter?: boolean | 'ipAddress';
|
|
39
40
|
strings?: string;
|
|
@@ -43,6 +44,16 @@ declare global {
|
|
|
43
44
|
workerurl?: string;
|
|
44
45
|
}
|
|
45
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
|
+
|
|
46
57
|
declare namespace svelteHTML {
|
|
47
58
|
interface IntrinsicElements {
|
|
48
59
|
'altcha-widget': AltchaWidgetSvelte;
|
|
@@ -74,6 +85,7 @@ declare global {
|
|
|
74
85
|
}
|
|
75
86
|
|
|
76
87
|
interface AltchaWidgetReact extends AltchaWidget extends React.HTMLAttributes<HTMLElement> {
|
|
88
|
+
children?: React.ReactNode;
|
|
77
89
|
ref?: React.RefObject<HTMLElement>;
|
|
78
90
|
style?: AltchaWidgetCSSProperties;
|
|
79
91
|
}
|