UNPKG

altcha

Version:

Privacy-first CAPTCHA widget, compliant with global regulations (GDPR/HIPAA/CCPA/LGDP/DPDPA/PIPL) and WCAG accessible. No tracking, self-verifying.

134 lines (133 loc) 4.82 kB
(function(factory) { typeof define === "function" && define.amd ? define(factory) : factory(); })((function() { "use strict"; const noop = () => { }; function safe_not_equal(a, b) { return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function"; } function subscribe_to_store(store2, run, invalidate) { if (store2 == null) { run(void 0); return noop; } const unsub = untrack( () => store2.subscribe( run, // @ts-expect-error invalidate ) ); return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; } const subscriber_queue = []; function writable(value, start = noop) { let stop = null; const subscribers = /* @__PURE__ */ new Set(); function set(new_value) { if (safe_not_equal(value, new_value)) { value = new_value; if (stop) { const run_queue = !subscriber_queue.length; for (const subscriber of subscribers) { subscriber[1](); subscriber_queue.push(subscriber, value); } if (run_queue) { for (let i = 0; i < subscriber_queue.length; i += 2) { subscriber_queue[i][0](subscriber_queue[i + 1]); } subscriber_queue.length = 0; } } } } function update(fn) { set(fn( /** @type {T} */ value )); } function subscribe(run, invalidate = noop) { const subscriber = [run, invalidate]; subscribers.add(subscriber); if (subscribers.size === 1) { stop = start(set, update) || noop; } run( /** @type {T} */ value ); return () => { subscribers.delete(subscriber); if (subscribers.size === 0 && stop) { stop(); stop = null; } }; } return { set, update, subscribe }; } function get(store2) { let value; subscribe_to_store(store2, (_) => value = _)(); return value; } let untracking = false; function untrack(fn) { var previous_untracking = untracking; try { untracking = true; return fn(); } finally { untracking = previous_untracking; } } function store(defaultValue) { const scope = { get: (name) => { return get(scope.store)[name]; }, set: (name, value) => { if (typeof name === "string") { Object.assign(get(scope.store), { [name]: value }); } else { Object.assign(get(scope.store), name); } scope.store.set(get(scope.store)); }, store: writable(defaultValue) }; return scope; } globalThis.$altcha = globalThis.$altcha || { algorithms: /* @__PURE__ */ new Map(), defaults: store({}), i18n: store({}), instances: /* @__PURE__ */ new Set(), plugins: /* @__PURE__ */ new Set() }; const i18n = { ariaLinkLabel: "Altcha (అధికారిక వెబ్‌సైట్)", enterCode: "కోడ్‌ని నమోదు చేయండి", enterCodeAria: "మీరు విన్న కోడ్‌ని నమోదు చేయండి. ఆడియో ప్లే చేయడానికి స్పేస్‌ను నొక్కండి.", error: "చెకింగ్ విఫలమైంది. దయచేసి మరల ప్రయత్నించండి.", expired: "చెకింగ్ కాలం ముగిసింది. దయచేసి మరల ప్రయత్నించండి.", footer: 'ఈ సైట్ రక్షించబడింది <a href="https://altcha.org/" tabindex="-1" target="_blank" aria-label="Altcha (అధికారిక వెబ్‌సైట్)">ALTCHA</a>', getAudioChallenge: "ఆడియో ఛాలెంజ్ పొందండి", label: "నేను రోబోట్ కాదు", loading: "లోడ్ అవుతోంది...", reload: "మళ్ళీ లోడ్ చేయండి", verify: "ధ్రువీకరించు", verificationRequired: "ధృవీకరణ అవసరం!", verified: "ధ్రువీకరించబడింది", verifying: "ధ్రువీకరణ జరుగుతుంది...", waitAlert: "ధ్రువీకరణ జరుగుతుంది... దయచేసి వేచి ఉండండి.", cancel: "రద్దు చేయండి", enterCodeFromImage: "కొనసాగడానికి, దయచేసి క్రింది చిత్రంలో ఉన్న కోడ్‌ను నమోదు చేయండి." }; globalThis.$altcha.i18n.set("te", i18n); }));