diff --git a/config.py b/config.py index 8edeeec5..2527a96a 100644 --- a/config.py +++ b/config.py @@ -42,7 +42,6 @@ class Config: SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_SAMESITE = 'Strict' REMEMBER_COOKIE_SECURE = True - # PERMANENT_SESSION_LIFETIME = 3600 WTF_CSRF_ENABLED = True # WTF_CSRF_CHECK_DEFAULT = False # We'll check it manually for API routes # WTF_CSRF_HEADERS = ['X-CSRFToken'] # Accept CSRF token from this header diff --git a/controllers/core.py b/controllers/core.py index fdddb99f..8331205c 100644 --- a/controllers/core.py +++ b/controllers/core.py @@ -14,6 +14,7 @@ Initializes the Flask application, sets the configuration based on the environme # internal from datastores.datastore_base import DataStore_Base from forms.contact import Form_Contact +from helpers.helper_app import Helper_App from models.model_view_contact import Model_View_Contact from models.model_view_home import Model_View_Home import lib.argument_validation as av @@ -29,6 +30,8 @@ import json import base64 import hmac import hashlib +import datetime +from altcha import ChallengeOptions, create_challenge, verify_solution routes_core = Blueprint('routes_core', __name__) @@ -56,60 +59,51 @@ def contact(): def contact_post(): try: form = Form_Contact() + Helper_App.console_log(f"Form submitted: {request.form}") + Helper_App.console_log(f"ALTCHA data in request: {request.form.get('altcha')}") if form.validate_on_submit(): - altcha_payload = form.altcha.data - if not altcha_payload: - flash('Please complete the ALTCHA challenge', 'danger') - return "Invalid. ALTCHA challenge failed." - # Decode and verify the ALTCHA payload try: - decoded_payload = json.loads(base64.b64decode(altcha_payload)) - - # Verify the signature - if verify_altcha_signature(decoded_payload): - # Parse the verification data - verification_data = urllib.parse.parse_qs(decoded_payload['verificationData']) - - # Check if the verification was successful - if verification_data.get('verified', ['false'])[0] == 'true': - # If spam filter is enabled, check the classification - if 'classification' in verification_data: - classification = verification_data.get('classification', [''])[0] - score = float(verification_data.get('score', ['0'])[0]) - - # If the classification is BAD and score is high, reject the submission - if classification == 'BAD' and score > 5: - flash('Your submission was flagged as potential spam', 'error') - return render_template('contact.html', form=form) - - # Process the form submission - email = form.email.data - CC = form.CC.data # not in use - contact_name = form.contact_name.data - company_name = form.company_name.data - message = form.message.data - receive_marketing = form.receive_marketing.data - receive_marketing_text = "I would like to receive marketing emails." if receive_marketing else "" - # send email - mailItem = Message("PARTS Website Contact Us Message", recipients=[current_app.config['MAIL_CONTACT_PUBLIC']]) - mailItem.body = f"Dear Lord Edward Middleton-Smith,\n\n{message}\n{receive_marketing_text}\nKind regards,\n{contact_name}\n{company_name}\n{email}" - mail.send(mailItem) - flash('Thank you for your message. We will get back to you soon!', 'success') - return "Submitted." - else: - flash('CAPTCHA verification failed', 'error') - else: - flash('Invalid verification signature', 'error') + email = form.email.data + # CC = form.CC.data # not in use + contact_name = form.contact_name.data + company_name = form.company_name.data + message = form.message.data + receive_marketing = form.receive_marketing.data + receive_marketing_text = "I would like to receive marketing emails." if receive_marketing else "" + # send email + mailItem = Message("PARTS Website Contact Us Message", recipients=[current_app.config['MAIL_CONTACT_PUBLIC']]) + mailItem.body = f"Dear Lord Edward Middleton-Smith,\n\n{message}\n{receive_marketing_text}\nKind regards,\n{contact_name}\n{company_name}\n{email}" + mail.send(mailItem) + flash('Thank you for your message. We will get back to you soon!', 'success') + return "Submitted." except Exception as e: - flash(f'Error verifying CAPTCHA: {str(e)}', 'error') + return f"Error: {e}" + print(f"Form validation errors: {form.errors}") return "Invalid. Failed to submit." # html_body = render_template('pages/core/_contact.html', model = model) except Exception as e: return jsonify(error=str(e)), 403 +@routes_core.route(Model_View_Contact.HASH_ALTCHA_CREATE_CHALLENGE, methods=['GET']) +def create_altcha_challenge(): + options = ChallengeOptions( + expires = datetime.datetime.now() + datetime.timedelta(hours=1), + max_number = 100000, # The maximum random number + hmac_key = current_app.config["ALTCHA_SECRET_KEY"], + ) + challenge = create_challenge(options) + print("Challenge created:", challenge) + # return jsonify({"challenge": challenge}) + return jsonify({ + "algorithm": challenge.algorithm, + "challenge": challenge.challenge, + "salt": challenge.salt, + "signature": challenge.signature, + }) +""" def verify_altcha_signature(payload): - """Verify the ALTCHA signature""" + "" "Verify the ALTCHA signature"" " if 'algorithm' not in payload or 'signature' not in payload or 'verificationData' not in payload: return False @@ -135,4 +129,30 @@ def verify_altcha_signature(payload): ).hexdigest() # Compare the calculated signature with the provided signature - return hmac.compare_digest(calculated_signature, signature) \ No newline at end of file + return hmac.compare_digest(calculated_signature, signature) + + + +def create_altcha_dummy_signature(challenge): + # Example payload to verify + payload = { + "algorithm": challenge.algorithm, + "challenge": challenge.challenge, + "number": 12345, # Example number + "salt": challenge.salt, + "signature": challenge.signature, + } + return payload + +@routes_core.route(Model_View_Contact.HASH_ALTCHA_VERIFY_SOLUTION, methods=['POST']) +def verify_altcha_challenge(): + payload = request.json + + ok, err = verify_solution(payload, current_app.config["ALTCHA_SECRET_KEY"], check_expires=True) + if err: + return jsonify({"error": err}), 400 + elif ok: + return jsonify({"verified": True}) + else: + return jsonify({"verified": False}), 403 +""" \ No newline at end of file diff --git a/forms/contact.py b/forms/contact.py index 59dc2257..522dc6f8 100644 --- a/forms/contact.py +++ b/forms/contact.py @@ -14,65 +14,66 @@ Defines Flask-WTF form for handling user input on Contact Us page. # internal # from business_objects.store.product_category import Filters_Product_Category # circular # from models.model_view_store import Model_View_Store # circular +from models.model_view_base import Model_View_Base from forms.base import Form_Base # external from flask import Flask, render_template, request, flash, redirect, url_for, current_app from flask_wtf import FlaskForm -from wtforms import StringField, TextAreaField, SubmitField, HiddenField, BooleanField +from wtforms import StringField, TextAreaField, SubmitField, HiddenField, BooleanField, Field from wtforms.validators import DataRequired, Email, ValidationError +import markupsafe from flask_wtf.recaptcha import RecaptchaField from abc import ABCMeta, abstractmethod -import requests import json -import hmac -import hashlib +from altcha import verify_solution import base64 -import urllib.parse -""" -def validate_altcha(form, field): - if not field.data: - raise ValidationError('Please complete the ALTCHA challenge') - - try: - # Decode the base64-encoded payload - payload_json = base64.b64decode(field.data).decode('utf-8') - payload = json.loads(payload_json) +class ALTCHAValidator: + def __init__(self, message=None): + self.message = message or 'ALTCHA verification failed' - # Verify ALTCHA response - if not payload.get('verified', False): - raise ValidationError('ALTCHA verification failed') + def __call__(self, form, field): + altcha_data = field.data - # Verify signature - verification_data = payload.get('verificationData', '') - received_signature = payload.get('signature', '') - algorithm = payload.get('algorithm', 'SHA-256') + if not altcha_data: + raise ValidationError(self.message) - # Calculate the hash of verification data - verification_hash = hashlib.sha256(verification_data.encode()).digest() - - # Calculate HMAC signature - hmac_key = current_app.config['ALTCHA_SECRET_KEY'].encode() - calculated_signature = hmac.new( - hmac_key, - verification_hash, - getattr(hashlib, algorithm.lower().replace('-', '')) - ).hexdigest() - - if calculated_signature != received_signature: - raise ValidationError('Invalid ALTCHA signature') + try: + # The data is base64 encoded JSON + try: + # First try to decode it as JSON directly (if it's not base64 encoded) + altcha_payload = json.loads(altcha_data) + except json.JSONDecodeError: + # If direct JSON decoding fails, try base64 decoding first + decoded_data = base64.b64decode(altcha_data).decode('utf-8') + altcha_payload = json.loads(decoded_data) + + ok, err = verify_solution(altcha_payload, current_app.config["ALTCHA_SECRET_KEY"], check_expires=True) - # Optional: If using the spam filter, you could parse verification_data - # and reject submissions classified as spam - # Example: - parsed_data = dict(urllib.parse.parse_qsl(verification_data)) - if parsed_data.get('classification') == 'BAD': - raise ValidationError('This submission was classified as spam') - - except Exception as e: - current_app.logger.error(f"ALTCHA validation error: {str(e)}") - raise ValidationError('ALTCHA validation failed') -""" + if err or not ok: + raise ValidationError(self.message + ': ' + (err or 'Invalid solution')) + + except Exception as e: + raise ValidationError(f'Invalid ALTCHA data: {str(e)}') + +class ALTCHAField(Field): + def __init__(self, label='', validators=None, **kwargs): + validators = validators or [] + validators.append(ALTCHAValidator()) + + super(ALTCHAField, self).__init__(label, validators, **kwargs) + + def __call__(self, **kwargs): + html = f""" + + + """ + return markupsafe.Markup(html) + class Form_Contact(FlaskForm): email = StringField('Email') @@ -81,5 +82,6 @@ class Form_Contact(FlaskForm): message = TextAreaField('Message') receive_marketing = BooleanField('I would like to receive marketing emails.') # recaptcha = RecaptchaField() - altcha = HiddenField('ALTCHA') # , validators=[validate_altcha] + # altcha = HiddenField('ALTCHA') # , validators=[validate_altcha] + altcha = ALTCHAField('Verification') submit = SubmitField('Send Message') diff --git a/models/model_view_base.py b/models/model_view_base.py index 6dc1c451..be918f87 100644 --- a/models/model_view_base.py +++ b/models/model_view_base.py @@ -149,6 +149,8 @@ class Model_View_Base(BaseModel, ABC): FLAG_USER: ClassVar[str] = User.FLAG_USER FLAG_WEBSITE: ClassVar[str] = Base.FLAG_WEBSITE # flagIsDatePicker: ClassVar[str] = 'is-date-picker' + HASH_ALTCHA_CREATE_CHALLENGE: ClassVar[str] = '/altcha/create-challenge' + # HASH_ALTCHA_VERIFY_SOLUTION: ClassVar[str] = '/altcha/verify-solution' HASH_APPLY_FILTERS_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_filter' HASH_CALLBACK_LOGIN: ClassVar[str] = '/callback-login' HASH_PAGE_ACCESSIBILITY_REPORT: ClassVar[str] = '/accessibility-report' diff --git a/models/model_view_contact.py b/models/model_view_contact.py index 96fb6208..5290a399 100644 --- a/models/model_view_contact.py +++ b/models/model_view_contact.py @@ -22,19 +22,11 @@ from pydantic import BaseModel from typing import ClassVar class Model_View_Contact(Model_View_Base): - # Attributes + FLAG_ALTCHA_WIDGET: ClassVar[str] = 'altcha-widget' FLAG_COMPANY_NAME: ClassVar[str] = 'company_name' FLAG_CONTACT_NAME: ClassVar[str] = 'contact_name' FLAG_RECEIVE_MARKETING: ClassVar[str] = 'receive_marketing' ID_CONTACT_FORM: ClassVar[str] = 'contact-form' - """ - ID_EMAIL: ClassVar[str] = 'email' - ID_COMPANY_NAME: ClassVar[str] = 'company_name' - ID_CONTACT_NAME: ClassVar[str] = 'contact_name' - ID_MESSAGE: ClassVar[str] = 'msg' - ID_RECEIVE_MARKETING: ClassVar[str] = 'receive_marketing' - ID_NAME: ClassVar[str] = 'name' - """ form_contact: Form_Contact diff --git a/requirements.txt b/requirements.txt index 7cb5c623..bdac4198 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,5 @@ authlib pydantic # psycopg2 requests -cryptography \ No newline at end of file +cryptography +altcha \ No newline at end of file diff --git a/static/dist/js/main.bundle.js b/static/dist/js/main.bundle.js index 980950fe..f25a7e88 100644 --- a/static/dist/js/main.bundle.js +++ b/static/dist/js/main.bundle.js @@ -766,6 +766,3538 @@ var PageHome = /*#__PURE__*/function (_BasePage) { }(BasePage); home_defineProperty(PageHome, "hash", hashPageHome); +;// ./static/js/vendor/altcha.js +var _Qr$v, _window$__svelte; +function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == altcha_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(altcha_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } +function altcha_callSuper(t, o, e) { return o = altcha_getPrototypeOf(o), altcha_possibleConstructorReturn(t, altcha_isNativeReflectConstruct() ? Reflect.construct(o, e || [], altcha_getPrototypeOf(t).constructor) : o.apply(t, e)); } +function altcha_possibleConstructorReturn(t, e) { if (e && ("object" == altcha_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return altcha_assertThisInitialized(t); } +function altcha_assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } +function altcha_superPropGet(t, o, e, r) { var p = altcha_get(altcha_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } +function altcha_get() { return altcha_get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = altcha_superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, altcha_get.apply(null, arguments); } +function altcha_superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = altcha_getPrototypeOf(t));); return t; } +function altcha_inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && altcha_setPrototypeOf(t, e); } +function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, altcha_getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), altcha_setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); } +function _construct(t, e, r) { if (altcha_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && altcha_setPrototypeOf(p, r.prototype), p; } +function altcha_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (altcha_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } } +function altcha_setPrototypeOf(t, e) { return altcha_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, altcha_setPrototypeOf(t, e); } +function altcha_getPrototypeOf(t) { return altcha_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, altcha_getPrototypeOf(t); } +function altcha_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } +function altcha_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, altcha_toPropertyKey(o.key), o); } } +function altcha_createClass(e, r, t) { return r && altcha_defineProperties(e.prototype, r), t && altcha_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { altcha_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function altcha_defineProperty(e, r, t) { return (r = altcha_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } +function altcha_toPropertyKey(t) { var i = altcha_toPrimitive(t, "string"); return "symbol" == altcha_typeof(i) ? i : i + ""; } +function altcha_toPrimitive(t, r) { if ("object" != altcha_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != altcha_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); } +function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } +function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } +function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } +function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } +function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } +function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } +function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n2 = 0, F = function F() {}; return { s: F, n: function n() { return _n2 >= r.length ? { done: !0 } : { done: !1, value: r[_n2++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } +function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } +function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } +function altcha_typeof(o) { "@babel/helpers - typeof"; return altcha_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, altcha_typeof(o); } +var hi = Object.defineProperty; +var Or = function Or(e) { + throw TypeError(e); +}; +var gi = function gi(e, t, r) { + return t in e ? hi(e, t, { + enumerable: !0, + configurable: !0, + writable: !0, + value: r + }) : e[t] = r; +}; +var ne = function ne(e, t, r) { + return gi(e, altcha_typeof(t) != "symbol" ? t + "" : t, r); + }, + zr = function zr(e, t, r) { + return t.has(e) || Or("Cannot " + r); + }; +var H = function H(e, t, r) { + return zr(e, t, "read from private field"), r ? r.call(e) : t.get(e); + }, + Mt = function Mt(e, t, r) { + return t.has(e) ? Or("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r); + }, + Ut = function Ut(e, t, r, l) { + return zr(e, t, "write to private field"), l ? l.call(e, r) : t.set(e, r), r; + }; +var en = "(function(){\"use strict\";const d=new TextEncoder;function p(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,\"0\")).join(\"\")}async function b(e,t,r){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 p(await crypto.subtle.digest(r.toUpperCase(),d.encode(e+t)))}function w(e,t,r=\"SHA-256\",n=1e6,s=0){const o=new AbortController,a=Date.now();return{promise:(async()=>{for(let c=s;c<=n;c+=1){if(o.signal.aborted)return null;if(await b(t,c,r)===e)return{number:c,took:Date.now()-a}}return null})(),controller:o}}function h(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n{for(let u=n;u<=r;u+=1){if(o.signal.aborted||!c||!y)return null;try{const f=await crypto.subtle.decrypt({name:s,iv:g(u)},c,y);if(f)return{clearText:new TextDecoder().decode(f),took:Date.now()-a}}catch{}}return null};let c=null,y=null;try{y=h(e);const u=await crypto.subtle.digest(\"SHA-256\",d.encode(t));c=await crypto.subtle.importKey(\"raw\",u,s,!1,[\"decrypt\"])}catch{return{promise:Promise.reject(),controller:o}}return{promise:l(),controller:o}}let i;onmessage=async e=>{const{type:t,payload:r,start:n,max:s}=e.data;let o=null;if(t===\"abort\")i==null||i.abort(),i=void 0;else if(t===\"work\"){if(\"obfuscated\"in r){const{key:a,obfuscated:l}=r||{};o=await m(l,a,s,n)}else{const{algorithm:a,challenge:l,salt:c}=r||{};o=w(l,c,a,s,n)}i=o.controller,o.promise.then(a=>{self.postMessage(a&&{...a,worker:!0})})}}})();\n", + Fr = (typeof self === "undefined" ? "undefined" : altcha_typeof(self)) < "u" && self.Blob && new Blob([en], { + type: "text/javascript;charset=utf-8" + }); +function _i(e) { + var t; + try { + if (t = Fr && (self.URL || self.webkitURL).createObjectURL(Fr), !t) throw ""; + var r = new Worker(t, { + name: e == null ? void 0 : e.name + }); + return r.addEventListener("error", function () { + (self.URL || self.webkitURL).revokeObjectURL(t); + }), r; + } catch (_unused) { + return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(en), { + name: e == null ? void 0 : e.name + }); + } finally { + t && (self.URL || self.webkitURL).revokeObjectURL(t); + } +} +var mi = "5"; +var Qr; +(typeof window === "undefined" ? "undefined" : altcha_typeof(window)) < "u" && ((_Qr$v = (Qr = (_window$__svelte = window.__svelte) !== null && _window$__svelte !== void 0 ? _window$__svelte : window.__svelte = {}).v) !== null && _Qr$v !== void 0 ? _Qr$v : Qr.v = /* @__PURE__ */new Set()).add(mi); +var wi = 1, + pi = 4, + yi = 8, + bi = 16, + Ei = 1, + xi = 2, + Wt = "[", + tn = "[!", + rn = "]", + Je = {}, + W = Symbol(), + $i = "http://www.w3.org/1999/xhtml", + Mr = !1, + oe = 2, + nn = 4, + It = 8, + Yt = 16, + pe = 32, + ze = 64, + yt = 128, + re = 256, + bt = 512, + K = 1024, + ye = 2048, + et = 4096, + Ke = 8192, + St = 16384, + ki = 32768, + Zt = 65536, + Ci = 1 << 19, + ln = 1 << 20, + ut = Symbol("$state"), + an = Symbol("legacy props"), + Ai = Symbol(""); +var on = Array.isArray, + Ri = Array.prototype.indexOf, + Ii = Array.from, + Et = Object.keys, + xt = Object.defineProperty, + Pe = Object.getOwnPropertyDescriptor, + Si = Object.getOwnPropertyDescriptors, + Ti = Object.prototype, + Ni = Array.prototype, + sn = Object.getPrototypeOf; +function fn(e) { + for (var t = 0; t < e.length; t++) e[t](); +} +var Li = (typeof requestIdleCallback === "undefined" ? "undefined" : altcha_typeof(requestIdleCallback)) > "u" ? function (e) { + return setTimeout(e, 1); +} : requestIdleCallback; +var dt = [], + vt = []; +function un() { + var e = dt; + dt = [], fn(e); +} +function cn() { + var e = vt; + vt = [], fn(e); +} +function Gt(e) { + dt.length === 0 && queueMicrotask(un), dt.push(e); +} +function Di(e) { + vt.length === 0 && Li(cn), vt.push(e); +} +function Ur() { + dt.length > 0 && un(), vt.length > 0 && cn(); +} +function dn(e) { + return e === this.v; +} +function Pi(e, t) { + return e != e ? t == t : e !== t || e !== null && altcha_typeof(e) == "object" || typeof e == "function"; +} +function vn(e) { + return !Pi(e, this.v); +} +function Oi(e) { + throw new Error("https://svelte.dev/e/effect_in_teardown"); +} +function zi() { + throw new Error("https://svelte.dev/e/effect_in_unowned_derived"); +} +function Fi(e) { + throw new Error("https://svelte.dev/e/effect_orphan"); +} +function Mi() { + throw new Error("https://svelte.dev/e/effect_update_depth_exceeded"); +} +function Ui() { + throw new Error("https://svelte.dev/e/hydration_failed"); +} +function ji(e) { + throw new Error("https://svelte.dev/e/props_invalid_value"); +} +function Vi() { + throw new Error("https://svelte.dev/e/state_descriptors_fixed"); +} +function Bi() { + throw new Error("https://svelte.dev/e/state_prototype_fixed"); +} +function qi() { + throw new Error("https://svelte.dev/e/state_unsafe_local_read"); +} +function Hi() { + throw new Error("https://svelte.dev/e/state_unsafe_mutation"); +} +var Wi = !1; +function ue(e, t) { + var r = { + f: 0, + // TODO ideally we could skip this altogether, but it causes type errors + v: e, + reactions: null, + equals: dn, + rv: 0, + wv: 0 + }; + return r; +} +function He(e) { + return /* @__PURE__ */Yi(ue(e)); +} +// @__NO_SIDE_EFFECTS__ +function hn(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; + var r = ue(e); + return t || (r.equals = vn), r; +} +// @__NO_SIDE_EFFECTS__ +function Yi(e) { + return k !== null && !ae && (k.f & oe) !== 0 && (ce === null ? Qi([e]) : ce.push(e)), e; +} +function P(e, t) { + return k !== null && !ae && Dn() && (k.f & (oe | Yt)) !== 0 && ( + // If the source was created locally within the current derived, then + // we allow the mutation. + ce === null || !ce.includes(e)) && Hi(), Zi(e, t); +} +function Zi(e, t) { + return e.equals(t) || (e.v, e.v = t, e.wv = En(), gn(e, ye), A !== null && (A.f & K) !== 0 && (A.f & (pe | ze)) === 0 && (ge === null ? el([e]) : ge.push(e))), t; +} +function gn(e, t) { + var r = e.reactions; + if (r !== null) for (var l = r.length, i = 0; i < l; i++) { + var a = r[i], + o = a.f; + (o & ye) === 0 && (de(a, t), (o & (K | re)) !== 0 && ((o & oe) !== 0 ? gn(/** @type {Derived} */ + a, et) : Lt(/** @type {Effect} */ + a))); + } +} +// @__NO_SIDE_EFFECTS__ +function De(e) { + var t = oe | ye, + r = k !== null && (k.f & oe) !== 0 ? (/** @type {Derived} */ + k) : null; + return A === null || r !== null && (r.f & re) !== 0 ? t |= re : A.f |= ln, { + ctx: B, + deps: null, + effects: null, + equals: dn, + f: t, + fn: e, + reactions: null, + rv: 0, + v: (/** @type {V} */ + null), + wv: 0, + parent: r !== null && r !== void 0 ? r : A + }; +} +function _n(e) { + var t = e.effects; + if (t !== null) { + e.effects = null; + for (var r = 0; r < t.length; r += 1) we(/** @type {Effect} */ + t[r]); + } +} +function Gi(e) { + for (var t = e.parent; t !== null;) { + if ((t.f & oe) === 0) return /** @type {Effect} */t; + t = t.parent; + } + return null; +} +function Ji(e) { + var t, + r = A; + Se(Gi(e)); + try { + _n(e), t = $n(e); + } finally { + Se(r); + } + return t; +} +function mn(e) { + var t = Ji(e), + r = (Ce || (e.f & re) !== 0) && e.deps !== null ? et : K; + de(e, r), e.equals(t) || (e.v = t, e.wv = En()); +} +function Tt(e) { + console.warn("https://svelte.dev/e/hydration_mismatch"); +} +var D = !1; +function Ge(e) { + D = e; +} +var O; +function Re(e) { + if (e === null) throw Tt(), Je; + return O = e; +} +function Xe() { + return Re(/** @type {TemplateNode} */ + /* @__PURE__ */Te(O)); +} +function Z(e) { + if (D) { + if (/* @__PURE__ */Te(O) !== null) throw Tt(), Je; + O = e; + } +} +function Ki() { + for (var e = 0, t = O;;) { + if (t.nodeType === 8) { + var r = /** @type {Comment} */ + t.data; + if (r === rn) { + if (e === 0) return t; + e -= 1; + } else (r === Wt || r === tn) && (e += 1); + } + var l = /** @type {TemplateNode} */ + /* @__PURE__ */Te(t); + t.remove(), t = l; + } +} +function le(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var r = arguments.length > 2 ? arguments[2] : undefined; + if (altcha_typeof(e) != "object" || e === null || ut in e) return e; + var l = sn(e); + if (l !== Ti && l !== Ni) return e; + var i = /* @__PURE__ */new Map(), + a = on(e), + o = ue(0); + a && i.set("length", ue(/** @type {any[]} */ + e.length)); + var f; + return new Proxy(/** @type {any} */ + e, { + defineProperty: function defineProperty(s, c, v) { + (!("value" in v) || v.configurable === !1 || v.enumerable === !1 || v.writable === !1) && Vi(); + var h = i.get(c); + return h === void 0 ? (h = ue(v.value), i.set(c, h)) : P(h, le(v.value, f)), !0; + }, + deleteProperty: function deleteProperty(s, c) { + var v = i.get(c); + if (v === void 0) c in s && i.set(c, ue(W));else { + if (a && typeof c == "string") { + var h = /** @type {Source} */ + i.get("length"), + g = Number(c); + Number.isInteger(g) && g < h.v && P(h, g); + } + P(v, W), jr(o); + } + return !0; + }, + get: function get(s, c, v) { + var w; + if (c === ut) return e; + var h = i.get(c), + g = c in s; + if (h === void 0 && (!g || (w = Pe(s, c)) != null && w.writable) && (h = ue(le(g ? s[c] : W, f)), i.set(c, h)), h !== void 0) { + var m = d(h); + return m === W ? void 0 : m; + } + return Reflect.get(s, c, v); + }, + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(s, c) { + var v = Reflect.getOwnPropertyDescriptor(s, c); + if (v && "value" in v) { + var h = i.get(c); + h && (v.value = d(h)); + } else if (v === void 0) { + var g = i.get(c), + m = g == null ? void 0 : g.v; + if (g !== void 0 && m !== W) return { + enumerable: !0, + configurable: !0, + value: m, + writable: !0 + }; + } + return v; + }, + has: function has(s, c) { + var m; + if (c === ut) return !0; + var v = i.get(c), + h = v !== void 0 && v.v !== W || Reflect.has(s, c); + if (v !== void 0 || A !== null && (!h || (m = Pe(s, c)) != null && m.writable)) { + v === void 0 && (v = ue(h ? le(s[c], f) : W), i.set(c, v)); + var g = d(v); + if (g === W) return !1; + } + return h; + }, + set: function set(s, c, v, h) { + var F; + var g = i.get(c), + m = c in s; + if (a && c === "length") for (var w = v; w < /** @type {Source} */ + g.v; w += 1) { + var z = i.get(w + ""); + z !== void 0 ? P(z, W) : w in s && (z = ue(W), i.set(w + "", z)); + } + g === void 0 ? (!m || (F = Pe(s, c)) != null && F.writable) && (g = ue(void 0), P(g, le(v, f)), i.set(c, g)) : (m = g.v !== W, P(g, le(v, f))); + var T = Reflect.getOwnPropertyDescriptor(s, c); + if (T != null && T.set && T.set.call(h, v), !m) { + if (a && typeof c == "string") { + var Y = /** @type {Source} */ + i.get("length"), + M = Number(c); + Number.isInteger(M) && M >= Y.v && P(Y, M + 1); + } + jr(o); + } + return !0; + }, + ownKeys: function ownKeys(s) { + d(o); + var c = Reflect.ownKeys(s).filter(function (g) { + var m = i.get(g); + return m === void 0 || m.v !== W; + }); + var _iterator = _createForOfIteratorHelper(i), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _step$value = _slicedToArray(_step.value, 2), + v = _step$value[0], + h = _step$value[1]; + h.v !== W && !(v in s) && c.push(v); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return c; + }, + setPrototypeOf: function setPrototypeOf() { + Bi(); + } + }); +} +function jr(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + P(e, e.v + t); +} +var Vr, wn, pn, yn; +function jt() { + if (Vr === void 0) { + Vr = window, wn = /Firefox/.test(navigator.userAgent); + var e = Element.prototype, + t = Node.prototype; + pn = Pe(t, "firstChild").get, yn = Pe(t, "nextSibling").get, e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0, Text.prototype.__t = void 0; + } +} +function Jt() { + var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + return document.createTextNode(e); +} +// @__NO_SIDE_EFFECTS__ +function me(e) { + return pn.call(e); +} +// @__NO_SIDE_EFFECTS__ +function Te(e) { + return yn.call(e); +} +function G(e, t) { + if (!D) return /* @__PURE__ */me(e); + var r = /** @type {TemplateNode} */ + /* @__PURE__ */me(O); + return r === null && (r = O.appendChild(Jt())), Re(r), r; +} +function Br(e, t) { + if (!D) { + var r = /** @type {DocumentFragment} */ + /* @__PURE__ */me(/** @type {Node} */ + e); + return r instanceof Comment && r.data === "" ? /* @__PURE__ */Te(r) : r; + } + return O; +} +function he(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1; + var l = D ? O : e; + for (var i; t--;) i = l, l = /** @type {TemplateNode} */ + /* @__PURE__ */Te(l); + if (!D) return l; + var a = l == null ? void 0 : l.nodeType; + if (r && a !== 3) { + var o = Jt(); + return l === null ? i == null || i.after(o) : l.before(o), Re(o), o; + } + return Re(l), /** @type {TemplateNode} */ + l; +} +function Xi(e) { + e.textContent = ""; +} +var wt = !1, + $t = !1, + kt = null, + Oe = !1, + Kt = !1; +function qr(e) { + Kt = e; +} +var ct = []; +var k = null, + ae = !1; +function Ie(e) { + k = e; +} +var A = null; +function Se(e) { + A = e; +} +var ce = null; +function Qi(e) { + ce = e; +} +var V = null, + J = 0, + ge = null; +function el(e) { + ge = e; +} +var bn = 1, + Ct = 0, + Ce = !1; +function En() { + return ++bn; +} +function ht(e) { + var h; + var t = e.f; + if ((t & ye) !== 0) return !0; + if ((t & et) !== 0) { + var r = e.deps, + l = (t & re) !== 0; + if (r !== null) { + var i, + a, + o = (t & bt) !== 0, + f = l && A !== null && !Ce, + s = r.length; + if (o || f) { + var c = /** @type {Derived} */ + e, + v = c.parent; + for (i = 0; i < s; i++) { + var _a$reactions; + a = r[i], (o || !((h = a == null ? void 0 : a.reactions) != null && h.includes(c))) && ((_a$reactions = a.reactions) !== null && _a$reactions !== void 0 ? _a$reactions : a.reactions = []).push(c); + } + o && (c.f ^= bt), f && v !== null && (v.f & re) === 0 && (c.f ^= re); + } + for (i = 0; i < s; i++) if (a = r[i], ht(/** @type {Derived} */ + a) && mn(/** @type {Derived} */ + a), a.wv > e.wv) return !0; + } + (!l || A !== null && !Ce) && de(e, K); + } + return !1; +} +function tl(e, t) { + for (var r = t; r !== null;) { + if ((r.f & yt) !== 0) try { + r.fn(e); + return; + } catch (_unused2) { + r.f ^= yt; + } + r = r.parent; + } + throw wt = !1, e; +} +function rl(e) { + return (e.f & St) === 0 && (e.parent === null || (e.parent.f & yt) === 0); +} +function Nt(e, t, r, l) { + if (wt) { + if (r === null && (wt = !1), rl(t)) throw e; + return; + } + r !== null && (wt = !0); + { + tl(e, t); + return; + } +} +function xn(e, t) { + var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0; + var l = e.reactions; + if (l !== null) for (var i = 0; i < l.length; i++) { + var a = l[i]; + (a.f & oe) !== 0 ? xn(/** @type {Derived} */ + a, t, !1) : t === a && (r ? de(a, ye) : (a.f & K) !== 0 && de(a, et), Lt(/** @type {Effect} */ + a)); + } +} +function $n(e) { + var m; + var t = V, + r = J, + l = ge, + i = k, + a = Ce, + o = ce, + f = B, + s = ae, + c = e.f; + V = /** @type {null | Value[]} */ + null, J = 0, ge = null, Ce = (c & re) !== 0 && (ae || !Oe || k === null), k = (c & (pe | ze)) === 0 ? e : null, ce = null, Wr(e.ctx), ae = !1, Ct++; + try { + var v = /** @type {Function} */ + (0, e.fn)(), + h = e.deps; + if (V !== null) { + var g; + if (At(e, J), h !== null && J > 0) for (h.length = J + V.length, g = 0; g < V.length; g++) h[J + g] = V[g];else e.deps = h = V; + if (!Ce) for (g = J; g < h.length; g++) { + var _m$reactions; + ((_m$reactions = (m = h[g]).reactions) !== null && _m$reactions !== void 0 ? _m$reactions : m.reactions = []).push(e); + } + } else h !== null && J < h.length && (At(e, J), h.length = J); + if (Dn() && ge !== null && !ae && h !== null && (e.f & (oe | et | ye)) === 0) for (g = 0; g < /** @type {Source[]} */ + ge.length; g++) xn(ge[g], /** @type {Effect} */ + e); + return i !== null && Ct++, v; + } finally { + V = t, J = r, ge = l, k = i, Ce = a, ce = o, Wr(f), ae = s; + } +} +function nl(e, t) { + var r = t.reactions; + if (r !== null) { + var l = Ri.call(r, e); + if (l !== -1) { + var i = r.length - 1; + i === 0 ? r = t.reactions = null : (r[l] = r[i], r.pop()); + } + } + r === null && (t.f & oe) !== 0 && ( + // Destroying a child effect while updating a parent effect can cause a dependency to appear + // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps` + // allows us to skip the expensive work of disconnecting and immediately reconnecting it + V === null || !V.includes(t)) && (de(t, et), (t.f & (re | bt)) === 0 && (t.f ^= bt), _n(/** @type {Derived} **/ + t), At(/** @type {Derived} **/ + t, 0)); +} +function At(e, t) { + var r = e.deps; + if (r !== null) for (var l = t; l < r.length; l++) nl(e, r[l]); +} +function Xt(e) { + var t = e.f; + if ((t & St) === 0) { + de(e, K); + var r = A, + l = B, + i = Oe; + A = e, Oe = !0; + try { + (t & Yt) !== 0 ? hl(e) : An(e), Cn(e); + var a = $n(e); + e.teardown = typeof a == "function" ? a : null, e.wv = bn; + var o = e.deps, + f; + Mr && Wi && e.f & ye; + } catch (s) { + Nt(s, e, r, l || e.ctx); + } finally { + Oe = i, A = r; + } + } +} +function il() { + try { + Mi(); + } catch (e) { + if (kt !== null) Nt(e, kt, null);else throw e; + } +} +function kn() { + var e = Oe; + try { + var t = 0; + for (Oe = !0; ct.length > 0;) { + t++ > 1e3 && il(); + var r = ct, + l = r.length; + ct = []; + for (var i = 0; i < l; i++) { + var a = al(r[i]); + ll(a); + } + } + } finally { + $t = !1, Oe = e, kt = null; + } +} +function ll(e) { + var t = e.length; + if (t !== 0) for (var r = 0; r < t; r++) { + var l = e[r]; + if ((l.f & (St | Ke)) === 0) try { + ht(l) && (Xt(l), l.deps === null && l.first === null && l.nodes_start === null && (l.teardown === null ? Rn(l) : l.fn = null)); + } catch (i) { + Nt(i, l, null, l.ctx); + } + } +} +function Lt(e) { + $t || ($t = !0, queueMicrotask(kn)); + for (var t = kt = e; t.parent !== null;) { + t = t.parent; + var r = t.f; + if ((r & (ze | pe)) !== 0) { + if ((r & K) === 0) return; + t.f ^= K; + } + } + ct.push(t); +} +function al(e) { + for (var t = [], r = e; r !== null;) { + var l = r.f, + i = (l & (pe | ze)) !== 0, + a = i && (l & K) !== 0; + if (!a && (l & Ke) === 0) { + if ((l & nn) !== 0) t.push(r);else if (i) r.f ^= K;else { + var o = k; + try { + k = r, ht(r) && Xt(r); + } catch (c) { + Nt(c, r, null, r.ctx); + } finally { + k = o; + } + } + var f = r.first; + if (f !== null) { + r = f; + continue; + } + } + var s = r.parent; + for (r = r.next; r === null && s !== null;) r = s.next, s = s.parent; + } + return t; +} +function $(e) { + var t; + for (Ur(); ct.length > 0;) $t = !0, kn(), Ur(); + return /** @type {T} */t; +} +function ol() { + return _ol.apply(this, arguments); +} +function _ol() { + _ol = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() { + return _regeneratorRuntime().wrap(function _callee9$(_context9) { + while (1) switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return Promise.resolve(); + case 2: + $(); + case 3: + case "end": + return _context9.stop(); + } + }, _callee9); + })); + return _ol.apply(this, arguments); +} +function d(e) { + var t = e.f, + r = (t & oe) !== 0; + if (k !== null && !ae) { + ce !== null && ce.includes(e) && qi(); + var l = k.deps; + e.rv < Ct && (e.rv = Ct, V === null && l !== null && l[J] === e ? J++ : V === null ? V = [e] : (!Ce || !V.includes(e)) && V.push(e)); + } else if (r && /** @type {Derived} */ + e.deps === null && /** @type {Derived} */ + e.effects === null) { + var i = /** @type {Derived} */ + e, + a = i.parent; + a !== null && (a.f & re) === 0 && (i.f ^= re); + } + return r && (i = /** @type {Derived} */ + e, ht(i) && mn(i)), e.v; +} +function Qe(e) { + var t = ae; + try { + return ae = !0, e(); + } finally { + ae = t; + } +} +var sl = -7169; +function de(e, t) { + e.f = e.f & sl | t; +} +function fl(e) { + A === null && k === null && Fi(), k !== null && (k.f & re) !== 0 && A === null && zi(), Kt && Oi(); +} +function ul(e, t) { + var r = t.last; + r === null ? t.last = t.first = e : (r.next = e, e.prev = r, t.last = e); +} +function Fe(e, t, r) { + var l = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0; + var i = A, + a = { + ctx: B, + deps: null, + nodes_start: null, + nodes_end: null, + f: e | ye, + first: null, + fn: t, + last: null, + next: null, + parent: i, + prev: null, + teardown: null, + transitions: null, + wv: 0 + }; + if (r) try { + Xt(a), a.f |= ki; + } catch (s) { + throw we(a), s; + } else t !== null && Lt(a); + var o = r && a.deps === null && a.first === null && a.nodes_start === null && a.teardown === null && (a.f & (ln | yt)) === 0; + if (!o && l && (i !== null && ul(a, i), k !== null && (k.f & oe) !== 0)) { + var _f$effects; + var f = /** @type {Derived} */ + k; + ((_f$effects = f.effects) !== null && _f$effects !== void 0 ? _f$effects : f.effects = []).push(a); + } + return a; +} +function cl(e) { + var t = Fe(It, null, !1); + return de(t, K), t.teardown = e, t; +} +function Vt(e) { + fl(); + var t = A !== null && (A.f & pe) !== 0 && B !== null && !B.m; + if (t) { + var _r$e; + var r = /** @type {ComponentContext} */ + B; + ((_r$e = r.e) !== null && _r$e !== void 0 ? _r$e : r.e = []).push({ + fn: e, + effect: A, + reaction: k + }); + } else { + var l = Qt(e); + return l; + } +} +function dl(e) { + var t = Fe(ze, e, !0); + return function () { + we(t); + }; +} +function vl(e) { + var t = Fe(ze, e, !0); + return function () { + var r = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + return new Promise(function (l) { + r.outro ? Bt(t, function () { + we(t), l(void 0); + }) : (we(t), l(void 0)); + }); + }; +} +function Qt(e) { + return Fe(nn, e, !1); +} +function er(e) { + return Fe(It, e, !0); +} +function We(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : De; + var l = t.map(r); + return tr(function () { + return e.apply(void 0, _toConsumableArray(l.map(d))); + }); +} +function tr(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + return Fe(It | Yt | t, e, !0); +} +function Rt(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0; + return Fe(It | pe, e, !0, t); +} +function Cn(e) { + var t = e.teardown; + if (t !== null) { + var r = Kt, + l = k; + qr(!0), Ie(null); + try { + t.call(null); + } finally { + qr(r), Ie(l); + } + } +} +function An(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; + var r = e.first; + for (e.first = e.last = null; r !== null;) { + var l = r.next; + (r.f & ze) !== 0 ? r.parent = null : we(r, t), r = l; + } +} +function hl(e) { + for (var t = e.first; t !== null;) { + var r = t.next; + (t.f & pe) === 0 && we(t), t = r; + } +} +function we(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0; + var r = !1; + if ((t || (e.f & Ci) !== 0) && e.nodes_start !== null) { + for (var l = e.nodes_start, i = e.nodes_end; l !== null;) { + var a = l === i ? null : (/** @type {TemplateNode} */ + /* @__PURE__ */Te(l)); + l.remove(), l = a; + } + r = !0; + } + An(e, t && !r), At(e, 0), de(e, St); + var o = e.transitions; + if (o !== null) { + var _iterator2 = _createForOfIteratorHelper(o), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var s = _step2.value; + s.stop(); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + Cn(e); + var f = e.parent; + f !== null && f.first !== null && Rn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes_start = e.nodes_end = null; +} +function Rn(e) { + var t = e.parent, + r = e.prev, + l = e.next; + r !== null && (r.next = l), l !== null && (l.prev = r), t !== null && (t.first === e && (t.first = l), t.last === e && (t.last = r)); +} +function Bt(e, t) { + var r = []; + In(e, r, !0), gl(r, function () { + we(e), t && t(); + }); +} +function gl(e, t) { + var r = e.length; + if (r > 0) { + var l = function l() { + return --r || t(); + }; + var _iterator3 = _createForOfIteratorHelper(e), + _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var i = _step3.value; + i.out(l); + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } else t(); +} +function In(e, t, r) { + if ((e.f & Ke) === 0) { + if (e.f ^= Ke, e.transitions !== null) { + var _iterator4 = _createForOfIteratorHelper(e.transitions), + _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var o = _step4.value; + (o.is_global || r) && t.push(o); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + } + for (var l = e.first; l !== null;) { + var i = l.next, + a = (l.f & Zt) !== 0 || (l.f & pe) !== 0; + In(l, t, a ? r : !1), l = i; + } + } +} +function Hr(e) { + Sn(e, !0); +} +function Sn(e, t) { + if ((e.f & Ke) !== 0) { + e.f ^= Ke, (e.f & K) === 0 && (e.f ^= K), ht(e) && (de(e, ye), Lt(e)); + for (var r = e.first; r !== null;) { + var l = r.next, + i = (r.f & Zt) !== 0 || (r.f & pe) !== 0; + Sn(r, i ? t : !1), r = l; + } + if (e.transitions !== null) { + var _iterator5 = _createForOfIteratorHelper(e.transitions), + _step5; + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var a = _step5.value; + (a.is_global || t) && a["in"](); + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + } + } +} +function Tn(e) { + throw new Error("https://svelte.dev/e/lifecycle_outside_component"); +} +var B = null; +function Wr(e) { + B = e; +} +function Nn(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; + var r = arguments.length > 2 ? arguments[2] : undefined; + B = { + p: B, + c: null, + e: null, + m: !1, + s: e, + x: null, + l: null + }; +} +function Ln(e) { + var t = B; + if (t !== null) { + e !== void 0 && (t.x = e); + var o = t.e; + if (o !== null) { + var r = A, + l = k; + t.e = null; + try { + for (var i = 0; i < o.length; i++) { + var a = o[i]; + Se(a.effect), Ie(a.reaction), Qt(a.fn); + } + } finally { + Se(r), Ie(l); + } + } + B = t.p, t.m = !0; + } + return e || /** @type {T} */ + {}; +} +function Dn() { + return !0; +} +var _l = ["touchstart", "touchmove"]; +function ml(e) { + return _l.includes(e); +} +var Yr = !1; +function Pn() { + Yr || (Yr = !0, document.addEventListener("reset", function (e) { + Promise.resolve().then(function () { + var t; + if (!e.defaultPrevented) { + var _iterator6 = _createForOfIteratorHelper(/**@type {HTMLFormElement} */ + e.target.elements), + _step6; + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + var r = _step6.value; + (t = r.__on_r) == null || t.call(r); + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + } + }); + }, + // In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation) + { + capture: !0 + })); +} +function On(e) { + var t = k, + r = A; + Ie(null), Se(null); + try { + return e(); + } finally { + Ie(t), Se(r); + } +} +function wl(e, t, r) { + var l = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : r; + e.addEventListener(t, function () { + return On(r); + }); + var i = e.__on_r; + i ? e.__on_r = function () { + i(), l(!0); + } : e.__on_r = function () { + return l(!0); + }, Pn(); +} +var zn = /* @__PURE__ */new Set(), + qt = /* @__PURE__ */new Set(); +function pl(e, t, r) { + var l = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + function i(a) { + var _this = this; + if (l.capture || ft.call(t, a), !a.cancelBubble) return On(function () { + return r == null ? void 0 : r.call(_this, a); + }); + } + return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Gt(function () { + t.addEventListener(e, i, l); + }) : t.addEventListener(e, i, l), i; +} +function yl(e, t, r, l, i) { + var a = { + capture: l, + passive: i + }, + o = pl(e, t, r, a); + (t === document.body || t === window || t === document) && cl(function () { + t.removeEventListener(e, o, a); + }); +} +function bl(e) { + for (var t = 0; t < e.length; t++) zn.add(e[t]); + var _iterator7 = _createForOfIteratorHelper(qt), + _step7; + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var r = _step7.value; + r(e); + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); + } +} +function ft(e) { + var M; + var t = this, + r = /** @type {Node} */ + t.ownerDocument, + l = e.type, + i = ((M = e.composedPath) == null ? void 0 : M.call(e)) || [], + a = /** @type {null | Element} */ + i[0] || e.target, + o = 0, + f = e.__root; + if (f) { + var s = i.indexOf(f); + if (s !== -1 && (t === document || t === /** @type {any} */ + window)) { + e.__root = t; + return; + } + var c = i.indexOf(t); + if (c === -1) return; + s <= c && (o = s); + } + if (a = /** @type {Element} */ + i[o] || e.target, a !== t) { + xt(e, "currentTarget", { + configurable: !0, + get: function get() { + return a || r; + } + }); + var v = k, + h = A; + Ie(null), Se(null); + try { + for (var g, m = []; a !== null;) { + var w = a.assignedSlot || a.parentNode || /** @type {any} */ + a.host || null; + try { + var z = a["__" + l]; + if (z != null && (! /** @type {any} */ + a.disabled || + // DOM could've been updated already by the time this is reached, so we check this as well + // -> the target could not have been disabled because it emits the event in the first place + e.target === a)) if (on(z)) { + var _z = z, + _z2 = _toArray(_z), + T = _z2[0], + Y = _z2.slice(1); + T.apply(a, [e].concat(_toConsumableArray(Y))); + } else z.call(a, e); + } catch (F) { + g ? m.push(F) : g = F; + } + if (e.cancelBubble || w === t || w === null) break; + a = w; + } + if (g) { + var _iterator8 = _createForOfIteratorHelper(m), + _step8; + try { + var _loop = function _loop() { + var F = _step8.value; + queueMicrotask(function () { + throw F; + }); + }; + for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { + _loop(); + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + throw g; + } + } finally { + e.__root = t, delete e.currentTarget, Ie(v), Se(h); + } + } +} +function rr(e) { + var t = document.createElement("template"); + return t.innerHTML = e, t.content; +} +function Ae(e, t) { + var r = /** @type {Effect} */ + A; + r.nodes_start === null && (r.nodes_start = e, r.nodes_end = t); +} +// @__NO_SIDE_EFFECTS__ +function ve(e, t) { + var r = (t & Ei) !== 0, + l = (t & xi) !== 0, + i, + a = !e.startsWith(""); + return function () { + if (D) return Ae(O, null), O; + i === void 0 && (i = rr(a ? e : "" + e), r || (i = /** @type {Node} */ + /* @__PURE__ */me(i))); + var o = /** @type {TemplateNode} */ + l || wn ? document.importNode(i, !0) : i.cloneNode(!0); + if (r) { + var f = /** @type {TemplateNode} */ + /* @__PURE__ */me(o), + s = /** @type {TemplateNode} */ + o.lastChild; + Ae(f, s); + } else Ae(o, o); + return o; + }; +} +// @__NO_SIDE_EFFECTS__ +function El(e, t) { + var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "svg"; + var l = !e.startsWith(""), + i = "<".concat(r, ">").concat(l ? e : "" + e, "").concat(r, ">"), + a; + return function () { + if (D) return Ae(O, null), O; + if (!a) { + var o = /** @type {DocumentFragment} */ + rr(i), + f = /** @type {Element} */ + /* @__PURE__ */me(o); + a = /** @type {Element} */ + /* @__PURE__ */me(f); + } + var s = /** @type {TemplateNode} */ + a.cloneNode(!0); + return Ae(s, s), s; + }; +} +function ee(e, t) { + if (D) { + A.nodes_end = O, Xe(); + return; + } + e !== null && e.before(/** @type {Node} */ + t); +} +function Fn(e, t) { + return Mn(e, t); +} +function xl(e, t) { + var _t$intro; + jt(), t.intro = (_t$intro = t.intro) !== null && _t$intro !== void 0 ? _t$intro : !1; + var r = t.target, + l = D, + i = O; + try { + for (var a = /** @type {TemplateNode} */ + /* @__PURE__ */me(r); a && (a.nodeType !== 8 || /** @type {Comment} */ + a.data !== Wt);) a = /** @type {TemplateNode} */ + /* @__PURE__ */Te(a); + if (!a) throw Je; + Ge(!0), Re(/** @type {Comment} */ + a), Xe(); + var o = Mn(e, _objectSpread(_objectSpread({}, t), {}, { + anchor: a + })); + if (O === null || O.nodeType !== 8 || /** @type {Comment} */ + O.data !== rn) throw Tt(), Je; + return Ge(!1), /** @type {Exports} */ + o; + } catch (o) { + if (o === Je) return t.recover === !1 && Ui(), jt(), Xi(r), Ge(!1), Fn(e, t); + throw o; + } finally { + Ge(l), Re(i); + } +} +var Ye = /* @__PURE__ */new Map(); +function Mn(e, _ref) { + var t = _ref.target, + r = _ref.anchor, + _ref$props = _ref.props, + l = _ref$props === void 0 ? {} : _ref$props, + i = _ref.events, + a = _ref.context, + _ref$intro = _ref.intro, + o = _ref$intro === void 0 ? !0 : _ref$intro; + jt(); + var f = /* @__PURE__ */new Set(), + s = function s(h) { + for (var g = 0; g < h.length; g++) { + var m = h[g]; + if (!f.has(m)) { + f.add(m); + var w = ml(m); + t.addEventListener(m, ft, { + passive: w + }); + var z = Ye.get(m); + z === void 0 ? (document.addEventListener(m, ft, { + passive: w + }), Ye.set(m, 1)) : Ye.set(m, z + 1); + } + } + }; + s(Ii(zn)), qt.add(s); + var c = void 0, + v = vl(function () { + var h = r !== null && r !== void 0 ? r : t.appendChild(Jt()); + return Rt(function () { + if (a) { + Nn({}); + var g = /** @type {ComponentContext} */ + B; + g.c = a; + } + i && (l.$$events = i), D && Ae(/** @type {TemplateNode} */ + h, null), c = e(h, l) || {}, D && (A.nodes_end = O), a && Ln(); + }), function () { + var w; + var _iterator9 = _createForOfIteratorHelper(f), + _step9; + try { + for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { + var g = _step9.value; + t.removeEventListener(g, ft); + var m = /** @type {number} */ + Ye.get(g); + --m === 0 ? (document.removeEventListener(g, ft), Ye["delete"](g)) : Ye.set(g, m); + } + } catch (err) { + _iterator9.e(err); + } finally { + _iterator9.f(); + } + qt["delete"](s), h !== r && ((w = h.parentNode) == null || w.removeChild(h)); + }; + }); + return Ht.set(c, v), c; +} +var Ht = /* @__PURE__ */new WeakMap(); +function $l(e, t) { + var r = Ht.get(e); + return r ? (Ht["delete"](e), r(t)) : Promise.resolve(); +} +function ke(e, t) { + var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0], + _ref3 = _slicedToArray(_ref2, 2), + r = _ref3[0], + l = _ref3[1]; + D && r === 0 && Xe(); + var i = e, + a = null, + o = null, + f = W, + s = r > 0 ? Zt : 0, + c = !1; + var v = function v(g) { + var m = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0; + c = !0, h(m, g); + }, + h = function h(g, m) { + if (f === (f = g)) return; + var w = !1; + if (D && l !== -1) { + if (r === 0) { + var T = /** @type {Comment} */ + i.data; + T === Wt ? l = 0 : T === tn ? l = 1 / 0 : (l = parseInt(T.substring(1)), l !== l && (l = f ? 1 / 0 : -1)); + } + var z = l > r; + !!f === z && (i = Ki(), Re(i), Ge(!1), w = !0, l = -1); + } + f ? (a ? Hr(a) : m && (a = Rt(function () { + return m(i); + })), o && Bt(o, function () { + o = null; + })) : (o ? Hr(o) : m && (o = Rt(function () { + return m(i, [r + 1, l]); + })), a && Bt(a, function () { + a = null; + })), w && Ge(!0); + }; + tr(function () { + c = !1, t(v), c || h(null, null); + }, s), D && (i = O); +} +function Ze(e, t, r, l, i) { + var a = e, + o = "", + f; + tr(function () { + var _t2; + if (o === (o = (_t2 = t()) !== null && _t2 !== void 0 ? _t2 : "")) { + D && Xe(); + return; + } + f !== void 0 && (we(f), f = void 0), o !== "" && (f = Rt(function () { + if (D) { + O.data; + for (var s = Xe(), c = s; s !== null && (s.nodeType !== 8 || /** @type {Comment} */ + s.data !== "");) c = s, s = /** @type {TemplateNode} */ + /* @__PURE__ */Te(s); + if (s === null) throw Tt(), Je; + Ae(O, c), a = Re(s); + return; + } + var v = o + "", + h = rr(v); + Ae(/** @type {TemplateNode} */ + /* @__PURE__ */me(h), /** @type {TemplateNode} */ + h.lastChild), a.before(h); + })); + }); +} +function kl(e, t, r, l, i) { + var f; + D && Xe(); + var a = (f = t.$$slots) == null ? void 0 : f[r], + o = !1; + a === !0 && (a = t.children, o = !0), a === void 0 || a(e, o ? function () { + return l; + } : l); +} +function Cl(e, t) { + Gt(function () { + var _r$head; + var r = e.getRootNode(), + l = /** @type {ShadowRoot} */ + r.host ? (/** @type {ShadowRoot} */ + r) : /** @type {Document} */(_r$head = r.head) !== null && _r$head !== void 0 ? _r$head : /** @type {Document} */ + r.ownerDocument.head; + if (!l.querySelector("#" + t.hash)) { + var i = document.createElement("style"); + i.id = t.hash, i.textContent = t.code, l.appendChild(i); + } + }); +} +var Zr = _toConsumableArray(" \t\n\r\f\xA0\x0B\uFEFF"); +function Al(e, t, r) { + var l = "" + e; + if (r) { + for (var i in r) if (r[i]) l = l ? l + " " + i : i;else if (l.length) for (var a = i.length, o = 0; (o = l.indexOf(i, o)) >= 0;) { + var f = o + a; + (o === 0 || Zr.includes(l[o - 1])) && (f === l.length || Zr.includes(l[f])) ? l = (o === 0 ? "" : l.substring(0, o)) + l.substring(f + 1) : o = f; + } + } + return l === "" ? null : l; +} +function Rl(e, t, r, l, i, a) { + var o = e.__className; + if (D || o !== r) { + var f = Al(r, l, a); + (!D || f !== e.getAttribute("class")) && (f == null ? e.removeAttribute("class") : e.className = f), e.__className = r; + } else if (a && i !== a) for (var s in a) { + var c = !!a[s]; + (i == null || c !== !!i[s]) && e.classList.toggle(s, c); + } + return a; +} +var Il = Symbol("is custom element"), + Sl = Symbol("is html"); +function Gr(e) { + if (D) { + var t = !1, + r = function r() { + if (!t) { + if (t = !0, e.hasAttribute("value")) { + var l = e.value; + ie(e, "value", null), e.value = l; + } + if (e.hasAttribute("checked")) { + var i = e.checked; + ie(e, "checked", null), e.checked = i; + } + } + }; + e.__on_r = r, Di(r), Pn(); + } +} +function Tl(e, t) { + var r = Un(e); + r.value === (r.value = // treat null and undefined the same for the initial value + t !== null && t !== void 0 ? t : void 0) || + // @ts-expect-error + // `progress` elements always need their value set when it's `0` + e.value === t && (t !== 0 || e.nodeName !== "PROGRESS") || (e.value = t !== null && t !== void 0 ? t : ""); +} +function ie(e, t, r, l) { + var i = Un(e); + D && (i[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === "LINK") || i[t] !== (i[t] = r) && (t === "loading" && (e[Ai] = r), r == null ? e.removeAttribute(t) : typeof r != "string" && Nl(e).includes(t) ? e[t] = r : e.setAttribute(t, r)); +} +function Un(e) { + var _e$__attributes; + return ( + /** @type {Record} **/ + // @ts-expect-error + (_e$__attributes = e.__attributes) !== null && _e$__attributes !== void 0 ? _e$__attributes : e.__attributes = altcha_defineProperty(altcha_defineProperty({}, Il, e.nodeName.includes("-")), Sl, e.namespaceURI === $i) + ); +} +var Jr = /* @__PURE__ */new Map(); +function Nl(e) { + var t = Jr.get(e.nodeName); + if (t) return t; + Jr.set(e.nodeName, t = []); + for (var r, l = e, i = Element.prototype; i !== l;) { + r = Si(l); + for (var a in r) r[a].set && t.push(a); + l = sn(l); + } + return t; +} +function Ll(e, t) { + var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : t; + wl(e, "change", function (l) { + var i = l ? e.defaultChecked : e.checked; + r(i); + }), + // If we are hydrating and the value has since changed, + // then use the update value from the input instead. + (D && e.defaultChecked !== e.checked || + // If defaultChecked is set, then checked == defaultChecked + Qe(t) == null) && r(e.checked), er(function () { + var l = t(); + e.checked = !!l; + }); +} +function Kr(e, t) { + return e === t || (e == null ? void 0 : e[ut]) === t; +} +function Xr() { + var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var t = arguments.length > 1 ? arguments[1] : undefined; + var r = arguments.length > 2 ? arguments[2] : undefined; + var l = arguments.length > 3 ? arguments[3] : undefined; + return Qt(function () { + var i, a; + return er(function () { + i = a, a = [], Qe(function () { + e !== r.apply(void 0, _toConsumableArray(a)) && (t.apply(void 0, [e].concat(_toConsumableArray(a))), i && Kr(r.apply(void 0, _toConsumableArray(i)), e) && t.apply(void 0, [null].concat(_toConsumableArray(i)))); + }); + }), function () { + Gt(function () { + a && Kr(r.apply(void 0, _toConsumableArray(a)), e) && t.apply(void 0, [null].concat(_toConsumableArray(a))); + }); + }; + }), e; +} +function jn(e) { + B === null && Tn(), Vt(function () { + var t = Qe(e); + if (typeof t == "function") return /** @type {() => void} */t; + }); +} +function Dl(e) { + B === null && Tn(), jn(function () { + return function () { + return Qe(e); + }; + }); +} +var mt = !1; +function Pl(e) { + var t = mt; + try { + return mt = !1, [e(), mt]; + } finally { + mt = t; + } +} +function C(e, t, r, l) { + var _Pl, _Pl2, _ref4; + var be; + var i = (r & wi) !== 0, + a = !0, + o = (r & yi) !== 0, + f = (r & bi) !== 0, + s = !1, + c; + o ? (_Pl = Pl(function () { + return /** @type {V} */e[t]; + }), _Pl2 = _slicedToArray(_Pl, 2), c = _Pl2[0], s = _Pl2[1], _Pl) : c = /** @type {V} */ + e[t]; + var v = ut in e || an in e, + h = o && ((_ref4 = (be = Pe(e, t)) == null ? void 0 : be.set) !== null && _ref4 !== void 0 ? _ref4 : v && t in e && function (N) { + return e[t] = N; + }) || void 0, + g = /** @type {V} */ + l, + m = !0, + w = !1, + z = function z() { + return w = !0, m && (m = !1, f ? g = Qe(/** @type {() => V} */ + l) : g = /** @type {V} */ + l), g; + }; + c === void 0 && l !== void 0 && (h && a && ji(), c = z(), h && h(c)); + var T; + if (T = function T() { + var N = /** @type {V} */ + e[t]; + return N === void 0 ? z() : (m = !0, w = !1, N); + }, (r & pi) === 0) return T; + if (h) { + var Y = e.$$legacy; + return function (N, X) { + return arguments.length > 0 ? ((!X || Y || s) && h(X ? T() : N), N) : T(); + }; + } + var M = !1, + F = /* @__PURE__ */hn(c), + se = /* @__PURE__ */De(function () { + var N = T(), + X = d(F); + return M ? (M = !1, X) : F.v = N; + }); + return i || (se.equals = vn), function (N, X) { + if (arguments.length > 0) { + var U = X ? d(se) : o ? le(N) : N; + return se.equals(U) || (M = !0, P(F, U), w && g !== void 0 && (g = U), Qe(function () { + return d(se); + })), N; + } + return d(se); + }; +} +function Ol(e) { + return new zl(e); +} +var _e, te; +var zl = /*#__PURE__*/function () { + /** + * @param {ComponentConstructorOptions & { + * component: any; + * }} options + */ + function zl(t) { + var _t$intro2, + _this2 = this; + altcha_classCallCheck(this, zl); + /** @type {any} */ + Mt(this, _e); + /** @type {Record} */ + Mt(this, te); + var a; + var r = /* @__PURE__ */new Map(), + l = function l(o, f) { + var s = /* @__PURE__ */hn(f); + return r.set(o, s), s; + }; + var i = new Proxy(_objectSpread(_objectSpread({}, t.props || {}), {}, { + $$events: {} + }), { + get: function get(o, f) { + var _r$get; + return d((_r$get = r.get(f)) !== null && _r$get !== void 0 ? _r$get : l(f, Reflect.get(o, f))); + }, + has: function has(o, f) { + var _r$get2; + return f === an ? !0 : (d((_r$get2 = r.get(f)) !== null && _r$get2 !== void 0 ? _r$get2 : l(f, Reflect.get(o, f))), Reflect.has(o, f)); + }, + set: function set(o, f, s) { + var _r$get3; + return P((_r$get3 = r.get(f)) !== null && _r$get3 !== void 0 ? _r$get3 : l(f, s), s), Reflect.set(o, f, s); + } + }); + Ut(this, te, (t.hydrate ? xl : Fn)(t.component, { + target: t.target, + anchor: t.anchor, + props: i, + context: t.context, + intro: (_t$intro2 = t.intro) !== null && _t$intro2 !== void 0 ? _t$intro2 : !1, + recover: t.recover + })), (!((a = t == null ? void 0 : t.props) != null && a.$$host) || t.sync === !1) && $(), Ut(this, _e, i.$$events); + var _loop2 = function _loop2() { + var o = _Object$keys[_i2]; + o === "$set" || o === "$destroy" || o === "$on" || xt(_this2, o, { + get: function get() { + return H(this, te)[o]; + }, + /** @param {any} value */set: function set(f) { + H(this, te)[o] = f; + }, + enumerable: !0 + }); + }; + for (var _i2 = 0, _Object$keys = Object.keys(H(this, te)); _i2 < _Object$keys.length; _i2++) { + _loop2(); + } + H(this, te).$set = /** @param {Record} next */ + function (o) { + Object.assign(i, o); + }, H(this, te).$destroy = function () { + $l(H(_this2, te)); + }; + } + /** @param {Record} props */ + return altcha_createClass(zl, [{ + key: "$set", + value: function $set(t) { + H(this, te).$set(t); + } + /** + * @param {string} event + * @param {(...args: any[]) => any} callback + * @returns {any} + */ + }, { + key: "$on", + value: function $on(t, r) { + var _this3 = this; + H(this, _e)[t] = H(this, _e)[t] || []; + var l = function l() { + for (var _len = arguments.length, i = new Array(_len), _key = 0; _key < _len; _key++) { + i[_key] = arguments[_key]; + } + return r.call.apply(r, [_this3].concat(i)); + }; + return H(this, _e)[t].push(l), function () { + H(_this3, _e)[t] = H(_this3, _e)[t].filter(/** @param {any} fn */ + function (i) { + return i !== l; + }); + }; + } + }, { + key: "$destroy", + value: function $destroy() { + H(this, te).$destroy(); + } + }]); +}(); +_e = new WeakMap(), te = new WeakMap(); +var Vn; +typeof HTMLElement == "function" && (Vn = /*#__PURE__*/function (_HTMLElement) { + /** + * @param {*} $$componentCtor + * @param {*} $$slots + * @param {*} use_shadow_dom + */ + function Vn(t, r, l) { + var _this4; + altcha_classCallCheck(this, Vn); + _this4 = altcha_callSuper(this, Vn); + /** The Svelte component constructor */ + ne(_this4, "$$ctor"); + /** Slots */ + ne(_this4, "$$s"); + /** @type {any} The Svelte component instance */ + ne(_this4, "$$c"); + /** Whether or not the custom element is connected */ + ne(_this4, "$$cn", !1); + /** @type {Record} Component props data */ + ne(_this4, "$$d", {}); + /** `true` if currently in the process of reflecting component props back to attributes */ + ne(_this4, "$$r", !1); + /** @type {Record} Props definition (name, reflected, type etc) */ + ne(_this4, "$$p_d", {}); + /** @type {Record} Event listeners */ + ne(_this4, "$$l", {}); + /** @type {Map} Event listener unsubscribe functions */ + ne(_this4, "$$l_u", /* @__PURE__ */new Map()); + /** @type {any} The managed render effect for reflecting attributes */ + ne(_this4, "$$me"); + _this4.$$ctor = t, _this4.$$s = r, l && _this4.attachShadow({ + mode: "open" + }); + return _this4; + } + /** + * @param {string} type + * @param {EventListenerOrEventListenerObject} listener + * @param {boolean | AddEventListenerOptions} [options] + */ + altcha_inherits(Vn, _HTMLElement); + return altcha_createClass(Vn, [{ + key: "addEventListener", + value: function addEventListener(t, r, l) { + if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(r), this.$$c) { + var i = this.$$c.$on(t, r); + this.$$l_u.set(r, i); + } + altcha_superPropGet(Vn, "addEventListener", this, 3)([t, r, l]); + } + /** + * @param {string} type + * @param {EventListenerOrEventListenerObject} listener + * @param {boolean | AddEventListenerOptions} [options] + */ + }, { + key: "removeEventListener", + value: function removeEventListener(t, r, l) { + if (altcha_superPropGet(Vn, "removeEventListener", this, 3)([t, r, l]), this.$$c) { + var i = this.$$l_u.get(r); + i && (i(), this.$$l_u["delete"](r)); + } + } + }, { + key: "connectedCallback", + value: function () { + var _connectedCallback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() { + var _this5 = this; + var t, r, l, _iterator10, _step10, _i4, _iterator11, _step11, _i5, _a, i, _i3, _iterator13, _step13, a, o; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + if (!(this.$$cn = !0, !this.$$c)) { + _context.next = 15; + break; + } + t = function t(i) { + return function (a) { + var o = document.createElement("slot"); + i !== "default" && (o.name = i), ee(a, o); + }; + }; + _context.next = 4; + return Promise.resolve(); + case 4: + if (!(!this.$$cn || this.$$c)) { + _context.next = 6; + break; + } + return _context.abrupt("return"); + case 6: + r = {}, l = Fl(this); + _iterator10 = _createForOfIteratorHelper(this.$$s); + try { + for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { + _i4 = _step10.value; + _i4 in l && (_i4 === "default" && !this.$$d.children ? (this.$$d.children = t(_i4), r["default"] = !0) : r[_i4] = t(_i4)); + } + } catch (err) { + _iterator10.e(err); + } finally { + _iterator10.f(); + } + _iterator11 = _createForOfIteratorHelper(this.attributes); + try { + for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { + _i5 = _step11.value; + _a = this.$$g_p(_i5.name); + _a in this.$$d || (this.$$d[_a] = pt(_a, _i5.value, this.$$p_d, "toProp")); + } + } catch (err) { + _iterator11.e(err); + } finally { + _iterator11.f(); + } + for (i in this.$$p_d) !(i in this.$$d) && this[i] !== void 0 && (this.$$d[i] = this[i], delete this[i]); + this.$$c = Ol({ + component: this.$$ctor, + target: this.shadowRoot || this, + props: _objectSpread(_objectSpread({}, this.$$d), {}, { + $$slots: r, + $$host: this + }) + }), this.$$me = dl(function () { + er(function () { + var i; + _this5.$$r = !0; + var _iterator12 = _createForOfIteratorHelper(Et(_this5.$$c)), + _step12; + try { + for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { + var a = _step12.value; + if (!((i = _this5.$$p_d[a]) != null && i.reflect)) continue; + _this5.$$d[a] = _this5.$$c[a]; + var o = pt(a, _this5.$$d[a], _this5.$$p_d, "toAttribute"); + o == null ? _this5.removeAttribute(_this5.$$p_d[a].attribute || a) : _this5.setAttribute(_this5.$$p_d[a].attribute || a, o); + } + } catch (err) { + _iterator12.e(err); + } finally { + _iterator12.f(); + } + _this5.$$r = !1; + }); + }); + for (_i3 in this.$$l) { + _iterator13 = _createForOfIteratorHelper(this.$$l[_i3]); + try { + for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) { + a = _step13.value; + o = this.$$c.$on(_i3, a); + this.$$l_u.set(a, o); + } + } catch (err) { + _iterator13.e(err); + } finally { + _iterator13.f(); + } + } + this.$$l = {}; + case 15: + case "end": + return _context.stop(); + } + }, _callee, this); + })); + function connectedCallback() { + return _connectedCallback.apply(this, arguments); + } + return connectedCallback; + }() // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte + // and setting attributes through setAttribute etc, this is helpful + /** + * @param {string} attr + * @param {string} _oldValue + * @param {string} newValue + */ + }, { + key: "attributeChangedCallback", + value: function attributeChangedCallback(t, r, l) { + var i; + this.$$r || (t = this.$$g_p(t), this.$$d[t] = pt(t, l, this.$$p_d, "toProp"), (i = this.$$c) == null || i.$set(altcha_defineProperty({}, t, this.$$d[t]))); + } + }, { + key: "disconnectedCallback", + value: function disconnectedCallback() { + var _this6 = this; + this.$$cn = !1, Promise.resolve().then(function () { + !_this6.$$cn && _this6.$$c && (_this6.$$c.$destroy(), _this6.$$me(), _this6.$$c = void 0); + }); + } + /** + * @param {string} attribute_name + */ + }, { + key: "$$g_p", + value: function $$g_p(t) { + var _this7 = this; + return Et(this.$$p_d).find(function (r) { + return _this7.$$p_d[r].attribute === t || !_this7.$$p_d[r].attribute && r.toLowerCase() === t; + }) || t; + } + }]); +}(/*#__PURE__*/_wrapNativeSuper(HTMLElement))); +function pt(e, t, r, l) { + var a; + var i = (a = r[e]) == null ? void 0 : a.type; + if (t = i === "Boolean" && typeof t != "boolean" ? t != null : t, !l || !r[e]) return t; + if (l === "toAttribute") switch (i) { + case "Object": + case "Array": + return t == null ? null : JSON.stringify(t); + case "Boolean": + return t ? "" : null; + case "Number": + return t !== null && t !== void 0 ? t : null; + default: + return t; + } else switch (i) { + case "Object": + case "Array": + return t && JSON.parse(t); + case "Boolean": + return t; + // conversion already handled above + case "Number": + return t != null ? +t : t; + default: + return t; + } +} +function Fl(e) { + var t = {}; + return e.childNodes.forEach(function (r) { + t[/** @type {Element} node */ + r.slot || "default"] = !0; + }), t; +} +function Ml(e, t, r, l, i, a) { + var o = /*#__PURE__*/function (_Vn) { + function o() { + var _this8; + altcha_classCallCheck(this, o); + _this8 = altcha_callSuper(this, o, [e, r, i]), _this8.$$p_d = t; + return _this8; + } + altcha_inherits(o, _Vn); + return altcha_createClass(o, null, [{ + key: "observedAttributes", + get: function get() { + return Et(t).map(function (f) { + return (t[f].attribute || f).toLowerCase(); + }); + } + }]); + }(Vn); + return Et(t).forEach(function (f) { + xt(o.prototype, f, { + get: function get() { + return this.$$c && f in this.$$c ? this.$$c[f] : this.$$d[f]; + }, + set: function set(s) { + var h; + s = pt(f, s, t), this.$$d[f] = s; + var c = this.$$c; + if (c) { + var v = (h = Pe(c, f)) == null ? void 0 : h.get; + v ? c[f] = s : c.$set(altcha_defineProperty({}, f, s)); + } + } + }); + }), l.forEach(function (f) { + xt(o.prototype, f, { + get: function get() { + var s; + return (s = this.$$c) == null ? void 0 : s[f]; + } + }); + }), e.element = /** @type {any} */ + o, o; +} +var Bn = new TextEncoder(); +function Ul(e) { + return _toConsumableArray(new Uint8Array(e)).map(function (t) { + return t.toString(16).padStart(2, "0"); + }).join(""); +} +function jl(_x) { + return _jl.apply(this, arguments); +} +function _jl() { + _jl = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e) { + var t, + r, + l, + i, + _args10 = arguments; + return _regeneratorRuntime().wrap(function _callee10$(_context10) { + while (1) switch (_context10.prev = _context10.next) { + case 0: + t = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : "SHA-256"; + r = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : 1e5; + l = Date.now().toString(16); + e || (e = Math.round(Math.random() * r)); + _context10.next = 6; + return qn(l, e, t); + case 6: + i = _context10.sent; + return _context10.abrupt("return", { + algorithm: t, + challenge: i, + salt: l, + signature: "" + }); + case 8: + case "end": + return _context10.stop(); + } + }, _callee10); + })); + return _jl.apply(this, arguments); +} +function qn(_x2, _x3, _x4) { + return _qn.apply(this, arguments); +} +function _qn() { + _qn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, r) { + return _regeneratorRuntime().wrap(function _callee11$(_context11) { + while (1) switch (_context11.prev = _context11.next) { + case 0: + if (!((typeof crypto === "undefined" ? "undefined" : altcha_typeof(crypto)) > "u" || !("subtle" in crypto) || !("digest" in crypto.subtle))) { + _context11.next = 2; + break; + } + throw new Error("Web Crypto is not available. Secure context is required (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts)."); + case 2: + _context11.t0 = Ul; + _context11.next = 5; + return crypto.subtle.digest(r.toUpperCase(), Bn.encode(e + t)); + case 5: + _context11.t1 = _context11.sent; + return _context11.abrupt("return", (0, _context11.t0)(_context11.t1)); + case 7: + case "end": + return _context11.stop(); + } + }, _callee11); + })); + return _qn.apply(this, arguments); +} +function Vl(e, t) { + var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "SHA-256"; + var l = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1e6; + var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var a = new AbortController(), + o = Date.now(); + return { + promise: _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { + var s; + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + s = i; + case 1: + if (!(s <= l)) { + _context2.next = 13; + break; + } + if (!a.signal.aborted) { + _context2.next = 4; + break; + } + return _context2.abrupt("return", null); + case 4: + _context2.next = 6; + return qn(t, s, r); + case 6: + _context2.t0 = _context2.sent; + _context2.t1 = e; + if (!(_context2.t0 === _context2.t1)) { + _context2.next = 10; + break; + } + return _context2.abrupt("return", { + number: s, + took: Date.now() - o + }); + case 10: + s += 1; + _context2.next = 1; + break; + case 13: + return _context2.abrupt("return", null); + case 14: + case "end": + return _context2.stop(); + } + }, _callee2); + }))(), + controller: a + }; +} +function Bl() { + try { + return Intl.DateTimeFormat().resolvedOptions().timeZone; + } catch (_unused3) {} +} +function ql(e) { + var t = atob(e), + r = new Uint8Array(t.length); + for (var l = 0; l < t.length; l++) r[l] = t.charCodeAt(l); + return r; +} +function Hl(e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12; + var r = new Uint8Array(t); + for (var l = 0; l < t; l++) r[l] = e % 256, e = Math.floor(e / 256); + return r; +} +function Wl(_x5) { + return _Wl.apply(this, arguments); +} +function _Wl() { + _Wl = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e) { + var t, + r, + l, + i, + a, + o, + f, + s, + c, + v, + _args13 = arguments; + return _regeneratorRuntime().wrap(function _callee13$(_context13) { + while (1) switch (_context13.prev = _context13.next) { + case 0: + t = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : ""; + r = _args13.length > 2 && _args13[2] !== undefined ? _args13[2] : 1e6; + l = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : 0; + i = "AES-GCM", a = new AbortController(), o = Date.now(), f = /*#__PURE__*/function () { + var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() { + var v, h; + return _regeneratorRuntime().wrap(function _callee12$(_context12) { + while (1) switch (_context12.prev = _context12.next) { + case 0: + v = l; + case 1: + if (!(v <= r)) { + _context12.next = 17; + break; + } + if (!(a.signal.aborted || !s || !c)) { + _context12.next = 4; + break; + } + return _context12.abrupt("return", null); + case 4: + _context12.prev = 4; + _context12.next = 7; + return crypto.subtle.decrypt({ + name: i, + iv: Hl(v) + }, s, c); + case 7: + h = _context12.sent; + if (!h) { + _context12.next = 10; + break; + } + return _context12.abrupt("return", { + clearText: new TextDecoder().decode(h), + took: Date.now() - o + }); + case 10: + _context12.next = 14; + break; + case 12: + _context12.prev = 12; + _context12.t0 = _context12["catch"](4); + case 14: + v += 1; + _context12.next = 1; + break; + case 17: + return _context12.abrupt("return", null); + case 18: + case "end": + return _context12.stop(); + } + }, _callee12, null, [[4, 12]]); + })); + return function f() { + return _ref7.apply(this, arguments); + }; + }(); + s = null, c = null; + _context13.prev = 5; + c = ql(e); + _context13.next = 9; + return crypto.subtle.digest("SHA-256", Bn.encode(t)); + case 9: + v = _context13.sent; + _context13.next = 12; + return crypto.subtle.importKey("raw", v, i, !1, ["decrypt"]); + case 12: + s = _context13.sent; + _context13.next = 18; + break; + case 15: + _context13.prev = 15; + _context13.t0 = _context13["catch"](5); + return _context13.abrupt("return", { + promise: Promise.reject(), + controller: a + }); + case 18: + return _context13.abrupt("return", { + promise: f(), + controller: a + }); + case 19: + case "end": + return _context13.stop(); + } + }, _callee13, null, [[5, 15]]); + })); + return _Wl.apply(this, arguments); +} +var E = /* @__PURE__ */function (e) { + return e.ERROR = "error", e.VERIFIED = "verified", e.VERIFYING = "verifying", e.UNVERIFIED = "unverified", e.EXPIRED = "expired", e; + }(E || {}), + Yl = /* @__PURE__ */El(''), + Zl = /* @__PURE__ */ve(' ', 1), + Gl = /* @__PURE__ */ve(''), + Jl = /* @__PURE__ */ve(''), + Kl = /* @__PURE__ */ve(''), + Xl = /* @__PURE__ */ve(''), + Ql = /* @__PURE__ */ve(''), + ea = /* @__PURE__ */ve(' '), + ta = /* @__PURE__ */ve(''), + ra = /* @__PURE__ */ve(''), + na = /* @__PURE__ */ve(' ', 1); +var ia = { + 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 la(e, t) { + var Lr, Dr; + Nn(t, !0), Cl(e, ia); + var r = C(t, "auto", 7, void 0), + l = C(t, "blockspam", 7, void 0), + i = C(t, "challengeurl", 7, void 0), + a = C(t, "challengejson", 7, void 0), + o = C(t, "customfetch", 7, void 0), + f = C(t, "debug", 7, !1), + s = C(t, "delay", 7, 0), + c = C(t, "expire", 7, void 0), + v = C(t, "floating", 7, void 0), + h = C(t, "floatinganchor", 7, void 0), + g = C(t, "floatingoffset", 7, void 0), + m = C(t, "hidefooter", 7, !1), + w = C(t, "hidelogo", 7, !1), + z = C(t, "id", 7, void 0), + T = C(t, "name", 7, "altcha"), + Y = C(t, "maxnumber", 7, 1e6), + M = C(t, "mockerror", 7, !1), + F = C(t, "obfuscated", 7, void 0), + se = C(t, "plugins", 7, void 0), + be = C(t, "refetchonexpire", 7, !0), + N = C(t, "spamfilter", 7, !1), + X = C(t, "strings", 7, void 0), + U = C(t, "test", 7, !1), + Ee = C(t, "verifyurl", 7, void 0), + Me = C(t, "workers", 23, function () { + return Math.min(16, navigator.hardwareConcurrency || 8); + }), + tt = C(t, "workerurl", 7, void 0); + var nr = ["SHA-256", "SHA-384", "SHA-512"], + ir = "Visit Altcha.org", + lr = "https://altcha.org/", + rt = function rt(n, u) { + t.$$host.dispatchEvent(new CustomEvent(n, { + detail: u + })); + }, + ar = (Dr = (Lr = document.documentElement.lang) == null ? void 0 : Lr.split("-")) == null ? void 0 : Dr[0], + Dt = /* @__PURE__ */De(function () { + var n; + return i() && new URL(i(), location.origin).host.endsWith(".altcha.org") && !!((n = i()) != null && n.includes("apiKey=ckey_")); + }), + Pt = /* @__PURE__ */De(function () { + return a() ? wr(a()) : void 0; + }), + or = /* @__PURE__ */De(function () { + return X() ? wr(X()) : {}; + }), + Q = /* @__PURE__ */De(function () { + var n; + return _objectSpread({ + ariaLinkLabel: ir, + 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." + }, d(or)); + }), + sr = /* @__PURE__ */De(function () { + return z() || "".concat(T(), "_checkbox"); + }); + var Ue = He(!1), + R = He(le(E.UNVERIFIED)), + j = He(void 0), + nt = He(null), + je = null, + y = null, + Ve = He(null), + fe = null, + xe = [], + Ne = He(null); + Vt(function () { + Xn(d(Ve)); + }), Vt(function () { + Qn(d(R)); + }), Dl(function () { + Hn(), y && (y.removeEventListener("submit", hr), y.removeEventListener("reset", gr), y.removeEventListener("focusin", vr), y = null), fe && (clearTimeout(fe), fe = null), document.removeEventListener("click", cr), document.removeEventListener("scroll", dr), window.removeEventListener("resize", mr); + }), jn(function () { + var n; + I("mounted", "1.3.0"), I("workers", Me()), Jn(), I("plugins", xe.length ? xe.map(function (u) { + return u.constructor.pluginName; + }).join(", ") : "none"), U() && I("using test mode"), c() && Ot(c()), r() !== void 0 && I("auto", r()), v() !== void 0 && pr(v()), y = (n = d(j)) == null ? void 0 : n.closest("form"), y && (y.addEventListener("submit", hr, { + capture: !0 + }), y.addEventListener("reset", gr), r() === "onfocus" && y.addEventListener("focusin", vr)), r() === "onload" && (F() ? it() : $e()), d(Dt) && (m() || w()) && I("Attributes hidefooter and hidelogo ignored because usage with free API Keys requires attribution."), requestAnimationFrame(function () { + rt("load"); + }); + }); + function fr(n, u) { + return btoa(JSON.stringify({ + algorithm: n.algorithm, + challenge: n.challenge, + number: u.number, + salt: n.salt, + signature: n.signature, + test: U() ? !0 : void 0, + took: u.took + })); + } + function Hn() { + for (var _i6 = 0, _xe = xe; _i6 < _xe.length; _i6++) { + var n = _xe[_i6]; + n.destroy(); + } + } + function ur() { + i() && be() && d(R) === E.VERIFIED ? $e() : lt(E.EXPIRED, d(Q).expired); + } + function Wn() { + return _Wn.apply(this, arguments); + } + function _Wn() { + _Wn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { + var n, L, u, _, b, S, x, p, q, _L, qe, _L2; + return _regeneratorRuntime().wrap(function _callee3$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + if (!M()) { + _context3.next = 2; + break; + } + throw I("mocking error"), new Error("Mocked error."); + case 2: + if (!d(Pt)) { + _context3.next = 4; + break; + } + return _context3.abrupt("return", (I("using provided json data"), d(Pt))); + case 4: + if (!U()) { + _context3.next = 6; + break; + } + return _context3.abrupt("return", (I("generating test challenge", { + test: U() + }), jl(typeof U() != "boolean" ? +U() : void 0))); + case 6: + if (!i() && y) { + L = y.getAttribute("action"); + L != null && L.includes("/form/") && i(L + "/altcha"); + } + if (i()) { + _context3.next = 9; + break; + } + throw new Error("Attribute challengeurl not set."); + case 9: + I("fetching challenge from", i()); + u = null, _ = null; + if (!o()) { + _context3.next = 18; + break; + } + if (!(I("using customfetch"), typeof o() == "string")) { + _context3.next = 17; + break; + } + if (!(u = globalThis[o()] || null, !u)) { + _context3.next = 15; + break; + } + throw new Error("Custom fetch function not found: ".concat(o())); + case 15: + _context3.next = 18; + break; + case 17: + u = o(); + case 18: + b = { + headers: N() !== !1 ? { + "x-altcha-spam-filter": "1" + } : {} + }; + if (!u) { + _context3.next = 27; + break; + } + _context3.next = 22; + return u(i(), b); + case 22: + _ = _context3.sent; + if (!(!_ || !(_ instanceof Response))) { + _context3.next = 25; + break; + } + throw new Error("Custom fetch function did not return a response."); + case 25: + _context3.next = 30; + break; + case 27: + _context3.next = 29; + return fetch(i(), b); + case 29: + _ = _context3.sent; + case 30: + if (!(_.status !== 200)) { + _context3.next = 32; + break; + } + throw new Error("Server responded with ".concat(_.status, ".")); + case 32: + S = _.headers.get("X-Altcha-Config"); + _context3.next = 35; + return _.json(); + case 35: + x = _context3.sent; + p = new URLSearchParams((n = x.salt.split("?")) == null ? void 0 : n[1]); + q = p.get("expires") || p.get("expire"); + if (q) { + _L = new Date(+q * 1e3), qe = isNaN(_L.getTime()) ? 0 : _L.getTime() - Date.now(); + qe > 0 && Ot(qe); + } + if (S) try { + _L2 = JSON.parse(S); + _L2 && altcha_typeof(_L2) == "object" && (_L2.verifyurl && (_L2.verifyurl = new URL(_L2.verifyurl, new URL(i())).toString()), Er(_L2)); + } catch (L) { + I("unable to configure from X-Altcha-Config", L); + } + return _context3.abrupt("return", x); + case 41: + case "end": + return _context3.stop(); + } + }, _callee3); + })); + return _Wn.apply(this, arguments); + } + function Yn(n) { + var _; + var u = y == null ? void 0 : y.querySelector(typeof n == "string" ? "input[name=\"".concat(n, "\"]") : 'input[type="email"]:not([data-no-spamfilter])'); + return ((_ = u == null ? void 0 : u.value) == null ? void 0 : _.slice(u.value.indexOf("@"))) || void 0; + } + function Zn() { + return N() === "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 + } : altcha_typeof(N()) == "object" ? N() : { + 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 Gn(n) { + return _toConsumableArray((y == null ? void 0 : y.querySelectorAll(n != null && n.length ? n.map(function (_) { + return "input[name=\"".concat(_, "\"]"); + }).join(", ") : 'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])')) || []).reduce(function (_, b) { + var S = b.name, + x = b.value; + return S && x && (_[S] = /\n/.test(x) ? x.replace(new RegExp("(? 0 && arguments[0] !== undefined ? arguments[0] : 20; + if (d(j)) if (je || (je = (h() ? document.querySelector(h()) : y == null ? void 0 : y.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])')) || y), je) { + var u = parseInt(g(), 10) || 12, + _ = je.getBoundingClientRect(), + b = d(j).getBoundingClientRect(), + S = document.documentElement.clientHeight, + x = document.documentElement.clientWidth, + p = v() === "auto" ? _.bottom + b.height + u + n > S : v() === "top", + q = Math.max(n, Math.min(x - n - b.width, _.left + _.width / 2 - b.width / 2)); + if (p ? d(j).style.top = "".concat(_.top - (b.height + u), "px") : d(j).style.top = "".concat(_.bottom + u, "px"), d(j).style.left = "".concat(q, "px"), d(j).setAttribute("data-floating", p ? "top" : "bottom"), d(nt)) { + var L = d(nt).getBoundingClientRect(); + d(nt).style.left = _.left - q + _.width / 2 - L.width / 2 + "px"; + } + } else I("unable to find floating anchor element"); + } + function ei(_x6) { + return _ei.apply(this, arguments); + } + function _ei() { + _ei = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(n) { + var u, _Zn, S, x, p, q, L, qe, ot, st, vi, Pr, _, b; + return _regeneratorRuntime().wrap(function _callee4$(_context4) { + while (1) switch (_context4.prev = _context4.next) { + case 0: + if (Ee()) { + _context4.next = 2; + break; + } + throw new Error("Attribute verifyurl not set."); + case 2: + I("requesting server verification from", Ee()); + u = { + payload: n + }; + if (N() !== !1) { + _Zn = Zn(), S = _Zn.blockedCountries, x = _Zn.classifier, p = _Zn.disableRules, q = _Zn.email, L = _Zn.expectedLanguages, qe = _Zn.expectedCountries, ot = _Zn.fields, st = _Zn.ipAddress, vi = _Zn.text, Pr = _Zn.timeZone; + u.blockedCountries = S, u.classifier = x, u.disableRules = p, u.email = q === !1 ? void 0 : Yn(q), u.expectedCountries = qe, u.expectedLanguages = L || (ar ? [ar] : void 0), u.fields = ot === !1 ? void 0 : Gn(ot), u.ipAddress = st === !1 ? void 0 : st || "auto", u.text = vi, u.timeZone = Pr === !1 ? void 0 : Pr || Bl(); + } + _context4.next = 7; + return fetch(Ee(), { + body: JSON.stringify(u), + headers: { + "content-type": "application/json" + }, + method: "POST" + }); + case 7: + _ = _context4.sent; + if (!(_.status !== 200)) { + _context4.next = 10; + break; + } + throw new Error("Server responded with ".concat(_.status, ".")); + case 10: + _context4.next = 12; + return _.json(); + case 12: + b = _context4.sent; + if (!(b != null && b.payload && P(Ne, le(b.payload)), rt("serververification", b), l() && b.classification === "BAD")) { + _context4.next = 15; + break; + } + throw new Error("SpamFilter returned negative classification."); + case 15: + case "end": + return _context4.stop(); + } + }, _callee4); + })); + return _ei.apply(this, arguments); + } + function Ot(n) { + I("expire", n), fe && (clearTimeout(fe), fe = null), n < 1 ? ur() : fe = setTimeout(ur, n); + } + function pr(n) { + I("floating", n), v() !== n && (d(j).style.left = "", d(j).style.top = ""), v(n === !0 || n === "" ? "auto" : n === !1 || n === "false" ? void 0 : v()), v() ? (r() || r("onsubmit"), document.addEventListener("scroll", dr), document.addEventListener("click", cr), window.addEventListener("resize", mr)) : r() === "onsubmit" && r(void 0); + } + function yr(n) { + if (!n.algorithm) throw new Error("Invalid challenge. Property algorithm is missing."); + if (n.signature === void 0) throw new Error("Invalid challenge. Property signature is missing."); + if (!nr.includes(n.algorithm.toUpperCase())) throw new Error("Unknown algorithm value. Allowed values: ".concat(nr.join(", "))); + if (!n.challenge || n.challenge.length < 40) throw new Error("Challenge is too short. Min. 40 chars."); + if (!n.salt || n.salt.length < 10) throw new Error("Salt is too short. Min. 10 chars."); + } + function br(_x7) { + return _br.apply(this, arguments); + } + function _br() { + _br = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(n) { + var u, _; + return _regeneratorRuntime().wrap(function _callee5$(_context5) { + while (1) switch (_context5.prev = _context5.next) { + case 0: + u = null; + if (!("Worker" in window)) { + _context5.next = 13; + break; + } + _context5.prev = 2; + _context5.next = 5; + return ti(n, n.maxnumber); + case 5: + u = _context5.sent; + _context5.next = 11; + break; + case 8: + _context5.prev = 8; + _context5.t0 = _context5["catch"](2); + I(_context5.t0); + case 11: + if (!((u == null ? void 0 : u.number) !== void 0 || "obfuscated" in n)) { + _context5.next = 13; + break; + } + return _context5.abrupt("return", { + data: n, + solution: u + }); + case 13: + if (!("obfuscated" in n)) { + _context5.next = 22; + break; + } + _context5.next = 16; + return Wl(n.obfuscated, n.key, n.maxnumber); + case 16: + _ = _context5.sent; + _context5.t1 = n; + _context5.next = 20; + return _.promise; + case 20: + _context5.t2 = _context5.sent; + return _context5.abrupt("return", { + data: _context5.t1, + solution: _context5.t2 + }); + case 22: + _context5.t3 = n; + _context5.next = 25; + return Vl(n.challenge, n.salt, n.algorithm, n.maxnumber || Y()).promise; + case 25: + _context5.t4 = _context5.sent; + return _context5.abrupt("return", { + data: _context5.t3, + solution: _context5.t4 + }); + case 27: + case "end": + return _context5.stop(); + } + }, _callee5, null, [[2, 8]]); + })); + return _br.apply(this, arguments); + } + function ti(_x8) { + return _ti.apply(this, arguments); + } + function _ti() { + _ti = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(n) { + var u, + _, + b, + p, + S, + x, + _i10, + _b2, + _p, + _args6 = arguments; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + u = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : typeof U() == "number" ? U() : Y(); + _ = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : Math.ceil(Me()); + b = []; + _ = Math.min(16, Math.max(1, _)); + for (p = 0; p < _; p++) b.push(altchaCreateWorker(tt())); + S = Math.ceil(u / _); + _context6.next = 8; + return Promise.all(b.map(function (p, q) { + var L = q * S; + return new Promise(function (qe) { + p.addEventListener("message", function (ot) { + if (ot.data) for (var _i9 = 0, _b = b; _i9 < _b.length; _i9++) { + var st = _b[_i9]; + st !== p && st.postMessage({ + type: "abort" + }); + } + qe(ot.data); + }), p.postMessage({ + payload: n, + max: L + S, + start: L, + type: "work" + }); + }); + })); + case 8: + x = _context6.sent; + for (_i10 = 0, _b2 = b; _i10 < _b2.length; _i10++) { + _p = _b2[_i10]; + _p.terminate(); + } + return _context6.abrupt("return", x.find(function (p) { + return !!p; + }) || null); + case 11: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + return _ti.apply(this, arguments); + } + function it() { + return _it.apply(this, arguments); + } + function _it() { + _it = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() { + var n; + return _regeneratorRuntime().wrap(function _callee7$(_context7) { + while (1) switch (_context7.prev = _context7.next) { + case 0: + if (F()) { + _context7.next = 3; + break; + } + Le(E.ERROR); + return _context7.abrupt("return"); + case 3: + n = xe.find(function (u) { + return u.constructor.pluginName === "obfuscation"; + }); + if (!(!n || !("clarify" in n))) { + _context7.next = 7; + break; + } + Le(E.ERROR), I("Plugin `obfuscation` not found. Import `altcha/plugins/obfuscation` to load it."); + return _context7.abrupt("return"); + case 7: + if (!("clarify" in n && typeof n.clarify == "function")) { + _context7.next = 9; + break; + } + return _context7.abrupt("return", n.clarify()); + case 9: + case "end": + return _context7.stop(); + } + }, _callee7); + })); + return _it.apply(this, arguments); + } + function Er(n) { + n.obfuscated !== void 0 && F(n.obfuscated), n.auto !== void 0 && (r(n.auto), r() === "onload" && (F() ? it() : $e())), n.blockspam !== void 0 && l(!!n.blockspam), n.customfetch !== void 0 && o(n.customfetch), n.floatinganchor !== void 0 && h(n.floatinganchor), n.delay !== void 0 && s(n.delay), n.floatingoffset !== void 0 && g(n.floatingoffset), n.floating !== void 0 && pr(n.floating), n.expire !== void 0 && (Ot(n.expire), c(n.expire)), n.challenge && (a(typeof n.challenge == "string" ? n.challenge : JSON.stringify(n.challenge)), yr(d(Pt))), n.challengeurl !== void 0 && i(n.challengeurl), n.debug !== void 0 && f(!!n.debug), n.hidefooter !== void 0 && m(!!n.hidefooter), n.hidelogo !== void 0 && w(!!n.hidelogo), n.maxnumber !== void 0 && Y(+n.maxnumber), n.mockerror !== void 0 && M(!!n.mockerror), n.name !== void 0 && T(n.name), n.refetchonexpire !== void 0 && be(!!n.refetchonexpire), n.spamfilter !== void 0 && N(altcha_typeof(n.spamfilter) == "object" ? n.spamfilter : !!n.spamfilter), n.strings && X(typeof n.strings == "string" ? n.strings : JSON.stringify(n.strings)), n.test !== void 0 && U(typeof n.test == "number" ? n.test : !!n.test), n.verifyurl !== void 0 && Ee(n.verifyurl), n.workers !== void 0 && Me(+n.workers), n.workerurl !== void 0 && tt(n.workerurl); + } + function xr() { + return { + auto: r(), + blockspam: l(), + challengeurl: i(), + debug: f(), + delay: s(), + expire: c(), + floating: v(), + floatinganchor: h(), + floatingoffset: g(), + hidefooter: m(), + hidelogo: w(), + name: T(), + maxnumber: Y(), + mockerror: M(), + obfuscated: F(), + refetchonexpire: be(), + spamfilter: N(), + strings: d(Q), + test: U(), + verifyurl: Ee(), + workers: Me(), + workerurl: tt() + }; + } + function $r() { + return je; + } + function ri(n) { + return xe.find(function (u) { + return u.constructor.pluginName === n; + }); + } + function kr() { + return d(R); + } + function lt() { + var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : E.UNVERIFIED; + var u = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + fe && (clearTimeout(fe), fe = null), P(Ue, !1), P(Ne, null), Le(n, u); + } + function Cr(n) { + je = n; + } + function Le(n) { + var u = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + P(R, le(n)), P(Ve, le(u)), rt("statechange", { + payload: d(Ne), + state: d(R) + }); + } + function $e() { + return _$e.apply(this, arguments); + } + function _$e() { + _$e = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() { + return _regeneratorRuntime().wrap(function _callee8$(_context8) { + while (1) switch (_context8.prev = _context8.next) { + case 0: + lt(E.VERIFYING); + _context8.next = 3; + return new Promise(function (n) { + return setTimeout(n, s() || 0); + }); + case 3: + return _context8.abrupt("return", Wn().then(function (n) { + return yr(n), I("challenge", n), br(n); + }).then(function (_ref6) { + var n = _ref6.data, + u = _ref6.solution; + if (I("solution", u), "challenge" in n && u && !("clearText" in u)) if ((u == null ? void 0 : u.number) !== void 0) { + if (Ee()) return ei(fr(n, u)); + P(Ne, le(fr(n, u))), I("payload", d(Ne)); + } else throw I("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."), new Error("Unexpected result returned."); + }).then(function () { + Le(E.VERIFIED), I("verified"), ol().then(function () { + rt("verified", { + payload: d(Ne) + }); + }); + })["catch"](function (n) { + I(n), Le(E.ERROR, n.message); + })); + case 4: + case "end": + return _context8.stop(); + } + }, _callee8); + })); + return _$e.apply(this, arguments); + } + var Ar = na(), + Rr = Br(Ar); + kl(Rr, t, "default", {}); + var at = he(Rr, 2), + zt = G(at), + Ir = G(zt); + { + var ni = function ni(n) { + var u = Yl(); + ee(n, u); + }; + ke(Ir, function (n) { + d(R) === E.VERIFYING && n(ni); + }); + } + var _t = he(Ir, 2); + var Sr; + var Be = G(_t); + Gr(Be), Be.__change = Kn, Z(_t); + var Ft = he(_t, 2), + ii = G(Ft); + { + var li = function li(n) { + var u = Zl(), + _ = Br(u), + b = G(_); + Ze(b, function () { + return d(Q).verified; + }), Z(_); + var S = he(_, 2); + Gr(S), We(function () { + ie(S, "name", T()), Tl(S, d(Ne)); + }), ee(n, u); + }, + ai = function ai(n, u) { + { + var _ = function _(S) { + var x = Gl(), + p = G(x); + Ze(p, function () { + return d(Q).verifying; + }), Z(x), ee(S, x); + }, + b = function b(S) { + var x = Jl(), + p = G(x); + Ze(p, function () { + return d(Q).label; + }), Z(x), We(function () { + return ie(x, "for", d(sr)); + }), ee(S, x); + }; + ke(n, function (S) { + d(R) === E.VERIFYING ? S(_) : S(b, !1); + }, u); + } + }; + ke(ii, function (n) { + d(R) === E.VERIFIED ? n(li) : n(ai, !1); + }); + } + Z(Ft); + var oi = he(Ft, 2); + { + var si = function si(n) { + var u = Kl(), + _ = G(u); + ie(_, "href", lr), Z(u), We(function () { + return ie(_, "aria-label", d(Q).ariaLinkLabel); + }), ee(n, u); + }; + ke(oi, function (n) { + (w() !== !0 || d(Dt)) && n(si); + }); + } + Z(zt); + var Tr = he(zt, 2); + { + var fi = function fi(n) { + var u = ea(), + _ = he(G(u), 2); + { + var b = function b(x) { + var p = Xl(), + q = G(p); + Ze(q, function () { + return d(Q).expired; + }), Z(p), We(function () { + return ie(p, "title", d(Ve)); + }), ee(x, p); + }, + S = function S(x) { + var p = Ql(), + q = G(p); + Ze(q, function () { + return d(Q).error; + }), Z(p), We(function () { + return ie(p, "title", d(Ve)); + }), ee(x, p); + }; + ke(_, function (x) { + d(R) === E.EXPIRED ? x(b) : x(S, !1); + }); + } + Z(u), ee(n, u); + }; + ke(Tr, function (n) { + (d(Ve) || d(R) === E.EXPIRED) && n(fi); + }); + } + var Nr = he(Tr, 2); + { + var ui = function ui(n) { + var u = ta(), + _ = G(u), + b = G(_); + Ze(b, function () { + return d(Q).footer; + }), Z(_), Z(u), ee(n, u); + }; + ke(Nr, function (n) { + d(Q).footer && (m() !== !0 || d(Dt)) && n(ui); + }); + } + var ci = he(Nr, 2); + { + var di = function di(n) { + var u = ra(); + Xr(u, function (_) { + return P(nt, _); + }, function () { + return d(nt); + }), ee(n, u); + }; + ke(ci, function (n) { + v() && n(di); + }); + } + return Z(at), Xr(at, function (n) { + return P(j, n); + }, function () { + return d(j); + }), We(function (n) { + ie(at, "data-state", d(R)), ie(at, "data-floating", v()), Sr = Rl(_t, 1, "altcha-checkbox svelte-ddsc3z", null, Sr, n), ie(Be, "id", d(sr)), Be.required = r() !== "onsubmit" && (!v() || r() !== "off"); + }, [function () { + return { + "altcha-hidden": d(R) === E.VERIFYING + }; + }]), yl("invalid", Be, _r), Ll(Be, function () { + return d(Ue); + }, function (n) { + return P(Ue, n); + }), ee(e, Ar), Ln({ + clarify: it, + configure: Er, + getConfiguration: xr, + getFloatingAnchor: $r, + getPlugin: ri, + getState: kr, + reset: lt, + setFloatingAnchor: Cr, + setState: Le, + verify: $e, + get auto() { + return r(); + }, + set auto(n) { + if (n === void 0) { + n = void 0; + } + r(n), $(); + }, + get blockspam() { + return l(); + }, + set blockspam(n) { + if (n === void 0) { + n = void 0; + } + l(n), $(); + }, + get challengeurl() { + return i(); + }, + set challengeurl(n) { + if (n === void 0) { + n = void 0; + } + i(n), $(); + }, + get challengejson() { + return a(); + }, + set challengejson(n) { + if (n === void 0) { + n = void 0; + } + a(n), $(); + }, + get customfetch() { + return o(); + }, + set customfetch(n) { + if (n === void 0) { + n = void 0; + } + o(n), $(); + }, + get debug() { + return f(); + }, + set debug(n) { + if (n === void 0) { + n = !1; + } + f(n), $(); + }, + get delay() { + return s(); + }, + set delay(n) { + if (n === void 0) { + n = 0; + } + s(n), $(); + }, + get expire() { + return c(); + }, + set expire(n) { + if (n === void 0) { + n = void 0; + } + c(n), $(); + }, + get floating() { + return v(); + }, + set floating(n) { + if (n === void 0) { + n = void 0; + } + v(n), $(); + }, + get floatinganchor() { + return h(); + }, + set floatinganchor(n) { + if (n === void 0) { + n = void 0; + } + h(n), $(); + }, + get floatingoffset() { + return g(); + }, + set floatingoffset(n) { + if (n === void 0) { + n = void 0; + } + g(n), $(); + }, + get hidefooter() { + return m(); + }, + set hidefooter(n) { + if (n === void 0) { + n = !1; + } + m(n), $(); + }, + get hidelogo() { + return w(); + }, + set hidelogo(n) { + if (n === void 0) { + n = !1; + } + w(n), $(); + }, + get id() { + return z(); + }, + set id(n) { + if (n === void 0) { + n = void 0; + } + z(n), $(); + }, + get name() { + return T(); + }, + set name(n) { + if (n === void 0) { + n = "altcha"; + } + T(n), $(); + }, + get maxnumber() { + return Y(); + }, + set maxnumber(n) { + if (n === void 0) { + n = 1e6; + } + Y(n), $(); + }, + get mockerror() { + return M(); + }, + set mockerror(n) { + if (n === void 0) { + n = !1; + } + M(n), $(); + }, + get obfuscated() { + return F(); + }, + set obfuscated(n) { + if (n === void 0) { + n = void 0; + } + F(n), $(); + }, + get plugins() { + return se(); + }, + set plugins(n) { + if (n === void 0) { + n = void 0; + } + se(n), $(); + }, + get refetchonexpire() { + return be(); + }, + set refetchonexpire(n) { + if (n === void 0) { + n = !0; + } + be(n), $(); + }, + get spamfilter() { + return N(); + }, + set spamfilter(n) { + if (n === void 0) { + n = !1; + } + N(n), $(); + }, + get strings() { + return X(); + }, + set strings(n) { + if (n === void 0) { + n = void 0; + } + X(n), $(); + }, + get test() { + return U(); + }, + set test(n) { + if (n === void 0) { + n = !1; + } + U(n), $(); + }, + get verifyurl() { + return Ee(); + }, + set verifyurl(n) { + if (n === void 0) { + n = void 0; + } + Ee(n), $(); + }, + get workers() { + return Me(); + }, + set workers(n) { + if (n === void 0) { + n = Math.min(16, navigator.hardwareConcurrency || 8); + } + Me(n), $(); + }, + get workerurl() { + return tt(); + }, + set workerurl(n) { + if (n === void 0) { + n = void 0; + } + tt(n), $(); + } + }); +} +bl(["change"]); +customElements.define("altcha-widget", Ml(la, { + 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: {}, + id: {}, + name: {}, + obfuscated: {}, + plugins: {}, + spamfilter: {}, + strings: {}, + verifyurl: {}, + workerurl: {} +}, ["default"], ["clarify", "configure", "getConfiguration", "getFloatingAnchor", "getPlugin", "getState", "reset", "setFloatingAnchor", "setState", "verify"], !1)); +globalThis.altchaCreateWorker = function (e) { + return e ? new Worker(new URL(e)) : new _i(); +}; +globalThis.altchaPlugins = globalThis.altchaPlugins || []; + ;// ./static/js/pages/core/contact.js function contact_typeof(o) { "@babel/helpers - typeof"; return contact_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, contact_typeof(o); } function contact_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } @@ -781,6 +4313,9 @@ function contact_setPrototypeOf(t, e) { return contact_setPrototypeOf = Object.s function contact_defineProperty(e, r, t) { return (r = contact_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function contact_toPropertyKey(t) { var i = contact_toPrimitive(t, "string"); return "symbol" == contact_typeof(i) ? i : i + ""; } function contact_toPrimitive(t, r) { if ("object" != contact_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != contact_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +// internal + +// vendor var PageContact = /*#__PURE__*/function (_BasePage) { function PageContact(router) { @@ -792,31 +4327,51 @@ var PageContact = /*#__PURE__*/function (_BasePage) { key: "initialize", value: function initialize() { this.sharedInitialize(); - this.hookupCaptcha(); + // this.hookupALTCHAByLocalServer(); this.hookupButtonSubmitFormContactUs(); } + + /* + hookupALTCHAByAPI() { + const form = document.querySelector(idContactForm); + const altchaWidget = form.querySelector('altcha-widget'); + + // Listen for verification events from the ALTCHA widget + if (altchaWidget) { + altchaWidget.addEventListener('serververification', function(event) { + // Create or update the hidden input for ALTCHA + let altchaInput = form.querySelector('input[name="altcha"]'); + if (!altchaInput) { + altchaInput = document.createElement('input'); + altchaInput.type = 'hidden'; + altchaInput.name = 'altcha'; + form.appendChild(altchaInput); + } + + // Set the verification payload + altchaInput.value = event.detail.payload; + }); + } + } + */ }, { - key: "hookupCaptcha", - value: function hookupCaptcha() { - var form = document.querySelector(idContactForm); - var altchaWidget = form.querySelector('altcha-widget'); - - // Listen for verification events from the ALTCHA widget - if (altchaWidget) { - altchaWidget.addEventListener('serververification', function (event) { - // Create or update the hidden input for ALTCHA - var altchaInput = form.querySelector('input[name="altcha"]'); - if (!altchaInput) { - altchaInput = document.createElement('input'); - altchaInput.type = 'hidden'; - altchaInput.name = 'altcha'; - form.appendChild(altchaInput); - } - - // Set the verification payload - altchaInput.value = event.detail.payload; - }); - } + key: "hookupALTCHAByLocalServer", + value: function hookupALTCHAByLocalServer() { + window.ALTCHA = { + init: function init(config) { + document.querySelectorAll(config.selector).forEach(function (el) { + new la({ + target: el, + props: { + challengeurl: config.challenge.url, + auto: 'onload' + } + }).$on('verified', function (e) { + config.challenge.onSuccess(e.detail.payload, el); + }); + }); + } + }; } }, { key: "hookupButtonSubmitFormContactUs", @@ -948,12 +4503,12 @@ license_defineProperty(PageLicense, "hash", hashPageLicense); ;// ./static/js/api.js function api_typeof(o) { "@babel/helpers - typeof"; return api_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, api_typeof(o); } -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == api_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(api_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } -function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } -function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { api_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function api_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ api_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == api_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(api_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } +function api_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function api_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? api_ownKeys(Object(t), !0).forEach(function (r) { api_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : api_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function api_defineProperty(e, r, t) { return (r = api_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } -function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } -function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } +function api_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } +function api_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { api_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { api_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } function api_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function api_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, api_toPropertyKey(o.key), o); } } function api_createClass(e, r, t) { return r && api_defineProperties(e.prototype, r), t && api_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } @@ -972,7 +4527,7 @@ var API = /*#__PURE__*/function () { }, { key: "request", value: function () { - var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(hashEndpoint) { + var _request = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee(hashEndpoint) { var method, data, params, @@ -981,7 +4536,7 @@ var API = /*#__PURE__*/function () { options, response, _args = arguments; - return _regeneratorRuntime().wrap(function _callee$(_context) { + return api_regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: method = _args.length > 1 && _args[1] !== undefined ? _args[1] : 'GET'; @@ -996,7 +4551,7 @@ var API = /*#__PURE__*/function () { }, flagCsrfToken, csrfToken) }; if (data && (method === 'POST' || method === 'PUT' || method === 'PATCH')) { - data = _objectSpread(_objectSpread({}, data), {}, api_defineProperty({}, flagCsrfToken, csrfToken)); + data = api_objectSpread(api_objectSpread({}, data), {}, api_defineProperty({}, flagCsrfToken, csrfToken)); options.body = JSON.stringify(data); } _context.prev = 7; @@ -1070,9 +4625,9 @@ var API = /*#__PURE__*/function () { }, { key: "loginUser", value: function () { - var _loginUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { + var _loginUser = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee2() { var callback; - return _regeneratorRuntime().wrap(function _callee2$(_context2) { + return api_regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: callback = {}; @@ -1096,9 +4651,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveCategories", value: function () { - var _saveCategories = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(categories, formFilters, comment) { + var _saveCategories = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee3(categories, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee3$(_context3) { + return api_regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: dataRequest = {}; @@ -1123,9 +4678,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveProducts", value: function () { - var _saveProducts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(products, formFilters, comment) { + var _saveProducts = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee4(products, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee4$(_context4) { + return api_regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: dataRequest = {}; @@ -1150,9 +4705,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveProductPermutations", value: function () { - var _saveProductPermutations = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(permutations, formFilters, comment) { + var _saveProductPermutations = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee5(permutations, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee5$(_context5) { + return api_regeneratorRuntime().wrap(function _callee5$(_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: dataRequest = {}; @@ -1177,9 +4732,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveProductVariations", value: function () { - var _saveProductVariations = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(variationTypes, formFilters, comment) { + var _saveProductVariations = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee6(variationTypes, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee6$(_context6) { + return api_regeneratorRuntime().wrap(function _callee6$(_context6) { while (1) switch (_context6.prev = _context6.next) { case 0: dataRequest = {}; @@ -1204,9 +4759,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveStockItems", value: function () { - var _saveStockItems = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(stockItems, formFilters, comment) { + var _saveStockItems = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee7(stockItems, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee7$(_context7) { + return api_regeneratorRuntime().wrap(function _callee7$(_context7) { while (1) switch (_context7.prev = _context7.next) { case 0: dataRequest = {}; @@ -1231,9 +4786,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveSuppliers", value: function () { - var _saveSuppliers = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(suppliers, formFilters, comment) { + var _saveSuppliers = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee8(suppliers, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee8$(_context8) { + return api_regeneratorRuntime().wrap(function _callee8$(_context8) { while (1) switch (_context8.prev = _context8.next) { case 0: dataRequest = {}; @@ -1258,9 +4813,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveSupplierPurchaseOrders", value: function () { - var _saveSupplierPurchaseOrders = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(supplierPurchaseOrders, formFilters, comment) { + var _saveSupplierPurchaseOrders = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee9(supplierPurchaseOrders, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee9$(_context9) { + return api_regeneratorRuntime().wrap(function _callee9$(_context9) { while (1) switch (_context9.prev = _context9.next) { case 0: dataRequest = {}; @@ -1285,9 +4840,9 @@ var API = /*#__PURE__*/function () { }, { key: "saveManufacturingPurchaseOrders", value: function () { - var _saveManufacturingPurchaseOrders = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(manufacturingPurchaseOrders, formFilters, comment) { + var _saveManufacturingPurchaseOrders = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee10(manufacturingPurchaseOrders, formFilters, comment) { var dataRequest; - return _regeneratorRuntime().wrap(function _callee10$(_context10) { + return api_regeneratorRuntime().wrap(function _callee10$(_context10) { while (1) switch (_context10.prev = _context10.next) { case 0: dataRequest = {}; diff --git a/static/js/pages/core/contact.js b/static/js/pages/core/contact.js index 07b3bc52..9736e71a 100644 --- a/static/js/pages/core/contact.js +++ b/static/js/pages/core/contact.js @@ -1,5 +1,7 @@ - +// internal import BasePage from "../base.js"; +// vendor +import { Altcha } from "../../vendor/altcha.js"; export default class PageContact extends BasePage { static hash = hashPageContact; @@ -10,11 +12,12 @@ export default class PageContact extends BasePage { initialize() { this.sharedInitialize(); - this.hookupCaptcha(); + // this.hookupALTCHAByLocalServer(); this.hookupButtonSubmitFormContactUs(); } - hookupCaptcha() { + /* + hookupALTCHAByAPI() { const form = document.querySelector(idContactForm); const altchaWidget = form.querySelector('altcha-widget'); @@ -35,6 +38,22 @@ export default class PageContact extends BasePage { }); } } + */ + hookupALTCHAByLocalServer() { + window.ALTCHA = { init: (config) => { + document.querySelectorAll(config.selector).forEach(el => { + new Altcha({ + target: el, + props: { + challengeurl: config.challenge.url, + auto: 'onload' + } + }).$on('verified', (e) => { + config.challenge.onSuccess(e.detail.payload, el); + }); + }); + }}; + } hookupButtonSubmitFormContactUs() { const button = document.querySelector('form input[type="submit"]'); diff --git a/templates/layouts/layout.html b/templates/layouts/layout.html index f69a5814..e35b823c 100644 --- a/templates/layouts/layout.html +++ b/templates/layouts/layout.html @@ -132,6 +132,7 @@ var flagTemporaryElement = "{{ model.FLAG_TEMPORARY_ELEMENT }}"; var flagUser = "{{ model.FLAG_USER }}"; var flagWebsite = "{{ model.FLAG_WEBSITE }}"; + var hashALTCHACreateChallenge = "{{ model.HASH_ALTCHA_CREATE_CHALLENGE }}"; var hashApplyFiltersStoreProductPermutation = "{{ model.HASH_APPLY_FILTERS_STORE_PRODUCT_PERMUTATION }}"; var hashPageAccessibilityReport = "{{ model.HASH_PAGE_ACCESSIBILITY_REPORT }}"; var hashPageAccessibilityStatement = "{{ model.HASH_PAGE_ACCESSIBILITY_STATEMENT }}"; diff --git a/templates/pages/core/_contact.html b/templates/pages/core/_contact.html index b4480a0e..452ae8e3 100644 --- a/templates/pages/core/_contact.html +++ b/templates/pages/core/_contact.html @@ -5,7 +5,22 @@ {# #} + {# with CDN + + + #} + {# with locally stored vendor project - this is imported into contact.js + #} + {% endblock %} {% block page_nav_links %} @@ -35,6 +50,16 @@ Contact Us Please fill in the form below and we'll get back to you as soon as possible. + {% with messages = get_flashed_messages() %} + {% if messages %} + + {% for message in messages %} + {{ message }} + {% endfor %} + + {% endif %} + {% endwith %} + {{ form.csrf_token }} @@ -66,10 +91,26 @@ {# {{ model.form_contact.recaptcha() }} #} + {# + #} + + {{ form.altcha.label }} + {# + {{ form.altcha }} + {{ form.altcha.hidden() }} + #} + + {{ model.form_contact.submit() }} @@ -109,7 +150,45 @@ #} + {# with CDN + + #} + + {# with locally stored vendor project - this is now in contact.js + + #}
Please fill in the form below and we'll get back to you as soon as possible.