/** * Minified by jsDelivr using Terser v5.37.0. * Original file: /gh/altcha-org/altcha@main/dist/altcha.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ var vi=Object.defineProperty,Pr=e=>{throw TypeError(e)},gi=(e,t,n)=>t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ne=(e,t,n)=>gi(e,"symbol"!=typeof t?t+"":t,n),zr=(e,t,n)=>t.has(e)||Pr("Cannot "+n),M=(e,t,n)=>(zr(e,t,"read from private field"),n?n.call(e):t.get(e)),Yt=(e,t,n)=>t.has(e)?Pr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ft=(e,t,n,r)=>(zr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const Hr="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGQ9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIHAoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBiKGUsdCxyKXtpZih0eXBlb2YgY3J5cHRvPiJ1Inx8ISgic3VidGxlImluIGNyeXB0byl8fCEoImRpZ2VzdCJpbiBjcnlwdG8uc3VidGxlKSl0aHJvdyBuZXcgRXJyb3IoIldlYiBDcnlwdG8gaXMgbm90IGF2YWlsYWJsZS4gU2VjdXJlIGNvbnRleHQgaXMgcmVxdWlyZWQgKGh0dHBzOi8vZGV2ZWxvcGVyLm1vemlsbGEub3JnL2VuLVVTL2RvY3MvV2ViL1NlY3VyaXR5L1NlY3VyZV9Db250ZXh0cykuIik7cmV0dXJuIHAoYXdhaXQgY3J5cHRvLnN1YnRsZS5kaWdlc3Qoci50b1VwcGVyQ2FzZSgpLGQuZW5jb2RlKGUrdCkpKX1mdW5jdGlvbiB3KGUsdCxyPSJTSEEtMjU2IixuPTFlNixzPTApe2NvbnN0IG89bmV3IEFib3J0Q29udHJvbGxlcixhPURhdGUubm93KCk7cmV0dXJue3Byb21pc2U6KGFzeW5jKCk9Pntmb3IobGV0IGM9cztjPD1uO2MrPTEpe2lmKG8uc2lnbmFsLmFib3J0ZWQpcmV0dXJuIG51bGw7aWYoYXdhaXQgYih0LGMscik9PT1lKXJldHVybntudW1iZXI6Yyx0b29rOkRhdGUubm93KCktYX19cmV0dXJuIG51bGx9KSgpLGNvbnRyb2xsZXI6b319ZnVuY3Rpb24gaChlKXtjb25zdCB0PWF0b2IoZSkscj1uZXcgVWludDhBcnJheSh0Lmxlbmd0aCk7Zm9yKGxldCBuPTA7bjx0Lmxlbmd0aDtuKyspcltuXT10LmNoYXJDb2RlQXQobik7cmV0dXJuIHJ9ZnVuY3Rpb24gZyhlLHQ9MTIpe2NvbnN0IHI9bmV3IFVpbnQ4QXJyYXkodCk7Zm9yKGxldCBuPTA7bjx0O24rKylyW25dPWUlMjU2LGU9TWF0aC5mbG9vcihlLzI1Nik7cmV0dXJuIHJ9YXN5bmMgZnVuY3Rpb24gbShlLHQ9IiIscj0xZTYsbj0wKXtjb25zdCBzPSJBRVMtR0NNIixvPW5ldyBBYm9ydENvbnRyb2xsZXIsYT1EYXRlLm5vdygpLGw9YXN5bmMoKT0+e2ZvcihsZXQgdT1uO3U8PXI7dSs9MSl7aWYoby5zaWduYWwuYWJvcnRlZHx8IWN8fCF5KXJldHVybiBudWxsO3RyeXtjb25zdCBmPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVjcnlwdCh7bmFtZTpzLGl2OmcodSl9LGMseSk7aWYoZilyZXR1cm57Y2xlYXJUZXh0Om5ldyBUZXh0RGVjb2RlcigpLmRlY29kZShmKSx0b29rOkRhdGUubm93KCktYX19Y2F0Y2h7fX1yZXR1cm4gbnVsbH07bGV0IGM9bnVsbCx5PW51bGw7dHJ5e3k9aChlKTtjb25zdCB1PWF3YWl0IGNyeXB0by5zdWJ0bGUuZGlnZXN0KCJTSEEtMjU2IixkLmVuY29kZSh0KSk7Yz1hd2FpdCBjcnlwdG8uc3VidGxlLmltcG9ydEtleSgicmF3Iix1LHMsITEsWyJkZWNyeXB0Il0pfWNhdGNoe3JldHVybntwcm9taXNlOlByb21pc2UucmVqZWN0KCksY29udHJvbGxlcjpvfX1yZXR1cm57cHJvbWlzZTpsKCksY29udHJvbGxlcjpvfX1sZXQgaTtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOnIsc3RhcnQ6bixtYXg6c309ZS5kYXRhO2xldCBvPW51bGw7aWYodD09PSJhYm9ydCIpaT09bnVsbHx8aS5hYm9ydCgpLGk9dm9pZCAwO2Vsc2UgaWYodD09PSJ3b3JrIil7aWYoIm9iZnVzY2F0ZWQiaW4gcil7Y29uc3R7a2V5OmEsb2JmdXNjYXRlZDpsfT1yfHx7fTtvPWF3YWl0IG0obCxhLHMsbil9ZWxzZXtjb25zdHthbGdvcml0aG06YSxjaGFsbGVuZ2U6bCxzYWx0OmN9PXJ8fHt9O289dyhsLGMsYSxzLG4pfWk9by5jb250cm9sbGVyLG8ucHJvbWlzZS50aGVuKGE9PntzZWxmLnBvc3RNZXNzYWdlKGEmJnsuLi5hLHdvcmtlcjohMH0pfSl9fX0pKCk7Cg==",_i=e=>Uint8Array.from(atob(e),(e=>e.charCodeAt(0))),Gr=typeof self<"u"&&self.Blob&&new Blob([_i(Hr)],{type:"text/javascript;charset=utf-8"});function mi(e){let t;try{if(t=Gr&&(self.URL||self.webkitURL).createObjectURL(Gr),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),n}catch{return new Worker("data:text/javascript;base64,"+Hr,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const bi="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(bi);const yi=1,pi=4,wi=8,Ei=16,xi=1,ki=2,Jr="[",Kr="[!",qr="]",Me={},j=Symbol(),Qr=!1;var en=Array.isArray,Ci=Array.from,kt=Object.keys,Ct=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ri=Object.getOwnPropertyDescriptors,Ii=Object.prototype,$i=Array.prototype,Xt=Object.getPrototypeOf;function tn(e){for(var t=0;t=v.v&&V(v,p+1)}Dr(a)}return!0},ownKeys(e){h(a);var t=Reflect.ownKeys(e).filter((e=>{var t=l.get(e);return void 0===t||t.v!==j}));for(var[n,r]of l)r.v!==j&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Fi()}})}function Dr(e,t=1){V(e,e.v+t)}var Yr,cn,dn;function Wt(){if(void 0===Yr){Yr=window;var e=Element.prototype,t=Node.prototype;cn=Ae(t,"firstChild").get,dn=Ae(t,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0}}function Lt(e=""){return document.createTextNode(e)}function Te(e){return cn.call(e)}function $e(e){return dn.call(e)}function J(e,t){if(!z)return Te(e);var n=Te(P);return null===n&&(n=P.appendChild(Lt())),Re(n),n}function Ot(e,t){if(!z){var n=Te(e);return n instanceof Comment&&""===n.data?$e(n):n}return P}function me(e,t=1,n=!1){let r=z?P:e;for(var o;t--;)o=r,r=$e(r);if(!z)return r;var l=null==r?void 0:r.nodeType;if(n&&3!==l){var i=Lt();return null===r?null==o||o.after(i):r.before(i),Re(i),i}return Re(r),r}function Mi(e){e.textContent=""}function ot(e){var t=2050;null===y?t|=Ve:y.f|=nn;var n=null!==R&&2&R.f?R:null;const r={children:null,ctx:X,deps:null,equals:an,f:t,fn:e,reactions:null,v:null,version:0,parent:n??y};return null!==n&&(n.children??(n.children=[])).push(r),r}function hn(e){var t=e.children;if(null!==t){e.children=null;for(var n=0;n{Pe(t)}}function Qt(e){return Qe(4,e,!1)}function er(e){return Qe(8,e,!0)}function Oe(e){return tr(e)}function tr(e,t=0){return Qe(24|t,e,!0)}function It(e,t=!0){return Qe(40,e,!0,t)}function mn(e){var t=e.teardown;if(null!==t){const e=nr,n=R;Zr(!0),Ie(null);try{t.call(null)}finally{Zr(e),Ie(n)}}}function bn(e){var t=e.deriveds;if(null!==t){e.deriveds=null;for(var n=0;n{Pe(e),t&&t()}))}function qi(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var o of e)o.out(r)}else t()}function wn(e,t,n){if(!(e.f&He)){if(e.f^=He,null!==e.transitions)for(const r of e.transitions)(r.is_global||n)&&t.push(r);for(var r=e.first;null!==r;){var o=r.next;wn(r,t,!!(!!(r.f&Kt)||!!(32&r.f))&&n),r=o}}}function Or(e){En(e,!0)}function En(e,t){if(e.f&He){_t(e)&&Tt(e),e.f^=He;for(var n=e.first;null!==n;){var r=n.next;En(n,!!(!!(n.f&Kt)||!!(32&n.f))&&t),n=r}if(null!==e.transitions)for(const n of e.transitions)(n.is_global||t)&&n.in()}}const Qi=typeof requestIdleCallback>"u"?e=>setTimeout(e,1):requestIdleCallback;let $t=!1,St=!1,Mt=[],jt=[];function xn(){$t=!1;const e=Mt.slice();Mt=[],tn(e)}function kn(){St=!1;const e=jt.slice();jt=[],tn(e)}function rr(e){$t||($t=!0,queueMicrotask(xn)),Mt.push(e)}function el(e){St||(St=!0,Qi(kn)),jt.push(e)}function tl(){$t&&xn(),St&&kn()}function Cn(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}const Rn=0,rl=1;let wt=!1,Et=Rn,ft=!1,ct=null,je=!1,nr=!1;function Xr(e){je=e}function Zr(e){nr=e}let Le=[],Be=0,R=null;function Ie(e){R=e}let y=null;function he(e){y=e}let de=null;function nl(e){de=e}let O=null,q=0,xe=null;function il(e){xe=e}let In=0,Ue=!1,X=null;function $n(){return++In}function ll(){return!sn}function _t(e){var t,n,r=e.f;if(r&Ce)return!0;if(r>){var o=e.deps,l=!!(r&Ve);if(null!==o){var i;if(r&Rt){for(i=0;ie.version)return!0}}l||ve(e,B)}return!1}function al(e,t){for(var n=t;null!==n;){if(n.f&Zt)try{return void n.fn(e)}catch{n.f^=Zt}n=n.parent}throw wt=!1,e}function ol(e){return!(e.f&qe||null!==e.parent&&e.parent.f&Zt)}function At(e,t,n,r){if(wt){if(null===n&&(wt=!1),ol(t))throw e}else null!==n&&(wt=!0),al(e,t)}function Sn(e){var t,n=O,r=q,o=xe,l=R,i=Ue,a=de,s=X,c=e.f;O=null,q=0,xe=null,R=96&c?null:e,Ue=!je&&!!(c&Ve),de=null,X=e.ctx;try{var u=(0,e.fn)(),d=e.deps;if(null!==O){var f;if(dt(e,q),null!==d&&q>0)for(d.length=q+O.length,f=0;f1e3){Be=0;try{zi()}catch(e){if(null===ct)throw e;At(e,ct,null)}}Be++}function Ln(e){var t=e.length;if(0!==t){Nn();var n=je;je=!0;try{for(var r=0;r1001)return;const e=Le;Le=[],Ln(e),ft||(Be=0,ct=null)}function Vt(e){Et===Rn&&(ft||(ft=!0,queueMicrotask(fl))),ct=e;for(var t=e;null!==t.parent;){var n=(t=t.parent).f;if(96&n){if(!(n&B))return;t.f^=B}}Le.push(t)}function An(e,t){var n=e.first,r=[];e:for(;null!==n;){var o=n.f,l=!!(32&o),i=l&&!!(o&B),a=n.next;if(!(i||o&He))if(8&o){if(l)n.f^=B;else try{_t(n)&&Tt(n)}catch(e){At(e,n,null,n.ctx)}var s=n.first;if(null!==s){n=s;continue}}else 4&o&&r.push(n);if(null===a){let t=n.parent;for(;null!==t;){if(e===t)break e;var c=t.next;if(null!==c){n=c;continue e}t=t.parent}}n=a}for(var u=0;u0||t.length>0)&&k(),Be=0,ct=null,r}finally{Et=t,Le=n}}async function cl(){await Promise.resolve(),k()}function h(e){var t,n=e.f,r=!!(2&n);if(r&&n&qe){var o=vn(e);return qt(e),o}if(null!==R){null!==de&&de.includes(e)&&Oi();var l=R.deps;null===O&&null!==l&&l[q]===e?q++:null===O?O=[e]:O.push(e),null!==xe&&null!==y&&y.f&B&&!(32&y.f)&&xe.includes(e)&&(ve(y,Ce),Vt(y))}else if(r&&null===e.deps)for(var i=e,a=i.parent,s=i;null!==a;){if(!(2&a.f)){var c=a;null!=(t=c.deriveds)&&t.includes(s)||(c.deriveds??(c.deriveds=[])).push(s);break}s=a,a=a.parent}return r&&(_t(i=e)&&gn(i)),e.v}function Ke(e){const t=R;try{return R=null,e()}finally{R=t}}const dl=-7169;function ve(e,t){e.f=e.f&dl|t}function Tn(e,t=!1,n){X={p:X,c:null,e:null,m:!1,s:e,x:null,l:null}}function Vn(e){const t=X;if(null!==t){void 0!==e&&(t.x=e);const i=t.e;if(null!==i){var n=y,r=R;t.e=null;try{for(var o=0;o{Promise.resolve().then((()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)null==(t=n.__on_r)||t.call(n)}))}),{capture:!0}))}function zn(e){var t=R,n=y;Ie(null),he(null);try{return e()}finally{Ie(t),he(n)}}function hl(e,t,n,r=n){e.addEventListener(t,(()=>zn(n)));const o=e.__on_r;e.__on_r=o?()=>{o(),r(!0)}:()=>r(!0),Pn()}const Gn=new Set,Bt=new Set;function vl(e,t,n,r){function o(e){if(r.capture||st.call(t,e),!e.cancelBubble)return zn((()=>n.call(this,e)))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?rr((()=>{t.addEventListener(e,o,r)})):t.addEventListener(e,o,r),o}function gl(e,t,n,r,o){var l={capture:r,passive:o},i=vl(e,t,n,l);(t===document.body||t===window||t===document)&&Ji((()=>{t.removeEventListener(e,i,l)}))}function _l(e){for(var t=0;ti||r});var d=R,f=y;Ie(null),he(null);try{for(var h,v=[];null!==i;){var p=i.assignedSlot||i.parentNode||i.host||null;try{var g=i["__"+o];if(void 0!==g&&!i.disabled)if(en(g)){var[m,...b]=g;m.apply(i,[e,...b])}else g.call(i,e)}catch(e){h?v.push(e):h=e}if(e.cancelBubble||p===n||null===p)break;i=p}if(h){for(let e of v)queueMicrotask((()=>{throw e}));throw h}}finally{e.__root=n,delete e.currentTarget,Ie(d),he(f)}}}function Dn(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function ke(e,t){var n=y;null===n.nodes_start&&(n.nodes_start=e,n.nodes_end=t)}function se(e,t){var n,r=!!(1&t),o=!!(2&t),l=!e.startsWith("");return()=>{if(z)return ke(P,null),P;void 0===n&&(n=Dn(l?e:""+e),r||(n=Te(n)));var t=o?document.importNode(n,!0):n.cloneNode(!0);r?ke(Te(t),t.lastChild):ke(t,t);return t}}function ml(){if(z)return ke(P,null),P;var e=document.createDocumentFragment(),t=document.createComment(""),n=Lt();return e.append(t,n),ke(t,n),e}function K(e,t){if(z)return y.nodes_end=P,void Je();null!==e&&e.before(t)}const bl=["touchstart","touchmove"];function yl(e){return bl.includes(e)}function Yn(e,t){return Fn(e,t)}function pl(e,t){Wt(),t.intro=t.intro??!1;const n=t.target,r=z,o=P;try{for(var l=Te(n);l&&(8!==l.nodeType||l.data!==Jr);)l=$e(l);if(!l)throw Me;We(!0),Re(l),Je();const r=Fn(e,{...t,anchor:l});if(null===P||8!==P.nodeType||P.data!==qr)throw Nt(),Me;return We(!1),r}catch(r){if(r===Me)return!1===t.recover&&Gi(),Wt(),Mi(n),We(!1),Yn(e,t);throw r}finally{We(r),Re(o)}}const Xe=new Map;function Fn(e,{target:t,anchor:n,props:r={},events:o,context:l,intro:i=!0}){Wt();var a=new Set,s=e=>{for(var n=0;n{var i=n??t.appendChild(Lt());return It((()=>{l&&(Tn({}),X.c=l);o&&(r.$$events=o),z&&ke(i,null),c=e(i,r)||{},z&&(y.nodes_end=P),l&&Vn()})),()=>{var e;for(var r of a){t.removeEventListener(r,st);var o=Xe.get(r);0==--o?(document.removeEventListener(r,st),Xe.delete(r)):Xe.set(r,o)}Bt.delete(s),Ht.delete(c),i!==n&&(null==(e=i.parentNode)||e.removeChild(i))}}));return Ht.set(c,u),c}let Ht=new WeakMap;function wl(e){const t=Ht.get(e);t&&t()}function Ee(e,t,n=!1){z&&Je();var r=e,o=null,l=null,i=j,a=!1;const s=(e,t=!0)=>{a=!0,c(t,e)},c=(e,t)=>{if(i===(i=e))return;let n=!1;if(z){const e=r.data===Kr;!!i===e&&(Re(r=Ui()),We(!1),n=!0)}i?(o?Or(o):t&&(o=It((()=>t(r)))),l&&Fr(l,(()=>{l=null}))):(l?Or(l):t&&(l=It((()=>t(r)))),o&&Fr(o,(()=>{o=null}))),n&&We(!0)};tr((()=>{a=!1,t(s),a||c(null,null)}),n?Kt:0),z&&(r=P)}function Ze(e,t,n,r,o){var l,i=e,a="";tr((()=>{a!==(a=t()??"")?(void 0!==l&&(Pe(l),l=void 0),""!==a&&(l=It((()=>{if(z){P.data;for(var e=Je(),t=e;null!==e&&(8!==e.nodeType||""!==e.data);)t=e,e=$e(e);if(null===e)throw Nt(),Me;return ke(P,t),void(i=Re(e))}var n=Dn(a+"");ke(Te(n),n.lastChild),i.before(n)})))):z&&Je()}))}function El(e,t,n,r,o){var l;z&&Je();var i=null==(l=t.$$slots)?void 0:l[n],a=!1;!0===i&&(i=t.children,a=!0),void 0===i||i(e,a?()=>r:r)}function xl(e,t){rr((()=>{var n=e.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,r.appendChild(e)}}))}function Ur(e){if(z){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;ie(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var r=e.checked;ie(e,"checked",null),e.checked=r}}};e.__on_r=n,el(n),Pn()}}function kl(e,t){var n=e.__attributes??(e.__attributes={});n.value===(n.value=t??void 0)||e.value===t&&(0!==t||"PROGRESS"!==e.nodeName)||(e.value=t)}function ie(e,t,n,r){var o=e.__attributes??(e.__attributes={});z&&(o[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)||o[t]!==(o[t]=n)&&("style"===t&&"__styles"in e&&(e.__styles={}),"loading"===t&&(e[Li]=n),null==n?e.removeAttribute(t):"string"!=typeof n&&Cl(e).includes(t)?e[t]=n:e.setAttribute(t,n))}var Mr=new Map;function Cl(e){var t=Mr.get(e.nodeName);if(t)return t;Mr.set(e.nodeName,t=[]);for(var n,r=Xt(e),o=Element.prototype;o!==r;){for(var l in n=Ri(r))n[l].set&&t.push(l);r=Xt(r)}return t}function Rl(e,t,n){if(n){if(e.classList.contains(t))return;e.classList.add(t)}else{if(!e.classList.contains(t))return;e.classList.remove(t)}}function Il(e,t,n=t){hl(e,"change",(t=>{var r=t?e.defaultChecked:e.checked;n(r)})),(z&&e.defaultChecked!==e.checked||null==Ke(t))&&n(e.checked),er((()=>{var n=t();e.checked=!!n}))}function jr(e,t){return e===t||(null==e?void 0:e[ut])===t}function Br(e={},t,n,r){return Qt((()=>{var r,o;return er((()=>{r=o,o=[],Ke((()=>{e!==n(...o)&&(t(e,...o),r&&jr(n(...r),e)&&t(null,...r))}))})),()=>{rr((()=>{o&&jr(n(...o),e)&&t(null,...o)}))}})),e}function On(e){null===X&&Cn(),Ut((()=>{const t=Ke(e);if("function"==typeof t)return t}))}function $l(e){null===X&&Cn(),On((()=>()=>Ke(e)))}let pt=!1;function Sl(e){var t=pt;try{return pt=!1,[e(),pt]}finally{pt=t}}function Nl(e){for(var t=y,n=y;null!==t&&!(96&t.f);)t=t.parent;try{return he(t),e()}finally{he(n)}}function N(e,t,n,r){var o,l,i=!!(1&n),a=!sn,s=!!(8&n),c=!!(16&n),u=!1;s?[l,u]=Sl((()=>e[t])):l=e[t];var d,f=ut in e||ln in e,v=(null==(o=Ae(e,t))?void 0:o.set)??(f&&s&&t in e?n=>e[t]=n:void 0),p=r,g=!0,m=!1,b=()=>(m=!0,g&&(g=!1,p=c?Ke(r):r),p);if(void 0===l&&void 0!==r&&(v&&a&&Di(),l=b(),v&&v(l)),d=()=>{var n=e[t];return void 0===n?b():(g=!0,m=!1,n)},!(4&n))return d;if(v){var y=e.$$legacy;return function(e,t){return arguments.length>0?((!t||y||u)&&v(t?d():e),e):d()}}var w=!1,x=un(l),$=Nl((()=>ot((()=>{var e=d(),t=h(x);return w?(w=!1,t):x.v=e}))));return i||($.equals=on),function(e,t){if(arguments.length>0){const n=t?h($):s?le(e):e;return $.equals(n)||(w=!0,V(x,n),m&&void 0!==p&&(p=n),Ke((()=>h($)))),e}return h($)}}function Ll(e){return new Al(e)}var be,te;class Al{constructor(e){var t;Yt(this,be),Yt(this,te);var n=new Map,r=(e,t)=>{var r=un(t);return n.set(e,r),r};const o=new Proxy({...e.props||{},$$events:{}},{get:(e,t)=>h(n.get(t)??r(t,Reflect.get(e,t))),has:(e,t)=>t===ln||(h(n.get(t)??r(t,Reflect.get(e,t))),Reflect.has(e,t)),set:(e,t,o)=>(V(n.get(t)??r(t,o),o),Reflect.set(e,t,o))});Ft(this,te,(e.hydrate?pl:Yn)(e.component,{target:e.target,anchor:e.anchor,props:o,context:e.context,intro:e.intro??!1,recover:e.recover})),(!(null!=(t=null==e?void 0:e.props)&&t.$$host)||!1===e.sync)&&k(),Ft(this,be,o.$$events);for(const e of Object.keys(M(this,te)))"$set"===e||"$destroy"===e||"$on"===e||Ct(this,e,{get(){return M(this,te)[e]},set(t){M(this,te)[e]=t},enumerable:!0});M(this,te).$set=e=>{Object.assign(o,e)},M(this,te).$destroy=()=>{wl(M(this,te))}}$set(e){M(this,te).$set(e)}$on(e,t){M(this,be)[e]=M(this,be)[e]||[];const n=(...e)=>t.call(this,...e);return M(this,be)[e].push(n),()=>{M(this,be)[e]=M(this,be)[e].filter((e=>e!==n))}}$destroy(){M(this,te).$destroy()}}let Xn;function xt(e,t,n,r){var o;const l=null==(o=n[e])?void 0:o.type;if(t="Boolean"===l&&"boolean"!=typeof t?null!=t:t,!r||!n[e])return t;if("toAttribute"===r)switch(l){case"Object":case"Array":return null==t?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(l){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":default:return t;case"Number":return null!=t?+t:t}}function Tl(e){const t={};return e.childNodes.forEach((e=>{t[e.slot||"default"]=!0})),t}function Vl(e,t,n,r,o,l){let i=class extends Xn{constructor(){super(e,n,o),this.$$p_d=t}static get observedAttributes(){return kt(t).map((e=>(t[e].attribute||e).toLowerCase()))}};return kt(t).forEach((e=>{Ct(i.prototype,e,{get(){return this.$$c&&e in this.$$c?this.$$c[e]:this.$$d[e]},set(n){var r;n=xt(e,n,t),this.$$d[e]=n;var o=this.$$c;o&&((null==(r=Ae(o,e))?void 0:r.get)?o[e]=n:o.$set({[e]:n}))}})})),r.forEach((e=>{Ct(i.prototype,e,{get(){var t;return null==(t=this.$$c)?void 0:t[e]}})})),e.element=i,i}be=new WeakMap,te=new WeakMap,"function"==typeof HTMLElement&&(Xn=class extends HTMLElement{constructor(e,t,n){super(),ne(this,"$$ctor"),ne(this,"$$s"),ne(this,"$$c"),ne(this,"$$cn",!1),ne(this,"$$d",{}),ne(this,"$$r",!1),ne(this,"$$p_d",{}),ne(this,"$$l",{}),ne(this,"$$l_u",new Map),ne(this,"$$me"),this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const e=this.$$l_u.get(t);e&&(e(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(e){return t=>{const n=document.createElement("slot");"default"!==e&&(n.name=e),K(t,n)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=Tl(this);for(const r of this.$$s)r in n&&("default"!==r||this.$$d.children?t[r]=e(r):(this.$$d.children=e(r),t.default=!0));for(const e of this.attributes){const t=this.$$g_p(e.name);t in this.$$d||(this.$$d[t]=xt(t,e.value,this.$$p_d,"toProp"))}for(const e in this.$$p_d)!(e in this.$$d)&&void 0!==this[e]&&(this.$$d[e]=this[e],delete this[e]);this.$$c=Ll({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=_n((()=>{er((()=>{var e;this.$$r=!0;for(const t of kt(this.$$c)){if(null==(e=this.$$p_d[t])||!e.reflect)continue;this.$$d[t]=this.$$c[t];const n=xt(t,this.$$d[t],this.$$p_d,"toAttribute");null==n?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,n)}this.$$r=!1}))}));for(const e in this.$$l)for(const t of this.$$l[e]){const n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}this.$$l={}}}attributeChangedCallback(e,t,n){var r;this.$$r||(e=this.$$g_p(e),this.$$d[e]=xt(e,n,this.$$p_d,"toProp"),null==(r=this.$$c)||r.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then((()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)}))}$$g_p(e){return kt(this.$$p_d).find((t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e))||e}});const Zn=new TextEncoder;function Pl(e){return[...new Uint8Array(e)].map((e=>e.toString(16).padStart(2,"0"))).join("")}async function zl(e,t="SHA-256",n=1e5){const r=Date.now().toString(16);e||(e=Math.round(Math.random()*n));return{algorithm:t,challenge:await Wn(r,e,t),salt:r,signature:""}}async function Wn(e,t,n){if(typeof crypto>"u"||!("subtle"in crypto)||!("digest"in crypto.subtle))throw new Error("Web Crypto is not available. Secure context is required (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");return Pl(await crypto.subtle.digest(n.toUpperCase(),Zn.encode(e+t)))}function Gl(e,t,n="SHA-256",r=1e6,o=0){const l=new AbortController,i=Date.now();return{promise:(async()=>{for(let a=o;a<=r;a+=1){if(l.signal.aborted)return null;if(await Wn(t,a,n)===e)return{number:a,took:Date.now()-i}}return null})(),controller:l}}function Dl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Yl(e){const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e{for(let e=r;e<=n;e+=1){if(l.signal.aborted||!a||!s)return null;try{const t=await crypto.subtle.decrypt({name:o,iv:Fl(e)},a,s);if(t)return{clearText:(new TextDecoder).decode(t),took:Date.now()-i}}catch{}}return null})(),controller:l}}var x=(e=>(e.ERROR="error",e.VERIFIED="verified",e.VERIFYING="verifying",e.UNVERIFIED="unverified",e.EXPIRED="expired",e))(x||{}),Xl=se(''),Zl=se(' ',1),Wl=se(''),Ul=se(''),Ml=se('
'),jl=se('
'),Bl=se('
'),Hl=se('
'),Jl=se(''),Kl=se('
'),ql=se('
',1);const Ql={hash:"svelte-ddsc3z",code:'.altcha.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:focus-within {border-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating].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:where(.svelte-ddsc3z) {border-bottom-color:transparent;border-top-color:var(--altcha-color-border, #a0a0a0);bottom:-12px;top:auto;}.altcha[data-floating=bottom].svelte-ddsc3z:focus-within::after {border-bottom-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating=top].svelte-ddsc3z:focus-within::after {border-top-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating].svelte-ddsc3z:not([data-state=unverified]) {display:block;}.altcha-anchor-arrow.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 {align-items:center;display:flex;gap:0.4rem;padding:0.7rem;}.altcha-label.svelte-ddsc3z {flex-grow:1;}.altcha-label.svelte-ddsc3z label:where(.svelte-ddsc3z) {cursor:pointer;}.altcha-logo.svelte-ddsc3z {color:currentColor;opacity:0.3;}.altcha-logo.svelte-ddsc3z:hover {opacity:1;}.altcha-error.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 {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:hover {opacity:1;}.altcha-footer.svelte-ddsc3z > :where(.svelte-ddsc3z):first-child {flex-grow:1;}.altcha-footer.svelte-ddsc3z a {color:currentColor;}.altcha-checkbox.svelte-ddsc3z {display:flex;align-items:center;height:24px;width:24px;}.altcha-checkbox.svelte-ddsc3z input:where(.svelte-ddsc3z) {width:18px;height:18px;margin:0;}.altcha-hidden.svelte-ddsc3z {display:none;}.altcha-spinner.svelte-ddsc3z {\n animation: svelte-ddsc3z-altcha-spinner 0.75s infinite linear;transform-origin:center;}\n\n@keyframes svelte-ddsc3z-altcha-spinner {\n 100% {\n transform: rotate(360deg);\n }\n}'};function ea(e,t){var n,r;Tn(t,!0),xl(e,Ql);let o=N(t,"auto",7,void 0),l=N(t,"blockspam",7,void 0),i=N(t,"challengeurl",7,void 0),a=N(t,"challengejson",7,void 0),s=N(t,"customfetch",7,void 0),c=N(t,"debug",7,!1),u=N(t,"delay",7,0),d=N(t,"expire",7,void 0),f=N(t,"floating",7,void 0),v=N(t,"floatinganchor",7,void 0),p=N(t,"floatingoffset",7,void 0),g=N(t,"hidefooter",7,!1),m=N(t,"hidelogo",7,!1),b=N(t,"name",7,"altcha"),y=N(t,"maxnumber",7,1e6),w=N(t,"mockerror",7,!1),$=N(t,"obfuscated",7,void 0),E=N(t,"plugins",7,void 0),R=N(t,"refetchonexpire",7,!0),C=N(t,"spamfilter",7,!1),I=N(t,"strings",7,void 0),_=N(t,"test",7,!1),L=N(t,"verifyurl",7,void 0),z=N(t,"workers",23,(()=>Math.min(16,navigator.hardwareConcurrency||8))),X=N(t,"workerurl",7,void 0);const P=["SHA-256","SHA-384","SHA-512"],S="Visit Altcha.org",O="https://altcha.org/",j=(e,n)=>{t.$$host.dispatchEvent(new CustomEvent(e,{detail:n}))},A=null==(r=null==(n=document.documentElement.lang)?void 0:n.split("-"))?void 0:r[0],G=ot((()=>{var e;return i()&&new URL(i(),location.origin).host.endsWith(".altcha.org")&&!(null==(e=i())||!e.includes("apiKey=ckey_"))})),Z=ot((()=>a()?ve(a()):void 0)),W=ot((()=>I()?ve(I()):{})),M=ot((()=>{var e;return{ariaLinkLabel:S,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by ALTCHA`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...h(W)}}));let B=Fe(!1),Y=Fe(le(x.UNVERIFIED)),F=Fe(void 0),T=Fe(null),U=null,D=null,q=Fe(null),Q=null,ee=[],te=Fe(null);function ne(e,t){return btoa(JSON.stringify({algorithm:e.algorithm,challenge:e.challenge,number:t.number,salt:e.salt,signature:e.signature,test:!!_()||void 0,took:t.took}))}function re(){i()&&R()&&h(Y)===x.VERIFIED?Le():Ne(x.EXPIRED,h(M).expired)}function oe(...e){(c()||e.some((e=>e instanceof Error)))&&console[e[0]instanceof Error?"error":"log"]("ALTCHA",`[name=${b()}]`,...e)}function ae(e){const t=e.target;f()&&t&&!h(F).contains(t)&&(h(Y)===x.VERIFIED||"off"===o()&&h(Y)===x.UNVERIFIED)&&(h(F).style.display="none")}function se(){f()&&h(Y)!==x.UNVERIFIED&&pe()}function ce(e){h(Y)===x.UNVERIFIED&&Le()}function ue(e){D&&"onsubmit"===o()?h(Y)===x.UNVERIFIED?(e.preventDefault(),e.stopPropagation(),Le().then((()=>{null==D||D.requestSubmit()}))):h(Y)!==x.VERIFIED&&(e.preventDefault(),e.stopPropagation(),h(Y)===x.VERIFYING&&fe()):D&&f()&&"off"===o()&&h(Y)===x.UNVERIFIED&&(e.preventDefault(),e.stopPropagation(),h(F).style.display="block",pe())}function de(){Ne()}function fe(){h(Y)===x.VERIFYING&&h(M).waitAlert&&alert(h(M).waitAlert)}function he(){f()&&pe()}function ve(e){return JSON.parse(e)}function pe(e=20){if(h(F))if(U||(U=(v()?document.querySelector(v()):null==D?void 0:D.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||D),U){const t=parseInt(p(),10)||12,n=U.getBoundingClientRect(),r=h(F).getBoundingClientRect(),o=document.documentElement.clientHeight,l=document.documentElement.clientWidth,i="auto"===f()?n.bottom+r.height+t+e>o:"top"===f(),a=Math.max(e,Math.min(l-e-r.width,n.left+n.width/2-r.width/2));if(h(F).style.top=i?n.top-(r.height+t)+"px":`${n.bottom+t}px`,h(F).style.left=`${a}px`,h(F).setAttribute("data-floating",i?"top":"bottom"),h(T)){const e=h(T).getBoundingClientRect();h(T).style.left=n.left-a+n.width/2-e.width/2+"px"}}else oe("unable to find floating anchor element")}async function ge(e){if(!L())throw new Error("Attribute verifyurl not set.");oe("requesting server verification from",L());const t={payload:e};if(!1!==C()){const{blockedCountries:e,classifier:n,disableRules:r,email:o,expectedLanguages:l,expectedCountries:i,fields:a,ipAddress:s,text:c,timeZone:u}="ipAddress"===C()?{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}:"object"==typeof C()?C():{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};t.blockedCountries=e,t.classifier=n,t.disableRules=r,t.email=!1===o?void 0:function(e){var t;const n=null==D?void 0:D.querySelector("string"==typeof e?`input[name="${e}"]`:'input[type="email"]:not([data-no-spamfilter])');return(null==(t=null==n?void 0:n.value)?void 0:t.slice(n.value.indexOf("@")))||void 0}(o),t.expectedCountries=i,t.expectedLanguages=l||(A?[A]:void 0),t.fields=!1===a?void 0:function(e){return[...(null==D?void 0:D.querySelectorAll(null!=e&&e.length?e.map((e=>`input[name="${e}"]`)).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce(((e,t)=>{const n=t.name,r=t.value;return n&&r&&(e[n]=/\n/.test(r)?r.replace(new RegExp("(?{const l=n*o;return new Promise((n=>{t.addEventListener("message",(e=>{if(e.data)for(const e of r)e!==t&&e.postMessage({type:"abort"});n(e.data)})),t.postMessage({payload:e,max:l+o,start:l,type:"work"})}))})));for(const e of r)e.terminate();return l.find((e=>!!e))||null}(e,e.maxnumber)}catch(e){oe(e)}if(void 0!==(null==t?void 0:t.number)||"obfuscated"in e)return{data:e,solution:t}}if("obfuscated"in e){const t=await Ol(e.obfuscated,e.key,e.maxnumber);return{data:e,solution:await t.promise}}return{data:e,solution:await Gl(e.challenge,e.salt,e.algorithm,e.maxnumber||y()).promise}}async function $e(){if(!$())return void Ve(x.ERROR);const e=ee.find((e=>"obfuscation"===e.constructor.pluginName));return e&&"clarify"in e?"clarify"in e&&"function"==typeof e.clarify?e.clarify():void 0:(Ve(x.ERROR),void oe("Plugin `obfuscation` not found. Import `altcha/plugins/obfuscation` to load it."))}function ke(e){void 0!==e.obfuscated&&$(e.obfuscated),void 0!==e.auto&&(o(e.auto),"onload"===o()&&($()?$e():Le())),void 0!==e.blockspam&&l(!!e.blockspam),void 0!==e.customfetch&&s(e.customfetch),void 0!==e.floatinganchor&&v(e.floatinganchor),void 0!==e.delay&&u(e.delay),void 0!==e.floatingoffset&&p(e.floatingoffset),void 0!==e.floating&&ye(e.floating),void 0!==e.expire&&(be(e.expire),d(e.expire)),e.challenge&&(a("string"==typeof e.challenge?e.challenge:JSON.stringify(e.challenge)),we(h(Z))),void 0!==e.challengeurl&&i(e.challengeurl),void 0!==e.debug&&c(!!e.debug),void 0!==e.hidefooter&&g(!!e.hidefooter),void 0!==e.hidelogo&&m(!!e.hidelogo),void 0!==e.maxnumber&&y(+e.maxnumber),void 0!==e.mockerror&&w(!!e.mockerror),void 0!==e.name&&b(e.name),void 0!==e.refetchonexpire&&R(!!e.refetchonexpire),void 0!==e.spamfilter&&C("object"==typeof e.spamfilter?e.spamfilter:!!e.spamfilter),e.strings&&I("string"==typeof e.strings?e.strings:JSON.stringify(e.strings)),void 0!==e.test&&_("number"==typeof e.test?e.test:!!e.test),void 0!==e.verifyurl&&L(e.verifyurl),void 0!==e.workers&&z(+e.workers),void 0!==e.workerurl&&X(e.workerurl)}function Re(){return{auto:o(),blockspam:l(),challengeurl:i(),debug:c(),delay:u(),expire:d(),floating:f(),floatinganchor:v(),floatingoffset:p(),hidefooter:g(),hidelogo:m(),name:b(),maxnumber:y(),mockerror:w(),obfuscated:$(),refetchonexpire:R(),spamfilter:C(),strings:h(M),test:_(),verifyurl:L(),workers:z(),workerurl:X()}}function Ce(){return U}function Ie(){return h(Y)}function Ne(e=x.UNVERIFIED,t=null){Q&&(clearTimeout(Q),Q=null),V(B,!1),V(te,null),Ve(e,t)}function _e(e){U=e}function Ve(e,t=null){V(Y,le(e)),V(q,le(t)),j("statechange",{payload:h(te),state:h(Y)})}async function Le(){return Ne(x.VERIFYING),await new Promise((e=>setTimeout(e,u()||0))),async function(){var e;if(w())throw oe("mocking error"),new Error("Mocked error.");if(h(Z))return oe("using provided json data"),h(Z);if(_())return oe("generating test challenge",{test:_()}),zl("boolean"!=typeof _()?+_():void 0);{if(!i()&&D){const e=D.getAttribute("action");null!=e&&e.includes("/form/")&&i(e+"/altcha")}if(!i())throw new Error("Attribute challengeurl not set.");oe("fetching challenge from",i());let t=null,n=null;if(s())if(oe("using customfetch"),"string"==typeof s()){if(t=globalThis[s()]||null,!t)throw new Error(`Custom fetch function not found: ${s()}`)}else t=s();const r={headers:!1!==C()?{"x-altcha-spam-filter":"1"}:{}};if(t){if(n=await t(i(),r),!(n&&n instanceof Response))throw new Error("Custom fetch function did not return a response.")}else n=await fetch(i(),r);if(200!==n.status)throw new Error(`Server responded with ${n.status}.`);const o=n.headers.get("Expires"),l=n.headers.get("X-Altcha-Config"),a=await n.json(),c=new URLSearchParams(null==(e=a.salt.split("?"))?void 0:e[1]),u=c.get("expires")||c.get("expire");if(u){const e=new Date(1e3*+u),t=isNaN(e.getTime())?0:e.getTime()-Date.now();t>0&&be(t)}if(l)try{const e=JSON.parse(l);e&&"object"==typeof e&&(e.verifyurl&&(e.verifyurl=new URL(e.verifyurl,new URL(i())).toString()),ke(e))}catch(e){oe("unable to configure from X-Altcha-Config",e)}if(!d()&&null!=o&&o.length){const e=Date.parse(o);if(e){const t=e-Date.now();t>0&&be(t)}}return a}}().then((e=>(we(e),oe("challenge",e),xe(e)))).then((({data:e,solution:t})=>{if(oe("solution",t),"challenge"in e&&t&&!("clearText"in t)){if(void 0===(null==t?void 0:t.number))throw oe("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.");if(L())return ge(ne(e,t));V(te,le(ne(e,t))),oe("payload",h(te))}})).then((()=>{Ve(x.VERIFIED),oe("verified"),cl().then((()=>{j("verified",{payload:h(te)})}))})).catch((e=>{oe(e),Ve(x.ERROR,e.message)}))}Ut((()=>{!function(){for(const e of ee)"function"==typeof e.onErrorChange&&e.onErrorChange(h(q))}(h(q))})),Ut((()=>{!function(){for(const e of ee)"function"==typeof e.onStateChange&&e.onStateChange(h(Y));f()&&h(Y)!==x.UNVERIFIED&&requestAnimationFrame((()=>{pe()})),V(B,h(Y)===x.VERIFIED)}(h(Y))})),$l((()=>{(function(){for(const e of ee)e.destroy()})(),D&&(D.removeEventListener("submit",ue),D.removeEventListener("reset",de),D.removeEventListener("focusin",ce),D=null),Q&&(clearTimeout(Q),Q=null),document.removeEventListener("click",ae),document.removeEventListener("scroll",se),window.removeEventListener("resize",he)})),On((()=>{var e;oe("mounted","1.1.0"),oe("workers",z()),function(){const e=void 0!==E()?E().split(","):void 0;for(const t of globalThis.altchaPlugins)(!e||e.includes(t.pluginName))&&ee.push(new t({el:h(F),clarify:$e,dispatch:j,getConfiguration:Re,getFloatingAnchor:Ce,getState:Ie,log:oe,reset:Ne,solve:xe,setState:Ve,setFloatingAnchor:_e,verify:Le}))}(),oe("plugins",ee.length?ee.map((e=>e.constructor.pluginName)).join(", "):"none"),_()&&oe("using test mode"),d()&&be(d()),void 0!==o()&&oe("auto",o()),void 0!==f()&&ye(f()),D=null==(e=h(F))?void 0:e.closest("form"),D&&(D.addEventListener("submit",ue,{capture:!0}),D.addEventListener("reset",de),"onfocus"===o()&&D.addEventListener("focusin",ce)),"onload"===o()&&($()?$e():Le()),h(G)&&(g()||m())&&oe("Attributes hidefooter and hidelogo ignored because usage with free API Keys requires attribution."),requestAnimationFrame((()=>{j("load")}))}));var ze=ql(),Xe=Ot(ze);El(Xe,t,"default",{});var Pe=me(Xe,2),Se=J(Pe),je=J(Se),Ae=e=>{K(e,Xl())};Ee(je,(e=>{h(Y)===x.VERIFYING&&e(Ae)}));var Ge=me(je,2),We=J(Ge);Ur(We),We.__change=function(){[x.UNVERIFIED,x.ERROR,x.EXPIRED].includes(h(Y))?!1!==C()&&!1===(null==D?void 0:D.reportValidity())?V(B,!1):$()?$e():Le():V(B,!0)},H(Ge);var Me=me(Ge,2),Je=J(Me),Be=e=>{var t=Zl(),n=Ot(t);Ze(J(n),(()=>h(M).verified)),H(n);var r=me(n,2);Ur(r),Oe((()=>{ie(r,"name",b()),kl(r,h(te))})),K(e,t)},Ye=e=>{var t=ml(),n=Ot(t),r=e=>{var t=Wl();Ze(J(t),(()=>h(M).verifying)),H(t),K(e,t)},o=e=>{var t=Ul();Ze(J(t),(()=>h(M).label)),H(t),Oe((()=>ie(t,"for",`${b()??""}_checkbox`))),K(e,t)};Ee(n,(e=>{h(Y)===x.VERIFYING?e(r):e(o,!1)}),!0),K(e,t)};Ee(Je,(e=>{h(Y)===x.VERIFIED?e(Be):e(Ye,!1)})),H(Me);var Te=me(Me,2),He=e=>{var t=Ml(),n=J(t);ie(n,"href",O),H(t),Oe((()=>ie(n,"aria-label",h(M).ariaLinkLabel))),K(e,t)};Ee(Te,(e=>{(!0!==m()||h(G))&&e(He)})),H(Se);var Ue=me(Se,2),Ke=e=>{var t=Hl(),n=me(J(t),2),r=e=>{var t=jl();Ze(J(t),(()=>h(M).expired)),H(t),Oe((()=>ie(t,"title",h(q)))),K(e,t)},o=e=>{var t=Bl();Ze(J(t),(()=>h(M).error)),H(t),Oe((()=>ie(t,"title",h(q)))),K(e,t)};Ee(n,(e=>{h(Y)===x.EXPIRED?e(r):e(o,!1)})),H(t),K(e,t)};Ee(Ue,(e=>{(h(q)||h(Y)===x.EXPIRED)&&e(Ke)}));var De=me(Ue,2),qe=e=>{var t=Jl(),n=J(t);Ze(J(n),(()=>h(M).footer)),H(n),H(t),K(e,t)};Ee(De,(e=>{h(M).footer&&(!0!==g()||h(G))&&e(qe)}));var Qe=me(De,2),et=e=>{var t=Kl();Br(t,(e=>V(T,e)),(()=>h(T))),K(e,t)};return Ee(Qe,(e=>{f()&&e(et)})),H(Pe),Br(Pe,(e=>V(F,e)),(()=>h(F))),Oe((()=>{ie(Pe,"data-state",h(Y)),ie(Pe,"data-floating",f()),Rl(Ge,"altcha-hidden",h(Y)===x.VERIFYING),ie(We,"id",`${b()??""}_checkbox`),We.required="onsubmit"!==o()&&(!f()||"off"!==o())})),gl("invalid",We,fe),Il(We,(()=>h(B)),(e=>V(B,e))),K(e,ze),Vn({clarify:$e,configure:ke,getConfiguration:Re,getFloatingAnchor:Ce,getPlugin:function(e){return ee.find((t=>t.constructor.pluginName===e))},getState:Ie,reset:Ne,setFloatingAnchor:_e,setState:Ve,verify:Le,get auto(){return o()},set auto(e=void 0){o(e),k()},get blockspam(){return l()},set blockspam(e=void 0){l(e),k()},get challengeurl(){return i()},set challengeurl(e=void 0){i(e),k()},get challengejson(){return a()},set challengejson(e=void 0){a(e),k()},get customfetch(){return s()},set customfetch(e=void 0){s(e),k()},get debug(){return c()},set debug(e=!1){c(e),k()},get delay(){return u()},set delay(e=0){u(e),k()},get expire(){return d()},set expire(e=void 0){d(e),k()},get floating(){return f()},set floating(e=void 0){f(e),k()},get floatinganchor(){return v()},set floatinganchor(e=void 0){v(e),k()},get floatingoffset(){return p()},set floatingoffset(e=void 0){p(e),k()},get hidefooter(){return g()},set hidefooter(e=!1){g(e),k()},get hidelogo(){return m()},set hidelogo(e=!1){m(e),k()},get name(){return b()},set name(e="altcha"){b(e),k()},get maxnumber(){return y()},set maxnumber(e=1e6){y(e),k()},get mockerror(){return w()},set mockerror(e=!1){w(e),k()},get obfuscated(){return $()},set obfuscated(e=void 0){$(e),k()},get plugins(){return E()},set plugins(e=void 0){E(e),k()},get refetchonexpire(){return R()},set refetchonexpire(e=!0){R(e),k()},get spamfilter(){return C()},set spamfilter(e=!1){C(e),k()},get strings(){return I()},set strings(e=void 0){I(e),k()},get test(){return _()},set test(e=!1){_(e),k()},get verifyurl(){return L()},set verifyurl(e=void 0){L(e),k()},get workers(){return z()},set workers(e=Math.min(16,navigator.hardwareConcurrency||8)){z(e),k()},get workerurl(){return X()},set workerurl(e=void 0){X(e),k()}})}_l(["change"]),customElements.define("altcha-widget",Vl(ea,{blockspam:{type:"Boolean"},debug:{type:"Boolean"},delay:{type:"Number"},expire:{type:"Number"},floatingoffset:{type:"Number"},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},maxnumber:{type:"Number"},mockerror:{type:"Boolean"},refetchonexpire:{type:"Boolean"},test:{type:"Boolean"},workers:{type:"Number"},auto:{},challengeurl:{},challengejson:{},customfetch:{},floating:{},floatinganchor:{},name:{},obfuscated:{},plugins:{},spamfilter:{},strings:{},verifyurl:{},workerurl:{}},["default"],["clarify","configure","getConfiguration","getFloatingAnchor","getPlugin","getState","reset","setFloatingAnchor","setState","verify"],!1)),globalThis.altchaCreateWorker=e=>e?new Worker(new URL(e)):new mi,globalThis.altchaPlugins=globalThis.altchaPlugins||[];export{ea as Altcha}; //# sourceMappingURL=/sm/638df34d7a75e2016f9fd707bc2784bc7c8fc9aa9533684cd03dce4cc922471b.map