From 81fc6dbd94715e5dfd5c884c6ae1ccd612667f6a Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Thu, 14 May 2026 16:11:55 +0000 Subject: [PATCH 01/20] htmx sample --- Dart/htmx/dart-htmx/.gitignore | 69 ++ Dart/htmx/dart-htmx/firebase.json | 29 + Dart/htmx/dart-htmx/functions/.gitignore | 11 + Dart/htmx/dart-htmx/functions/bin/server.dart | 187 ++++++ Dart/htmx/dart-htmx/functions/pubspec.lock | 597 ++++++++++++++++++ Dart/htmx/dart-htmx/functions/pubspec.yaml | 17 + 6 files changed, 910 insertions(+) create mode 100644 Dart/htmx/dart-htmx/.gitignore create mode 100644 Dart/htmx/dart-htmx/firebase.json create mode 100644 Dart/htmx/dart-htmx/functions/.gitignore create mode 100644 Dart/htmx/dart-htmx/functions/bin/server.dart create mode 100644 Dart/htmx/dart-htmx/functions/pubspec.lock create mode 100644 Dart/htmx/dart-htmx/functions/pubspec.yaml diff --git a/Dart/htmx/dart-htmx/.gitignore b/Dart/htmx/dart-htmx/.gitignore new file mode 100644 index 0000000000..b17f631075 --- /dev/null +++ b/Dart/htmx/dart-htmx/.gitignore @@ -0,0 +1,69 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +firebase-debug.log* +firebase-debug.*.log* + +# Firebase cache +.firebase/ + +# Firebase config + +# Uncomment this if you'd like others to create their own Firebase project. +# For a team working on the same Firebase project(s), it is recommended to leave +# it commented so all members can deploy to the same project(s) in .firebaserc. +# .firebaserc + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# dataconnect generated files +.dataconnect diff --git a/Dart/htmx/dart-htmx/firebase.json b/Dart/htmx/dart-htmx/firebase.json new file mode 100644 index 0000000000..456cc1299a --- /dev/null +++ b/Dart/htmx/dart-htmx/firebase.json @@ -0,0 +1,29 @@ +{ + "functions": [ + { + "source": "functions", + "codebase": "default", + "disallowLegacyRuntimeConfig": true, + "ignore": [ + ".dart_tool", + ".git", + "firebase-debug.log", + "firebase-debug.*.log", + "*.local" + ], + "runtime": "dart3" + } + ], + "emulators": { + "functions": { + "port": 5001 + }, + "firestore": { + "port": 8080 + }, + "ui": { + "enabled": true + }, + "singleProjectMode": true + } +} diff --git a/Dart/htmx/dart-htmx/functions/.gitignore b/Dart/htmx/dart-htmx/functions/.gitignore new file mode 100644 index 0000000000..fb25e1562c --- /dev/null +++ b/Dart/htmx/dart-htmx/functions/.gitignore @@ -0,0 +1,11 @@ +.dart_tool/ +build/ +*.dart.js +*.info.json +*.js +*.js.map +*.js.deps +*.js.symbols +firebase-debug.log +firebase-debug.*.log +*.local diff --git a/Dart/htmx/dart-htmx/functions/bin/server.dart b/Dart/htmx/dart-htmx/functions/bin/server.dart new file mode 100644 index 0000000000..6b0c3d3f37 --- /dev/null +++ b/Dart/htmx/dart-htmx/functions/bin/server.dart @@ -0,0 +1,187 @@ +import 'dart:convert'; +import 'package:firebase_functions/firebase_functions.dart'; +import 'package:google_cloud_firestore/google_cloud_firestore.dart'; +import 'package:html/dom.dart' as html; + +class Contact { + String firstName; + String lastName; + String email; + + Contact({required this.firstName, required this.lastName, required this.email}); + + factory Contact.fromJson(Map json) { + return Contact( + firstName: json['firstName'] as String? ?? 'Joe', + lastName: json['lastName'] as String? ?? 'Blow', + email: json['email'] as String? ?? 'joe@blow.com', + ); + } + + Map toJson() => { + 'firstName': firstName, + 'lastName': lastName, + 'email': email, + }; +} + +Future getContact(DocumentReference ref) async { + final snapshot = await ref.get(); + if (!snapshot.exists) { + final defaultContact = Contact(firstName: 'Joe', lastName: 'Blow', email: 'joe@blow.com'); + await ref.set(defaultContact.toJson()); + return defaultContact; + } + return Contact.fromJson(snapshot.data()!); +} + +html.Document createBaseDocument(String titleText, html.Element content) { + final doc = html.Document(); + final htmlNode = html.Element.tag('html')..attributes['lang'] = 'en'; + doc.append(htmlNode); + + final head = html.Element.tag('head'); + htmlNode.append(head); + + head.append(html.Element.tag('meta')..attributes['charset'] = 'utf-8'); + head.append(html.Element.tag('meta')..attributes['name'] = 'viewport'..attributes['content'] = 'width=device-width, initial-scale=1'); + head.append(html.Element.tag('title')..text = titleText); + head.append(html.Element.tag('link')..attributes['rel'] = 'stylesheet'..attributes['href'] = 'https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css'); + head.append(html.Element.tag('script')..attributes['src'] = 'https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta3'..attributes['crossorigin'] = 'anonymous'); + + final body = html.Element.tag('body'); + htmlNode.append(body); + + final main = html.Element.tag('main')..attributes['class'] = 'container'; + body.append(main); + main.append(content); + + return doc; +} + +html.Element createDisplayView(Contact contact) { + final article = html.Element.tag('article')..attributes['id'] = 'contact-card'; + + final header = html.Element.tag('header')..text = 'Contact Info'; + article.append(header); + + final grid = html.Element.tag('div')..attributes['class'] = 'grid'; + article.append(grid); + + final col1 = html.Element.tag('div'); + grid.append(col1); + col1.append(html.Element.tag('strong')..text = 'First Name: '); + col1.append(html.Text(contact.firstName)); + + final col2 = html.Element.tag('div'); + grid.append(col2); + col2.append(html.Element.tag('strong')..text = 'Last Name: '); + col2.append(html.Text(contact.lastName)); + + final col3 = html.Element.tag('div'); + grid.append(col3); + col3.append(html.Element.tag('strong')..text = 'Email: '); + col3.append(html.Text(contact.email)); + + final footer = html.Element.tag('footer'); + article.append(footer); + + final editBtn = html.Element.tag('button') + ..attributes['hx-get'] = '?mode=edit' + ..attributes['hx-target'] = '#contact-card' + ..attributes['hx-swap'] = 'outerHTML' + ..attributes['class'] = 'secondary' + ..text = 'Click To Edit'; + footer.append(editBtn); + + return article; +} + +html.Element createEditView(Contact contact) { + final article = html.Element.tag('article')..attributes['id'] = 'contact-card'; + + final form = html.Element.tag('form') + ..attributes['hx-put'] = '?' + ..attributes['hx-target'] = '#contact-card' + ..attributes['hx-swap'] = 'outerHTML'; + article.append(form); + + final header = html.Element.tag('header')..text = 'Edit Contact'; + form.append(header); + + final grid = html.Element.tag('div')..attributes['class'] = 'grid'; + form.append(grid); + + final label1 = html.Element.tag('label')..text = 'First Name'; + grid.append(label1); + label1.append(html.Element.tag('input')..attributes['type'] = 'text'..attributes['name'] = 'firstName'..attributes['value'] = contact.firstName); + + final label2 = html.Element.tag('label')..text = 'Last Name'; + grid.append(label2); + label2.append(html.Element.tag('input')..attributes['type'] = 'text'..attributes['name'] = 'lastName'..attributes['value'] = contact.lastName); + + final label3 = html.Element.tag('label')..text = 'Email'; + form.append(label3); + label3.append(html.Element.tag('input')..attributes['type'] = 'email'..attributes['name'] = 'email'..attributes['value'] = contact.email); + + final footer = html.Element.tag('footer')..attributes['class'] = 'grid'; + form.append(footer); + + final cancelBtn = html.Element.tag('button') + ..attributes['type'] = 'button' + ..attributes['hx-get'] = '?' + ..attributes['hx-target'] = '#contact-card' + ..attributes['hx-swap'] = 'outerHTML' + ..attributes['class'] = 'secondary' + ..text = 'Cancel'; + footer.append(cancelBtn); + + final saveBtn = html.Element.tag('button')..attributes['type'] = 'submit'..text = 'Save'; + footer.append(saveBtn); + + return article; +} + +void main(List args) { + fireUp(args, (firebase) { + final firestore = Firestore(); + + firebase.https.onRequest( + name: 'contact', + (request) async { + final docRef = firestore.collection('contacts').doc('1'); + final contact = await getContact(docRef); + + final mode = request.url.queryParameters['mode']; + final isHxRequest = request.headers['hx-request'] == 'true'; + + if (request.method == 'GET') { + if (mode == 'edit') { + final editView = createEditView(contact); + final htmlStr = isHxRequest ? editView.outerHtml : createBaseDocument('Edit Contact', editView).outerHtml; + return Response(200, body: htmlStr, headers: {'Content-Type': 'text/html'}); + } else { + final displayView = createDisplayView(contact); + final htmlStr = isHxRequest ? displayView.outerHtml : createBaseDocument('Contact', displayView).outerHtml; + return Response(200, body: htmlStr, headers: {'Content-Type': 'text/html'}); + } + } else if (request.method == 'PUT' || request.method == 'POST') { + final bodyStr = await request.readAsString(); + final formData = Uri.splitQueryString(bodyStr); + + contact.firstName = formData['firstName'] ?? contact.firstName; + contact.lastName = formData['lastName'] ?? contact.lastName; + contact.email = formData['email'] ?? contact.email; + + await docRef.set(contact.toJson()); + + final displayView = createDisplayView(contact); + final htmlStr = isHxRequest ? displayView.outerHtml : createBaseDocument('Contact', displayView).outerHtml; + return Response(200, body: htmlStr, headers: {'Content-Type': 'text/html'}); + } + + return Response(405, body: 'Method Not Allowed'); + }, + ); + }); +} diff --git a/Dart/htmx/dart-htmx/functions/pubspec.lock b/Dart/htmx/dart-htmx/functions/pubspec.lock new file mode 100644 index 0000000000..e398f98a6c --- /dev/null +++ b/Dart/htmx/dart-htmx/functions/pubspec.lock @@ -0,0 +1,597 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _discoveryapis_commons: + dependency: transitive + description: + name: _discoveryapis_commons + sha256: "113c4100b90a5b70a983541782431b82168b3cae166ab130649c36eb3559d498" + url: "https://pub.dev" + source: hosted + version: "1.0.7" + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: a49d6cf99e8d8e7a8e93668d09ced0bbdb954d0b4fccc2f5f9241c6b87fad95c + url: "https://pub.dev" + source: hosted + version: "99.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "663efa951fb8a45e06f491223a604c93820598f20e6a99c25617a1576065e8b7" + url: "https://pub.dev" + source: hosted + version: "12.1.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + asn1lib: + dependency: transitive + description: + name: asn1lib + sha256: "9a8f69025044eb466b9b60ef3bc3ac99b4dc6c158ae9c56d25eeccf5bc56d024" + url: "https://pub.dev" + source: hosted + version: "1.6.5" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + build: + dependency: transitive + description: + name: build + sha256: a156715e7cd728130c592f30552575908aae5b100005fbc1f0fb16b3c03a3d10 + url: "https://pub.dev" + source: hosted + version: "4.0.6" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4070d2a59f8eec34c97c86ceb44403834899075f66e8a9d59706f8e7834f6f71" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957 + url: "https://pub.dev" + source: hosted + version: "4.1.1" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "1523ce62448ebac2c15a8ba5fbad8acac169788658a7dd2a1c2d9c2a9318b9a6" + url: "https://pub.dev" + source: hosted + version: "2.15.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "34e4067d30ce212937df995f03b69992eea683539ceeac7f679a1f1eba055b56" + url: "https://pub.dev" + source: hosted + version: "8.12.6" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + dart_jsonwebtoken: + dependency: transitive + description: + name: dart_jsonwebtoken + sha256: ad84e60181696513d04d5f2078e0bbc20365b911f46f647797317414bdc88fbe + url: "https://pub.dev" + source: hosted + version: "3.4.1" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: a4c1ccfee44c7e75ed80484071a5c142a385345e658fd8bd7c4b5c97e7198f98 + url: "https://pub.dev" + source: hosted + version: "3.1.8" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + firebase_admin_sdk: + dependency: "direct main" + description: + name: firebase_admin_sdk + sha256: b17f129ecb0ee2c0523f7441f6f40bfbc8ffcf9fb58fe9e4b0dbe1255969ba4d + url: "https://pub.dev" + source: hosted + version: "0.5.3" + firebase_functions: + dependency: "direct main" + description: + name: firebase_functions + sha256: "1aabfa549089585614edeb46e3f6f0d1fa50435256d2fad08028cd290e451037" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + google_cloud: + dependency: transitive + description: + name: google_cloud + sha256: b385e20726ef5315d302c5933bfb728103116c5be2d3d17094b01a82da538c1f + url: "https://pub.dev" + source: hosted + version: "0.5.0" + google_cloud_firestore: + dependency: "direct main" + description: + name: google_cloud_firestore + sha256: "2ef311299694771e677c5285cac27f30bdba174f3119001b3fae39e546042fce" + url: "https://pub.dev" + source: hosted + version: "0.5.2" + google_cloud_firestore_v1: + dependency: transitive + description: + name: google_cloud_firestore_v1 + sha256: "9f671248e9722e1baf34d20273e4b75cff0bd6f911c7ca74eee911afb7c6f0e5" + url: "https://pub.dev" + source: hosted + version: "0.5.2" + google_cloud_longrunning: + dependency: transitive + description: + name: google_cloud_longrunning + sha256: "6795a17c5b14f50a7db2bb8564f2e033973fad698eae75fe7bd59f5614d5dda6" + url: "https://pub.dev" + source: hosted + version: "0.5.2" + google_cloud_protobuf: + dependency: transitive + description: + name: google_cloud_protobuf + sha256: f45f656c63d040b21d5cf947a3c44d537eb82ee68e485ccfcf2edbcbd1041461 + url: "https://pub.dev" + source: hosted + version: "0.5.2" + google_cloud_rpc: + dependency: transitive + description: + name: google_cloud_rpc + sha256: "143ca2179dbcc5e4d16e8ee352aa4891b105b0aafc4e617bd4d713715a4afef2" + url: "https://pub.dev" + source: hosted + version: "0.5.2" + google_cloud_storage: + dependency: transitive + description: + name: google_cloud_storage + sha256: cb4f2887e445c51c33de6de3275948037cdf15080e4d8725f1c6dfc0a88b38de + url: "https://pub.dev" + source: hosted + version: "0.6.2" + google_cloud_type: + dependency: transitive + description: + name: google_cloud_type + sha256: f82055273f7f7a9f52d96285fd4fd61a79fc7ef86454d880b93cf81347c1d1ad + url: "https://pub.dev" + source: hosted + version: "0.5.2" + google_identity_services_web: + dependency: transitive + description: + name: google_identity_services_web + sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454" + url: "https://pub.dev" + source: hosted + version: "0.3.3+1" + googleapis: + dependency: transitive + description: + name: googleapis + sha256: "62b5988f228b774448ebd99b53fe8069becb55840f1b28948bb84160373dc0b6" + url: "https://pub.dev" + source: hosted + version: "16.0.0" + googleapis_auth: + dependency: transitive + description: + name: googleapis_auth + sha256: "2a8895c3885197f96bb2fd91ee0ae77b53ff3874c7b1f1eadb6566248e880958" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + html: + dependency: "direct main" + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: cb09e7dac6210041fad964ed7fbee004f14258b4eca4040f72d1234062ace4c8 + url: "https://pub.dev" + source: hosted + version: "4.11.0" + lints: + dependency: "direct dev" + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + meta: + dependency: transitive + description: + name: meta + sha256: df0c643f44ad098eb37988027a8e2b2b5a031fd3977f06bbfd3a76637e8df739 + url: "https://pub.dev" + source: hosted + version: "1.18.2" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pem: + dependency: transitive + description: + name: pem + sha256: e66b389cbb007fa5860d511f08ea604ea68e78afc4e1b543dc227a0f0ef4faf9 + url: "https://pub.dev" + source: hosted + version: "2.0.6" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + protobuf: + dependency: transitive + description: + name: protobuf + sha256: "75ec242d22e950bdcc79ee38dd520ce4ee0bc491d7fadc4ea47694604d22bf06" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: ec37cc0e6694374cbef59ed79685572c870a54ede6fa30a3e420feb3adffea02 + url: "https://pub.dev" + source: hosted + version: "4.2.3" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" + yaml_edit: + dependency: transitive + description: + name: yaml_edit + sha256: "07c9e63ba42519745182b88ca12264a7ba2484d8239958778dfe4d44fe760488" + url: "https://pub.dev" + source: hosted + version: "2.2.4" +sdks: + dart: ">=3.10.0 <4.0.0" diff --git a/Dart/htmx/dart-htmx/functions/pubspec.yaml b/Dart/htmx/dart-htmx/functions/pubspec.yaml new file mode 100644 index 0000000000..0b3eaa03e1 --- /dev/null +++ b/Dart/htmx/dart-htmx/functions/pubspec.yaml @@ -0,0 +1,17 @@ +name: my_function +description: An app using Dart with Cloud Functions for Firebase +version: 0.0.1 +publish_to: none + +environment: + sdk: ^3.9.0 + +dependencies: + firebase_functions: ^0.6.0 + firebase_admin_sdk: ^0.5.0 + google_cloud_firestore: ^0.5.0 + html: ^0.15.4 + +dev_dependencies: + build_runner: ^2.4.0 + lints: ^6.0.0 From 5c777c1c6468756a0012c4e3e5bd2117b3bce464 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Thu, 14 May 2026 18:01:41 +0000 Subject: [PATCH 02/20] match other samples --- Dart/htmx/dart-htmx/.gitignore | 12 + Dart/htmx/dart-htmx/README.md | 62 ++ Dart/htmx/dart-htmx/bin/server.dart | 155 +++++ Dart/htmx/dart-htmx/firebase.json | 4 +- Dart/htmx/dart-htmx/functions/.gitignore | 11 - Dart/htmx/dart-htmx/functions/bin/server.dart | 187 ------ Dart/htmx/dart-htmx/functions/pubspec.lock | 597 ------------------ .../dart-htmx/{functions => }/pubspec.yaml | 5 +- 8 files changed, 233 insertions(+), 800 deletions(-) create mode 100644 Dart/htmx/dart-htmx/README.md create mode 100644 Dart/htmx/dart-htmx/bin/server.dart delete mode 100644 Dart/htmx/dart-htmx/functions/.gitignore delete mode 100644 Dart/htmx/dart-htmx/functions/bin/server.dart delete mode 100644 Dart/htmx/dart-htmx/functions/pubspec.lock rename Dart/htmx/dart-htmx/{functions => }/pubspec.yaml (69%) diff --git a/Dart/htmx/dart-htmx/.gitignore b/Dart/htmx/dart-htmx/.gitignore index b17f631075..213b74eb72 100644 --- a/Dart/htmx/dart-htmx/.gitignore +++ b/Dart/htmx/dart-htmx/.gitignore @@ -67,3 +67,15 @@ node_modules/ # dataconnect generated files .dataconnect + +# Dart +.dart_tool/ +build/ +*.dart.js +*.info.json +*.js +*.js.map +*.js.deps +*.js.symbols +pubspec.lock +functions.yaml diff --git a/Dart/htmx/dart-htmx/README.md b/Dart/htmx/dart-htmx/README.md new file mode 100644 index 0000000000..2f400d3ab7 --- /dev/null +++ b/Dart/htmx/dart-htmx/README.md @@ -0,0 +1,62 @@ +# Firebase SDK for Cloud Functions Sample - HTMX & Pico CSS + +This sample demonstrates using the **Firebase SDK for Cloud Functions** with Dart, HTMX, and Pico CSS to build a dynamic click-to-edit web application powered by Firestore. + +## Introduction + +The `contact` function serves an HTML page with a contact card. Using HTMX, clicking "Click To Edit" fetches an edit form and swaps it into the page without a full reload. Submitting the form updates the contact in Firestore and swaps the updated display card back into the page. + +Further reading: + - [Read more about Cloud Functions for Firebase](https://firebase.google.com/docs/functions) + - [HTMX Documentation](https://htmx.org/docs/) + - [Pico CSS Documentation](https://picocss.com/docs) + +## Initial setup, build tools and dependencies + +### 1. Clone this repo + +Clone or download this repo and open the `Dart/htmx/dart-htmx` directory. + +### 2. Create a Firebase project and configure the sample + +Create a Firebase Project on the [Firebase Console](https://console.firebase.google.com). + +Set up your Firebase project by running `firebase use --add`, select your Project ID and follow the instructions. + +### 3. Install the Firebase CLI + +You need to have installed the Firebase CLI. If you haven't, run: + +```bash +npm install -g firebase-tools +``` + +## Deploy the app + +First you need to get the `dart` dependencies of the functions: + +```bash +dart pub get +``` + +Deploy to Firebase using the following command: + +```bash +firebase deploy +``` + +Alternatively, you can call `firebase emulators:start` to test the functions on the local emulator suite. + +## Try the sample + +After deploying the function, check the CLI's output to see the URL for your function. + +Open the URL in a browser to view the contact card, click "Click To Edit", modify the details, and click "Save" to see HTMX and Firestore in action. + +## Contributing + +We'd love that you contribute to the project. Before doing so please read our [Contributor guide](../../CONTRIBUTING.md). + +## License + +© Google, 2026. Licensed under an [Apache-2](../../../LICENSE) license. diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart new file mode 100644 index 0000000000..c4123a522c --- /dev/null +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -0,0 +1,155 @@ +import 'dart:convert'; +import 'package:firebase_functions/firebase_functions.dart'; +import 'package:google_cloud_firestore/google_cloud_firestore.dart'; + +class Contact { + String firstName; + String lastName; + String email; + + Contact({ + required this.firstName, + required this.lastName, + required this.email, + }); + + factory Contact.fromJson(Map json) { + return Contact( + firstName: json['firstName'] as String? ?? 'Joe', + lastName: json['lastName'] as String? ?? 'Blow', + email: json['email'] as String? ?? 'joe@blow.com', + ); + } + + Map toJson() => { + 'firstName': firstName, + 'lastName': lastName, + 'email': email, + }; +} + +Future getContact(DocumentReference ref) async { + final snapshot = await ref.get(); + if (!snapshot.exists) { + final defaultContact = Contact( + firstName: 'Joe', + lastName: 'Blow', + email: 'joe@blow.com', + ); + await ref.set(defaultContact.toJson()); + return defaultContact; + } + return Contact.fromJson(snapshot.data()!); +} + +String createBaseDocument(String titleText, String content) => + ''' + + + + + + ${const HtmlEscape().convert(titleText)} + + + + +
+ $content +
+ + +'''; + +String createDisplayView(Contact contact) => + ''' +
+
Contact Info
+
+
First Name: ${const HtmlEscape().convert(contact.firstName)}
+
Last Name: ${const HtmlEscape().convert(contact.lastName)}
+
Email: ${const HtmlEscape().convert(contact.email)}
+
+
+ +
+
+'''; + +String createEditView(Contact contact) => + ''' +
+
+
Edit Contact
+
+ + +
+ +
+ + +
+
+
+'''; + +void main() { + runFunctions((firebase) { + final firestore = Firestore(); + + firebase.https.onRequest(name: 'contact', (request) async { + final docRef = firestore.collection('contacts').doc('1'); + final contact = await getContact(docRef); + + final mode = request.url.queryParameters['mode']; + final isHxRequest = request.headers['hx-request'] == 'true'; + + if (request.method == 'GET') { + if (mode == 'edit') { + final editView = createEditView(contact); + final htmlStr = isHxRequest + ? editView + : createBaseDocument('Edit Contact', editView); + return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + } else { + final displayView = createDisplayView(contact); + final htmlStr = isHxRequest + ? displayView + : createBaseDocument('Contact', displayView); + return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + } + } else if (request.method == 'PUT' || request.method == 'POST') { + final bodyStr = await request.readAsString(); + final formData = Uri.splitQueryString(bodyStr); + + contact.firstName = formData['firstName'] ?? contact.firstName; + contact.lastName = formData['lastName'] ?? contact.lastName; + contact.email = formData['email'] ?? contact.email; + + await docRef.set(contact.toJson()); + + final displayView = createDisplayView(contact); + final htmlStr = isHxRequest + ? displayView + : createBaseDocument('Contact', displayView); + return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + } + + return Response(405, body: 'Method Not Allowed'); + }); + }); +} diff --git a/Dart/htmx/dart-htmx/firebase.json b/Dart/htmx/dart-htmx/firebase.json index 456cc1299a..24fc527586 100644 --- a/Dart/htmx/dart-htmx/firebase.json +++ b/Dart/htmx/dart-htmx/firebase.json @@ -1,8 +1,8 @@ { "functions": [ { - "source": "functions", - "codebase": "default", + "source": ".", + "codebase": "dart-htmx", "disallowLegacyRuntimeConfig": true, "ignore": [ ".dart_tool", diff --git a/Dart/htmx/dart-htmx/functions/.gitignore b/Dart/htmx/dart-htmx/functions/.gitignore deleted file mode 100644 index fb25e1562c..0000000000 --- a/Dart/htmx/dart-htmx/functions/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.dart_tool/ -build/ -*.dart.js -*.info.json -*.js -*.js.map -*.js.deps -*.js.symbols -firebase-debug.log -firebase-debug.*.log -*.local diff --git a/Dart/htmx/dart-htmx/functions/bin/server.dart b/Dart/htmx/dart-htmx/functions/bin/server.dart deleted file mode 100644 index 6b0c3d3f37..0000000000 --- a/Dart/htmx/dart-htmx/functions/bin/server.dart +++ /dev/null @@ -1,187 +0,0 @@ -import 'dart:convert'; -import 'package:firebase_functions/firebase_functions.dart'; -import 'package:google_cloud_firestore/google_cloud_firestore.dart'; -import 'package:html/dom.dart' as html; - -class Contact { - String firstName; - String lastName; - String email; - - Contact({required this.firstName, required this.lastName, required this.email}); - - factory Contact.fromJson(Map json) { - return Contact( - firstName: json['firstName'] as String? ?? 'Joe', - lastName: json['lastName'] as String? ?? 'Blow', - email: json['email'] as String? ?? 'joe@blow.com', - ); - } - - Map toJson() => { - 'firstName': firstName, - 'lastName': lastName, - 'email': email, - }; -} - -Future getContact(DocumentReference ref) async { - final snapshot = await ref.get(); - if (!snapshot.exists) { - final defaultContact = Contact(firstName: 'Joe', lastName: 'Blow', email: 'joe@blow.com'); - await ref.set(defaultContact.toJson()); - return defaultContact; - } - return Contact.fromJson(snapshot.data()!); -} - -html.Document createBaseDocument(String titleText, html.Element content) { - final doc = html.Document(); - final htmlNode = html.Element.tag('html')..attributes['lang'] = 'en'; - doc.append(htmlNode); - - final head = html.Element.tag('head'); - htmlNode.append(head); - - head.append(html.Element.tag('meta')..attributes['charset'] = 'utf-8'); - head.append(html.Element.tag('meta')..attributes['name'] = 'viewport'..attributes['content'] = 'width=device-width, initial-scale=1'); - head.append(html.Element.tag('title')..text = titleText); - head.append(html.Element.tag('link')..attributes['rel'] = 'stylesheet'..attributes['href'] = 'https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css'); - head.append(html.Element.tag('script')..attributes['src'] = 'https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta3'..attributes['crossorigin'] = 'anonymous'); - - final body = html.Element.tag('body'); - htmlNode.append(body); - - final main = html.Element.tag('main')..attributes['class'] = 'container'; - body.append(main); - main.append(content); - - return doc; -} - -html.Element createDisplayView(Contact contact) { - final article = html.Element.tag('article')..attributes['id'] = 'contact-card'; - - final header = html.Element.tag('header')..text = 'Contact Info'; - article.append(header); - - final grid = html.Element.tag('div')..attributes['class'] = 'grid'; - article.append(grid); - - final col1 = html.Element.tag('div'); - grid.append(col1); - col1.append(html.Element.tag('strong')..text = 'First Name: '); - col1.append(html.Text(contact.firstName)); - - final col2 = html.Element.tag('div'); - grid.append(col2); - col2.append(html.Element.tag('strong')..text = 'Last Name: '); - col2.append(html.Text(contact.lastName)); - - final col3 = html.Element.tag('div'); - grid.append(col3); - col3.append(html.Element.tag('strong')..text = 'Email: '); - col3.append(html.Text(contact.email)); - - final footer = html.Element.tag('footer'); - article.append(footer); - - final editBtn = html.Element.tag('button') - ..attributes['hx-get'] = '?mode=edit' - ..attributes['hx-target'] = '#contact-card' - ..attributes['hx-swap'] = 'outerHTML' - ..attributes['class'] = 'secondary' - ..text = 'Click To Edit'; - footer.append(editBtn); - - return article; -} - -html.Element createEditView(Contact contact) { - final article = html.Element.tag('article')..attributes['id'] = 'contact-card'; - - final form = html.Element.tag('form') - ..attributes['hx-put'] = '?' - ..attributes['hx-target'] = '#contact-card' - ..attributes['hx-swap'] = 'outerHTML'; - article.append(form); - - final header = html.Element.tag('header')..text = 'Edit Contact'; - form.append(header); - - final grid = html.Element.tag('div')..attributes['class'] = 'grid'; - form.append(grid); - - final label1 = html.Element.tag('label')..text = 'First Name'; - grid.append(label1); - label1.append(html.Element.tag('input')..attributes['type'] = 'text'..attributes['name'] = 'firstName'..attributes['value'] = contact.firstName); - - final label2 = html.Element.tag('label')..text = 'Last Name'; - grid.append(label2); - label2.append(html.Element.tag('input')..attributes['type'] = 'text'..attributes['name'] = 'lastName'..attributes['value'] = contact.lastName); - - final label3 = html.Element.tag('label')..text = 'Email'; - form.append(label3); - label3.append(html.Element.tag('input')..attributes['type'] = 'email'..attributes['name'] = 'email'..attributes['value'] = contact.email); - - final footer = html.Element.tag('footer')..attributes['class'] = 'grid'; - form.append(footer); - - final cancelBtn = html.Element.tag('button') - ..attributes['type'] = 'button' - ..attributes['hx-get'] = '?' - ..attributes['hx-target'] = '#contact-card' - ..attributes['hx-swap'] = 'outerHTML' - ..attributes['class'] = 'secondary' - ..text = 'Cancel'; - footer.append(cancelBtn); - - final saveBtn = html.Element.tag('button')..attributes['type'] = 'submit'..text = 'Save'; - footer.append(saveBtn); - - return article; -} - -void main(List args) { - fireUp(args, (firebase) { - final firestore = Firestore(); - - firebase.https.onRequest( - name: 'contact', - (request) async { - final docRef = firestore.collection('contacts').doc('1'); - final contact = await getContact(docRef); - - final mode = request.url.queryParameters['mode']; - final isHxRequest = request.headers['hx-request'] == 'true'; - - if (request.method == 'GET') { - if (mode == 'edit') { - final editView = createEditView(contact); - final htmlStr = isHxRequest ? editView.outerHtml : createBaseDocument('Edit Contact', editView).outerHtml; - return Response(200, body: htmlStr, headers: {'Content-Type': 'text/html'}); - } else { - final displayView = createDisplayView(contact); - final htmlStr = isHxRequest ? displayView.outerHtml : createBaseDocument('Contact', displayView).outerHtml; - return Response(200, body: htmlStr, headers: {'Content-Type': 'text/html'}); - } - } else if (request.method == 'PUT' || request.method == 'POST') { - final bodyStr = await request.readAsString(); - final formData = Uri.splitQueryString(bodyStr); - - contact.firstName = formData['firstName'] ?? contact.firstName; - contact.lastName = formData['lastName'] ?? contact.lastName; - contact.email = formData['email'] ?? contact.email; - - await docRef.set(contact.toJson()); - - final displayView = createDisplayView(contact); - final htmlStr = isHxRequest ? displayView.outerHtml : createBaseDocument('Contact', displayView).outerHtml; - return Response(200, body: htmlStr, headers: {'Content-Type': 'text/html'}); - } - - return Response(405, body: 'Method Not Allowed'); - }, - ); - }); -} diff --git a/Dart/htmx/dart-htmx/functions/pubspec.lock b/Dart/htmx/dart-htmx/functions/pubspec.lock deleted file mode 100644 index e398f98a6c..0000000000 --- a/Dart/htmx/dart-htmx/functions/pubspec.lock +++ /dev/null @@ -1,597 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _discoveryapis_commons: - dependency: transitive - description: - name: _discoveryapis_commons - sha256: "113c4100b90a5b70a983541782431b82168b3cae166ab130649c36eb3559d498" - url: "https://pub.dev" - source: hosted - version: "1.0.7" - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: a49d6cf99e8d8e7a8e93668d09ced0bbdb954d0b4fccc2f5f9241c6b87fad95c - url: "https://pub.dev" - source: hosted - version: "99.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "663efa951fb8a45e06f491223a604c93820598f20e6a99c25617a1576065e8b7" - url: "https://pub.dev" - source: hosted - version: "12.1.0" - args: - dependency: transitive - description: - name: args - sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - asn1lib: - dependency: transitive - description: - name: asn1lib - sha256: "9a8f69025044eb466b9b60ef3bc3ac99b4dc6c158ae9c56d25eeccf5bc56d024" - url: "https://pub.dev" - source: hosted - version: "1.6.5" - async: - dependency: transitive - description: - name: async - sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 - url: "https://pub.dev" - source: hosted - version: "2.13.1" - build: - dependency: transitive - description: - name: build - sha256: a156715e7cd728130c592f30552575908aae5b100005fbc1f0fb16b3c03a3d10 - url: "https://pub.dev" - source: hosted - version: "4.0.6" - build_config: - dependency: transitive - description: - name: build_config - sha256: "4070d2a59f8eec34c97c86ceb44403834899075f66e8a9d59706f8e7834f6f71" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - build_daemon: - dependency: transitive - description: - name: build_daemon - sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957 - url: "https://pub.dev" - source: hosted - version: "4.1.1" - build_runner: - dependency: "direct dev" - description: - name: build_runner - sha256: "1523ce62448ebac2c15a8ba5fbad8acac169788658a7dd2a1c2d9c2a9318b9a6" - url: "https://pub.dev" - source: hosted - version: "2.15.0" - built_collection: - dependency: transitive - description: - name: built_collection - sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.dev" - source: hosted - version: "5.1.1" - built_value: - dependency: transitive - description: - name: built_value - sha256: "34e4067d30ce212937df995f03b69992eea683539ceeac7f679a1f1eba055b56" - url: "https://pub.dev" - source: hosted - version: "8.12.6" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" - url: "https://pub.dev" - source: hosted - version: "2.0.4" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - convert: - dependency: transitive - description: - name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 - url: "https://pub.dev" - source: hosted - version: "3.1.2" - crypto: - dependency: transitive - description: - name: crypto - sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf - url: "https://pub.dev" - source: hosted - version: "3.0.7" - csslib: - dependency: transitive - description: - name: csslib - sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - dart_jsonwebtoken: - dependency: transitive - description: - name: dart_jsonwebtoken - sha256: ad84e60181696513d04d5f2078e0bbc20365b911f46f647797317414bdc88fbe - url: "https://pub.dev" - source: hosted - version: "3.4.1" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: a4c1ccfee44c7e75ed80484071a5c142a385345e658fd8bd7c4b5c97e7198f98 - url: "https://pub.dev" - source: hosted - version: "3.1.8" - ffi: - dependency: transitive - description: - name: ffi - sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" - url: "https://pub.dev" - source: hosted - version: "2.2.0" - file: - dependency: transitive - description: - name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 - url: "https://pub.dev" - source: hosted - version: "7.0.1" - firebase_admin_sdk: - dependency: "direct main" - description: - name: firebase_admin_sdk - sha256: b17f129ecb0ee2c0523f7441f6f40bfbc8ffcf9fb58fe9e4b0dbe1255969ba4d - url: "https://pub.dev" - source: hosted - version: "0.5.3" - firebase_functions: - dependency: "direct main" - description: - name: firebase_functions - sha256: "1aabfa549089585614edeb46e3f6f0d1fa50435256d2fad08028cd290e451037" - url: "https://pub.dev" - source: hosted - version: "0.6.0" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be - url: "https://pub.dev" - source: hosted - version: "1.1.1" - glob: - dependency: transitive - description: - name: glob - sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de - url: "https://pub.dev" - source: hosted - version: "2.1.3" - google_cloud: - dependency: transitive - description: - name: google_cloud - sha256: b385e20726ef5315d302c5933bfb728103116c5be2d3d17094b01a82da538c1f - url: "https://pub.dev" - source: hosted - version: "0.5.0" - google_cloud_firestore: - dependency: "direct main" - description: - name: google_cloud_firestore - sha256: "2ef311299694771e677c5285cac27f30bdba174f3119001b3fae39e546042fce" - url: "https://pub.dev" - source: hosted - version: "0.5.2" - google_cloud_firestore_v1: - dependency: transitive - description: - name: google_cloud_firestore_v1 - sha256: "9f671248e9722e1baf34d20273e4b75cff0bd6f911c7ca74eee911afb7c6f0e5" - url: "https://pub.dev" - source: hosted - version: "0.5.2" - google_cloud_longrunning: - dependency: transitive - description: - name: google_cloud_longrunning - sha256: "6795a17c5b14f50a7db2bb8564f2e033973fad698eae75fe7bd59f5614d5dda6" - url: "https://pub.dev" - source: hosted - version: "0.5.2" - google_cloud_protobuf: - dependency: transitive - description: - name: google_cloud_protobuf - sha256: f45f656c63d040b21d5cf947a3c44d537eb82ee68e485ccfcf2edbcbd1041461 - url: "https://pub.dev" - source: hosted - version: "0.5.2" - google_cloud_rpc: - dependency: transitive - description: - name: google_cloud_rpc - sha256: "143ca2179dbcc5e4d16e8ee352aa4891b105b0aafc4e617bd4d713715a4afef2" - url: "https://pub.dev" - source: hosted - version: "0.5.2" - google_cloud_storage: - dependency: transitive - description: - name: google_cloud_storage - sha256: cb4f2887e445c51c33de6de3275948037cdf15080e4d8725f1c6dfc0a88b38de - url: "https://pub.dev" - source: hosted - version: "0.6.2" - google_cloud_type: - dependency: transitive - description: - name: google_cloud_type - sha256: f82055273f7f7a9f52d96285fd4fd61a79fc7ef86454d880b93cf81347c1d1ad - url: "https://pub.dev" - source: hosted - version: "0.5.2" - google_identity_services_web: - dependency: transitive - description: - name: google_identity_services_web - sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454" - url: "https://pub.dev" - source: hosted - version: "0.3.3+1" - googleapis: - dependency: transitive - description: - name: googleapis - sha256: "62b5988f228b774448ebd99b53fe8069becb55840f1b28948bb84160373dc0b6" - url: "https://pub.dev" - source: hosted - version: "16.0.0" - googleapis_auth: - dependency: transitive - description: - name: googleapis_auth - sha256: "2a8895c3885197f96bb2fd91ee0ae77b53ff3874c7b1f1eadb6566248e880958" - url: "https://pub.dev" - source: hosted - version: "2.3.1" - graphs: - dependency: transitive - description: - name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" - url: "https://pub.dev" - source: hosted - version: "2.3.2" - html: - dependency: "direct main" - description: - name: html - sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" - url: "https://pub.dev" - source: hosted - version: "0.15.6" - http: - dependency: transitive - description: - name: http - sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" - url: "https://pub.dev" - source: hosted - version: "1.6.0" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 - url: "https://pub.dev" - source: hosted - version: "3.2.2" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" - url: "https://pub.dev" - source: hosted - version: "4.1.2" - intl: - dependency: transitive - description: - name: intl - sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" - url: "https://pub.dev" - source: hosted - version: "0.20.2" - io: - dependency: transitive - description: - name: io - sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b - url: "https://pub.dev" - source: hosted - version: "1.0.5" - json_annotation: - dependency: transitive - description: - name: json_annotation - sha256: cb09e7dac6210041fad964ed7fbee004f14258b4eca4040f72d1234062ace4c8 - url: "https://pub.dev" - source: hosted - version: "4.11.0" - lints: - dependency: "direct dev" - description: - name: lints - sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" - url: "https://pub.dev" - source: hosted - version: "6.1.0" - logging: - dependency: transitive - description: - name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 - url: "https://pub.dev" - source: hosted - version: "1.3.0" - meta: - dependency: transitive - description: - name: meta - sha256: df0c643f44ad098eb37988027a8e2b2b5a031fd3977f06bbfd3a76637e8df739 - url: "https://pub.dev" - source: hosted - version: "1.18.2" - mime: - dependency: transitive - description: - name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - package_config: - dependency: transitive - description: - name: package_config - sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc - url: "https://pub.dev" - source: hosted - version: "2.2.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - pem: - dependency: transitive - description: - name: pem - sha256: e66b389cbb007fa5860d511f08ea604ea68e78afc4e1b543dc227a0f0ef4faf9 - url: "https://pub.dev" - source: hosted - version: "2.0.6" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" - url: "https://pub.dev" - source: hosted - version: "7.0.2" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5" - url: "https://pub.dev" - source: hosted - version: "4.0.0" - pool: - dependency: transitive - description: - name: pool - sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" - url: "https://pub.dev" - source: hosted - version: "1.5.2" - protobuf: - dependency: transitive - description: - name: protobuf - sha256: "75ec242d22e950bdcc79ee38dd520ce4ee0bc491d7fadc4ea47694604d22bf06" - url: "https://pub.dev" - source: hosted - version: "6.0.0" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" - url: "https://pub.dev" - source: hosted - version: "2.2.0" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" - url: "https://pub.dev" - source: hosted - version: "1.5.0" - shelf: - dependency: transitive - description: - name: shelf - sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 - url: "https://pub.dev" - source: hosted - version: "1.4.2" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" - url: "https://pub.dev" - source: hosted - version: "3.0.0" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: ec37cc0e6694374cbef59ed79685572c870a54ede6fa30a3e420feb3adffea02 - url: "https://pub.dev" - source: hosted - version: "4.2.3" - source_span: - dependency: transitive - description: - name: source_span - sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" - url: "https://pub.dev" - source: hosted - version: "1.10.2" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - stream_transform: - dependency: transitive - description: - name: stream_transform - sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 - url: "https://pub.dev" - source: hosted - version: "2.1.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" - url: "https://pub.dev" - source: hosted - version: "1.4.1" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" - url: "https://pub.dev" - source: hosted - version: "1.2.2" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - web: - dependency: transitive - description: - name: web - sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 - url: "https://pub.dev" - source: hosted - version: "3.0.3" - yaml: - dependency: transitive - description: - name: yaml - sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce - url: "https://pub.dev" - source: hosted - version: "3.1.3" - yaml_edit: - dependency: transitive - description: - name: yaml_edit - sha256: "07c9e63ba42519745182b88ca12264a7ba2484d8239958778dfe4d44fe760488" - url: "https://pub.dev" - source: hosted - version: "2.2.4" -sdks: - dart: ">=3.10.0 <4.0.0" diff --git a/Dart/htmx/dart-htmx/functions/pubspec.yaml b/Dart/htmx/dart-htmx/pubspec.yaml similarity index 69% rename from Dart/htmx/dart-htmx/functions/pubspec.yaml rename to Dart/htmx/dart-htmx/pubspec.yaml index 0b3eaa03e1..980b878040 100644 --- a/Dart/htmx/dart-htmx/functions/pubspec.yaml +++ b/Dart/htmx/dart-htmx/pubspec.yaml @@ -1,5 +1,5 @@ -name: my_function -description: An app using Dart with Cloud Functions for Firebase +name: dart_htmx +description: An app using Dart, HTMX, Pico CSS, and Cloud Functions for Firebase version: 0.0.1 publish_to: none @@ -10,7 +10,6 @@ dependencies: firebase_functions: ^0.6.0 firebase_admin_sdk: ^0.5.0 google_cloud_firestore: ^0.5.0 - html: ^0.15.4 dev_dependencies: build_runner: ^2.4.0 From aa79e187421279b0ce71087e3fffd06241b09078 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Fri, 15 May 2026 15:47:48 +0000 Subject: [PATCH 03/20] add auth --- Dart/htmx/dart-htmx/bin/server.dart | 87 ++++++++++++++++++++++++- Dart/htmx/dart-htmx/firebase.json | 3 + Dart/htmx/dart-htmx/lib/src/app_js.dart | 66 +++++++++++++++++++ Dart/htmx/dart-htmx/tool/bundle_js.dart | 29 +++++++++ Dart/htmx/dart-htmx/web/app.ts | 77 ++++++++++++++++++++++ Dart/htmx/dart-htmx/web/tsconfig.json | 11 ++++ 6 files changed, 271 insertions(+), 2 deletions(-) create mode 100644 Dart/htmx/dart-htmx/lib/src/app_js.dart create mode 100644 Dart/htmx/dart-htmx/tool/bundle_js.dart create mode 100644 Dart/htmx/dart-htmx/web/app.ts create mode 100644 Dart/htmx/dart-htmx/web/tsconfig.json diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index c4123a522c..c914d645d7 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -1,6 +1,9 @@ import 'dart:convert'; -import 'package:firebase_functions/firebase_functions.dart'; +import 'package:firebase_admin_sdk/auth.dart'; +import 'package:firebase_admin_sdk/firebase_admin_sdk.dart'; +import 'package:firebase_functions/firebase_functions.dart' hide DecodedIdToken; import 'package:google_cloud_firestore/google_cloud_firestore.dart'; +import '../lib/src/app_js.dart'; class Contact { String firstName; @@ -42,7 +45,27 @@ Future getContact(DocumentReference ref) async { return Contact.fromJson(snapshot.data()!); } -String createBaseDocument(String titleText, String content) => +Future verifyAuthHeader( + Request request, + FirebaseApp app, +) async { + final authHeader = request.headers['authorization']; + if (authHeader == null || !authHeader.startsWith('Bearer ')) { + return null; + } + final idToken = authHeader.substring(7); + try { + return await app.auth().verifyIdToken(idToken); + } catch (e) { + return null; + } +} + +String createBaseDocument( + String titleText, + String content, { + bool showSignOut = true, +}) => ''' @@ -52,8 +75,19 @@ String createBaseDocument(String titleText, String content) => ${const HtmlEscape().convert(titleText)} + + + +
$content
@@ -107,7 +141,30 @@ String createEditView(Contact contact) => '''; +String createSignInView() => ''' +
+
Sign In Required
+
+ + +
+ +
+
+ Demo account: test@example.com / Test@12345 +
+
+'''; + void main() { + final adminApp = FirebaseApp.initializeApp(); + runFunctions((firebase) { final firestore = Firestore(); @@ -119,7 +176,24 @@ void main() { final isHxRequest = request.headers['hx-request'] == 'true'; if (request.method == 'GET') { + if (mode == 'signin') { + final signInView = createSignInView(); + final htmlStr = isHxRequest + ? signInView + : createBaseDocument('Sign In', signInView, showSignOut: false); + return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + } + if (mode == 'edit') { + final decodedToken = await verifyAuthHeader(request, adminApp); + if (decodedToken == null) { + if (isHxRequest) { + return Response(401, headers: {'HX-Redirect': '?mode=signin'}); + } else { + return Response.found('?mode=signin'); + } + } + final editView = createEditView(contact); final htmlStr = isHxRequest ? editView @@ -133,6 +207,15 @@ void main() { return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); } } else if (request.method == 'PUT' || request.method == 'POST') { + final decodedToken = await verifyAuthHeader(request, adminApp); + if (decodedToken == null) { + if (isHxRequest) { + return Response(401, headers: {'HX-Redirect': '?mode=signin'}); + } else { + return Response.found('?mode=signin'); + } + } + final bodyStr = await request.readAsString(); final formData = Uri.splitQueryString(bodyStr); diff --git a/Dart/htmx/dart-htmx/firebase.json b/Dart/htmx/dart-htmx/firebase.json index 24fc527586..2738ddb5db 100644 --- a/Dart/htmx/dart-htmx/firebase.json +++ b/Dart/htmx/dart-htmx/firebase.json @@ -15,6 +15,9 @@ } ], "emulators": { + "auth": { + "port": 9099 + }, "functions": { "port": 5001 }, diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart new file mode 100644 index 0000000000..9facd4b8d0 --- /dev/null +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -0,0 +1,66 @@ +// Generated file. Do not edit. +// Bundled from web/app.js + +const String appJs = r''' +"use strict"; +// Initialize Firebase with placeholder config for prod +firebase.initializeApp({ + apiKey: "demo-api-key", + authDomain: "demo-project.firebaseapp.com", + projectId: "demo-project", +}); +// Connect to Auth Emulator if running locally +if (window.location.hostname === "localhost" || + window.location.hostname === "127.0.0.1") { + firebase.auth().useEmulator("http://" + window.location.hostname + ":9099"); +} +let currentIdToken = ""; +firebase.auth().onIdTokenChanged(async (user) => { + if (user) { + currentIdToken = await user.getIdToken(); + } + else { + currentIdToken = ""; + } +}); +// Configure HTMX to attach Authorization header +document.body.addEventListener("htmx:configRequest", (event) => { + if (currentIdToken) { + event.detail.headers["Authorization"] = "Bearer " + currentIdToken; + } +}); +// Sign In Logic for HTML Form +window.signInWithEmailPassword = async (event) => { + event.preventDefault(); + const emailInput = document.getElementById("email"); + const passInput = document.getElementById("password"); + const errorDiv = document.getElementById("login-error"); + const email = emailInput.value; + const pass = passInput.value; + try { + errorDiv.innerText = ""; + await firebase.auth().signInWithEmailAndPassword(email, pass); + window.location.href = "?"; + } + catch (error) { + if (error.code === "auth/user-not-found") { + try { + // Automatically create the demo user in the emulator + await firebase.auth().createUserWithEmailAndPassword(email, pass); + window.location.href = "?"; + } + catch (createError) { + errorDiv.innerText = "Error creating demo user: " + createError.message; + } + } + else { + errorDiv.innerText = "Sign in error: " + error.message; + } + } +}; +// Sign Out Logic +window.signOut = async () => { + await firebase.auth().signOut(); + window.location.href = "?mode=signin"; +}; +'''; diff --git a/Dart/htmx/dart-htmx/tool/bundle_js.dart b/Dart/htmx/dart-htmx/tool/bundle_js.dart new file mode 100644 index 0000000000..121b0bfa97 --- /dev/null +++ b/Dart/htmx/dart-htmx/tool/bundle_js.dart @@ -0,0 +1,29 @@ +import 'dart:io'; + +void main() { + final jsFile = File('web/app.js'); + if (!jsFile.existsSync()) { + print('Error: web/app.js does not exist. Run tsc first.'); + exit(1); + } + + final jsContent = jsFile.readAsStringSync(); + + final dartContent = + ''' +// Generated file. Do not edit. +// Bundled from web/app.js + +const String appJs = r\'\'\' +$jsContent\'\'\'; +'''; + + final outputDir = Directory('lib/src'); + if (!outputDir.existsSync()) { + outputDir.createSync(recursive: true); + } + + final dartFile = File('lib/src/app_js.dart'); + dartFile.writeAsStringSync(dartContent); + print('Successfully bundled web/app.js into lib/src/app_js.dart'); +} diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts new file mode 100644 index 0000000000..679a1dcda2 --- /dev/null +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -0,0 +1,77 @@ +declare const firebase: { + auth(): { + useEmulator(url: string): void; + onIdTokenChanged(callback: (user: any) => void): void; + signInWithEmailAndPassword(email: string, pass: string): Promise; + createUserWithEmailAndPassword(email: string, pass: string): Promise; + signOut(): Promise; + }; + initializeApp(config: any): void; +}; + +// Initialize Firebase with placeholder config for prod +firebase.initializeApp({ + apiKey: "demo-api-key", + authDomain: "demo-project.firebaseapp.com", + projectId: "demo-project", +}); + +// Connect to Auth Emulator if running locally +if ( + window.location.hostname === "localhost" || + window.location.hostname === "127.0.0.1" +) { + firebase.auth().useEmulator("http://" + window.location.hostname + ":9099"); +} + +let currentIdToken = ""; + +firebase.auth().onIdTokenChanged(async (user: any) => { + if (user) { + currentIdToken = await user.getIdToken(); + } else { + currentIdToken = ""; + } +}); + +// Configure HTMX to attach Authorization header +document.body.addEventListener("htmx:configRequest", (event: any) => { + if (currentIdToken) { + event.detail.headers["Authorization"] = "Bearer " + currentIdToken; + } +}); + +// Sign In Logic for HTML Form +(window as any).signInWithEmailPassword = async (event: Event) => { + event.preventDefault(); + const emailInput = document.getElementById("email") as HTMLInputElement; + const passInput = document.getElementById("password") as HTMLInputElement; + const errorDiv = document.getElementById("login-error") as HTMLDivElement; + + const email = emailInput.value; + const pass = passInput.value; + + try { + errorDiv.innerText = ""; + await firebase.auth().signInWithEmailAndPassword(email, pass); + window.location.href = "?"; + } catch (error: any) { + if (error.code === "auth/user-not-found") { + try { + // Automatically create the demo user in the emulator + await firebase.auth().createUserWithEmailAndPassword(email, pass); + window.location.href = "?"; + } catch (createError: any) { + errorDiv.innerText = "Error creating demo user: " + createError.message; + } + } else { + errorDiv.innerText = "Sign in error: " + error.message; + } + } +}; + +// Sign Out Logic +(window as any).signOut = async () => { + await firebase.auth().signOut(); + window.location.href = "?mode=signin"; +}; diff --git a/Dart/htmx/dart-htmx/web/tsconfig.json b/Dart/htmx/dart-htmx/web/tsconfig.json new file mode 100644 index 0000000000..4855b3d3bb --- /dev/null +++ b/Dart/htmx/dart-htmx/web/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "node", + "strict": true, + "skipLibCheck": true, + "lib": ["DOM", "ES2020"] + }, + "include": ["app.ts"] +} From 71bf2329530c93d29883bc891683a03d09008882 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Fri, 15 May 2026 15:51:02 +0000 Subject: [PATCH 04/20] update demo user name --- Dart/htmx/dart-htmx/bin/server.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index c914d645d7..dbe7fbd75e 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -18,9 +18,9 @@ class Contact { factory Contact.fromJson(Map json) { return Contact( - firstName: json['firstName'] as String? ?? 'Joe', - lastName: json['lastName'] as String? ?? 'Blow', - email: json['email'] as String? ?? 'joe@blow.com', + firstName: json['firstName'] as String? ?? 'Jane', + lastName: json['lastName'] as String? ?? 'Doe', + email: json['email'] as String? ?? 'jane.doe@example.com', ); } @@ -35,9 +35,9 @@ Future getContact(DocumentReference ref) async { final snapshot = await ref.get(); if (!snapshot.exists) { final defaultContact = Contact( - firstName: 'Joe', - lastName: 'Blow', - email: 'joe@blow.com', + firstName: 'Jane', + lastName: 'Doe', + email: 'jane.doe@example.com', ); await ref.set(defaultContact.toJson()); return defaultContact; From 282129640cba5ed3048788364577849cb63f075f Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Fri, 15 May 2026 17:19:20 +0000 Subject: [PATCH 05/20] use typescript --- Dart/htmx/dart-htmx/bin/server.dart | 334 +++-- Dart/htmx/dart-htmx/hook/build.dart | 66 + Dart/htmx/dart-htmx/lib/src/app_js.dart | 1478 ++++++++++++++++++++++- Dart/htmx/dart-htmx/pubspec.yaml | 2 + Dart/htmx/dart-htmx/tool/bundle_js.dart | 29 - Dart/htmx/dart-htmx/web/app.ts | 73 +- Dart/htmx/dart-htmx/web/package.json | 17 + Dart/htmx/dart-htmx/web/tsconfig.json | 2 +- 8 files changed, 1755 insertions(+), 246 deletions(-) create mode 100644 Dart/htmx/dart-htmx/hook/build.dart delete mode 100644 Dart/htmx/dart-htmx/tool/bundle_js.dart create mode 100644 Dart/htmx/dart-htmx/web/package.json diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index dbe7fbd75e..caa5127192 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -1,8 +1,9 @@ -import 'dart:convert'; import 'package:firebase_admin_sdk/auth.dart'; import 'package:firebase_admin_sdk/firebase_admin_sdk.dart'; import 'package:firebase_functions/firebase_functions.dart' hide DecodedIdToken; import 'package:google_cloud_firestore/google_cloud_firestore.dart'; +import 'package:jaspr/dom.dart'; +import 'package:jaspr/server.dart'; import '../lib/src/app_js.dart'; class Contact { @@ -53,6 +54,7 @@ Future verifyAuthHeader( if (authHeader == null || !authHeader.startsWith('Bearer ')) { return null; } + // Strip 'Bearer ' prefix (7 characters) final idToken = authHeader.substring(7); try { return await app.auth().verifyIdToken(idToken); @@ -61,108 +63,181 @@ Future verifyAuthHeader( } } -String createBaseDocument( - String titleText, - String content, { - bool showSignOut = true, -}) => - ''' - - - - - - ${const HtmlEscape().convert(titleText)} - - - - - - - - -
- $content -
- - -'''; - -String createDisplayView(Contact contact) => - ''' -
-
Contact Info
-
-
First Name: ${const HtmlEscape().convert(contact.firstName)}
-
Last Name: ${const HtmlEscape().convert(contact.lastName)}
-
Email: ${const HtmlEscape().convert(contact.email)}
-
-
- -
-
-'''; - -String createEditView(Contact contact) => - ''' -
-
-
Edit Contact
-
- - -
- -
- - -
-
-
-'''; - -String createSignInView() => ''' -
-
Sign In Required
-
- - -
- -
-
- Demo account: test@example.com / Test@12345 -
-
-'''; +class BaseDocument extends StatelessComponent { + final String titleText; + final Component child; + final bool showSignOut; + + const BaseDocument({ + required this.titleText, + required this.child, + this.showSignOut = true, + }); + + @override + Component build(BuildContext context) { + return Document( + title: titleText, + lang: 'en', + head: [ + link( + rel: 'stylesheet', + href: 'https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css', + ), + script(content: appJs, attributes: {'type': 'module'}), + ], + body: Component.fragment([ + nav([ + ul([ + li([ + strong([Component.text('Dart HTMX Demo')]), + ]), + ]), + ul([ + if (showSignOut) + li([ + button( + [Component.text('Sign Out')], + classes: 'secondary outline', + attributes: {'onclick': 'signOut()'}, + ), + ]), + ]), + ], classes: 'container-fluid'), + main_([child], classes: 'container'), + ]), + ); + } +} + +Component createDisplayView(Contact contact) { + return article([ + header([Component.text('Contact Info')]), + div([ + div([ + strong([Component.text('First Name: ')]), + Component.text(contact.firstName), + ]), + div([ + strong([Component.text('Last Name: ')]), + Component.text(contact.lastName), + ]), + div([ + strong([Component.text('Email: ')]), + Component.text(contact.email), + ]), + ], classes: 'grid'), + footer([ + button( + [Component.text('Click To Edit')], + classes: 'secondary', + attributes: { + 'hx-get': '?mode=edit', + 'hx-target': '#contact-card', + 'hx-swap': 'outerHTML', + }, + ), + ]), + ], id: 'contact-card'); +} + +Component createEditView(Contact contact) { + return article([ + form( + [ + header([Component.text('Edit Contact')]), + div([ + label([ + Component.text('First Name'), + input( + type: InputType.text, + name: 'firstName', + value: contact.firstName, + ), + ]), + label([ + Component.text('Last Name'), + input( + type: InputType.text, + name: 'lastName', + value: contact.lastName, + ), + ]), + ], classes: 'grid'), + label([ + Component.text('Email'), + input(type: InputType.email, name: 'email', value: contact.email), + ]), + footer([ + button( + [Component.text('Cancel')], + classes: 'secondary', + type: ButtonType.button, + attributes: { + 'hx-get': '?', + 'hx-target': '#contact-card', + 'hx-swap': 'outerHTML', + }, + ), + button([Component.text('Save')], type: ButtonType.submit), + ], classes: 'grid'), + ], + attributes: { + 'hx-put': '?', + 'hx-target': '#contact-card', + 'hx-swap': 'outerHTML', + }, + ), + ], id: 'contact-card'); +} + +Component createSignInView() { + return article([ + header([Component.text('Sign In Required')]), + form( + [ + label([ + Component.text('Email'), + input( + type: InputType.email, + id: 'email', + attributes: {'required': 'true'}, + ), + ]), + label([ + Component.text('Password'), + input( + type: InputType.password, + id: 'password', + attributes: {'required': 'true'}, + ), + ]), + div( + [], + id: 'login-error', + attributes: { + 'style': + 'color: var(--pico-form-element-invalid-border-color); margin-bottom: 1rem;', + }, + ), + button([Component.text('Sign In')], type: ButtonType.submit), + ], + id: 'signin-form', + attributes: {'onsubmit': 'signInWithEmailPassword(event)'}, + ), + footer([ + small([ + Component.text('Demo account: '), + code([Component.text('test@example.com')]), + Component.text(' / '), + code([Component.text('Test@12345')]), + ]), + ]), + ], id: 'signin-card'); +} void main() { + Jaspr.initializeApp(); final adminApp = FirebaseApp.initializeApp(); runFunctions((firebase) { @@ -178,10 +253,20 @@ void main() { if (request.method == 'GET') { if (mode == 'signin') { final signInView = createSignInView(); - final htmlStr = isHxRequest - ? signInView - : createBaseDocument('Sign In', signInView, showSignOut: false); - return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + final result = await renderComponent( + isHxRequest + ? signInView + : BaseDocument( + titleText: 'Sign In', + child: signInView, + showSignOut: false, + ), + request: request, + ); + return Response.ok( + result.body, + headers: {'content-type': 'text/html'}, + ); } if (mode == 'edit') { @@ -195,16 +280,28 @@ void main() { } final editView = createEditView(contact); - final htmlStr = isHxRequest - ? editView - : createBaseDocument('Edit Contact', editView); - return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + final result = await renderComponent( + isHxRequest + ? editView + : BaseDocument(titleText: 'Edit Contact', child: editView), + request: request, + ); + return Response.ok( + result.body, + headers: {'content-type': 'text/html'}, + ); } else { final displayView = createDisplayView(contact); - final htmlStr = isHxRequest - ? displayView - : createBaseDocument('Contact', displayView); - return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + final result = await renderComponent( + isHxRequest + ? displayView + : BaseDocument(titleText: 'Contact', child: displayView), + request: request, + ); + return Response.ok( + result.body, + headers: {'content-type': 'text/html'}, + ); } } else if (request.method == 'PUT' || request.method == 'POST') { final decodedToken = await verifyAuthHeader(request, adminApp); @@ -226,10 +323,13 @@ void main() { await docRef.set(contact.toJson()); final displayView = createDisplayView(contact); - final htmlStr = isHxRequest - ? displayView - : createBaseDocument('Contact', displayView); - return Response.ok(htmlStr, headers: {'content-type': 'text/html'}); + final result = await renderComponent( + isHxRequest + ? displayView + : BaseDocument(titleText: 'Contact', child: displayView), + request: request, + ); + return Response.ok(result.body, headers: {'content-type': 'text/html'}); } return Response(405, body: 'Method Not Allowed'); diff --git a/Dart/htmx/dart-htmx/hook/build.dart b/Dart/htmx/dart-htmx/hook/build.dart new file mode 100644 index 0000000000..e4e1764734 --- /dev/null +++ b/Dart/htmx/dart-htmx/hook/build.dart @@ -0,0 +1,66 @@ +import 'dart:io'; +import 'package:hooks/hooks.dart'; + +void main(List args) async { + await build(args, (input, output) async { + print('Running npm install in web/...'); + final npmResult = Process.runSync( + 'npx', + ['npm', 'install'], + workingDirectory: 'web', + runInShell: true, + ); + if (npmResult.exitCode != 0) { + throw BuildError( + message: + 'Error running npm install:\n${npmResult.stdout}\n${npmResult.stderr}', + ); + } + + print('Running npm run build (esbuild) in web/...'); + final buildResult = Process.runSync( + 'npx', + ['npm', 'run', 'build'], + workingDirectory: 'web', + runInShell: true, + ); + if (buildResult.exitCode != 0) { + throw BuildError( + message: + 'Error running npm run build:\n${buildResult.stdout}\n${buildResult.stderr}', + ); + } + + final jsFile = File('web/dist/app.bundle.js'); + if (!jsFile.existsSync()) { + throw BuildError( + message: 'Error: web/dist/app.bundle.js does not exist after build.', + ); + } + + final jsContent = jsFile.readAsStringSync(); + + final dartContent = + ''' +// Generated file. Do not edit. +// Bundled from web/dist/app.bundle.js + +const String appJs = r\'\'\' +$jsContent\'\'\'; +'''; + + final outputDir = Directory('lib/src'); + if (!outputDir.existsSync()) { + outputDir.createSync(recursive: true); + } + + final dartFile = File('lib/src/app_js.dart'); + dartFile.writeAsStringSync(dartContent); + print( + 'Successfully bundled web/dist/app.bundle.js into lib/src/app_js.dart', + ); + + output.dependencies.add(Uri.file('web/app.ts')); + output.dependencies.add(Uri.file('web/package.json')); + }); +} diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index 9facd4b8d0..b5997abd06 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -1,66 +1,1420 @@ // Generated file. Do not edit. -// Bundled from web/app.js +// Bundled from web/dist/app.bundle.js const String appJs = r''' -"use strict"; -// Initialize Firebase with placeholder config for prod -firebase.initializeApp({ - apiKey: "demo-api-key", - authDomain: "demo-project.firebaseapp.com", - projectId: "demo-project", -}); -// Connect to Auth Emulator if running locally -if (window.location.hostname === "localhost" || - window.location.hostname === "127.0.0.1") { - firebase.auth().useEmulator("http://" + window.location.hostname + ":9099"); -} -let currentIdToken = ""; -firebase.auth().onIdTokenChanged(async (user) => { - if (user) { - currentIdToken = await user.getIdToken(); - } - else { - currentIdToken = ""; - } -}); -// Configure HTMX to attach Authorization header -document.body.addEventListener("htmx:configRequest", (event) => { - if (currentIdToken) { - event.detail.headers["Authorization"] = "Bearer " + currentIdToken; - } -}); -// Sign In Logic for HTML Form -window.signInWithEmailPassword = async (event) => { - event.preventDefault(); - const emailInput = document.getElementById("email"); - const passInput = document.getElementById("password"); - const errorDiv = document.getElementById("login-error"); - const email = emailInput.value; - const pass = passInput.value; - try { - errorDiv.innerText = ""; - await firebase.auth().signInWithEmailAndPassword(email, pass); - window.location.href = "?"; - } - catch (error) { - if (error.code === "auth/user-not-found") { - try { - // Automatically create the demo user in the emulator - await firebase.auth().createUserWithEmailAndPassword(email, pass); - window.location.href = "?"; - } - catch (createError) { - errorDiv.innerText = "Error creating demo user: " + createError.message; - } - } - else { - errorDiv.innerText = "Sign in error: " + error.message; - } - } -}; -// Sign Out Logic -window.signOut = async () => { - await firebase.auth().signOut(); - window.location.href = "?mode=signin"; -}; +var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var be=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Te.set(i,a),a}function Vn(r=Tt){let e=Te.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:ln,isAnonymous:un,providerData:st,stsTokenManager:dn}=n;p(it&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var Ut=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var on=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,Gt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var rt="";tt(Ie,async r=>{r?rt=await r.getIdToken():rt=""});fn.on("htmx:config:request",r=>{rt&&(r.detail.headers.Authorization="Bearer "+rt)});window.signInWithEmailPassword=async r=>{r.preventDefault();let e=document.getElementById("email"),n=document.getElementById("password"),t=document.getElementById("login-error"),i=e.value,s=n.value;try{t.innerText="",await rn(Ie,i,s),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,i,s),window.location.href="?"}catch(a){t.innerText="Error creating demo user: "+a.message}else t.innerText="Sign in error: "+o.message}};window.signOut=async()=>{await sn(Ie),window.location.href="?mode=signin"}; +/*! Bundled license information: + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/util/dist/index.esm2017.js: + (** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/component/dist/esm/index.esm2017.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/logger/dist/esm/index.esm2017.js: + (** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/app/dist/esm/index.esm2017.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/app/dist/esm/index.esm2017.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/app/dist/esm/index.esm2017.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/app/dist/esm/index.esm2017.js: + (** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +firebase/app/dist/esm/index.esm.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +@firebase/auth/dist/esm2017/index-68602d24.js: + (** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + (** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) +*/ '''; diff --git a/Dart/htmx/dart-htmx/pubspec.yaml b/Dart/htmx/dart-htmx/pubspec.yaml index 980b878040..755ed4d780 100644 --- a/Dart/htmx/dart-htmx/pubspec.yaml +++ b/Dart/htmx/dart-htmx/pubspec.yaml @@ -10,6 +10,8 @@ dependencies: firebase_functions: ^0.6.0 firebase_admin_sdk: ^0.5.0 google_cloud_firestore: ^0.5.0 + jaspr: ^0.23.1 + hooks: ^1.0.3 dev_dependencies: build_runner: ^2.4.0 diff --git a/Dart/htmx/dart-htmx/tool/bundle_js.dart b/Dart/htmx/dart-htmx/tool/bundle_js.dart deleted file mode 100644 index 121b0bfa97..0000000000 --- a/Dart/htmx/dart-htmx/tool/bundle_js.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'dart:io'; - -void main() { - final jsFile = File('web/app.js'); - if (!jsFile.existsSync()) { - print('Error: web/app.js does not exist. Run tsc first.'); - exit(1); - } - - final jsContent = jsFile.readAsStringSync(); - - final dartContent = - ''' -// Generated file. Do not edit. -// Bundled from web/app.js - -const String appJs = r\'\'\' -$jsContent\'\'\'; -'''; - - final outputDir = Directory('lib/src'); - if (!outputDir.existsSync()) { - outputDir.createSync(recursive: true); - } - - final dartFile = File('lib/src/app_js.dart'); - dartFile.writeAsStringSync(dartContent); - print('Successfully bundled web/app.js into lib/src/app_js.dart'); -} diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 679a1dcda2..a68ff979c7 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -1,77 +1,76 @@ -declare const firebase: { - auth(): { - useEmulator(url: string): void; - onIdTokenChanged(callback: (user: any) => void): void; - signInWithEmailAndPassword(email: string, pass: string): Promise; - createUserWithEmailAndPassword(email: string, pass: string): Promise; - signOut(): Promise; - }; - initializeApp(config: any): void; -}; +import htmx from 'htmx.org'; +import { initializeApp } from 'firebase/app'; +import { + getAuth, + connectAuthEmulator, + onIdTokenChanged, + signInWithEmailAndPassword, + createUserWithEmailAndPassword, + signOut as firebaseSignOut, +} from 'firebase/auth'; // Initialize Firebase with placeholder config for prod -firebase.initializeApp({ - apiKey: "demo-api-key", - authDomain: "demo-project.firebaseapp.com", - projectId: "demo-project", +const app = initializeApp({ + apiKey: 'demo-api-key', + authDomain: 'demo-project.firebaseapp.com', + projectId: 'demo-project', }); +const auth = getAuth(app); + // Connect to Auth Emulator if running locally -if ( - window.location.hostname === "localhost" || - window.location.hostname === "127.0.0.1" -) { - firebase.auth().useEmulator("http://" + window.location.hostname + ":9099"); +if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') { + connectAuthEmulator(auth, 'http://' + window.location.hostname + ':9099'); } -let currentIdToken = ""; +let currentIdToken = ''; -firebase.auth().onIdTokenChanged(async (user: any) => { +onIdTokenChanged(auth, async (user: any) => { if (user) { currentIdToken = await user.getIdToken(); } else { - currentIdToken = ""; + currentIdToken = ''; } }); // Configure HTMX to attach Authorization header -document.body.addEventListener("htmx:configRequest", (event: any) => { +htmx.on('htmx:config:request', (event: any) => { if (currentIdToken) { - event.detail.headers["Authorization"] = "Bearer " + currentIdToken; + event.detail.headers['Authorization'] = 'Bearer ' + currentIdToken; } }); // Sign In Logic for HTML Form (window as any).signInWithEmailPassword = async (event: Event) => { event.preventDefault(); - const emailInput = document.getElementById("email") as HTMLInputElement; - const passInput = document.getElementById("password") as HTMLInputElement; - const errorDiv = document.getElementById("login-error") as HTMLDivElement; + const emailInput = document.getElementById('email') as HTMLInputElement; + const passInput = document.getElementById('password') as HTMLInputElement; + const errorDiv = document.getElementById('login-error') as HTMLDivElement; const email = emailInput.value; const pass = passInput.value; try { - errorDiv.innerText = ""; - await firebase.auth().signInWithEmailAndPassword(email, pass); - window.location.href = "?"; + errorDiv.innerText = ''; + await signInWithEmailAndPassword(auth, email, pass); + window.location.href = '?'; } catch (error: any) { - if (error.code === "auth/user-not-found") { + if (error.code === 'auth/user-not-found') { try { // Automatically create the demo user in the emulator - await firebase.auth().createUserWithEmailAndPassword(email, pass); - window.location.href = "?"; + await createUserWithEmailAndPassword(auth, email, pass); + window.location.href = '?'; } catch (createError: any) { - errorDiv.innerText = "Error creating demo user: " + createError.message; + errorDiv.innerText = 'Error creating demo user: ' + createError.message; } } else { - errorDiv.innerText = "Sign in error: " + error.message; + errorDiv.innerText = 'Sign in error: ' + error.message; } } }; // Sign Out Logic (window as any).signOut = async () => { - await firebase.auth().signOut(); - window.location.href = "?mode=signin"; + await firebaseSignOut(auth); + window.location.href = '?mode=signin'; }; diff --git a/Dart/htmx/dart-htmx/web/package.json b/Dart/htmx/dart-htmx/web/package.json new file mode 100644 index 0000000000..359836779a --- /dev/null +++ b/Dart/htmx/dart-htmx/web/package.json @@ -0,0 +1,17 @@ +{ + "name": "dart-htmx-client", + "private": true, + "dependencies": { + "firebase": "^10.8.0", + "htmx.org": "4.0.0-beta3" + }, + "devDependencies": { + "esbuild": "^0.20.1", + "prettier": "^3.2.5", + "typescript": "^5.3.3" + }, + "scripts": { + "build": "esbuild app.ts --bundle --outfile=dist/app.bundle.js --format=esm --minify", + "format": "prettier --write app.ts" + } +} diff --git a/Dart/htmx/dart-htmx/web/tsconfig.json b/Dart/htmx/dart-htmx/web/tsconfig.json index 4855b3d3bb..67abfa69c3 100644 --- a/Dart/htmx/dart-htmx/web/tsconfig.json +++ b/Dart/htmx/dart-htmx/web/tsconfig.json @@ -7,5 +7,5 @@ "skipLibCheck": true, "lib": ["DOM", "ES2020"] }, - "include": ["app.ts"] + "include": ["app.ts", "firebase.d.ts"] } From bde9a413f4e5956ac6f99ea15483605a0834a035 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Fri, 15 May 2026 17:28:00 +0000 Subject: [PATCH 06/20] refine events --- Dart/htmx/dart-htmx/bin/server.dart | 7 +++++-- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index caa5127192..8a2ae51747 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -99,7 +99,8 @@ class BaseDocument extends StatelessComponent { button( [Component.text('Sign Out')], classes: 'secondary outline', - attributes: {'onclick': 'signOut()'}, + id: 'signout-button', + attributes: {'hx-get': '?'}, ), ]), ]), @@ -201,6 +202,7 @@ Component createSignInView() { input( type: InputType.email, id: 'email', + name: 'email', attributes: {'required': 'true'}, ), ]), @@ -209,6 +211,7 @@ Component createSignInView() { input( type: InputType.password, id: 'password', + name: 'password', attributes: {'required': 'true'}, ), ]), @@ -223,7 +226,7 @@ Component createSignInView() { button([Component.text('Sign In')], type: ButtonType.submit), ], id: 'signin-form', - attributes: {'onsubmit': 'signInWithEmailPassword(event)'}, + attributes: {'hx-post': '?'}, ), footer([ small([ diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index b5997abd06..b8ace390e8 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,7 +2,7 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var be=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Te.set(i,a),a}function Vn(r=Tt){let e=Te.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:ln,isAnonymous:un,providerData:st,stsTokenManager:dn}=n;p(it&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var Ut=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var on=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,Gt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var rt="";tt(Ie,async r=>{r?rt=await r.getIdToken():rt=""});fn.on("htmx:config:request",r=>{rt&&(r.detail.headers.Authorization="Bearer "+rt)});window.signInWithEmailPassword=async r=>{r.preventDefault();let e=document.getElementById("email"),n=document.getElementById("password"),t=document.getElementById("login-error"),i=e.value,s=n.value;try{t.innerText="",await rn(Ie,i,s),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,i,s),window.location.href="?"}catch(a){t.innerText="Error creating demo user: "+a.message}else t.innerText="Sign in error: "+o.message}};window.signOut=async()=>{await sn(Ie),window.location.href="?mode=signin"}; +var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},lt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},dt=function(r){return qr(r).replace(/\./g,"")},ht=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ht(r[1]);return e&&JSON.parse(e)},ft=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ft())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var pt=()=>{var r;return(r=ft())===null||r===void 0?void 0:r.config},mt=r=>{var e;return(e=ft())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ut(r,e);return n.subscribe.bind(n)}var ut=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ct),i.error===void 0&&(i.error=ct),i.complete===void 0&&(i.complete=ct);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ct(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var gt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new gt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,vt=new WeakMap,kn=new WeakMap,_t=new WeakMap,It=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),It.set(e,r),e}function ci(r){if(vt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});vt.set(r,e)}var yt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return vt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){yt=r(yt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,yt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(_t.has(r))return _t.get(r);let e=ui(r);return e!==r&&(_t.set(r,e),It.set(e,r)),e}var Te=r=>It.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],Et=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(Et.get(e))return Et.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return Et.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var bt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var Tt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var St="[DEFAULT]",ji={[Tt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,At=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(At.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;At.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function kt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var Ot=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Pt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:St,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=pt()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of At.values())o.addComponent(c);let a=new Ot(n,t,o);return Se.set(i,a),a}function Vn(r=St){let e=Se.get(r);if(!e&&r===St&&pt())return Pt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",wt=null;function Hn(){return wt||(wt=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),wt}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ct=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Rt(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=dt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Rt=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return dt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new bt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ct(e),"PRIVATE")),F(Tt,Ln,r),F(Tt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function en(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Mt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?en(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Mt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var xt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=tn(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Nt(i.auth_time)),issuedAtTime:ce(Nt(i.iat)),expirationTime:ce(Nt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Nt(r){return Number(r)*1e3}function tn(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=ht(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=tn(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Ut=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Ut(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:st,emailVerified:un,isAnonymous:dn,providerData:ot,stsTokenManager:hn}=n;p(st&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof st=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let at=new r({uid:st,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return ot&&Array.isArray(ot)&&(at.providerData=ot.map(Hr=>Object.assign({},Hr))),v&&(at._redirectEventId=v),at}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ft=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ft),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ft),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function nn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return nn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return nn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Vt=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ht=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var jt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Vt(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ht(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",qt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new xt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new qt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Wt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=kt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Wt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Wt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Bt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Bt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=tn(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function rn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await Wt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function sn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function on(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var an=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function cn(r="",e=10){let n="";for(let t=0;t{let l=cn("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function zt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await zt()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await zt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new $t(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await zt();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var Gt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=cn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};Gt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Kt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Kt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Jt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Lt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?en(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?en(r,Wo):`https://${r.authDomain}/${qo}`}var Dt="webStorageSupport",Yt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=an,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Lt(),i);return Ho(e,o,cn())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Lt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Jt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Dt,{type:Dt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Dt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||nn()}},Fr=Yt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Xt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Xt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Qt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new jt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Qt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=mt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function ln(r=Vn()){let e=kt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,an]}),t=mt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Pt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=ln(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var it="";nt(Ie,async r=>{r?it=await r.getIdToken():it=""});Ee.on("htmx:config:request",r=>{it&&(r.detail.headers.Authorization="Bearer "+it)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await sn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await rn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await on(Ie),window.location.href="?mode=signin"}); /*! Bundled license information: @firebase/util/dist/index.esm2017.js: diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index a68ff979c7..7d6f2a8210 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -40,16 +40,15 @@ htmx.on('htmx:config:request', (event: any) => { } }); -// Sign In Logic for HTML Form -(window as any).signInWithEmailPassword = async (event: Event) => { +// Sign In Logic via HTMX Event +htmx.on('#signin-form', 'htmx:confirm', async (event: any) => { event.preventDefault(); - const emailInput = document.getElementById('email') as HTMLInputElement; - const passInput = document.getElementById('password') as HTMLInputElement; + const form = event.target as HTMLFormElement; + const formData = new FormData(form); + const email = formData.get('email') as string; + const pass = formData.get('password') as string; const errorDiv = document.getElementById('login-error') as HTMLDivElement; - const email = emailInput.value; - const pass = passInput.value; - try { errorDiv.innerText = ''; await signInWithEmailAndPassword(auth, email, pass); @@ -67,10 +66,11 @@ htmx.on('htmx:config:request', (event: any) => { errorDiv.innerText = 'Sign in error: ' + error.message; } } -}; +}); -// Sign Out Logic -(window as any).signOut = async () => { +// Sign Out Logic via HTMX Event +htmx.on('#signout-button', 'htmx:confirm', async (event: any) => { + event.preventDefault(); await firebaseSignOut(auth); window.location.href = '?mode=signin'; -}; +}); From a1b76759146f46e36dbf3eeb443173cd303dde21 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Fri, 15 May 2026 17:32:04 +0000 Subject: [PATCH 07/20] little typescript fix --- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index b8ace390e8..8561a3ddb2 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,7 +2,7 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},lt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},dt=function(r){return qr(r).replace(/\./g,"")},ht=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ht(r[1]);return e&&JSON.parse(e)},ft=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ft())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var pt=()=>{var r;return(r=ft())===null||r===void 0?void 0:r.config},mt=r=>{var e;return(e=ft())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ut(r,e);return n.subscribe.bind(n)}var ut=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ct),i.error===void 0&&(i.error=ct),i.complete===void 0&&(i.complete=ct);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ct(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var gt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new gt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,vt=new WeakMap,kn=new WeakMap,_t=new WeakMap,It=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),It.set(e,r),e}function ci(r){if(vt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});vt.set(r,e)}var yt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return vt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){yt=r(yt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,yt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(_t.has(r))return _t.get(r);let e=ui(r);return e!==r&&(_t.set(r,e),It.set(e,r)),e}var Te=r=>It.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],Et=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(Et.get(e))return Et.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return Et.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var bt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var Tt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var St="[DEFAULT]",ji={[Tt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,At=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(At.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;At.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function kt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var Ot=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Pt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:St,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=pt()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of At.values())o.addComponent(c);let a=new Ot(n,t,o);return Se.set(i,a),a}function Vn(r=St){let e=Se.get(r);if(!e&&r===St&&pt())return Pt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",wt=null;function Hn(){return wt||(wt=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),wt}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ct=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Rt(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=dt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Rt=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return dt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new bt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ct(e),"PRIVATE")),F(Tt,Ln,r),F(Tt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function en(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Mt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?en(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Mt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var xt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=tn(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Nt(i.auth_time)),issuedAtTime:ce(Nt(i.iat)),expirationTime:ce(Nt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Nt(r){return Number(r)*1e3}function tn(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=ht(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=tn(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Ut=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Ut(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:st,emailVerified:un,isAnonymous:dn,providerData:ot,stsTokenManager:hn}=n;p(st&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof st=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let at=new r({uid:st,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return ot&&Array.isArray(ot)&&(at.providerData=ot.map(Hr=>Object.assign({},Hr))),v&&(at._redirectEventId=v),at}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ft=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ft),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ft),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function nn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return nn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return nn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Vt=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ht=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var jt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Vt(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ht(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",qt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new xt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new qt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Wt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=kt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Wt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Wt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Bt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Bt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=tn(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function rn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await Wt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function sn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function on(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var an=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function cn(r="",e=10){let n="";for(let t=0;t{let l=cn("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function zt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await zt()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await zt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new $t(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await zt();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var Gt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=cn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};Gt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Kt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Kt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Jt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Lt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?en(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?en(r,Wo):`https://${r.authDomain}/${qo}`}var Dt="webStorageSupport",Yt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=an,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Lt(),i);return Ho(e,o,cn())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Lt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Jt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Dt,{type:Dt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Dt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||nn()}},Fr=Yt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Xt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Xt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Qt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new jt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Qt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=mt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function ln(r=Vn()){let e=kt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,an]}),t=mt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Pt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=ln(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var it="";nt(Ie,async r=>{r?it=await r.getIdToken():it=""});Ee.on("htmx:config:request",r=>{it&&(r.detail.headers.Authorization="Bearer "+it)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await sn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await rn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await on(Ie),window.location.href="?mode=signin"}); +var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var Te=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Se.set(i,a),a}function Vn(r=Tt){let e=Se.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:un,isAnonymous:dn,providerData:st,stsTokenManager:hn}=n;p(it&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ut=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var on=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Gt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var ln="";nt(Ie,async r=>{ln=await r?.getIdToken()??""});Ee.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await sn(Ie),window.location.href="?mode=signin"}); /*! Bundled license information: @firebase/util/dist/index.esm2017.js: diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 7d6f2a8210..d05d90b9d7 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -7,6 +7,7 @@ import { signInWithEmailAndPassword, createUserWithEmailAndPassword, signOut as firebaseSignOut, + User, } from 'firebase/auth'; // Initialize Firebase with placeholder config for prod @@ -25,12 +26,8 @@ if (window.location.hostname === 'localhost' || window.location.hostname === '12 let currentIdToken = ''; -onIdTokenChanged(auth, async (user: any) => { - if (user) { - currentIdToken = await user.getIdToken(); - } else { - currentIdToken = ''; - } +onIdTokenChanged(auth, async (user: User | null) => { + currentIdToken = (await user?.getIdToken()) ?? ''; }); // Configure HTMX to attach Authorization header From 08d383b7fe31f7838325ed83b2a0af2951d88ecc Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Fri, 15 May 2026 18:29:54 +0000 Subject: [PATCH 08/20] strip comments in js build --- Dart/htmx/dart-htmx/lib/src/app_js.dart | 1414 ----------------------- Dart/htmx/dart-htmx/web/package.json | 2 +- 2 files changed, 1 insertion(+), 1415 deletions(-) diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index 8561a3ddb2..a2fc207751 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -3,1418 +3,4 @@ const String appJs = r''' var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var Te=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Se.set(i,a),a}function Vn(r=Tt){let e=Se.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:un,isAnonymous:dn,providerData:st,stsTokenManager:hn}=n;p(it&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ut=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var on=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Gt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var ln="";nt(Ie,async r=>{ln=await r?.getIdToken()??""});Ee.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await sn(Ie),window.location.href="?mode=signin"}); -/*! Bundled license information: - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/util/dist/index.esm2017.js: - (** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/component/dist/esm/index.esm2017.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/logger/dist/esm/index.esm2017.js: - (** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/app/dist/esm/index.esm2017.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/app/dist/esm/index.esm2017.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/app/dist/esm/index.esm2017.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/app/dist/esm/index.esm2017.js: - (** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -firebase/app/dist/esm/index.esm.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - -@firebase/auth/dist/esm2017/index-68602d24.js: - (** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) - (** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *) -*/ '''; diff --git a/Dart/htmx/dart-htmx/web/package.json b/Dart/htmx/dart-htmx/web/package.json index 359836779a..3a8d3bd914 100644 --- a/Dart/htmx/dart-htmx/web/package.json +++ b/Dart/htmx/dart-htmx/web/package.json @@ -11,7 +11,7 @@ "typescript": "^5.3.3" }, "scripts": { - "build": "esbuild app.ts --bundle --outfile=dist/app.bundle.js --format=esm --minify", + "build": "esbuild app.ts --bundle --outfile=dist/app.bundle.js --format=esm --minify --legal-comments=none", "format": "prettier --write app.ts" } } From c21e12447d6efd94298418996bb83e0bace5ef2c Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Fri, 15 May 2026 18:59:43 +0000 Subject: [PATCH 09/20] simplify the firestore example --- Dart/htmx/dart-htmx/README.md | 6 +- Dart/htmx/dart-htmx/bin/server.dart | 114 +++++++++------------------- 2 files changed, 40 insertions(+), 80 deletions(-) diff --git a/Dart/htmx/dart-htmx/README.md b/Dart/htmx/dart-htmx/README.md index 2f400d3ab7..f6402f1683 100644 --- a/Dart/htmx/dart-htmx/README.md +++ b/Dart/htmx/dart-htmx/README.md @@ -4,7 +4,9 @@ This sample demonstrates using the **Firebase SDK for Cloud Functions** with Dar ## Introduction -The `contact` function serves an HTML page with a contact card. Using HTMX, clicking "Click To Edit" fetches an edit form and swaps it into the page without a full reload. Submitting the form updates the contact in Firestore and swaps the updated display card back into the page. +The `contact` function serves an HTML page displaying a public message. Using HTMX, clicking "Click To Edit" fetches an edit form and swaps it into the page without a full reload. Submitting the form updates the message in Firestore (`messages/message`) and swaps the updated display card back into the page. + +Unauthenticated users can view the public message, while signed-in users can edit it. If an unauthenticated user attempts to edit, they are automatically redirected to a basic email/password sign-in page. Further reading: - [Read more about Cloud Functions for Firebase](https://firebase.google.com/docs/functions) @@ -51,7 +53,7 @@ Alternatively, you can call `firebase emulators:start` to test the functions on After deploying the function, check the CLI's output to see the URL for your function. -Open the URL in a browser to view the contact card, click "Click To Edit", modify the details, and click "Save" to see HTMX and Firestore in action. +Open the URL in a browser to view the public message card. Click "Click To Edit" to sign in with demo credentials (`test@example.com` / `Test@12345`), modify the message text, and click "Save" to see HTMX, Firebase Auth, and Firestore in action. ## Contributing diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index 8a2ae51747..869e7b38d5 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -6,44 +6,26 @@ import 'package:jaspr/dom.dart'; import 'package:jaspr/server.dart'; import '../lib/src/app_js.dart'; -class Contact { - String firstName; - String lastName; - String email; +class MessageData { + String text; - Contact({ - required this.firstName, - required this.lastName, - required this.email, - }); + MessageData({required this.text}); - factory Contact.fromJson(Map json) { - return Contact( - firstName: json['firstName'] as String? ?? 'Jane', - lastName: json['lastName'] as String? ?? 'Doe', - email: json['email'] as String? ?? 'jane.doe@example.com', - ); + factory MessageData.fromJson(Map json) { + return MessageData(text: json['text'] as String? ?? 'Hello World!'); } - Map toJson() => { - 'firstName': firstName, - 'lastName': lastName, - 'email': email, - }; + Map toJson() => {'text': text}; } -Future getContact(DocumentReference ref) async { +Future getMessage(DocumentReference ref) async { final snapshot = await ref.get(); if (!snapshot.exists) { - final defaultContact = Contact( - firstName: 'Jane', - lastName: 'Doe', - email: 'jane.doe@example.com', - ); - await ref.set(defaultContact.toJson()); - return defaultContact; + final defaultMessage = MessageData(text: 'Hello World!'); + await ref.set(defaultMessage.toJson()); + return defaultMessage; } - return Contact.fromJson(snapshot.data()!); + return MessageData.fromJson(snapshot.data()!); } Future verifyAuthHeader( @@ -111,63 +93,41 @@ class BaseDocument extends StatelessComponent { } } -Component createDisplayView(Contact contact) { +Component createDisplayView(MessageData msg) { return article([ - header([Component.text('Contact Info')]), + header([Component.text('Public Message')]), div([ - div([ - strong([Component.text('First Name: ')]), - Component.text(contact.firstName), - ]), - div([ - strong([Component.text('Last Name: ')]), - Component.text(contact.lastName), - ]), - div([ - strong([Component.text('Email: ')]), - Component.text(contact.email), - ]), - ], classes: 'grid'), + blockquote([Component.text(msg.text)]), + ]), footer([ button( [Component.text('Click To Edit')], classes: 'secondary', attributes: { 'hx-get': '?mode=edit', - 'hx-target': '#contact-card', + 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, ), ]), - ], id: 'contact-card'); + ], id: 'message-card'); } -Component createEditView(Contact contact) { +Component createEditView(MessageData msg) { return article([ form( [ - header([Component.text('Edit Contact')]), + header([Component.text('Edit Message')]), div([ label([ - Component.text('First Name'), + Component.text('Message Text'), input( type: InputType.text, - name: 'firstName', - value: contact.firstName, + name: 'text', + value: msg.text, + attributes: {'required': 'true'}, ), ]), - label([ - Component.text('Last Name'), - input( - type: InputType.text, - name: 'lastName', - value: contact.lastName, - ), - ]), - ], classes: 'grid'), - label([ - Component.text('Email'), - input(type: InputType.email, name: 'email', value: contact.email), ]), footer([ button( @@ -176,7 +136,7 @@ Component createEditView(Contact contact) { type: ButtonType.button, attributes: { 'hx-get': '?', - 'hx-target': '#contact-card', + 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, ), @@ -185,11 +145,11 @@ Component createEditView(Contact contact) { ], attributes: { 'hx-put': '?', - 'hx-target': '#contact-card', + 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, ), - ], id: 'contact-card'); + ], id: 'message-card'); } Component createSignInView() { @@ -247,8 +207,8 @@ void main() { final firestore = Firestore(); firebase.https.onRequest(name: 'contact', (request) async { - final docRef = firestore.collection('contacts').doc('1'); - final contact = await getContact(docRef); + final docRef = firestore.collection('messages').doc('message'); + final msg = await getMessage(docRef); final mode = request.url.queryParameters['mode']; final isHxRequest = request.headers['hx-request'] == 'true'; @@ -282,11 +242,11 @@ void main() { } } - final editView = createEditView(contact); + final editView = createEditView(msg); final result = await renderComponent( isHxRequest ? editView - : BaseDocument(titleText: 'Edit Contact', child: editView), + : BaseDocument(titleText: 'Edit Message', child: editView), request: request, ); return Response.ok( @@ -294,11 +254,11 @@ void main() { headers: {'content-type': 'text/html'}, ); } else { - final displayView = createDisplayView(contact); + final displayView = createDisplayView(msg); final result = await renderComponent( isHxRequest ? displayView - : BaseDocument(titleText: 'Contact', child: displayView), + : BaseDocument(titleText: 'Public Message', child: displayView), request: request, ); return Response.ok( @@ -319,17 +279,15 @@ void main() { final bodyStr = await request.readAsString(); final formData = Uri.splitQueryString(bodyStr); - contact.firstName = formData['firstName'] ?? contact.firstName; - contact.lastName = formData['lastName'] ?? contact.lastName; - contact.email = formData['email'] ?? contact.email; + msg.text = formData['text'] ?? msg.text; - await docRef.set(contact.toJson()); + await docRef.set(msg.toJson()); - final displayView = createDisplayView(contact); + final displayView = createDisplayView(msg); final result = await renderComponent( isHxRequest ? displayView - : BaseDocument(titleText: 'Contact', child: displayView), + : BaseDocument(titleText: 'Public Message', child: displayView), request: request, ); return Response.ok(result.body, headers: {'content-type': 'text/html'}); From 7173cb6a2e5cd86787e531c0b97d94e59fbc7dfd Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 16:14:42 +0000 Subject: [PATCH 10/20] add a note about cookie auth --- Dart/htmx/dart-htmx/bin/server.dart | 5 +++++ Dart/htmx/dart-htmx/web/app.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index 869e7b38d5..3f6b3d7c71 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -28,6 +28,11 @@ Future getMessage(DocumentReference ref) async { return MessageData.fromJson(snapshot.data()!); } +/// Extracts and verifies the `Authorization: Bearer ` header. +/// +/// NOTE: This header-based authentication could potentially be replaced with native +/// cookie-based authentication using Firebase's `browserCookiePersistence` once that +/// graduates from Beta/Public Preview. Future verifyAuthHeader( Request request, FirebaseApp app, diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index d05d90b9d7..438dc24195 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -31,6 +31,8 @@ onIdTokenChanged(auth, async (user: User | null) => { }); // Configure HTMX to attach Authorization header +// NOTE: This manual header injection could potentially be replaced with native browser cookies +// using `browserCookiePersistence` once it graduates from Beta/Public Preview. htmx.on('htmx:config:request', (event: any) => { if (currentIdToken) { event.detail.headers['Authorization'] = 'Bearer ' + currentIdToken; From 959e32d5f1ed34db7a1151415fad1b496c1950d9 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 17:31:22 +0000 Subject: [PATCH 11/20] fix urls --- Dart/htmx/dart-htmx/bin/server.dart | 24 +++++++++++++++--------- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 6 +++--- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index 3f6b3d7c71..ba0716108f 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -87,7 +87,7 @@ class BaseDocument extends StatelessComponent { [Component.text('Sign Out')], classes: 'secondary outline', id: 'signout-button', - attributes: {'hx-get': '?'}, + attributes: {'hx-get': '/contact'}, ), ]), ]), @@ -109,7 +109,7 @@ Component createDisplayView(MessageData msg) { [Component.text('Click To Edit')], classes: 'secondary', attributes: { - 'hx-get': '?mode=edit', + 'hx-get': '/contact?mode=edit', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -140,7 +140,7 @@ Component createEditView(MessageData msg) { classes: 'secondary', type: ButtonType.button, attributes: { - 'hx-get': '?', + 'hx-get': '/contact', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -149,7 +149,7 @@ Component createEditView(MessageData msg) { ], classes: 'grid'), ], attributes: { - 'hx-put': '?', + 'hx-put': '/contact', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -191,7 +191,7 @@ Component createSignInView() { button([Component.text('Sign In')], type: ButtonType.submit), ], id: 'signin-form', - attributes: {'hx-post': '?'}, + attributes: {'hx-post': '/contact'}, ), footer([ small([ @@ -241,9 +241,12 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response(401, headers: {'HX-Redirect': '?mode=signin'}); + return Response( + 401, + headers: {'HX-Redirect': '/contact?mode=signin'}, + ); } else { - return Response.found('?mode=signin'); + return Response.found('/contact?mode=signin'); } } @@ -275,9 +278,12 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response(401, headers: {'HX-Redirect': '?mode=signin'}); + return Response( + 401, + headers: {'HX-Redirect': '/contact?mode=signin'}, + ); } else { - return Response.found('?mode=signin'); + return Response.found('/contact?mode=signin'); } } diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index a2fc207751..36ae4c91e6 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var Te=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Se.set(i,a),a}function Vn(r=Tt){let e=Se.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:un,isAnonymous:dn,providerData:st,stsTokenManager:hn}=n;p(it&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ut=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var on=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Gt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var ln="";nt(Ie,async r=>{ln=await r?.getIdToken()??""});Ee.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await sn(Ie),window.location.href="?mode=signin"}); +var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var Te=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Se.set(i,a),a}function Vn(r=Tt){let e=Se.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:un,isAnonymous:dn,providerData:st,stsTokenManager:hn}=n;p(it&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ut=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var on=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Gt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var ln="";nt(Ie,async r=>{ln=await r?.getIdToken()??""});Ee.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="/contact"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="/contact"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await sn(Ie),window.location.href="/contact?mode=signin"}); '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 438dc24195..9e48b61cf9 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -51,13 +51,13 @@ htmx.on('#signin-form', 'htmx:confirm', async (event: any) => { try { errorDiv.innerText = ''; await signInWithEmailAndPassword(auth, email, pass); - window.location.href = '?'; + window.location.href = '/contact'; } catch (error: any) { if (error.code === 'auth/user-not-found') { try { // Automatically create the demo user in the emulator await createUserWithEmailAndPassword(auth, email, pass); - window.location.href = '?'; + window.location.href = '/contact'; } catch (createError: any) { errorDiv.innerText = 'Error creating demo user: ' + createError.message; } @@ -71,5 +71,5 @@ htmx.on('#signin-form', 'htmx:confirm', async (event: any) => { htmx.on('#signout-button', 'htmx:confirm', async (event: any) => { event.preventDefault(); await firebaseSignOut(auth); - window.location.href = '?mode=signin'; + window.location.href = '/contact?mode=signin'; }); From 2c64f057cdd2f296779253d2c5f83f87ad9955cc Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 17:37:51 +0000 Subject: [PATCH 12/20] try again --- Dart/htmx/dart-htmx/bin/server.dart | 24 +++++++++--------------- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 6 +++--- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index ba0716108f..3f6b3d7c71 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -87,7 +87,7 @@ class BaseDocument extends StatelessComponent { [Component.text('Sign Out')], classes: 'secondary outline', id: 'signout-button', - attributes: {'hx-get': '/contact'}, + attributes: {'hx-get': '?'}, ), ]), ]), @@ -109,7 +109,7 @@ Component createDisplayView(MessageData msg) { [Component.text('Click To Edit')], classes: 'secondary', attributes: { - 'hx-get': '/contact?mode=edit', + 'hx-get': '?mode=edit', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -140,7 +140,7 @@ Component createEditView(MessageData msg) { classes: 'secondary', type: ButtonType.button, attributes: { - 'hx-get': '/contact', + 'hx-get': '?', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -149,7 +149,7 @@ Component createEditView(MessageData msg) { ], classes: 'grid'), ], attributes: { - 'hx-put': '/contact', + 'hx-put': '?', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -191,7 +191,7 @@ Component createSignInView() { button([Component.text('Sign In')], type: ButtonType.submit), ], id: 'signin-form', - attributes: {'hx-post': '/contact'}, + attributes: {'hx-post': '?'}, ), footer([ small([ @@ -241,12 +241,9 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response( - 401, - headers: {'HX-Redirect': '/contact?mode=signin'}, - ); + return Response(401, headers: {'HX-Redirect': '?mode=signin'}); } else { - return Response.found('/contact?mode=signin'); + return Response.found('?mode=signin'); } } @@ -278,12 +275,9 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response( - 401, - headers: {'HX-Redirect': '/contact?mode=signin'}, - ); + return Response(401, headers: {'HX-Redirect': '?mode=signin'}); } else { - return Response.found('/contact?mode=signin'); + return Response.found('?mode=signin'); } } diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index 36ae4c91e6..a2fc207751 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var Te=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Se.set(i,a),a}function Vn(r=Tt){let e=Se.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:un,isAnonymous:dn,providerData:st,stsTokenManager:hn}=n;p(it&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ut=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var on=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Gt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var ln="";nt(Ie,async r=>{ln=await r?.getIdToken()??""});Ee.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="/contact"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="/contact"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await sn(Ie),window.location.href="/contact?mode=signin"}); +var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var Te=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Se.set(i,a),a}function Vn(r=Tt){let e=Se.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:un,isAnonymous:dn,providerData:st,stsTokenManager:hn}=n;p(it&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ut=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var on=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Gt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var ln="";nt(Ie,async r=>{ln=await r?.getIdToken()??""});Ee.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await sn(Ie),window.location.href="?mode=signin"}); '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 9e48b61cf9..438dc24195 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -51,13 +51,13 @@ htmx.on('#signin-form', 'htmx:confirm', async (event: any) => { try { errorDiv.innerText = ''; await signInWithEmailAndPassword(auth, email, pass); - window.location.href = '/contact'; + window.location.href = '?'; } catch (error: any) { if (error.code === 'auth/user-not-found') { try { // Automatically create the demo user in the emulator await createUserWithEmailAndPassword(auth, email, pass); - window.location.href = '/contact'; + window.location.href = '?'; } catch (createError: any) { errorDiv.innerText = 'Error creating demo user: ' + createError.message; } @@ -71,5 +71,5 @@ htmx.on('#signin-form', 'htmx:confirm', async (event: any) => { htmx.on('#signout-button', 'htmx:confirm', async (event: any) => { event.preventDefault(); await firebaseSignOut(auth); - window.location.href = '/contact?mode=signin'; + window.location.href = '?mode=signin'; }); From 381df225bb7ef8fdfebbb0df6bb429397779f337 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 17:44:45 +0000 Subject: [PATCH 13/20] jaspr base path default was breaking things --- Dart/htmx/dart-htmx/bin/server.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index 3f6b3d7c71..be397b84a9 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -66,6 +66,7 @@ class BaseDocument extends StatelessComponent { return Document( title: titleText, lang: 'en', + base: null, head: [ link( rel: 'stylesheet', From d60f35ef2bf8a823f36719c7ba96bfc0245dd886 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 17:48:18 +0000 Subject: [PATCH 14/20] change eventing --- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 60 +++++++++++++------------ 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index a2fc207751..39ec78ab35 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var Ee=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var we=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new we;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(Te(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(Te(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(Te(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var Te=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Se=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Se.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Se.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new be(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Se.set(i,a),a}function Vn(r=Tt){let e=Se.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Ae(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var De=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),De.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Ce("Failed to decode base64 JWT payload"),null)}catch(i){return Ce("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function Le(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Ae(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",De.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Ae(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await Le(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:it,emailVerified:un,isAnonymous:dn,providerData:st,stsTokenManager:hn}=n;p(it&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof it=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let ot=new r({uid:it,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return st&&Array.isArray(st)&&(ot.providerData=st.map(Hr=>Object.assign({},Hr))),v&&(ot._redirectEventId=v),ot}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await Le(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Me=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Me.type="NONE";var Ut=Me;function Re(r,e,n){return`firebase:${r}:${e}:${n}`}var xe=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Re(this.userKey,i.apiKey,s),this.fullPersistenceKey=Re("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Re(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await xe.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await xe.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var Ue=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var et={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){et=r}function br(r){return et.loadJS(r)}function _s(){return et.recaptchaEnterpriseScript}function vs(){return et.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function tt(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Ae(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Fe=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Fe.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Ve=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Ve{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function nt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var He="__sak";var je=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(He,"1"),this.storage.removeItem(He),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,qe=class extends je{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};qe.type="LOCAL";var Nr=qe;var We=class extends je{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};We.type="SESSION";var on=We;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var Be=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Be.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,$e="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function rt(r,e){return r.transaction([$e],e?"readwrite":"readonly").objectStore($e)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore($e,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains($e)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=rt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=rt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=rt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,ze=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,He,"1"),await Xn(e,He),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=rt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};ze.type="LOCAL";var xr=ze;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var Ge=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends Ge{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",ke=new Map,Gt=class extends Ge{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=ke.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}ke.set(this.auth._key(),e)}return this.bypassAuthState||ke.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){ke.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Re(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Pe=null,e})}var Pe=null;function Oo(r){return Pe=Pe||Ao(r),Pe}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ke=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ke(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ke(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Ve){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Je=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Je{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ye=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Ye.FACTOR_ID="phone";var Xe=class{static assertionForEnrollment(e,n){return Qe._fromSecret(e,n)}static assertionForSignIn(e,n){return Qe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ze._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Xe.FACTOR_ID="totp";var Qe=class r extends Je{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Ze=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Oe(e)||Oe(n))&&(i=!0),i&&(Oe(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Oe(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Oe(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),nt(n,a=>o(a))}}let i=_n("auth");return i&&tt(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&tt(Ie,"http://"+window.location.hostname+":9099");var ln="";nt(Ie,async r=>{ln=await r?.getIdToken()??""});Ee.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});Ee.on("#signin-form","htmx:confirm",async r=>{r.preventDefault();let e=r.target,n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}});Ee.on("#signout-button","htmx:confirm",async r=>{r.preventDefault(),await sn(Ie),window.location.href="?mode=signin"}); +var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var ot=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var be=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Te.set(i,a),a}function Vn(r=Tt){let e=Te.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:un,isAnonymous:dn,providerData:it,stsTokenManager:hn}=n;p(rt&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var Ut=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var on=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,Gt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var ln="";tt(Ie,async r=>{ln=await r?.getIdToken()??""});ot.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});ot.on("htmx:confirm",async r=>{let e=r.target;if(e.id==="signin-form"){r.preventDefault();let n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}}e.id==="signout-button"&&(r.preventDefault(),await sn(Ie),window.location.href="?mode=signin")}); '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 438dc24195..172510c72f 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -39,37 +39,41 @@ htmx.on('htmx:config:request', (event: any) => { } }); -// Sign In Logic via HTMX Event -htmx.on('#signin-form', 'htmx:confirm', async (event: any) => { - event.preventDefault(); - const form = event.target as HTMLFormElement; - const formData = new FormData(form); - const email = formData.get('email') as string; - const pass = formData.get('password') as string; - const errorDiv = document.getElementById('login-error') as HTMLDivElement; +// Global HTMX Event Delegation for Sign In and Sign Out +htmx.on('htmx:confirm', async (event: any) => { + const target = event.target as HTMLElement; - try { - errorDiv.innerText = ''; - await signInWithEmailAndPassword(auth, email, pass); - window.location.href = '?'; - } catch (error: any) { - if (error.code === 'auth/user-not-found') { - try { - // Automatically create the demo user in the emulator - await createUserWithEmailAndPassword(auth, email, pass); - window.location.href = '?'; - } catch (createError: any) { - errorDiv.innerText = 'Error creating demo user: ' + createError.message; + // Intercept Sign In Form + if (target.id === 'signin-form') { + event.preventDefault(); + const formData = new FormData(target as HTMLFormElement); + const email = formData.get('email') as string; + const pass = formData.get('password') as string; + const errorDiv = document.getElementById('login-error') as HTMLDivElement; + + try { + errorDiv.innerText = ''; + await signInWithEmailAndPassword(auth, email, pass); + window.location.href = '?'; + } catch (error: any) { + if (error.code === 'auth/user-not-found') { + try { + // Automatically create the demo user in the emulator + await createUserWithEmailAndPassword(auth, email, pass); + window.location.href = '?'; + } catch (createError: any) { + errorDiv.innerText = 'Error creating demo user: ' + createError.message; + } + } else { + errorDiv.innerText = 'Sign in error: ' + error.message; } - } else { - errorDiv.innerText = 'Sign in error: ' + error.message; } } -}); -// Sign Out Logic via HTMX Event -htmx.on('#signout-button', 'htmx:confirm', async (event: any) => { - event.preventDefault(); - await firebaseSignOut(auth); - window.location.href = '?mode=signin'; + // Intercept Sign Out Button + if (target.id === 'signout-button') { + event.preventDefault(); + await firebaseSignOut(auth); + window.location.href = '?mode=signin'; + } }); From 638210b4395ae8fe2e89ce1036e41c0eb549de69 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 17:51:31 +0000 Subject: [PATCH 15/20] try native events --- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index 39ec78ab35..cf747ad022 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var ot=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var be=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Te.set(i,a),a}function Vn(r=Tt){let e=Te.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:un,isAnonymous:dn,providerData:it,stsTokenManager:hn}=n;p(rt&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var Ut=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var on=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,Gt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var ln="";tt(Ie,async r=>{ln=await r?.getIdToken()??""});ot.on("htmx:config:request",r=>{ln&&(r.detail.headers.Authorization="Bearer "+ln)});ot.on("htmx:confirm",async r=>{let e=r.target;if(e.id==="signin-form"){r.preventDefault();let n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await rn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await nn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}}e.id==="signout-button"&&(r.preventDefault(),await sn(Ie),window.location.href="?mode=signin")}); +var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},at=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},lt=function(r){return qr(r).replace(/\./g,"")},ut=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ut(r[1]);return e&&JSON.parse(e)},dt=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=dt())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ht=()=>{var r;return(r=dt())===null||r===void 0?void 0:r.config},ft=r=>{var e;return(e=dt())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ct(r,e);return n.subscribe.bind(n)}var ct=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ot),i.error===void 0&&(i.error=ot),i.complete===void 0&&(i.complete=ot);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ot(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var pt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new pt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,gt=new WeakMap,kn=new WeakMap,mt=new WeakMap,vt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),vt.set(e,r),e}function ci(r){if(gt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});gt.set(r,e)}var _t={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return gt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){_t=r(_t)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,_t):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(mt.has(r))return mt.get(r);let e=ui(r);return e!==r&&(mt.set(r,e),vt.set(e,r)),e}var be=r=>vt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],yt=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yt.get(e))return yt.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return yt.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var Et=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var wt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var bt="[DEFAULT]",ji={[wt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,Tt=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(Tt.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;Tt.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Ct(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var St=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Rt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ht()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of Tt.values())o.addComponent(c);let a=new St(n,t,o);return Te.set(i,a),a}function Vn(r=bt){let e=Te.get(r);if(!e&&r===bt&&ht())return Rt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",It=null;function Hn(){return It||(It=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),It}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,At=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ot(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=lt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ot=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return lt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new Et(e),"PRIVATE")),te(new O("heartbeat",e=>new At(e),"PRIVATE")),F(wt,Ln,r),F(wt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Qt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Dt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Qt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Dt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Lt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=Zt(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(kt(i.auth_time)),issuedAtTime:ce(kt(i.iat)),expirationTime:ce(kt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function kt(r){return Number(r)*1e3}function Zt(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=ut(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=Zt(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Mt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Mt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:ln,isAnonymous:un,providerData:it,stsTokenManager:dn}=n;p(rt&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var xt=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(xt),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(xt),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function en(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return en(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return en(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ut=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ft=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Vt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ut(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ft(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",Ht=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Lt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new Ht(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function jt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Ct(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var qt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?qt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=Zt(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function tn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await jt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function nn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function rn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var sn=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function on(r="",e=10){let n="";for(let t=0;t{let l=on("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function Bt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await Bt()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Bt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Bt();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var $t=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=on();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};$t.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,zt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new zt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Gt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Nt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Qt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Qt(r,Wo):`https://${r.authDomain}/${qo}`}var Pt="webStorageSupport",Kt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=sn,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Nt(),i);return Ho(e,o,on())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Nt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Gt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Pt,{type:Pt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Pt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||en()}},Fr=Kt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Jt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Jt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Yt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Vt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Yt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=ft("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function an(r=Vn()){let e=Ct(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,sn]}),t=ft("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Rt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=an(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var cn="";tt(Ie,async r=>{cn=await r?.getIdToken()??""});fn.on("htmx:config:request",r=>{cn&&(r.detail.headers.Authorization="Bearer "+cn)});document.addEventListener("submit",async r=>{let e=r.target;if(e.id==="signin-form"){r.preventDefault();let n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await nn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await tn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}}});document.addEventListener("click",async r=>{r.target.id==="signout-button"&&(r.preventDefault(),await rn(Ie),window.location.href="?mode=signin")}); '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 172510c72f..3d275098b5 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -39,13 +39,12 @@ htmx.on('htmx:config:request', (event: any) => { } }); -// Global HTMX Event Delegation for Sign In and Sign Out -htmx.on('htmx:confirm', async (event: any) => { +// Intercept Sign In Form Submission (Native Event Delegation) +document.addEventListener('submit', async (event: Event) => { const target = event.target as HTMLElement; - // Intercept Sign In Form if (target.id === 'signin-form') { - event.preventDefault(); + event.preventDefault(); // Halt native browser form submission and page reload const formData = new FormData(target as HTMLFormElement); const email = formData.get('email') as string; const pass = formData.get('password') as string; @@ -69,10 +68,14 @@ htmx.on('htmx:confirm', async (event: any) => { } } } +}); + +// Intercept Sign Out Button Click (Native Event Delegation) +document.addEventListener('click', async (event: Event) => { + const target = event.target as HTMLElement; - // Intercept Sign Out Button if (target.id === 'signout-button') { - event.preventDefault(); + event.preventDefault(); // Prevent HTMX Ajax request from firing await firebaseSignOut(auth); window.location.href = '?mode=signin'; } From 6917b161f13563ef514665010bbecdb2c96ce17b Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 18:02:20 +0000 Subject: [PATCH 16/20] use htmx 4 way of setting headers --- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index cf747ad022..7b4e5a2213 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},at=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},lt=function(r){return qr(r).replace(/\./g,"")},ut=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ut(r[1]);return e&&JSON.parse(e)},dt=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=dt())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ht=()=>{var r;return(r=dt())===null||r===void 0?void 0:r.config},ft=r=>{var e;return(e=dt())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ct(r,e);return n.subscribe.bind(n)}var ct=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ot),i.error===void 0&&(i.error=ot),i.complete===void 0&&(i.complete=ot);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ot(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var pt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new pt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,gt=new WeakMap,kn=new WeakMap,mt=new WeakMap,vt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),vt.set(e,r),e}function ci(r){if(gt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});gt.set(r,e)}var _t={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return gt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){_t=r(_t)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,_t):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(mt.has(r))return mt.get(r);let e=ui(r);return e!==r&&(mt.set(r,e),vt.set(e,r)),e}var be=r=>vt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],yt=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yt.get(e))return yt.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return yt.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var Et=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var wt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var bt="[DEFAULT]",ji={[wt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,Tt=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(Tt.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;Tt.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Ct(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var St=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Rt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ht()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of Tt.values())o.addComponent(c);let a=new St(n,t,o);return Te.set(i,a),a}function Vn(r=bt){let e=Te.get(r);if(!e&&r===bt&&ht())return Rt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",It=null;function Hn(){return It||(It=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),It}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,At=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ot(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=lt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ot=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return lt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new Et(e),"PRIVATE")),te(new O("heartbeat",e=>new At(e),"PRIVATE")),F(wt,Ln,r),F(wt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Qt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Dt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Qt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Dt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Lt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=Zt(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(kt(i.auth_time)),issuedAtTime:ce(kt(i.iat)),expirationTime:ce(kt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function kt(r){return Number(r)*1e3}function Zt(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=ut(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=Zt(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Mt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Mt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:ln,isAnonymous:un,providerData:it,stsTokenManager:dn}=n;p(rt&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var xt=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(xt),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(xt),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function en(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return en(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return en(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ut=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ft=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Vt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ut(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ft(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",Ht=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Lt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new Ht(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function jt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Ct(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var qt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?qt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=Zt(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function tn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await jt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function nn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function rn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var sn=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function on(r="",e=10){let n="";for(let t=0;t{let l=on("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function Bt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await Bt()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Bt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Bt();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var $t=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=on();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};$t.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,zt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new zt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Gt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Nt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Qt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Qt(r,Wo):`https://${r.authDomain}/${qo}`}var Pt="webStorageSupport",Kt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=sn,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Nt(),i);return Ho(e,o,on())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Nt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Gt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Pt,{type:Pt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Pt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||en()}},Fr=Kt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Jt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Jt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Yt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Vt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Yt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=ft("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function an(r=Vn()){let e=Ct(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,sn]}),t=ft("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Rt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=an(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var cn="";tt(Ie,async r=>{cn=await r?.getIdToken()??""});fn.on("htmx:config:request",r=>{cn&&(r.detail.headers.Authorization="Bearer "+cn)});document.addEventListener("submit",async r=>{let e=r.target;if(e.id==="signin-form"){r.preventDefault();let n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await nn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await tn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}}});document.addEventListener("click",async r=>{r.target.id==="signout-button"&&(r.preventDefault(),await rn(Ie),window.location.href="?mode=signin")}); +var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},at=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},lt=function(r){return qr(r).replace(/\./g,"")},ut=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ut(r[1]);return e&&JSON.parse(e)},dt=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=dt())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ht=()=>{var r;return(r=dt())===null||r===void 0?void 0:r.config},ft=r=>{var e;return(e=dt())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ct(r,e);return n.subscribe.bind(n)}var ct=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ot),i.error===void 0&&(i.error=ot),i.complete===void 0&&(i.complete=ot);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ot(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var pt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new pt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,gt=new WeakMap,kn=new WeakMap,mt=new WeakMap,vt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),vt.set(e,r),e}function ci(r){if(gt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});gt.set(r,e)}var _t={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return gt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){_t=r(_t)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,_t):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(mt.has(r))return mt.get(r);let e=ui(r);return e!==r&&(mt.set(r,e),vt.set(e,r)),e}var be=r=>vt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],yt=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yt.get(e))return yt.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return yt.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var Et=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var wt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var bt="[DEFAULT]",ji={[wt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,Tt=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(Tt.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;Tt.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Ct(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var St=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Rt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ht()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of Tt.values())o.addComponent(c);let a=new St(n,t,o);return Te.set(i,a),a}function Vn(r=bt){let e=Te.get(r);if(!e&&r===bt&&ht())return Rt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",It=null;function Hn(){return It||(It=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),It}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,At=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ot(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=lt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ot=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return lt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new Et(e),"PRIVATE")),te(new O("heartbeat",e=>new At(e),"PRIVATE")),F(wt,Ln,r),F(wt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Qt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Dt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Qt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Dt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Lt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=Zt(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(kt(i.auth_time)),issuedAtTime:ce(kt(i.iat)),expirationTime:ce(kt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function kt(r){return Number(r)*1e3}function Zt(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=ut(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=Zt(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Mt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Mt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:ln,isAnonymous:un,providerData:it,stsTokenManager:dn}=n;p(rt&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var xt=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(xt),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(xt),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function en(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return en(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return en(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ut=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ft=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Vt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ut(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ft(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",Ht=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Lt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new Ht(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function jt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Ct(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var qt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?qt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=Zt(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function tn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await jt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function nn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function rn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var sn=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function on(r="",e=10){let n="";for(let t=0;t{let l=on("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function Bt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await Bt()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Bt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Bt();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var $t=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=on();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};$t.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,zt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new zt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Gt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Nt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Qt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Qt(r,Wo):`https://${r.authDomain}/${qo}`}var Pt="webStorageSupport",Kt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=sn,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Nt(),i);return Ho(e,o,on())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Nt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Gt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Pt,{type:Pt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Pt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||en()}},Fr=Kt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Jt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Jt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Yt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Vt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Yt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=ft("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function an(r=Vn()){let e=Ct(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,sn]}),t=ft("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Rt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=an(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var cn="";tt(Ie,async r=>{cn=await r?.getIdToken()??""});fn.on("htmx:config:request",r=>{cn&&(r.detail.ctx.request.headers.Authorization="Bearer "+cn)});document.addEventListener("submit",async r=>{let e=r.target;if(e.id==="signin-form"){r.preventDefault();let n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await nn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await tn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}}});document.addEventListener("click",async r=>{r.target.id==="signout-button"&&(r.preventDefault(),await rn(Ie),window.location.href="?mode=signin")}); '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 3d275098b5..cfe9d58a86 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -35,7 +35,7 @@ onIdTokenChanged(auth, async (user: User | null) => { // using `browserCookiePersistence` once it graduates from Beta/Public Preview. htmx.on('htmx:config:request', (event: any) => { if (currentIdToken) { - event.detail.headers['Authorization'] = 'Bearer ' + currentIdToken; + event.detail.ctx.request.headers['Authorization'] = 'Bearer ' + currentIdToken; } }); From 60b86671d38f49bf55e3d1de59530941fd4fd0f7 Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 18:33:26 +0000 Subject: [PATCH 17/20] rethink eventing --- Dart/htmx/dart-htmx/bin/server.dart | 13 ++++- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 66 +++++++++++-------------- 3 files changed, 41 insertions(+), 40 deletions(-) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index be397b84a9..442144e876 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -88,7 +88,10 @@ class BaseDocument extends StatelessComponent { [Component.text('Sign Out')], classes: 'secondary outline', id: 'signout-button', - attributes: {'hx-get': '?'}, + attributes: { + 'onclick': + 'event.preventDefault(); window.firebaseSignOut();', + }, ), ]), ]), @@ -192,7 +195,10 @@ Component createSignInView() { button([Component.text('Sign In')], type: ButtonType.submit), ], id: 'signin-form', - attributes: {'hx-post': '?'}, + attributes: { + 'onsubmit': + "event.preventDefault(); window.firebaseSignIn(this.email.value, this.password.value, 'login-error');", + }, ), footer([ small([ @@ -213,6 +219,9 @@ void main() { final firestore = Firestore(); firebase.https.onRequest(name: 'contact', (request) async { + print( + 'GCF Request: ${request.method} ${request.requestedUri.path} - Headers: ${request.headers}', + ); final docRef = firestore.collection('messages').doc('message'); final msg = await getMessage(docRef); diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index 7b4e5a2213..461ed60eda 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},at=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},lt=function(r){return qr(r).replace(/\./g,"")},ut=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ut(r[1]);return e&&JSON.parse(e)},dt=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=dt())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ht=()=>{var r;return(r=dt())===null||r===void 0?void 0:r.config},ft=r=>{var e;return(e=dt())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ct(r,e);return n.subscribe.bind(n)}var ct=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ot),i.error===void 0&&(i.error=ot),i.complete===void 0&&(i.complete=ot);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ot(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var pt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new pt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,gt=new WeakMap,kn=new WeakMap,mt=new WeakMap,vt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),vt.set(e,r),e}function ci(r){if(gt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});gt.set(r,e)}var _t={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return gt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){_t=r(_t)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,_t):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(mt.has(r))return mt.get(r);let e=ui(r);return e!==r&&(mt.set(r,e),vt.set(e,r)),e}var be=r=>vt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],yt=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yt.get(e))return yt.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return yt.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var Et=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var wt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var bt="[DEFAULT]",ji={[wt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,Tt=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(Tt.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;Tt.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Ct(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var St=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Rt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ht()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of Tt.values())o.addComponent(c);let a=new St(n,t,o);return Te.set(i,a),a}function Vn(r=bt){let e=Te.get(r);if(!e&&r===bt&&ht())return Rt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",It=null;function Hn(){return It||(It=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),It}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,At=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ot(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=lt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ot=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return lt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new Et(e),"PRIVATE")),te(new O("heartbeat",e=>new At(e),"PRIVATE")),F(wt,Ln,r),F(wt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Qt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Dt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Qt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Dt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Lt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=Zt(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(kt(i.auth_time)),issuedAtTime:ce(kt(i.iat)),expirationTime:ce(kt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function kt(r){return Number(r)*1e3}function Zt(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=ut(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=Zt(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Mt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Mt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:ln,isAnonymous:un,providerData:it,stsTokenManager:dn}=n;p(rt&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var xt=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(xt),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(xt),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function en(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return en(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return en(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ut=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ft=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Vt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ut(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ft(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",Ht=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Lt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new Ht(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function jt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Ct(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var qt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?qt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=Zt(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function tn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await jt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function nn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function rn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var sn=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function on(r="",e=10){let n="";for(let t=0;t{let l=on("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function Bt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await Bt()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Bt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Bt();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var $t=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=on();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};$t.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,zt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new zt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Gt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Nt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Qt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Qt(r,Wo):`https://${r.authDomain}/${qo}`}var Pt="webStorageSupport",Kt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=sn,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Nt(),i);return Ho(e,o,on())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Nt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Gt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Pt,{type:Pt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Pt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||en()}},Fr=Kt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Jt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Jt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Yt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Vt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Yt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=ft("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function an(r=Vn()){let e=Ct(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,sn]}),t=ft("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Rt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=an(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var cn="";tt(Ie,async r=>{cn=await r?.getIdToken()??""});fn.on("htmx:config:request",r=>{cn&&(r.detail.ctx.request.headers.Authorization="Bearer "+cn)});document.addEventListener("submit",async r=>{let e=r.target;if(e.id==="signin-form"){r.preventDefault();let n=new FormData(e),t=n.get("email"),i=n.get("password"),s=document.getElementById("login-error");try{s.innerText="",await nn(Ie,t,i),window.location.href="?"}catch(o){if(o.code==="auth/user-not-found")try{await tn(Ie,t,i),window.location.href="?"}catch(a){s.innerText="Error creating demo user: "+a.message}else s.innerText="Sign in error: "+o.message}}});document.addEventListener("click",async r=>{r.target.id==="signout-button"&&(r.preventDefault(),await rn(Ie),window.location.href="?mode=signin")}); +var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},at=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},lt=function(r){return qr(r).replace(/\./g,"")},ut=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ut(r[1]);return e&&JSON.parse(e)},dt=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=dt())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ht=()=>{var r;return(r=dt())===null||r===void 0?void 0:r.config},ft=r=>{var e;return(e=dt())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ct(r,e);return n.subscribe.bind(n)}var ct=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ot),i.error===void 0&&(i.error=ot),i.complete===void 0&&(i.complete=ot);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ot(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var pt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new pt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,gt=new WeakMap,kn=new WeakMap,mt=new WeakMap,vt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),vt.set(e,r),e}function ci(r){if(gt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});gt.set(r,e)}var _t={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return gt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){_t=r(_t)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,_t):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(mt.has(r))return mt.get(r);let e=ui(r);return e!==r&&(mt.set(r,e),vt.set(e,r)),e}var be=r=>vt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],yt=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yt.get(e))return yt.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return yt.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var Et=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var wt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var bt="[DEFAULT]",ji={[wt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,Tt=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(Tt.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;Tt.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Ct(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var St=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Rt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ht()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of Tt.values())o.addComponent(c);let a=new St(n,t,o);return Te.set(i,a),a}function Vn(r=bt){let e=Te.get(r);if(!e&&r===bt&&ht())return Rt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",It=null;function Hn(){return It||(It=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),It}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,At=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ot(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=lt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ot=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return lt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new Et(e),"PRIVATE")),te(new O("heartbeat",e=>new At(e),"PRIVATE")),F(wt,Ln,r),F(wt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Qt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Dt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Qt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Dt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Lt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=Zt(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(kt(i.auth_time)),issuedAtTime:ce(kt(i.iat)),expirationTime:ce(kt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function kt(r){return Number(r)*1e3}function Zt(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=ut(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=Zt(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Mt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Mt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:ln,isAnonymous:un,providerData:it,stsTokenManager:dn}=n;p(rt&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var xt=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(xt),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(xt),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function en(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return en(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return en(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ut=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ft=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Vt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ut(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ft(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",Ht=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Lt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new Ht(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function jt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Ct(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var qt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?qt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=Zt(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function tn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await jt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function nn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function rn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var sn=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function on(r="",e=10){let n="";for(let t=0;t{let l=on("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function Bt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await Bt()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Bt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Bt();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var $t=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=on();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};$t.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,zt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new zt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Gt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Nt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Qt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Qt(r,Wo):`https://${r.authDomain}/${qo}`}var Pt="webStorageSupport",Kt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=sn,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Nt(),i);return Ho(e,o,on())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Nt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Gt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Pt,{type:Pt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Pt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||en()}},Fr=Kt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Jt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Jt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Yt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Vt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Yt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=ft("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function an(r=Vn()){let e=Ct(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,sn]}),t=ft("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Rt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=an(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var cn="";tt(Ie,async r=>{cn=await r?.getIdToken()??""});fn.on("htmx:config:request",r=>{cn&&(r.detail.ctx.request.headers.Authorization="Bearer "+cn)});window.firebaseSignIn=async(r,e,n)=>{let t=document.getElementById(n);try{t&&(t.innerText=""),await nn(Ie,r,e),window.location.href="?"}catch(i){if(i.code==="auth/user-not-found"||i.code==="auth/invalid-credential")try{await tn(Ie,r,e),window.location.href="?"}catch(s){t&&(t.innerText="Error creating demo user: "+s.message)}else t&&(t.innerText="Sign in error: "+i.message)}};window.firebaseSignOut=async()=>{await rn(Ie),window.location.href="?mode=signin"}; '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index cfe9d58a86..c9966ce2ef 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -30,7 +30,7 @@ onIdTokenChanged(auth, async (user: User | null) => { currentIdToken = (await user?.getIdToken()) ?? ''; }); -// Configure HTMX to attach Authorization header +// Configure HTMX to attach Authorization header (HTMX v4 context API) // NOTE: This manual header injection could potentially be replaced with native browser cookies // using `browserCookiePersistence` once it graduates from Beta/Public Preview. htmx.on('htmx:config:request', (event: any) => { @@ -39,44 +39,36 @@ htmx.on('htmx:config:request', (event: any) => { } }); -// Intercept Sign In Form Submission (Native Event Delegation) -document.addEventListener('submit', async (event: Event) => { - const target = event.target as HTMLElement; - - if (target.id === 'signin-form') { - event.preventDefault(); // Halt native browser form submission and page reload - const formData = new FormData(target as HTMLFormElement); - const email = formData.get('email') as string; - const pass = formData.get('password') as string; - const errorDiv = document.getElementById('login-error') as HTMLDivElement; +// Expose clean global helpers on window for Locality of Behavior (LoB) inline event handlers +declare global { + interface Window { + firebaseSignIn: (email: string, pass: string, errorDivId: string) => Promise; + firebaseSignOut: () => Promise; + } +} - try { - errorDiv.innerText = ''; - await signInWithEmailAndPassword(auth, email, pass); - window.location.href = '?'; - } catch (error: any) { - if (error.code === 'auth/user-not-found') { - try { - // Automatically create the demo user in the emulator - await createUserWithEmailAndPassword(auth, email, pass); - window.location.href = '?'; - } catch (createError: any) { - errorDiv.innerText = 'Error creating demo user: ' + createError.message; - } - } else { - errorDiv.innerText = 'Sign in error: ' + error.message; +window.firebaseSignIn = async (email: string, pass: string, errorDivId: string) => { + const errorDiv = document.getElementById(errorDivId) as HTMLDivElement; + try { + if (errorDiv) errorDiv.innerText = ''; + await signInWithEmailAndPassword(auth, email, pass); + window.location.href = '?'; + } catch (error: any) { + if (error.code === 'auth/user-not-found' || error.code === 'auth/invalid-credential') { + try { + // Automatically create the demo user in the emulator + await createUserWithEmailAndPassword(auth, email, pass); + window.location.href = '?'; + } catch (createError: any) { + if (errorDiv) errorDiv.innerText = 'Error creating demo user: ' + createError.message; } + } else { + if (errorDiv) errorDiv.innerText = 'Sign in error: ' + error.message; } } -}); +}; -// Intercept Sign Out Button Click (Native Event Delegation) -document.addEventListener('click', async (event: Event) => { - const target = event.target as HTMLElement; - - if (target.id === 'signout-button') { - event.preventDefault(); // Prevent HTMX Ajax request from firing - await firebaseSignOut(auth); - window.location.href = '?mode=signin'; - } -}); +window.firebaseSignOut = async () => { + await firebaseSignOut(auth); + window.location.href = '?mode=signin'; +}; From 2fc64d631723c5ed21fb708b62de26a5303956fe Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 18:45:51 +0000 Subject: [PATCH 18/20] explicitly set basePath --- Dart/htmx/dart-htmx/bin/server.dart | 56 ++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index 442144e876..1bd9802dbb 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -54,10 +54,12 @@ class BaseDocument extends StatelessComponent { final String titleText; final Component child; final bool showSignOut; + final String basePath; const BaseDocument({ required this.titleText, required this.child, + required this.basePath, this.showSignOut = true, }); @@ -102,7 +104,7 @@ class BaseDocument extends StatelessComponent { } } -Component createDisplayView(MessageData msg) { +Component createDisplayView(MessageData msg, String basePath) { return article([ header([Component.text('Public Message')]), div([ @@ -113,7 +115,7 @@ Component createDisplayView(MessageData msg) { [Component.text('Click To Edit')], classes: 'secondary', attributes: { - 'hx-get': '?mode=edit', + 'hx-get': '$basePath?mode=edit', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -122,7 +124,7 @@ Component createDisplayView(MessageData msg) { ], id: 'message-card'); } -Component createEditView(MessageData msg) { +Component createEditView(MessageData msg, String basePath) { return article([ form( [ @@ -144,7 +146,7 @@ Component createEditView(MessageData msg) { classes: 'secondary', type: ButtonType.button, attributes: { - 'hx-get': '?', + 'hx-get': basePath, 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -153,7 +155,7 @@ Component createEditView(MessageData msg) { ], classes: 'grid'), ], attributes: { - 'hx-put': '?', + 'hx-put': basePath, 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -161,7 +163,7 @@ Component createEditView(MessageData msg) { ], id: 'message-card'); } -Component createSignInView() { +Component createSignInView(String basePath) { return article([ header([Component.text('Sign In Required')]), form( @@ -225,18 +227,20 @@ void main() { final docRef = firestore.collection('messages').doc('message'); final msg = await getMessage(docRef); + final basePath = request.requestedUri.path; final mode = request.url.queryParameters['mode']; final isHxRequest = request.headers['hx-request'] == 'true'; if (request.method == 'GET') { if (mode == 'signin') { - final signInView = createSignInView(); + final signInView = createSignInView(basePath); final result = await renderComponent( isHxRequest ? signInView : BaseDocument( titleText: 'Sign In', child: signInView, + basePath: basePath, showSignOut: false, ), request: request, @@ -251,17 +255,24 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response(401, headers: {'HX-Redirect': '?mode=signin'}); + return Response( + 401, + headers: {'HX-Redirect': '$basePath?mode=signin'}, + ); } else { - return Response.found('?mode=signin'); + return Response.found('$basePath?mode=signin'); } } - final editView = createEditView(msg); + final editView = createEditView(msg, basePath); final result = await renderComponent( isHxRequest ? editView - : BaseDocument(titleText: 'Edit Message', child: editView), + : BaseDocument( + titleText: 'Edit Message', + child: editView, + basePath: basePath, + ), request: request, ); return Response.ok( @@ -269,11 +280,15 @@ void main() { headers: {'content-type': 'text/html'}, ); } else { - final displayView = createDisplayView(msg); + final displayView = createDisplayView(msg, basePath); final result = await renderComponent( isHxRequest ? displayView - : BaseDocument(titleText: 'Public Message', child: displayView), + : BaseDocument( + titleText: 'Public Message', + child: displayView, + basePath: basePath, + ), request: request, ); return Response.ok( @@ -285,9 +300,12 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response(401, headers: {'HX-Redirect': '?mode=signin'}); + return Response( + 401, + headers: {'HX-Redirect': '$basePath?mode=signin'}, + ); } else { - return Response.found('?mode=signin'); + return Response.found('$basePath?mode=signin'); } } @@ -298,11 +316,15 @@ void main() { await docRef.set(msg.toJson()); - final displayView = createDisplayView(msg); + final displayView = createDisplayView(msg, basePath); final result = await renderComponent( isHxRequest ? displayView - : BaseDocument(titleText: 'Public Message', child: displayView), + : BaseDocument( + titleText: 'Public Message', + child: displayView, + basePath: basePath, + ), request: request, ); return Response.ok(result.body, headers: {'content-type': 'text/html'}); From 072fb78e67f0d0709667bf99540f8fa2483a8d8a Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 14:46:07 -0400 Subject: [PATCH 19/20] turn on htmx logging --- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index 461ed60eda..86b6a10a79 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var hn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=hn);var fn=hn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},at=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},lt=function(r){return qr(r).replace(/\./g,"")},ut=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ut(r[1]);return e&&JSON.parse(e)},dt=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=dt())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ht=()=>{var r;return(r=dt())===null||r===void 0?void 0:r.config},ft=r=>{var e;return(e=dt())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new ct(r,e);return n.subscribe.bind(n)}var ct=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=ot),i.error===void 0&&(i.error=ot),i.complete===void 0&&(i.complete=ot);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function ot(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var pt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new pt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,gt=new WeakMap,kn=new WeakMap,mt=new WeakMap,vt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),vt.set(e,r),e}function ci(r){if(gt.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});gt.set(r,e)}var _t={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return gt.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){_t=r(_t)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,_t):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(mt.has(r))return mt.get(r);let e=ui(r);return e!==r&&(mt.set(r,e),vt.set(e,r)),e}var be=r=>vt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],yt=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yt.get(e))return yt.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return yt.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var Et=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var wt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var bt="[DEFAULT]",ji={[wt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,Tt=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(Tt.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;Tt.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Ct(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var St=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function Rt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ht()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of Tt.values())o.addComponent(c);let a=new St(n,t,o);return Te.set(i,a),a}function Vn(r=bt){let e=Te.get(r);if(!e&&r===bt&&ht())return Rt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",It=null;function Hn(){return It||(It=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),It}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,At=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ot(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=lt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ot=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return lt(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new Et(e),"PRIVATE")),te(new O("heartbeat",e=>new At(e),"PRIVATE")),F(wt,Ln,r),F(wt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Qt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Dt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Qt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Dt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Lt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=Zt(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(kt(i.auth_time)),issuedAtTime:ce(kt(i.iat)),expirationTime:ce(kt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function kt(r){return Number(r)*1e3}function Zt(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=ut(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=Zt(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var Mt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Mt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:ln,isAnonymous:un,providerData:it,stsTokenManager:dn}=n;p(rt&&dn,e,"internal-error");let Vr=le.fromJSON(this.name,dn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof ln=="boolean",e,"internal-error"),p(typeof un=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:ln,displayName:h,isAnonymous:un,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var xt=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(xt),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(xt),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function en(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return en(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return en(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ut=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Ft=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Vt=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ut(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Ft(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",Ht=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Lt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new Ht(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function jt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Ct(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return jt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var qt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?qt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=Zt(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function tn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await jt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function nn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function rn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var sn=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function on(r="",e=10){let n="";for(let t=0;t{let l=on("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function Bt(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await Bt()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Bt(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Bt();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var $t=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=on();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};$t.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,zt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new zt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Gt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Nt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Qt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Qt(r,Wo):`https://${r.authDomain}/${qo}`}var Pt="webStorageSupport",Kt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=sn,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Nt(),i);return Ho(e,o,on())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Nt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Gt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Pt,{type:Pt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Pt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||en()}},Fr=Kt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Jt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Jt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Yt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Vt(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Yt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=ft("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function an(r=Vn()){let e=Ct(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,sn]}),t=ft("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=Rt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=an(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var cn="";tt(Ie,async r=>{cn=await r?.getIdToken()??""});fn.on("htmx:config:request",r=>{cn&&(r.detail.ctx.request.headers.Authorization="Bearer "+cn)});window.firebaseSignIn=async(r,e,n)=>{let t=document.getElementById(n);try{t&&(t.innerText=""),await nn(Ie,r,e),window.location.href="?"}catch(i){if(i.code==="auth/user-not-found"||i.code==="auth/invalid-credential")try{await tn(Ie,r,e),window.location.href="?"}catch(s){t&&(t.innerText="Error creating demo user: "+s.message)}else t&&(t.innerText="Sign in error: "+i.message)}};window.firebaseSignOut=async()=>{await rn(Ie),window.location.href="?mode=signin"}; +var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var ot=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var be=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Te.set(i,a),a}function Vn(r=Tt){let e=Te.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:un,isAnonymous:dn,providerData:it,stsTokenManager:hn}=n;p(rt&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var Ut=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var on=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,Gt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var ln="";tt(Ie,async r=>{ln=await r?.getIdToken()??""});ot.config.logAll=!0;ot.on("htmx:config:request",r=>{ln&&(r.detail.ctx.request.headers.Authorization="Bearer "+ln)});window.firebaseSignIn=async(r,e,n)=>{let t=document.getElementById(n);try{t&&(t.innerText=""),await rn(Ie,r,e),window.location.href="?"}catch(i){if(i.code==="auth/user-not-found"||i.code==="auth/invalid-credential")try{await nn(Ie,r,e),window.location.href="?"}catch(s){t&&(t.innerText="Error creating demo user: "+s.message)}else t&&(t.innerText="Sign in error: "+i.message)}};window.firebaseSignOut=async()=>{await sn(Ie),window.location.href="?mode=signin"}; '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index c9966ce2ef..1452370eed 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -30,6 +30,8 @@ onIdTokenChanged(auth, async (user: User | null) => { currentIdToken = (await user?.getIdToken()) ?? ''; }); +htmx.config.logAll = true; + // Configure HTMX to attach Authorization header (HTMX v4 context API) // NOTE: This manual header injection could potentially be replaced with native browser cookies // using `browserCookiePersistence` once it graduates from Beta/Public Preview. From 1bc855e8a2237c6c610308ddb28e417107ab2bee Mon Sep 17 00:00:00 2001 From: Jeff Huleatt <3759507+jhuleatt@users.noreply.github.com> Date: Mon, 18 May 2026 18:52:33 +0000 Subject: [PATCH 20/20] back to other way --- Dart/htmx/dart-htmx/bin/server.dart | 56 ++++++++----------------- Dart/htmx/dart-htmx/lib/src/app_js.dart | 2 +- Dart/htmx/dart-htmx/web/app.ts | 6 ++- 3 files changed, 22 insertions(+), 42 deletions(-) diff --git a/Dart/htmx/dart-htmx/bin/server.dart b/Dart/htmx/dart-htmx/bin/server.dart index 1bd9802dbb..442144e876 100644 --- a/Dart/htmx/dart-htmx/bin/server.dart +++ b/Dart/htmx/dart-htmx/bin/server.dart @@ -54,12 +54,10 @@ class BaseDocument extends StatelessComponent { final String titleText; final Component child; final bool showSignOut; - final String basePath; const BaseDocument({ required this.titleText, required this.child, - required this.basePath, this.showSignOut = true, }); @@ -104,7 +102,7 @@ class BaseDocument extends StatelessComponent { } } -Component createDisplayView(MessageData msg, String basePath) { +Component createDisplayView(MessageData msg) { return article([ header([Component.text('Public Message')]), div([ @@ -115,7 +113,7 @@ Component createDisplayView(MessageData msg, String basePath) { [Component.text('Click To Edit')], classes: 'secondary', attributes: { - 'hx-get': '$basePath?mode=edit', + 'hx-get': '?mode=edit', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -124,7 +122,7 @@ Component createDisplayView(MessageData msg, String basePath) { ], id: 'message-card'); } -Component createEditView(MessageData msg, String basePath) { +Component createEditView(MessageData msg) { return article([ form( [ @@ -146,7 +144,7 @@ Component createEditView(MessageData msg, String basePath) { classes: 'secondary', type: ButtonType.button, attributes: { - 'hx-get': basePath, + 'hx-get': '?', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -155,7 +153,7 @@ Component createEditView(MessageData msg, String basePath) { ], classes: 'grid'), ], attributes: { - 'hx-put': basePath, + 'hx-put': '?', 'hx-target': '#message-card', 'hx-swap': 'outerHTML', }, @@ -163,7 +161,7 @@ Component createEditView(MessageData msg, String basePath) { ], id: 'message-card'); } -Component createSignInView(String basePath) { +Component createSignInView() { return article([ header([Component.text('Sign In Required')]), form( @@ -227,20 +225,18 @@ void main() { final docRef = firestore.collection('messages').doc('message'); final msg = await getMessage(docRef); - final basePath = request.requestedUri.path; final mode = request.url.queryParameters['mode']; final isHxRequest = request.headers['hx-request'] == 'true'; if (request.method == 'GET') { if (mode == 'signin') { - final signInView = createSignInView(basePath); + final signInView = createSignInView(); final result = await renderComponent( isHxRequest ? signInView : BaseDocument( titleText: 'Sign In', child: signInView, - basePath: basePath, showSignOut: false, ), request: request, @@ -255,24 +251,17 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response( - 401, - headers: {'HX-Redirect': '$basePath?mode=signin'}, - ); + return Response(401, headers: {'HX-Redirect': '?mode=signin'}); } else { - return Response.found('$basePath?mode=signin'); + return Response.found('?mode=signin'); } } - final editView = createEditView(msg, basePath); + final editView = createEditView(msg); final result = await renderComponent( isHxRequest ? editView - : BaseDocument( - titleText: 'Edit Message', - child: editView, - basePath: basePath, - ), + : BaseDocument(titleText: 'Edit Message', child: editView), request: request, ); return Response.ok( @@ -280,15 +269,11 @@ void main() { headers: {'content-type': 'text/html'}, ); } else { - final displayView = createDisplayView(msg, basePath); + final displayView = createDisplayView(msg); final result = await renderComponent( isHxRequest ? displayView - : BaseDocument( - titleText: 'Public Message', - child: displayView, - basePath: basePath, - ), + : BaseDocument(titleText: 'Public Message', child: displayView), request: request, ); return Response.ok( @@ -300,12 +285,9 @@ void main() { final decodedToken = await verifyAuthHeader(request, adminApp); if (decodedToken == null) { if (isHxRequest) { - return Response( - 401, - headers: {'HX-Redirect': '$basePath?mode=signin'}, - ); + return Response(401, headers: {'HX-Redirect': '?mode=signin'}); } else { - return Response.found('$basePath?mode=signin'); + return Response.found('?mode=signin'); } } @@ -316,15 +298,11 @@ void main() { await docRef.set(msg.toJson()); - final displayView = createDisplayView(msg, basePath); + final displayView = createDisplayView(msg); final result = await renderComponent( isHxRequest ? displayView - : BaseDocument( - titleText: 'Public Message', - child: displayView, - basePath: basePath, - ), + : BaseDocument(titleText: 'Public Message', child: displayView), request: request, ); return Response.ok(result.body, headers: {'content-type': 'text/html'}); diff --git a/Dart/htmx/dart-htmx/lib/src/app_js.dart b/Dart/htmx/dart-htmx/lib/src/app_js.dart index 86b6a10a79..47d8c4d43c 100644 --- a/Dart/htmx/dart-htmx/lib/src/app_js.dart +++ b/Dart/htmx/dart-htmx/lib/src/app_js.dart @@ -2,5 +2,5 @@ // Bundled from web/dist/app.bundle.js const String appJs = r''' -var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var ot=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var be=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Te.set(i,a),a}function Vn(r=Tt){let e=Te.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:un,isAnonymous:dn,providerData:it,stsTokenManager:hn}=n;p(rt&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var Ut=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var on=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,Gt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var ln="";tt(Ie,async r=>{ln=await r?.getIdToken()??""});ot.config.logAll=!0;ot.on("htmx:config:request",r=>{ln&&(r.detail.ctx.request.headers.Authorization="Bearer "+ln)});window.firebaseSignIn=async(r,e,n)=>{let t=document.getElementById(n);try{t&&(t.innerText=""),await rn(Ie,r,e),window.location.href="?"}catch(i){if(i.code==="auth/user-not-found"||i.code==="auth/invalid-credential")try{await nn(Ie,r,e),window.location.href="?"}catch(s){t&&(t.innerText="Error creating demo user: "+s.message)}else t&&(t.innerText="Sign in error: "+i.message)}};window.firebaseSignOut=async()=>{await sn(Ie),window.location.href="?mode=signin"}; +var fn=(()=>{class r{#r=null;#n=[];issue(t,i){return t.queueStrategy=i,this.#r?i==="replace"||i!=="abort"&&this.#r.queueStrategy==="abort"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[],this.#r.request?.abort?.(),this.#r=t,!0):(i==="queue all"?(this.#n.push(t),t.status="queued"):i==="drop"?t.status="dropped":i==="queue last"?(this.#n.forEach(s=>s.status="dropped"),this.#n=[t],t.status="queued"):this.#n.length===0&&i!=="abort"?(this.#n.push(t),t.status="queued"):t.status="dropped",!1):(this.#r=t,!0)}finish(){this.#r=null}next(){return this.#n.shift()}abort(){this.#r?.request?.abort?.()}more(){return this.#n?.length}}class e{#r=new Map;#n="";#q=new Set;#A;#W=Function;#B=Object.getPrototypeOf(async function(){}).constructor;#O={createHTML:t=>t,createScript:t=>t};#$;#ge="a,form";#z=["get","post","put","patch","delete"];#G;#g;#C;#_;constructor(){this.#_e(),this.#ve(),this.#$=this.#a("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#G=new XPathEvaluator().createExpression(`.//*[@*[${this.#P("hx-on").map(i=>`starts-with(name(), "${i}")`).join(" or ")}]]`),this.#A={attributeValue:this.#t.bind(this),parseTriggerSpecs:this.#J.bind(this),determineMethodAndAction:this.#Y.bind(this),createRequestContext:this.#N.bind(this),collectFormData:this.#le.bind(this),getAttributeObject:this.#M.bind(this),insertContent:this.#L.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#ct.bind(this),initSecurity:(i,s,o)=>{i&&(this.#O=i),s&&(this.#W=s),o&&(this.#B=o)},onTrigger:this.#re.bind(this),htmxProp:this.#i.bind(this),triggerHtmxEvent:this.#e.bind(this),executeJavaScript:this.#u.bind(this)};let t=()=>{this.#$e(),this.process(document.body)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#_e(){this.version="4.0.0-beta3",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&this.#y(t.content,this.config),this.#n=this.config.extensions}#ve(){if(this.config.includeIndicatorCSS!==!1){let t=this.config.indicatorClass,i=this.config.requestClass,s=new CSSStyleSheet;s.replaceSync(`.${t}{opacity:0;visibility: hidden} .${i} .${t}, .${i}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]}}registerExtension(t,i){if(this.#n&&!this.#n.split(/,\s*/).includes(t)||this.#q.has(t))return!1;this.#q.add(t),i.init&&i.init(this.#A),Object.entries(i).forEach(([s,o])=>{this.#r.get(s)?.push(o)||this.#r.set(s,[o])})}#R(t){let i=this.config.prefix;return!t.closest||t.closest("[hx-ignore]")!=null||i&&t.closest(`[${i}ignore]`)!=null}#v(t,i){let s=this.config.prefix;return t.getAttribute(i)??(s?t.getAttribute(i.replace("hx-",s)):null)}#k(t,i){let s=this.config.prefix&&i.replace("hx-",this.config.prefix);return t.hasAttribute(i)?i:s&&t.hasAttribute(s)?s:null}#a(t){return this.#P(t).join(",")}#P(t){let i=[t];return this.config.prefix&&i.push(t.replaceAll("hx-",this.config.prefix)),i}#c(t,i){let s=[...t.querySelectorAll?.(i)??[]];return t.matches?.(i)&&s.unshift(t),s}#ye(t){return t==="before"?"beforebegin":t==="after"?"afterend":t==="prepend"?"afterbegin":t==="append"?"beforeend":t}#Ie(t,i){let s=[];return this.#t(t,i,void 0,(o,a)=>{o?.split(/\s*[,:]\s*/).includes("this")&&s.push(a)}),s}#t(t,i,s,o){let a=this.#d(":inherited"),c=this.#d(":append"),l=this.#v(t,i)??this.#v(t,i+a);if(l!=null)return o?o(l,t):l;let d=CSS.escape(this.config.implicitInheritance?i:i+a),h=CSS.escape(i+a+c),u=this.#a(`[${d}],[${h}]`),f=this.#k(t,i+c)??this.#k(t,i+a+c);if(f){let g=t.getAttribute(f),v=t.parentNode?.closest?.(u);if(o&&o(g,t),v){let w=this.#t(v,i,void 0,o);return w?(w+","+g).replace(/[{}]/g,""):g}return g}let m=t.parentNode?.closest?.(u);return m?(l=this.#t(m,i,void 0,o),!o&&l&&this.config.implicitInheritance&&this.#p(t,"htmx:after:implicitInheritance",{elt:t,name:i,parent:m}),l):s}#l(t){if(!t)return{};if(t[0]==="{")return JSON.parse(t);let i=/(?:"([^"]+)"|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<([^>]+)\/>|([^\s,]+)))?(?=\s|,|$)/g;return[...t.matchAll(i)].reduce((s,o)=>{let a=(o[1]??o[2]).split("."),c=(o[3]??o[4]??o[5]??o[6]??"true").trim();return c==="true"?c=!0:c==="false"?c=!1:/^\d+$/.test(c)&&(c=parseInt(c)),a.some(l=>this.#K(l))||(a.slice(0,-1).reduce((l,d)=>l[d]??={},s)[a.at(-1)]=c),s},{})}#K(t){return t==="#proto#"||t==="constructor"||t==="prototype"}#y(t,i){let s=this.#l(t);for(let o in s){if(this.#K(o))continue;let a=s[o];a&&typeof a=="object"&&!Array.isArray(a)&&i[o]?Object.assign(i[o],a):i[o]=a}return i}#J(t){return t.split(/,(?![^\[]*\])/).flatMap(i=>{let[,s,o]=i.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!s)return[];if(/\[[^\]]*$/.test(s))throw"unterminated:"+s;return[{name:s,...this.#l(o)}]})}#Y(t,i){if(this.#h(t))return this.#Ee(t,i);{let s=this.#t(t,"hx-method")||"GET",o=this.#t(t,"hx-action");if(!o)for(let a of this.#z){let c=this.#t(t,"hx-"+a);if(c!=null){o=c,s=a;break}}return s=s.toUpperCase(),{action:o,method:s}}}#Ee(t,i){if(t.matches("a"))return{action:t.getAttribute("href"),method:"GET"};{let s=i.submitter?.getAttribute?.("formAction")||t.getAttribute("action"),o=i.submitter?.getAttribute?.("formMethod")||t.getAttribute("method")||"GET";return{action:s,method:o.toUpperCase()}}}#i(t){return t._htmx||(t._htmx={listeners:[],triggerSpecs:[]},t.setAttribute("data-htmx-powered","true")),t._htmx}#we(t){if(this.#se(t)&&this.#e(t,"htmx:before:init",{},!0)){let i=this.#i(t);i.initialized=!0,i.eventHandler=this.#X(t),this.#ke(t),this.#ot(t),this.#e(t,"htmx:after:init",{},!0)}}#X(t){return async i=>{try{let s=this.#N(t,i);await this.#Z(s)}catch(s){this.#e(t,"htmx:error",{error:s})}}}#N(t,i){let{action:s,method:o}=this.#Y(t,i),[a,c]=(s||"").split("#"),l=new AbortController,d={sourceElement:t,sourceEvent:i,status:"created",select:this.#t(t,"hx-select"),selectOOB:this.#t(t,"hx-select-oob"),target:this.#t(t,"hx-target"),swap:this.#t(t,"hx-swap")??this.config.defaultSwap,push:this.#t(t,"hx-push-url"),replace:this.#t(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#t(t,"hx-confirm"),request:{validate:this.#t(t,"hx-validate",t.matches("form")&&!t.noValidate&&!i.submitter?.formNoValidate?"true":"false")==="true",action:a,anchor:c,method:o,headers:this.#be(t),abort:l.abort.bind(l),credentials:"same-origin",signal:l.signal,mode:this.config.mode}};t._htmx?.boosted&&this.#y(t._htmx.boosted,d),d.target=this.#I(t,d.target),d.request.headers["HX-Request-Type"]=d.target===document.body||d.select?"full":"partial",d.target&&(d.request.headers["HX-Target"]=this.#Q(d.target));let h=this.#t(t,"hx-config");return h&&(this.#y(h,d.request),d.request.mode=this.config.mode),d}#Q(t){return`${t.tagName.toLowerCase()}${t.id?"#"+encodeURI(t.id):""}`}#be(t){let i={"HX-Request":"true","HX-Source":this.#Q(t),"HX-Current-URL":location.href,Accept:"text/html"};return this.#h(t)&&(i["HX-Boosted"]="true"),i}#Te(t,i){return this.#M(t,"hx-headers",s=>{for(let o in s)i[o]=String(s[o])})}#I(t,i){return i instanceof Element?i:i!=null?this.#U(t,i,"hx-target"):this.#h(t)?document.body:t}#h(t){return t?._htmx?.boosted}async#Z(t){let i=t.sourceElement,s=t.sourceEvent;if(!i.isConnected||this.#Re(s))return;this.#ne(s)&&s.preventDefault();let o=/GET|DELETE/.test(t.request.method),a=o?i.matches("form")?i:null:i.form||i.closest("form"),c=this.#le(i,a,s.submitter,t.request.validate);if(!c)return;let l=this.#M(i,"hx-vals",u=>{t.vals=u;for(let f in u)c.set(f,u[f])});if(l&&await l,t.values)for(let u in t.values)c.delete(u),c.append(u,t.values[u]);let d=this.#Te(i,t.request.headers);if(d&&await d,Object.assign(t.request,{form:a,submitter:s.submitter,body:c}),!this.#e(i,"htmx:config:request",{ctx:t})||!this.#z.includes(t.request.method.toLowerCase()))return;let h=this.#V(t.request.action);if(h!=null){let u=Object.fromEntries(t.request.body);await this.#u(t.sourceElement,u,h,!1);return}else if(o){let u=new URL(t.request.action,document.baseURI);for(let f of t.request.body.keys())u.searchParams.delete(f);for(let[f,m]of t.request.body)u.searchParams.append(f,m);u.origin===location.origin?t.request.action=u.pathname+u.search:t.request.action=u.href,t.request.body=null}else this.#t(i,"hx-encoding")!=="multipart/form-data"&&(t.request.body=new URLSearchParams(t.request.body));await this.#ee(t)}async#ee(t){let i=t.sourceElement,s=this.#Ce(i),o=this.#te(i);if(!o.issue(t,s))return;t.status="issuing";let a=[],c=[];try{if(t.confirm&&!await new Promise(h=>{let u={ctx:t,issueRequest:()=>h(!0),dropRequest:()=>h(!1)};if(this.#e(i,"htmx:confirm",u)){let f=this.#V(t.confirm);h(f?this.#u(i,{},f,!0):window.confirm(t.confirm))}})||(this.#Oe(t),a=this.#Qe(i),c=this.#et(i),t.fetch||=window.fetch.bind(window),!this.#e(i,"htmx:before:request",{ctx:t})))return;let l=await t.fetch(t.request.action,t.request);if(t.response={raw:l,status:l.status,headers:l.headers},this.#Se(t),!this.#e(i,"htmx:before:response",{ctx:t})||(t.text=await l.text(),!this.#e(i,"htmx:after:request",{ctx:t})))return;if(t.response.status>=400&&this.#e(i,"htmx:response:error",{ctx:t}),this.#Ae(t)){t.keepIndicators=!0;return}t.status==="issuing"&&(t.hx.retarget&&(t.target=t.hx.retarget),t.hx.reswap&&(t.swap=t.hx.reswap),t.hx.reselect&&(t.select=t.hx.reselect),t.status="response received",this.#dt(t),await this.swap(t),t.status="swapped")}catch(l){t.status="error: "+l,this.#e(i,"htmx:error",{ctx:t,error:l})}finally{clearTimeout(t.requestTimeout),this.#e(i,"htmx:finally:request",{ctx:t}),t.keepIndicators||(this.#Ze(a),this.#tt(c)),o.finish(),o.more()&&this.#ee(o.next())}}#Se(t){t.hx={};for(let[i,s]of t.response.raw.headers)i.toLowerCase().startsWith("hx-")&&(t.hx[i.slice(3).toLowerCase().replace(/-/g,"")]=s)}#Ae(t){if(t.hx.trigger&&this.#Ne(t.hx.trigger,t.sourceElement),t.hx.refresh==="true")return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let i=t.hx.location,s={};return(i[0]==="{"||/[\s,]/.test(i))&&(s=this.#l(i),i=s.path,delete s.path),s.push??="true",this.ajax("GET",i,s),!0}}#Oe(t){let i=t.request.timeout!=null?this.parseInterval(t.request.timeout):this.config.defaultTimeout;i&&(t.requestTimeout=setTimeout(()=>t.request?.abort?.(),i))}#Ce(t){let i=this.#t(t,"hx-sync");if(!i)return"queue first";let s=i.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(s)?s:"queue first"}#te(t){let i=this.#t(t,"hx-sync"),s=t;if(i){let o=i.includes(":")?i.slice(0,i.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(i)?null:i;o&&(s=this.#U(t,o,"hx-sync")||t)}return this.#i(s).rq||=new r}#Re(t){return t.type==="click"&&(t.ctrlKey||t.metaKey||t.shiftKey)}#ne(t){let i=t.currentTarget;if(t.type==="submit"&&i?.tagName==="FORM")return!0;if(!(t.type==="click"&&t.button===0))return!1;let a=i?.closest?.('button, input[type="submit"], input[type="image"]'),c=a?.form||a?.closest("form");if(a&&!a.disabled&&c&&(a.type==="submit"||a.type==="image"||!a.type&&a.tagName==="BUTTON"))return!0;let d=i?.closest?.("a");if(!d||!d.href)return!1;let h=d.getAttribute("href");return!(h&&h.startsWith("#")&&h.length>1)}#ke(t,i=t._htmx.eventHandler){let s=this.#t(t,"hx-trigger");s||(s=t.matches("form")?"submit":t.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#re(t,s,i)}#re(t,i,s){let o=this.#J(i);this.#i(t).triggerSpecs.push(...o);for(let a of o){a.handler=s,a.listeners=[],a.values=new WeakMap;let[c,l]=this.#Pe(a.name);if(a.once){let h=a.handler;a.handler=u=>{h(u);for(let f of a.listeners)f.fromElt.removeEventListener(f.eventName,f.handler)}}if(c==="intersect"||c==="revealed"){let h={};a.root&&(h.root=this.#U(t,a.root)),a.threshold&&(h.threshold=parseFloat(a.threshold));let u=c==="revealed";a.observer=new IntersectionObserver(f=>{for(let m=0;m{clearTimeout(a.timeout),a.timeout=setTimeout(()=>h(u),this.parseInterval(a.delay))}}if(a.throttle){let h=a.handler;a.handler=u=>{a.throttled?a.throttledEvent=u:(a.throttled=!0,h(u),a.throttleTimeout=setTimeout(()=>{if(a.throttled=!1,a.throttledEvent){let f=a.throttledEvent;a.throttledEvent=null,a.handler(f)}},this.parseInterval(a.throttle)))}}if(a.target){let h=a.handler;a.handler=u=>{u.target?.matches?.(a.target)&&h(u)}}if(c==="every"){let h=Object.keys(a).find(u=>u!=="name");a.interval=setInterval(()=>{t.isConnected?this.#e(t,"every",{},!1):clearInterval(a.interval)},this.parseInterval(h))}if(a.consume){let h=a.handler;a.handler=u=>{u.stopPropagation(),h(u)}}if(l){let h=a.handler;a.handler=u=>{this.#ne(u)&&u.preventDefault();let f={};for(let m in u)f[m]=u[m];this.#u(t,f,l,!0,!1)&&h(u)}}let d=[t];if(a.from&&(d=this.#o(t,a.from)),a.changed){let h=a.handler;a.handler=u=>{let f=!1;for(let m of d)a.values.get(m)!==m.value&&(f=!0,a.values.set(m,m.value));f&&h(u)}}if(c==="load"){a.handler(new CustomEvent("load"));continue}for(let h of d){let u={fromElt:h,eventName:c,handler:a.handler};t._htmx.listeners.push(u),a.listeners.push(u),h.addEventListener(c,a.handler)}}}#Pe(t){let i=t.match(/^([^\[]*)\[([^\]]*)]/);return i?[i[1],i[2]]:[t,null]}#Ne(t,i){if(t[0]==="{"){let s=this.#l(t);for(let o in s){let a=s[o],c=i;a?.target&&(c=this.find(a.target)),this.trigger(c,o,typeof a=="object"?a:{value:a})}}else t.split(",").forEach(s=>this.trigger(i,s.trim(),{}))}#De(t){let i={},s=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(s))o!=="constructor"&&typeof this[o]=="function"&&(["find","findAll"].includes(o)?i[o]=(a,c)=>c===void 0?this[o](t,a):this[o](a,c):i[o]=this[o].bind(this));return i}#u(t,i,s,o=!0,a=!0){let c={};Object.assign(c,this.#De(t));let l={};this.#p(t,"htmx:scope",{scope:l}),Object.assign(c,l),Object.assign(c,i);let d=Object.keys(c),h=Object.values(c),u=a?this.#B:this.#W;return new u(...d,o?`return (${s})`:s).call(t,...h)}process(t){if(!t)return;if(!(t instanceof Element)){for(let a of t.children||[])this.process(a);return}if(this.#R(t)||!this.#e(t,"htmx:before:process"))return;let i=[t],s=this.#G.evaluate(t),o=null;for(;o=s.iterateNext();)i.push(o);for(let a of i)!this.#R(a)&&this.#e(a,"htmx:before:on:init",{},!0)&&this.#Xe(a);for(let a of this.#c(t,this.#$))this.#we(a);for(let a of this.#c(t,this.#ge))this.#Le(a);this.#e(t,"htmx:after:process")}#Le(t){let i=this.#t(t,"hx-boost");if(i&&i!=="false"&&this.#Me(t)&&this.#e(t,"htmx:before:init",{},!0)){let s=this.#i(t);s.initialized=!0,s.eventHandler=this.#X(t),s.boosted=i;let o=t.matches("a")?"click":"submit";t._htmx.listeners.push({fromElt:t,eventName:o,handler:t._htmx.eventHandler}),t.addEventListener(o,t._htmx.eventHandler),this.#e(t,"htmx:after:init",{},!0)}}#Me(t){if(this.#se(t)){if(t.tagName==="A"){if(t.target===""||t.target==="_self")return!t.getAttribute("href")?.startsWith?.("#")&&this.#ie(t.href)}else if(t.tagName==="FORM")return t.method!=="dialog"&&this.#ie(t.action)}}#ie(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch{return!1}}#se(t){return!t._htmx?.initialized&&!this.#R(t)}#s(t){if(t._htmx){this.#e(t,"htmx:before:cleanup");for(let i of t._htmx.triggerSpecs||[])i.interval&&clearInterval(i.interval),i.timeout&&clearTimeout(i.timeout),i.throttleTimeout&&clearTimeout(i.throttleTimeout),i.observer?.disconnect();for(let i of t._htmx.listeners||[])i.fromElt.removeEventListener(i.eventName,i.handler);this.#e(t,"htmx:after:cleanup")}if(t.firstChild)for(let i of t.querySelectorAll("[data-htmx-powered]"))this.#s(i)}#xe(t){let i=document.createElement("div");i.hidden=!0,document.body.insertAdjacentElement("afterend",i);let s=t.querySelectorAll?.(this.#a("[hx-preserve]"))||[];for(let o of s){let a=document.getElementById(o.id);a&&this.#m(i,a,null)}return i}#Ue(t){for(let i of[...t.children]){let s=document.getElementById(i.id);s&&(this.#m(s.parentNode,i,s),this.#s(s),s.remove())}t.remove()}#D(t){let i=this.#O.createHTML(t);return Document.parseHTMLUnsafe?.(i)||new DOMParser().parseFromString(i,"text/html")}#Fe(t){let i=t.replace(/)/gi,'"),s="";i=i.replace(/]*)?>[\s\S]*?<\/head>/i,l=>(s=this.#D(l).title,""));let o=i.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase(),a,c;if(o==="html"||o==="body"?(a=this.#D(i),c=document.createDocumentFragment(),c.append(a.body)):(a=this.#D(``),c=a.querySelector("template").content),!s){let l=c.querySelector("title:not(svg title)");l&&(s=l.textContent,l.remove())}return this.#ce(c),{fragment:c,title:s}}#oe(t,i,s,o){let a=i.id?"#"+CSS.escape(i.id):null;s!=="true"&&s&&!s.includes(" ")&&([s,a=a]=s.split(/:(.*)/)),(s==="true"||!s)&&(s="outerHTML");let c=this.#E(s);if(a=c.target||a,c.strip??=!c.style.startsWith("outer"),!a)return;let l=[...document.querySelectorAll(a)];for(let d of l){let h=document.createDocumentFragment();h.append(i.cloneNode(!0)),t.push({type:"oob",fragment:h,target:d,swapSpec:c,sourceElement:o})}i.remove()}#Ve(t,i,s){let o=[];if(s)for(let a of s.split(",")){let[c,l="true"]=a.split(/:(.*)/);for(let d of t.querySelectorAll(c))this.#oe(o,d,l,i)}for(let a of t.querySelectorAll(this.#a("[hx-swap-oob]"))){let c=this.#k(a,"hx-swap-oob"),l=a.getAttribute(c);a.removeAttribute(c),this.#oe(o,a,l,i)}return o}#f(t,i,s){i?i.before(...s.childNodes):t.append(...s.childNodes)}#E(t){t=t.trim();let i=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let s=t.match(/^(\S+)\s*(.*)$/);i=s[1],t=s[2]}return{style:this.#ye(i),...this.#l(t)}}#He(t,i){let s=[];for(let o of t.querySelectorAll("template[hx]")){let a=o.getAttribute("type");if(a==="partial"){let c=this.#v(o,"hx-target")||(o.id?"#"+CSS.escape(o.id):null);if(c){this.#ce(o.content);let l=this.#E(this.#v(o,"hx-swap")||this.config.defaultSwap);for(let d of document.querySelectorAll(c))s.push({type:"partial",fragment:o.content.cloneNode(!0),target:d,swapSpec:l,sourceElement:i.sourceElement})}}else this.#p(o,"htmx:process:"+a,{ctx:i,tasks:s});o.remove()}return s}#ae(t,i,s,o){try{s!=null&&t.setSelectionRange&&t.setSelectionRange(s,o),t.focus(i)}catch{}}#je(t){let i=this.#c(t,"[autofocus]")[0];i&&this.#ae(i)}#qe(t,i){if(t.scroll){let s=t.scrollTarget?this.#F(t.scrollTarget):i;s&&(t.scroll==="top"?s.scrollTop=0:t.scroll==="bottom"&&(s.scrollTop=s.scrollHeight))}(t.show==="top"||t.show==="bottom")&&(t.showTarget?this.#F(t.showTarget):i)?.scrollIntoView(t.show==="top")}#We(t){t.request?.anchor&&document.getElementById(t.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#ce(t){let i=this.#c(t,"script");for(let s of i){let o=document.createElement("script");for(let a of s.attributes)o.setAttribute(a.name,a.value);this.config.inlineScriptNonce&&(o.nonce=this.config.inlineScriptNonce),o.textContent=this.#O.createScript(s.textContent),s.replaceWith(o)}}async swap(t){try{this.#Ye(t);let{fragment:i,title:s}=this.#Fe(t.text);t.title=s;let o=[],a=this.#Ve(i,t.sourceElement,t.selectOOB),c=this.#He(i,t);o.push(...a,...c);let l=this.#Be(t,i,c);if(l&&o.unshift(l),!this.#e(t.sourceElement,"htmx:before:swap",{ctx:t,tasks:o}))return;let d=[],h=[];for(let u of o)u.swapSpec?.transition??l?.transition??t.transition?h.push(u):d.push(this.#L(u));if(h.length>0){let u=async()=>{for(let f of h)await this.#L(f,!1)};d.push(this.#ht(u))}await Promise.all(d),this.#e(t.sourceElement,"htmx:after:swap",{ctx:t}),t.title&&!l?.swapSpec?.ignoreTitle&&(document.title=t.title),this.#We(t)}finally{this.#e(t.sourceElement,"htmx:swap:finally",{ctx:t})}}#Be(t,i,s){let o=this.#E(t.swap||this.config.defaultSwap);if(o.style==="delete"||i.childElementCount>0||/\S/.test(i.textContent)||!s.length){if(t.select){let c=i.querySelectorAll(t.select);i=document.createDocumentFragment(),i.append(...c)}return this.#h(t.sourceElement)&&(o.show||="top"),{type:"main",fragment:i,target:this.#I(t.sourceElement||document.body,o.target||t.target),swapSpec:o,sourceElement:t.sourceElement,transition:t.transition&&o.transition!==!1}}}async#L(t,i=!0){let{target:s,swapSpec:o,fragment:a}=t;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return;typeof o=="string"&&(o=this.#E(o));let c=o.style;if(c==="none")return;if(a.firstElementChild?.tagName==="BODY"&&(c==="outerHTML"?c="outerSync":c.startsWith("outer")||(o.strip=!0)),o.strip&&a.firstElementChild&&(a=document.createDocumentFragment(),a.append(...(t.fragment.firstElementChild.content||t.fragment.firstElementChild).childNodes)),this.#b(s,"htmx-swapping"),i&&t.swapSpec?.swap&&await this.timeout(t.swapSpec?.swap),c==="delete"){s.parentNode&&(this.#s(s),s.parentNode.removeChild(s));return}let l,d=[],h=o.settle??this.config.defaultSettleDelay,u=s.parentNode;if(c==="innerHTML"||c==="outerHTML"&&u){let g=document.activeElement;if(g?.id){let v,w;try{v=g.selectionStart,w=g.selectionEnd}catch{}l={elt:g,start:v,end:w}}d=i&&h?this.#ft(a,s):[]}let f=this.#xe(a),m=[...a.childNodes];try{if(c==="innerHTML"){for(let g of s.children)this.#s(g);s.replaceChildren(...a.childNodes)}else if(c==="textContent"){for(let g of s.querySelectorAll("[data-htmx-powered]"))this.#s(g);s.textContent=a.textContent}else if(c==="outerHTML")u&&(this.#f(u,s,a),this.#s(s),u.removeChild(s),s=m[0]||u);else if(c==="outerSync"){this.#w(s,a.firstElementChild);for(let g of s.children)this.#s(g);s.replaceChildren(...a.firstElementChild.childNodes)}else if(c==="innerMorph")this.#H(s,a,!0),m=[...s.childNodes];else if(c==="outerMorph")this.#H(s,a,!1),m.push(s);else if(c==="beforebegin")u&&this.#f(u,s,a);else if(c==="afterbegin")this.#f(s,s.firstChild,a);else if(c==="beforeend")this.#f(s,null,a);else if(c==="afterend")u&&this.#f(u,s.nextSibling,a);else{let g=this.#r.get("handle_swap")||[],v=!1;for(let w of g){let q=w(c,s,a,o);if(q){v=!0,Array.isArray(q)&&(m=q);break}}if(!v)throw new Error(`Unknown swap style: ${c}`)}}finally{this.#T(s,"htmx-swapping")}if(this.#Ue(f),l&&!l.elt.matches(":focus")){let g=document.getElementById(l.elt.id);if(g){let v={preventScroll:o.focusScroll!==void 0?!o.focusScroll:!this.config.defaultFocusScroll};this.#ae(g,v,l.start,l.end)}}this.#e(s,"htmx:before:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#b(g,"htmx-added");if(i&&d.length>0){this.#b(s,"htmx-settling"),await this.timeout(h);for(let g of d)g();this.#T(s,"htmx-settling")}this.#e(s,"htmx:after:settle",{task:t,newContent:m,settleTasks:d});for(let g of m)this.#T(g,"htmx-added"),this.process(g),this.#je(g);this.#qe(o,s)}#e(t,i,s={},o=!0){if(s.error){let a=`htmx: ${i}: ${s.error.message??s.error}`;s.error instanceof Error?console.error(a,s.error,{elt:t,detail:s}):console.error(a,{elt:t,detail:s})}else s.warn?console.warn(`htmx: ${i}: ${s.warn}`,{elt:t,detail:s}):this.config.logAll&&console.log(`htmx: ${i}`,{elt:t,detail:s});return t=this.#S(t),this.#p(t,i,s),this.trigger(t,this.#d(i),s,o)}#p(t,i,s={}){let o=this.#r.get(i.replace(/:/g,"_"));if(o){s.cancelled=!1;for(let a of o)if(a(t,s)===!1||s.cancelled)return s.cancelled=!0,!1}return!0}timeout(t){if(t=this.parseInterval(t),t>0)return new Promise(i=>setTimeout(i,t))}onLoad(t){this.on(this.#d("htmx:after:process"),i=>{t(i.target)})}on(t,i,s){let o,a=document;return s===void 0?(o=t,s=i):(a=this.#S(t),o=i),a.addEventListener(o,s),s}find(t,i){return this.#F(t,i)}findAll(t,i){return this.#o(t,i)}parseInterval(t){if(typeof t=="number")return t;let i={ms:1,s:1e3,m:6e4},[,s,o]=t?.match(/^([\d.]+)(ms|s|m)?$/)||[],a=parseFloat(s)*(i[o]||1);return isNaN(a)?void 0:a}trigger(t,i,s={},o=!0){t=this.#S(t);let a=new CustomEvent(i,{detail:s,cancelable:!0,bubbles:o,composed:!0}),c=t?.isConnected?t:document;return!s.cancelled&&c.dispatchEvent(a)}ajax(t,i,s){(!s||s instanceof Element||typeof s=="string")&&(s={target:s});let o=typeof s.source=="string"?document.querySelector(s.source):s.source;if(typeof s.source=="string"&&!o)return Promise.reject(new Error("Source not found"));if(s.target){let c=this.#I(document.body,s.target);if(!c)return Promise.reject(new Error("Target not found"));o||=c}o||=document.body;let a=this.#N(o,s.event||{});return Object.assign(a,s),s.target&&(a.target=this.#I(document.body,s.target)),Object.assign(a.request,{action:i,method:t.toUpperCase()}),s.headers&&Object.assign(a.request.headers,s.headers),this.#Z(a)}#$e(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",t=>{t.state&&t.state.htmx&&(this.#C?.abort(),this.#Ke())}))}#ze(t){this.config.history&&(history.pushState({htmx:!0},"",t),this.#e(document,"htmx:after:history:push",{path:t}))}#Ge(t){this.config.history&&(history.replaceState({htmx:!0},"",t),this.#e(document,"htmx:after:history:replace",{path:t}))}#Ke(t){t=t||location.pathname+location.search;let i=document.querySelector(this.#a("[hx-history-elt]"))||document.body;this.#e(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})&&(this.config.history==="reload"?location.reload():(this.#C=new AbortController,this.ajax("GET",t,{target:i,swap:"outerSync",select:i!==document.body?this.#a("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#C.signal}})))}#Je(t){let{sourceElement:i,push:s,replace:o,hx:a,response:c}=t;if((a?.pushurl||a?.replaceurl)&&(s=a.pushurl,o=a.replaceurl),s==null&&o==null&&this.#h(i)&&(s="true"),(s==="false"||s===!1)&&(s=null),(o==="false"||o===!1)&&(o=null),!s&&!o)return null;let l=s||o;if(l==="true"){let h=c?.raw?.url||t.request.action,u=new URL(h,location.href);l=u.pathname+u.search+(t.request.anchor?"#"+t.request.anchor:"")}return{type:s?"push":"replace",path:l}}#Ye(t){let i=this.#Je(t);if(!i)return;let s={history:i,sourceElement:t.sourceElement,response:t.response};this.#e(document,"htmx:before:history:update",s)&&(i.type==="push"?this.#ze(i.path):this.#Ge(i.path),this.#e(document,"htmx:after:history:update",s))}#Xe(t){let i=this.#P("hx-on:").map(o=>this.#d(o)),s=this.config.metaCharacter||":";for(let o of t.getAttributeNames()){let a=i.find(v=>o.startsWith(v));if(!a)continue;let[c,...l]=o.substring(a.length).split("."),d=v=>l.includes(v);c.startsWith(s)&&(c="htmx"+c),d("cc")&&(c=c.replace(/-([a-z])/g,(v,w)=>w.toUpperCase()));let h=t.getAttribute(o),u=d("outside")?document:t,f={capture:d("capture"),passive:d("passive")},m=d("halt"),g=async v=>{if(!(d("self")&&v.target!==t)&&!(d("outside")&&t.contains(v.target))){(m||d("prevent"))&&v.preventDefault(),(m||d("stop"))&&v.stopPropagation(),d("once")&&u.removeEventListener(c,g,f);try{await this.#u(t,{event:v},`with(event?.detail||{}){${h}}`,!1)}catch(w){typeof w!="symbol"&&this.#e(t,"htmx:error",{error:w})}}};u.addEventListener(c,g,f),this.#i(t).listeners.push({fromElt:u,eventName:c,handler:g})}}#Qe(t){let i=this.#t(t,"hx-indicator"),s;i?s=this.#o(t,i,"hx-indicator"):s=[t];for(let o of s){let a=this.#i(o);a.rc=(a.rc||0)+1,this.#b(o,this.config.requestClass)}return s}#Ze(t){for(let i of t){let s=this.#i(i);s.rc&&--s.rc<=0&&(this.#T(i,this.config.requestClass),delete s.rc)}}#et(t){let i=this.#t(t,"hx-disable"),s=[];if(i){s=this.#o(t,i,"hx-disable");for(let o of s){let a=this.#i(o);a.dc=(a.dc||0)+1,o.disabled=!0}}return s}#tt(t){for(let i of t){let s=this.#i(i);s.dc&&--s.dc<=0&&(i.disabled=!1,delete s.dc)}}#le(t,i,s,o){if(o&&i&&!i.reportValidity())return;let a=i?new FormData(i):new FormData,c=i?new Set(i.elements):new Set;if(!i&&t.name){if(o&&t.reportValidity&&!t.reportValidity())return;a.append(t.name,t.value),c.add(t)}s&&s.name&&(a.append(s.name,s.value),c.add(s));let l=this.#t(t,"hx-include");if(l)for(let d of this.#o(t,l)){if(o&&d.reportValidity&&!d.reportValidity())return;this.#nt(d,c,a)}return a}#nt(t,i,s){let o=this.#c(t,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let a of o){if(!a.name||i.has(a))continue;i.add(a);let c=a.type;if(c==="checkbox"||c==="radio")a.checked&&s.append(a.name,a.value);else if(c==="file")for(let l of a.files)s.append(a.name,l);else if(c==="select-multiple")for(let l of a.selectedOptions)s.append(a.name,l.value);else a.matches("select, textarea, input")&&s.append(a.name,a.value)}}#M(t,i,s){let o=this.#t(t,i);if(!o)return null;let a=this.#V(o);if(a)return a.indexOf("{")!==0&&(a="{"+a+"}"),this.#u(t,{},a,!0).then(c=>{s(c)});s(this.#l(o))}#rt(t){let i=t.trim();return i.startsWith("<")&&i.endsWith("/>")?i.slice(1,-2):i}#o(t,i,s,o){let a=i??t,c=i?this.#S(t):document;if(a.startsWith("global "))return this.#o(c,a.slice(7),s,!0);let l=a?a.replace(/<[^>]+\/>/g,u=>u.replace(/,/g,"%2C")).split(",").map(u=>u.replace(/%2C/g,",")):[],d=[],h=[];for(let u of l){let f=this.#rt(u),m;if(f.startsWith("closest "))m=c.closest(f.slice(8));else if(f.startsWith("find "))m=c.querySelector(f.slice(5));else if(f.startsWith("findAll "))d.push(...c.querySelectorAll(f.slice(8)));else if(f==="next"||f==="nextElementSibling")m=c.nextElementSibling;else if(f.startsWith("next "))m=this.#it(c,f.slice(5),!!o);else if(f==="previous"||f==="previousElementSibling")m=c.previousElementSibling;else if(f.startsWith("previous "))m=this.#st(c,f.slice(9),!!o);else if(f==="document")m=document;else if(f==="window")m=window;else if(f==="body")m=document.body;else if(f==="host")m=c.getRootNode().host;else if(f==="this"){if(s){d.push(...this.#Ie(c,s));continue}m=c}else h.push(f);m&&d.push(m)}if(h.length>0){let u=h.join(","),f=this.#x(c,!!o);d.push(...f.querySelectorAll(u))}return[...new Set(d)]}#it(t,i,s){return this.#ue(this.#x(t,s).querySelectorAll(i),t,Node.DOCUMENT_POSITION_PRECEDING)}#st(t,i,s){let o=[...this.#x(t,s).querySelectorAll(i)].reverse();return this.#ue(o,t,Node.DOCUMENT_POSITION_FOLLOWING)}#ue(t,i,s){for(let o of t)if(o.compareDocumentPosition(i)===s)return o}#x(t,i){return t.isConnected&&t.getRootNode?t.getRootNode?.({composed:i}):document}#U(t,i,s){let o=this.#o(t,i,s)[0];return o||console.warn(`htmx: '${i}' on ${s} did not match any element`,{elt:t,selector:i,attr:s}),o}#F(t,i,s){return this.#o(t,i,s)[0]}#V(t){if(t!=null){if(t.startsWith("js:"))return t.substring(3);if(t.startsWith("javascript:"))return t.substring(11)}}#ot(t){let i=()=>{this.#te(t).abort()};t.addEventListener("htmx:abort",i),t._htmx.listeners.push({fromElt:t,eventName:"htmx:abort",handler:i})}#H(t,i,s){let{persistentIds:o,idMap:a}=this.#lt(t,i),c=document.createElement("div");c.hidden=!0,document.body.after(c);let l={target:t,idMap:a,persistentIds:o,pantry:c,futureMatches:new WeakSet};s?this.#j(l,t,i):this.#j(l,t.parentNode,i,t,t.nextSibling),this.#s(c),c.remove()}#j(t,i,s,o=null,a=null){i instanceof HTMLTemplateElement&&s instanceof HTMLTemplateElement&&(i=i.content,s=s.content),o||=i.firstChild;let c=s.firstChild;for(;c;){let l;if(o&&o!=a&&(l=this.#at(t,c,o,a),l&&l!==o)){let h=o;for(;h&&h!==l;){let u=h;h=h.nextSibling,u instanceof Element&&(t.idMap.has(u)||this.#de(t,u,c))?this.#m(i,u,a):this.#he(t,u)}}if(!l&&c instanceof Element&&t.persistentIds.has(c.id)){let h=CSS.escape(c.id);l=t.target.id===c.id&&t.target||t.target.querySelector(`[id="${h}"]`)||t.pantry.querySelector(`[id="${h}"]`);let u=l;for(;u=u.parentNode;){let f=t.idMap.get(u);f&&(f.delete(l.id),f.size||t.idMap.delete(u))}this.#m(i,l,o)}if(l){this.#fe(l,c,t),o=l.nextSibling,c=c.nextSibling;continue}let d=c.nextSibling;if(t.idMap.has(c)){let h=document.createElement(c.tagName);i.insertBefore(h,o),this.#fe(h,c,t),o=h.nextSibling}else i.insertBefore(c,o),o=c.nextSibling;c=d}for(;o&&o!=a;){let l=o;o=o.nextSibling,this.#he(t,l)}}#de(t,i,s){if(t.futureMatches.has(i))return!0;for(let o=s.nextSibling,a=0;o&&ad.has(m)))return u;if(!f){if(l>0&&u.isEqualNode(i))return u;a||(a=u)}}if(c+=f?.size||0,c>h||u.contains(document.activeElement)||--l<1&&h===0)break;u=u.nextSibling}return a&&this.#de(t,a,i)?null:a}#ct(t,i){return!(t instanceof Element)||t.tagName!==i.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(i)?!1:t._x_bindings?.id&&i.matches?.("[\\:id], [x-bind\\:id]")?!0:!t.id||t.id===i.id}#he(t,i){t.idMap.has(i)?this.#m(t.pantry,i,null):(this.#s(i),i.remove())}#m(t,i,s){if(t.moveBefore)try{t.moveBefore(i,s);return}catch{}t.insertBefore(i,s)}#fe(t,i,s){if(this.config.morphSkip&&t.matches?.(this.config.morphSkip)||!this.#p(t,"htmx:before:morph:node",{oldNode:t,newNode:i}))return;this.#w(t,i),t instanceof HTMLTextAreaElement&&t.defaultValue!=i.defaultValue&&(t.value=i.value),!(this.config.morphSkipChildren&&t.matches?.(this.config.morphSkipChildren))&&(!t.isEqualNode(i)||i.tagName==="TEMPLATE"||i.querySelector?.("template"))&&this.#j(s,t,i)}#w(t,i){let s=this.config.morphIgnore||[];for(let o of i.attributes)!s.includes(o.name)&&t.getAttribute(o.name)!==o.value&&(t.setAttribute(o.name,o.value),o.name==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=o.value));for(let o=t.attributes.length-1;o>=0;o--){let a=t.attributes[o];a&&!i.hasAttribute(a.name)&&!s.includes(a.name)&&t.removeAttribute(a.name)}}#pe(t,i,s,o){for(let a of o)if(i.has(a.id)){let c=a;for(;c&&c!==s;){let l=t.get(c);l==null&&(l=new Set,t.set(c,l)),l.add(a.id),c=c.parentElement}}}#lt(t,i){let s=this.#c(t,"[id]"),o=i.querySelectorAll("[id]"),a=this.#ut(s,o),c=new Map;return this.#pe(c,a,t.parentElement,s),this.#pe(c,a,i,o),{persistentIds:a,idMap:c}}#ut(t,i){let s=new Set,o=new Map;for(let{id:c,tagName:l}of t)o.has(c)?s.add(c):c&&o.set(c,l);let a=new Set;for(let{id:c,tagName:l}of i)a.has(c)?s.add(c):o.get(c)===l&&a.add(c);for(let c of s)a.delete(c);return a}#dt(t){let i=t.response.raw.status,s=this.config.noSwap.map(a=>a+""),o=i+"";for(let a of[o,o.slice(0,2)+"x",o[0]+"xx"]){if(s.includes(a)){t.swap="none";return}let c=this.#t(t.sourceElement,this.#d("hx-status:")+a);if(c){this.#y(c,t);return}}}#ht(t){return new Promise(i=>{this.#g||=[],this.#g.push({task:t,resolve:i}),this.#_||this.#me()})}async#me(){if(this.#g.length===0||this.#_)return;this.#_=!0;let{task:t,resolve:i}=this.#g.shift();try{document.startViewTransition?(this.#e(document,"htmx:before:viewTransition",{task:t}),await document.startViewTransition(t).finished,this.#e(document,"htmx:after:viewTransition",{task:t})):await t()}catch{}finally{this.#_=!1,i(),this.#me()}}#ft(t,i){let s=i.querySelectorAll("[id]"),o=Object.fromEntries([...s].map(l=>[l.id,l])),a=t.querySelectorAll("[id]"),c=[];for(let l of a){let d=o[l.id];if(d?.tagName===l.tagName){let h=l.cloneNode(!1);this.#w(l,d),c.push(()=>{this.#w(l,h)})}}return c}#b(t,i){t?.classList?.add?.(i)}#T(t,i){t?.classList?.remove?.(i),t?.classList?.length===0&&t.removeAttribute("class")}#S(t){return typeof t=="string"?this.find(t):t}#d(t){return this.config.metaCharacter?t.replace(/:/g,this.config.metaCharacter):t}}return new e})();typeof window<"u"&&(window.htmx=fn);var ot=fn;var mn=function(r){let e=[],n=0;for(let t=0;t>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},jr=function(r){let e=[],n=0,t=0;for(;n191&&i<224){let s=r[n++];e[t++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[n++],o=r[n++],a=r[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let s=r[n++],o=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},gn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i>2,h=(s&3)<<4|a>>4,u=(a&15)<<2|l>>6,f=l&63;c||(f=64,o||(u=64)),t.push(n[d],n[h],n[u],n[f])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mn(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):jr(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i>4;if(t.push(u),l!==64){let f=a<<4&240|l>>2;if(t.push(f),h!==64){let m=l<<6&192|h;t.push(m)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},ct=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},qr=function(r){let e=mn(r);return gn.encodeByteArray(e,!0)},ut=function(r){return qr(r).replace(/\./g,"")},dt=function(r){try{return gn.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Wr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Br=()=>Wr().__FIREBASE_DEFAULTS__,$r=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},zr=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&dt(r[1]);return e&&JSON.parse(e)},ht=()=>{try{return Br()||$r()||zr()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},_n=r=>{var e,n;return(n=(e=ht())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]};var ft=()=>{var r;return(r=ht())===null||r===void 0?void 0:r.config},pt=r=>{var e;return(e=ht())===null||e===void 0?void 0:e[`_${r}`]};var Ee=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function yn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function In(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function En(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function wn(){let r=I();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function bn(){try{return typeof indexedDB=="object"}catch{return!1}}function Tn(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}var Gr="FirebaseError",b=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=Gr,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,N.prototype.create)}},N=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,t):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new b(i,a,t)}};function Kr(r,e){return r.replace(Jr,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var Jr=/\{\$([^}]+)}/g;function Sn(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Y(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let s=r[i],o=e[i];if(pn(s)&&pn(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function pn(r){return r!==null&&typeof r=="object"}function X(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}function Q(r){let e={};return r.replace(/^\?/,"").split("&").forEach(t=>{if(t){let[i,s]=t.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Z(r){let e=r.indexOf("?");if(!e)return"";let n=r.indexOf("#",e);return r.substring(e,n>0?n:void 0)}function An(r,e){let n=new lt(r,e);return n.subscribe.bind(n)}var lt=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");Yr(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=at),i.error===void 0&&(i.error=at),i.complete===void 0&&(i.complete=at);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Yr(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function at(){}var ea=4*60*60*1e3;function A(r){return r&&r._delegate?r._delegate:r}var O=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var W="[DEFAULT]";var mt=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Ee;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Qr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});t.resolve(s)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);t===a&&o.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),s=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:Xr(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Xr(r){return r===W?void 0:r}function Qr(r){return r.instantiationMode==="EAGER"}var we=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new mt(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var Zr=[],_;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(_||(_={}));var ei={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},ti=_.INFO,ni={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},ri=(r,e,...n)=>{if(ee.some(n=>r instanceof n),On,Cn;function si(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oi(){return Cn||(Cn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Rn=new WeakMap,_t=new WeakMap,kn=new WeakMap,gt=new WeakMap,yt=new WeakMap;function ai(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{n(C(r.result)),i()},o=()=>{t(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Rn.set(n,r)}).catch(()=>{}),yt.set(e,r),e}function ci(r){if(_t.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});_t.set(r,e)}var vt={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return _t.get(r);if(e==="objectStoreNames")return r.objectStoreNames||kn.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return C(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pn(r){vt=r(vt)}function li(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(be(this),e,...n);return kn.set(t,e.sort?e.sort():[e]),C(t)}:oi().includes(r)?function(...e){return r.apply(be(this),e),C(Rn.get(this))}:function(...e){return C(r.apply(be(this),e))}}function ui(r){return typeof r=="function"?li(r):(r instanceof IDBTransaction&&ci(r),ii(r,si())?new Proxy(r,vt):r)}function C(r){if(r instanceof IDBRequest)return ai(r);if(gt.has(r))return gt.get(r);let e=ui(r);return e!==r&&(gt.set(r,e),yt.set(e,r)),e}var be=r=>yt.get(r);function Dn(r,e,{blocked:n,upgrade:t,blocking:i,terminated:s}={}){let o=indexedDB.open(r,e),a=C(o);return t&&o.addEventListener("upgradeneeded",c=>{t(C(o.result),c.oldVersion,c.newVersion,C(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var di=["get","getKey","getAll","getAllKeys","count"],hi=["put","add","delete","clear"],It=new Map;function Nn(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(It.get(e))return It.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=hi.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||di.includes(n)))return;let s=async function(o,...a){let c=this.transaction(o,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return It.set(e,s),s}Pn(r=>({...r,get:(e,n,t)=>Nn(e,n)||r.get(e,n,t),has:(e,n)=>!!Nn(e,n)||r.has(e,n)}));var wt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(fi(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function fi(r){let e=r.getComponent();return e?.type==="VERSION"}var bt="@firebase/app",Ln="0.10.13";var D=new ee("@firebase/app"),pi="@firebase/app-compat",mi="@firebase/analytics-compat",gi="@firebase/analytics",_i="@firebase/app-check-compat",vi="@firebase/app-check",yi="@firebase/auth",Ii="@firebase/auth-compat",Ei="@firebase/database",wi="@firebase/data-connect",bi="@firebase/database-compat",Ti="@firebase/functions",Si="@firebase/functions-compat",Ai="@firebase/installations",Oi="@firebase/installations-compat",Ci="@firebase/messaging",Ri="@firebase/messaging-compat",ki="@firebase/performance",Pi="@firebase/performance-compat",Ni="@firebase/remote-config",Di="@firebase/remote-config-compat",Li="@firebase/storage",Mi="@firebase/storage-compat",xi="@firebase/firestore",Ui="@firebase/vertexai-preview",Fi="@firebase/firestore-compat",Vi="firebase",Hi="10.14.1";var Tt="[DEFAULT]",ji={[bt]:"fire-core",[pi]:"fire-core-compat",[gi]:"fire-analytics",[mi]:"fire-analytics-compat",[vi]:"fire-app-check",[_i]:"fire-app-check-compat",[yi]:"fire-auth",[Ii]:"fire-auth-compat",[Ei]:"fire-rtdb",[wi]:"fire-data-connect",[bi]:"fire-rtdb-compat",[Ti]:"fire-fn",[Si]:"fire-fn-compat",[Ai]:"fire-iid",[Oi]:"fire-iid-compat",[Ci]:"fire-fcm",[Ri]:"fire-fcm-compat",[ki]:"fire-perf",[Pi]:"fire-perf-compat",[Ni]:"fire-rc",[Di]:"fire-rc-compat",[Li]:"fire-gcs",[Mi]:"fire-gcs-compat",[xi]:"fire-fst",[Fi]:"fire-fst-compat",[Ui]:"fire-vertex","fire-js":"fire-js",[Vi]:"fire-js-all"};var Te=new Map,qi=new Map,St=new Map;function Mn(r,e){try{r.container.addComponent(e)}catch(n){D.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function te(r){let e=r.name;if(St.has(e))return D.debug(`There were multiple attempts to register component ${e}.`),!1;St.set(e,r);for(let n of Te.values())Mn(n,r);for(let n of qi.values())Mn(n,r);return!0}function Rt(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function T(r){return r.settings!==void 0}var Wi={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},U=new N("app","Firebase",Wi);var At=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U.create("app-deleted",{appName:this._name})}};var ne=Hi;function kt(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:Tt,automaticDataCollectionEnabled:!1},e),i=t.name;if(typeof i!="string"||!i)throw U.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw U.create("no-options");let s=Te.get(i);if(s){if(Y(n,s.options)&&Y(t,s.config))return s;throw U.create("duplicate-app",{appName:i})}let o=new we(i);for(let c of St.values())o.addComponent(c);let a=new At(n,t,o);return Te.set(i,a),a}function Vn(r=Tt){let e=Te.get(r);if(!e&&r===Tt&&ft())return kt();if(!e)throw U.create("no-app",{appName:r});return e}function F(r,e,n){var t;let i=(t=ji[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);let s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){let a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),D.warn(a.join(" "));return}te(new O(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}var Bi="firebase-heartbeat-database",$i=1,oe="firebase-heartbeat-store",Et=null;function Hn(){return Et||(Et=Dn(Bi,$i,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(oe)}catch(n){console.warn(n)}}}}).catch(r=>{throw U.create("idb-open",{originalErrorMessage:r.message})})),Et}async function zi(r){try{let n=(await Hn()).transaction(oe),t=await n.objectStore(oe).get(jn(r));return await n.done,t}catch(e){if(e instanceof b)D.warn(e.message);else{let n=U.create("idb-get",{originalErrorMessage:e?.message});D.warn(n.message)}}}async function xn(r,e){try{let t=(await Hn()).transaction(oe,"readwrite");await t.objectStore(oe).put(e,jn(r)),await t.done}catch(n){if(n instanceof b)D.warn(n.message);else{let t=U.create("idb-set",{originalErrorMessage:n?.message});D.warn(t.message)}}}function jn(r){return`${r.name}!${r.options.appId}`}var Gi=1024,Ki=30*24*60*60*1e3,Ot=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Ct(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Un();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{let a=new Date(o.date).valueOf();return Date.now()-a<=Ki}),this._storage.overwrite(this._heartbeatsCache))}catch(t){D.warn(t)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=Un(),{heartbeatsToSend:t,unsentEntries:i}=Ji(this._heartbeatsCache.heartbeats),s=ut(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return D.warn(n),""}}};function Un(){return new Date().toISOString().substring(0,10)}function Ji(r,e=Gi){let n=[],t=r.slice();for(let i of r){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Fn(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Fn(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var Ct=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return bn()?Tn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await zi(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let i=await this.read();return xn(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};function Fn(r){return ut(JSON.stringify({version:2,heartbeats:r})).length}function Yi(r){te(new O("platform-logger",e=>new wt(e),"PRIVATE")),te(new O("heartbeat",e=>new Ot(e),"PRIVATE")),F(bt,Ln,r),F(bt,Ln,"esm2017"),F("fire-js","")}Yi("");var Xi="firebase",Qi="10.14.1";F(Xi,Qi,"app");function Se(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var B=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,x(n>e,"Short delay should be less than long delay!"),this.isMobile=vn()||En()}get(){return ts()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Zt(r,e){x(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var Ne=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;R("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;R("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;R("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var rs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var is=new B(3e4,6e4);function y(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}async function E(r,e,n,t,i={}){return cr(r,i,async()=>{let s={},o={};t&&(e==="GET"?o=t:s={body:JSON.stringify(t)});let a=X(Object.assign({key:r.config.apiKey},o)).slice(1),c=await r._getAdditionalHeaders();c["Content-Type"]="application/json",r.languageCode&&(c["X-Firebase-Locale"]=r.languageCode);let l=Object.assign({method:e,headers:c},s);return yn()||(l.referrerPolicy="no-referrer"),Ne.fetch()(lr(r,r.config.apiHost,n,a),l)})}async function cr(r,e,n){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},rs),e);try{let i=new Lt(r),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw ae(r,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ae(r,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ae(r,"email-already-in-use",o);if(c==="USER_DISABLED")throw ae(r,"user-disabled",o);let d=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ar(r,d,l);S(r,d)}}catch(i){if(i instanceof b)throw i;S(r,"network-request-failed",{message:String(i)})}}async function H(r,e,n,t,i={}){let s=await E(r,e,n,t,i);return"mfaPendingCredential"in s&&S(r,"multi-factor-auth-required",{_serverResponse:s}),s}function lr(r,e,n,t){let i=`${e}${n}?${t}`;return r.config.emulator?Zt(r.config,i):`${r.config.apiScheme}://${i}`}function ss(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var Lt=class{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(k(this.auth,"network-request-failed")),is.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function ae(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=k(r,e,t);return i.customData._tokenResponse=n,i}function Wn(r){return r!==void 0&&r.enterprise!==void 0}var Mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return ss(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}};async function os(r,e){return E(r,"GET","/v2/recaptchaConfig",y(r,e))}async function as(r,e){return E(r,"POST","/v1/accounts:delete",e)}async function ur(r,e){return E(r,"POST","/v1/accounts:lookup",e)}function ce(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function dr(r,e=!1){let n=A(r),t=await n.getIdToken(e),i=en(t);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:t,authTime:ce(Pt(i.auth_time)),issuedAtTime:ce(Pt(i.iat)),expirationTime:ce(Pt(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Pt(r){return Number(r)*1e3}function en(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return Oe("JWT malformed, contained fewer than 3 sections"),null;try{let i=dt(n);return i?JSON.parse(i):(Oe("Failed to decode base64 JWT payload"),null)}catch(i){return Oe("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Bn(r){let e=en(r);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(r,e,n=!1){if(n)return e;try{return await e}catch(t){throw t instanceof b&&cs(t)&&r.auth.currentUser===r&&await r.auth.signOut(),t}}function cs({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var xt=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var de=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function De(r){var e;let n=r.auth,t=await r.getIdToken(),i=await ue(r,ur(n,{idToken:t}));p(i?.users.length,n,"internal-error");let s=i.users[0];r._notifyReloadListener(s);let o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?fr(s.providerUserInfo):[],a=ls(r.providerData,o),c=r.isAnonymous,l=!(r.email&&s.passwordHash)&&!a?.length,d=c?l:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new de(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(r,h)}async function hr(r){let e=A(r);await De(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ls(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function fr(r){return r.map(e=>{var{providerId:n}=e,t=Se(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}async function us(r,e){let n=await cr(r,{},async()=>{let t=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=r.config,o=lr(r,i,"/v1/token",`key=${s}`),a=await r._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(o,{method:"POST",headers:a,body:t})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ds(r,e){return E(r,"POST","/v2/accounts:revokeToken",y(r,e))}var le=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Bn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Bn(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:t,refreshToken:i,expiresIn:s}=await us(e,n);this.updateTokensAndExpiration(t,i,Number(s))}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:s}=n,o=new r;return t&&(p(typeof t=="string","internal-error",{appName:e}),o.refreshToken=t),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new r,this.toJSON())}_performRefresh(){return R("not implemented")}};function V(r,e){p(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var ie=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,s=Se(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new xt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new de(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let n=await ue(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return dr(this,e)}reload(){return hr(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&await De(this),await this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(T(this.auth.app))return Promise.reject(M(this.auth));let e=await this.getIdToken();return await ue(this,as(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var t,i,s,o,a,c,l,d;let h=(t=n.displayName)!==null&&t!==void 0?t:void 0,u=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,m=(o=n.photoURL)!==null&&o!==void 0?o:void 0,g=(a=n.tenantId)!==null&&a!==void 0?a:void 0,v=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,w=(l=n.createdAt)!==null&&l!==void 0?l:void 0,q=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:rt,emailVerified:un,isAnonymous:dn,providerData:it,stsTokenManager:hn}=n;p(rt&&hn,e,"internal-error");let Vr=le.fromJSON(this.name,hn);p(typeof rt=="string",e,"internal-error"),V(h,e.name),V(u,e.name),p(typeof un=="boolean",e,"internal-error"),p(typeof dn=="boolean",e,"internal-error"),V(f,e.name),V(m,e.name),V(g,e.name),V(v,e.name),V(w,e.name),V(q,e.name);let st=new r({uid:rt,auth:e,email:u,emailVerified:un,displayName:h,isAnonymous:dn,photoURL:m,phoneNumber:f,tenantId:g,stsTokenManager:Vr,createdAt:w,lastLoginAt:q});return it&&Array.isArray(it)&&(st.providerData=it.map(Hr=>Object.assign({},Hr))),v&&(st._redirectEventId=v),st}static async _fromIdTokenResponse(e,n,t=!1){let i=new le;i.updateFromServerResponse(n);let s=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return await De(s),s}static async _fromGetAccountInfoResponse(e,n,t){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?fr(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new le;a.updateFromIdToken(t);let c=new r({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new de(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}};var $n=new Map;function L(r){x(r instanceof Function,"Expected a class definition");let e=$n.get(r);return e?(x(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,$n.set(r,e),e)}var Le=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Le.type="NONE";var Ut=Le;function Ce(r,e,n){return`firebase:${r}:${e}:${n}`}var Me=class r{constructor(e,n,t){this.persistence=e,this.auth=n,this.userKey=t;let{config:i,name:s}=this.auth;this.fullUserKey=Ce(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ce("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,t="authUser"){if(!n.length)return new r(L(Ut),e,t);let i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l),s=i[0]||L(Ut),o=Ce(t,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=await l._get(o);if(d){let h=ie._fromJSON(e,d);l!==s&&(a=h),s=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new r(s,e,t):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new r(s,e,t))}};function zn(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_r(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(yr(e))return"Blackberry";if(Ir(e))return"Webos";if(mr(e))return"Safari";if((e.includes("chrome/")||gr(e))&&!e.includes("edge/"))return"Chrome";if(vr(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function pr(r=I()){return/firefox\//i.test(r)}function mr(r=I()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gr(r=I()){return/crios\//i.test(r)}function _r(r=I()){return/iemobile/i.test(r)}function vr(r=I()){return/android/i.test(r)}function yr(r=I()){return/blackberry/i.test(r)}function Ir(r=I()){return/webos/i.test(r)}function tn(r=I()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function hs(r=I()){var e;return tn(r)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function fs(){return wn()&&document.documentMode===10}function Er(r=I()){return tn(r)||vr(r)||Ir(r)||yr(r)||/windows phone/i.test(r)||_r(r)}function wr(r,e=[]){let n;switch(r){case"Browser":n=zn(I());break;case"Worker":n=`${zn(I())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ne}/${t}`}var Ft=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=s=>new Promise((o,a)=>{try{let c=e(s);o(c)}catch(c){a(c)}});t.onAbort=n,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let t of this.queue)await t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}};async function ps(r,e={}){return E(r,"GET","/v2/passwordPolicy",y(r,e))}var ms=6,Vt=class{constructor(e){var n,t,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ms,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,t,i,s,o,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var Ht=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xe(this),this.idTokenSubscription=new xe(this),this.beforeStateQueue=new Ft(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=or,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=L(n)),this._initializationPromise=this.queue(async()=>{var t,i;if(!this._deleted&&(this.persistenceManager=await Me.create(this,e),!this._deleted)){if(!((t=this._popupRedirectResolver)===null||t===void 0)&&t._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let n=await ur(this,{idToken:e}),t=await ie._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(T(this.app)){let o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await De(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ns()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(T(this.app))return Promise.reject(M(this));let n=e?A(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return T(this.app)?Promise.reject(M(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return T(this.app)?Promise.reject(M(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(L(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ps(this),n=new Vt(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new N("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),await ds(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){let t=await this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&L(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await Me.create(this,[L(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,t;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{o=!0,c()}}else{let c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let t=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());t&&(n["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;let n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&Zi(`Error while retrieving App Check token: ${n.error}`),n?.token}};function j(r){return A(r)}var xe=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=An(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Ze={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gs(r){Ze=r}function br(r){return Ze.loadJS(r)}function _s(){return Ze.recaptchaEnterpriseScript}function vs(){return Ze.gapiScript}function Tr(r){return`__${r}${Math.floor(Math.random()*1e6)}`}var ys="recaptcha-enterprise",Is="NO_RECAPTCHA",jt=class{constructor(e){this.type=ys,this.auth=j(e)}async verify(e="verify",n=!1){async function t(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{os(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let l=new Mt(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){let c=window.grecaptcha;Wn(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(Is)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{t(this.auth).then(a=>{if(!n&&Wn(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=_s();c.length!==0&&(c+=a),br(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}};async function Gn(r,e,n,t=!1){let i=new jt(r),s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}let o=Object.assign({},e);return t?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function qt(r,e,n,t){var i;if(!((i=r._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Gn(r,e,n,n==="getOobCode");return t(r,s)}else return t(r,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Gn(r,e,n,n==="getOobCode");return t(r,o)}else return Promise.reject(s)})}function Sr(r,e){let n=Rt(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(Y(s,e??{}))return i;S(i,"already-initialized")}return n.initialize({options:e})}function Es(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(L);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}function et(r,e,n){let t=j(r);p(t._canInitEmulator,t,"emulator-config-failed"),p(/^https?:\/\//.test(e),t,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ar(e),{host:o,port:a}=ws(e),c=a===null?"":`:${a}`;t.config.emulator={url:`${s}//${o}${c}/`},t.settings.appVerificationDisabledForTesting=!0,t.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||bs()}function Ar(r){let e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function ws(r){let e=Ar(r),n=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!n)return{host:"",port:null};let t=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(t);if(i){let s=i[1];return{host:s,port:Kn(t.substr(s.length+1))}}else{let[s,o]=t.split(":");return{host:s,port:Kn(o)}}}function Kn(r){if(!r)return null;let e=Number(r);return isNaN(e)?null:e}function bs(){function r(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}var $=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return R("not implemented")}_getIdTokenResponse(e){return R("not implemented")}_linkToIdToken(e,n){return R("not implemented")}_getReauthenticationResolver(e){return R("not implemented")}};async function Ts(r,e){return E(r,"POST","/v1/accounts:signUp",e)}async function Ss(r,e){return H(r,"POST","/v1/accounts:signInWithPassword",y(r,e))}async function As(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}async function Os(r,e){return H(r,"POST","/v1/accounts:signInWithEmailLink",y(r,e))}var he=class r extends ${constructor(e,n,t,i=null){super("password",t),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new r(e,n,"password")}static _fromEmailAndCode(e,n,t=null){return new r(e,n,"emailLink",t)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,n,"signInWithPassword",Ss);case"emailLink":return As(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let t={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qt(e,t,"signUpPassword",Ts);case"emailLink":return Os(e,{idToken:n,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function re(r,e){return H(r,"POST","/v1/accounts:signInWithIdp",y(r,e))}var Cs="http://localhost",z=class r extends ${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):S("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:t,signInMethod:i}=n,s=Se(n,["providerId","signInMethod"]);if(!t||!i)return null;let o=new r(t,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return re(e,n)}_linkToIdToken(e,n){let t=this.buildRequest();return t.idToken=n,re(e,t)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,re(e,n)}buildRequest(){let e={requestUri:Cs,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=X(n)}return e}};async function Rs(r,e){return E(r,"POST","/v1/accounts:sendVerificationCode",y(r,e))}async function ks(r,e){return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e))}async function Ps(r,e){let n=await H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,e));if(n.temporaryProof)throw ae(r,"account-exists-with-different-credential",n);return n}var Ns={USER_NOT_FOUND:"user-not-found"};async function Ds(r,e){let n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return H(r,"POST","/v1/accounts:signInWithPhoneNumber",y(r,n),Ns)}var fe=class r extends ${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new r({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new r({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ks(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ps(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return Ds(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:t,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:t,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s}=e;return!t&&!n&&!i&&!s?null:new r({verificationId:n,verificationCode:t,phoneNumber:i,temporaryProof:s})}};function Ls(r){switch(r){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Ms(r){let e=Q(Z(r)).link,n=e?Q(Z(e)).deep_link_id:null,t=Q(Z(r)).deep_link_id;return(t?Q(Z(t)).link:null)||t||n||e||r}var Ue=class r{constructor(e){var n,t,i,s,o,a;let c=Q(Z(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,d=(t=c.oobCode)!==null&&t!==void 0?t:null,h=Ls((i=c.mode)!==null&&i!==void 0?i:null);p(l&&d&&h,"argument-error"),this.apiKey=l,this.operation=h,this.code=d,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){let n=Ms(e);try{return new r(n)}catch{return null}}};var G=class r{constructor(){this.providerId=r.PROVIDER_ID}static credential(e,n){return he._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let t=Ue.parseLink(n);return p(t,"argument-error"),he._fromEmailAndCode(e,t.code,t.tenantId)}};G.PROVIDER_ID="password";G.EMAIL_PASSWORD_SIGN_IN_METHOD="password";G.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Fe=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};var K=class extends Fe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var pe=class r extends K{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};pe.FACEBOOK_SIGN_IN_METHOD="facebook.com";pe.PROVIDER_ID="facebook.com";var me=class r extends K{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:t}=e;if(!n&&!t)return null;try{return r.credential(n,t)}catch{return null}}};me.GOOGLE_SIGN_IN_METHOD="google.com";me.PROVIDER_ID="google.com";var ge=class r extends K{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r.credential(e.oauthAccessToken)}catch{return null}}};ge.GITHUB_SIGN_IN_METHOD="github.com";ge.PROVIDER_ID="github.com";var _e=class r extends K{constructor(){super("twitter.com")}static credential(e,n){return z._fromParams({providerId:r.PROVIDER_ID,signInMethod:r.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return r.credentialFromTaggedObject(e)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:t}=e;if(!n||!t)return null;try{return r.credential(n,t)}catch{return null}}};_e.TWITTER_SIGN_IN_METHOD="twitter.com";_e.PROVIDER_ID="twitter.com";async function xs(r,e){return H(r,"POST","/v1/accounts:signUp",y(r,e))}var se=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,t,i=!1){let s=await ie._fromIdTokenResponse(e,t,i),o=Jn(t);return new r({user:s,providerId:o,_tokenResponse:t,operationType:n})}static async _forOperation(e,n,t){await e._updateTokensIfNecessary(t,!0);let i=Jn(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})}};function Jn(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}var Wt=class r extends b{constructor(e,n,t,i){var s;super(n.code,n.message),this.operationType=t,this.user=i,Object.setPrototypeOf(this,r.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:t}}static _fromErrorAndOperation(e,n,t,i){return new r(e,n,t,i)}};function Or(r,e,n,t){return(e==="reauthenticate"?n._getReauthenticationResolver(r):n._getIdTokenResponse(r)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Wt._fromErrorAndOperation(r,s,e,t):s})}async function Us(r,e,n=!1){let t=await ue(r,e._linkToIdToken(r.auth,await r.getIdToken()),n);return se._forOperation(r,"link",t)}async function Fs(r,e,n=!1){let{auth:t}=r;if(T(t.app))return Promise.reject(M(t));let i="reauthenticate";try{let s=await ue(r,Or(t,i,e,r),n);p(s.idToken,t,"internal-error");let o=en(s.idToken);p(o,t,"internal-error");let{sub:a}=o;return p(r.uid===a,t,"user-mismatch"),se._forOperation(r,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(t,"user-mismatch"),s}}async function Cr(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t="signIn",i=await Or(r,t,e),s=await se._fromIdTokenResponse(r,t,i);return n||await r._updateCurrentUser(s.user),s}async function Rr(r,e){return Cr(j(r),e)}async function kr(r){let e=j(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function nn(r,e,n){if(T(r.app))return Promise.reject(M(r));let t=j(r),o=await qt(t,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xs).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&kr(r),c}),a=await se._fromIdTokenResponse(t,"signIn",o);return await t._updateCurrentUser(a.user),a}function rn(r,e,n){return T(r.app)?Promise.reject(M(r)):Rr(A(r),G.credential(e,n)).catch(async t=>{throw t.code==="auth/password-does-not-meet-requirements"&&kr(r),t})}function tt(r,e,n,t){return A(r).onIdTokenChanged(e,n,t)}function Pr(r,e,n){return A(r).beforeAuthStateChanged(e,n)}function sn(r){return A(r).signOut()}function Vs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function Hs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}function js(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:start",y(r,e))}function qs(r,e){return E(r,"POST","/v2/accounts/mfaEnrollment:finalize",y(r,e))}var Ve="__sak";var He=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ve,"1"),this.storage.removeItem(Ve),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Ws=1e3,Bs=10,je=class extends He{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Er(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let t=this.storage.getItem(n),i=this.localCache[n];t!==i&&e(n,i,t)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}let t=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(t);!n&&this.localCache[t]===o||this.notifyListeners(t,o)},s=this.storage.getItem(t);fs()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Bs):i()}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,t)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:t}),!0)})},Ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};je.type="LOCAL";var Nr=je;var qe=class extends He{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};qe.type="SESSION";var on=qe;function $s(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var We=class r{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let t=new r(e);return this.receivers.push(t),t}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:t,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:t,eventType:i});let a=Array.from(o).map(async l=>l(n.origin,s)),c=await $s(a);n.ports[0].postMessage({status:"done",eventId:t,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};We.receivers=[];function an(r="",e=10){let n="";for(let t=0;t{let l=an("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},t);o={messageChannel:i,onMessage(h){let u=h;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function P(){return window}function zs(r){P().location.href=r}function Dr(){return typeof P().WorkerGlobalScope<"u"&&typeof P().importScripts=="function"}async function Gs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ks(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function Js(){return Dr()?self:null}var Lr="firebaseLocalStorageDb",Ys=1,Be="firebaseLocalStorage",Mr="fbase_key",J=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function nt(r,e){return r.transaction([Be],e?"readwrite":"readonly").objectStore(Be)}function Xs(){let r=indexedDB.deleteDatabase(Lr);return new J(r).toPromise()}function $t(){let r=indexedDB.open(Lr,Ys);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(Be,{keyPath:Mr})}catch(i){n(i)}}),r.addEventListener("success",async()=>{let t=r.result;t.objectStoreNames.contains(Be)?e(t):(t.close(),await Xs(),e(await $t()))})})}async function Yn(r,e,n){let t=nt(r,!0).put({[Mr]:e,value:n});return new J(t).toPromise()}async function Qs(r,e){let n=nt(r,!1).get(e),t=await new J(n).toPromise();return t===void 0?null:t.value}function Xn(r,e){let n=nt(r,!0).delete(e);return new J(n).toPromise()}var Zs=800,eo=3,$e=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await $t(),this.db)}async _withRetries(e){let n=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(t){if(n++>eo)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=We._getInstance(Js()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gs(),!this.activeServiceWorker)return;this.sender=new Bt(this.activeServiceWorker);let t=await this.sender._send("ping",{},800);t&&!((e=t[0])===null||e===void 0)&&e.fulfilled&&!((n=t[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ks()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await $t();return await Yn(e,Ve,"1"),await Xn(e,Ve),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yn(t,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(t=>Qs(t,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xn(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=nt(i,!1).getAll();return new J(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],t=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)t.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!t.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let t=this.listeners[e];if(t)for(let i of Array.from(t))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};$e.type="LOCAL";var xr=$e;function to(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:start",y(r,e))}function no(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}function ro(r,e){return E(r,"POST","/v2/accounts/mfaSignIn:finalize",y(r,e))}var Ca=Tr("rcb"),Ra=new B(3e4,6e4);var io="recaptcha";async function so(r,e,n){var t;let i=await n.verify();try{p(typeof i=="string",r,"argument-error"),p(n.type===io,r,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){let o=s.session;if("phoneNumber"in s)return p(o.type==="enroll",r,"internal-error"),(await Vs(r,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{p(o.type==="signin",r,"internal-error");let a=((t=s.multiFactorHint)===null||t===void 0?void 0:t.uid)||s.multiFactorUid;return p(a,r,"missing-multi-factor-info"),(await to(r,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{let{sessionInfo:o}=await Rs(r,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}var ve=class r{constructor(e){this.providerId=r.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,n){return so(this.auth,e,A(n))}static credential(e,n){return fe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return r.credentialFromTaggedObject(n)}static credentialFromError(e){return r.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:t}=e;return n&&t?fe._fromTokenResponse(n,t):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";function oo(r,e){return e?L(e):(p(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}var ye=class extends ${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return re(e,this._buildIdpRequest())}_linkToIdToken(e,n){return re(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return re(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}};function ao(r){return Cr(r.auth,new ye(r),r.bypassAuthState)}function co(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Fs(n,new ye(r),r.bypassAuthState)}async function lo(r){let{auth:e,user:n}=r;return p(n,e,"internal-error"),Us(n,new ye(r),r.bypassAuthState)}var ze=class{constructor(e,n,t,i,s=!1){this.auth=e,this.resolver=t,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:t,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let c={auth:this.auth,requestUri:n,sessionId:t,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ao;case"linkViaPopup":case"linkViaRedirect":return lo;case"reauthViaPopup":case"reauthViaRedirect":return co;default:S(this.auth,"internal-error")}}resolve(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){x(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var uo=new B(2e3,1e4);var zt=class r extends ze{constructor(e,n,t,i,s){super(e,n,i,s),this.provider=t,this.authWindow=null,this.pollId=null,r.currentPopupAction&&r.currentPopupAction.cancel(),r.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){x(this.filter.length===1,"Popup operations only handle one event");let e=an();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,r.currentPopupAction=null}pollUserCancellation(){let e=()=>{var n,t;if(!((t=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||t===void 0)&&t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,uo.get())};e()}};zt.currentPopupAction=null;var ho="pendingRedirect",Re=new Map,Gt=class extends ze{constructor(e,n,t=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,t),this.eventId=null}async execute(){let e=Re.get(this.auth._key());if(!e){try{let t=await fo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(n){e=()=>Promise.reject(n)}Re.set(this.auth._key(),e)}return this.bypassAuthState||Re.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function fo(r,e){let n=go(e),t=mo(r);if(!await t._isAvailable())return!1;let i=await t._get(n)==="true";return await t._remove(n),i}function po(r,e){Re.set(r._key(),e)}function mo(r){return L(r._redirectPersistence)}function go(r){return Ce(ho,r.config.apiKey,r.name)}async function _o(r,e,n=!1){if(T(r.app))return Promise.reject(M(r));let t=j(r),i=oo(t,e),o=await new Gt(t,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await t._persistUserIfCurrent(o.user),await t._setRedirectUser(null,e)),o}var vo=10*60*1e3,Kt=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(t=>{this.isEventForConsumer(e,t)&&(n=!0,this.sendToConsumer(e,t),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!yo(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var t;if(e.error&&!Ur(e)){let i=((t=e.error.code)===null||t===void 0?void 0:t.split("auth/")[1])||"internal-error";n.onError(k(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let t=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&t}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=vo&&this.cachedEventUids.clear(),this.cachedEventUids.has(Qn(e))}saveEventToCache(e){this.cachedEventUids.add(Qn(e)),this.lastProcessedEventTime=Date.now()}};function Qn(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Ur({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function yo(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ur(r);default:return!1}}async function Io(r,e={}){return E(r,"GET","/v1/projects",e)}var Eo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wo=/^https?/;async function bo(r){if(r.config.emulator)return;let{authorizedDomains:e}=await Io(r);for(let n of e)try{if(To(n))return}catch{}S(r,"unauthorized-domain")}function To(r){let e=Dt(),{protocol:n,hostname:t}=new URL(e);if(r.startsWith("chrome-extension://")){let o=new URL(r);return o.hostname===""&&t===""?n==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===t}if(!wo.test(n))return!1;if(Eo.test(r))return t===r;let i=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(t)}var So=new B(3e4,6e4);function Zn(){let r=P().___jsl;if(r?.H){for(let e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let n=0;n{var t,i,s;function o(){Zn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Zn(),n(k(r,"network-request-failed"))},timeout:So.get()})}if(!((i=(t=P().gapi)===null||t===void 0?void 0:t.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=P().gapi)===null||s===void 0)&&s.load)o();else{let a=Tr("iframefcb");return P()[a]=()=>{gapi.load?o():n(k(r,"network-request-failed"))},br(`${vs()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw ke=null,e})}var ke=null;function Oo(r){return ke=ke||Ao(r),ke}var Co=new B(5e3,15e3),Ro="__/auth/iframe",ko="emulator/auth/iframe",Po={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},No=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Do(r){let e=r.config;p(e.authDomain,r,"auth-domain-config-required");let n=e.emulator?Zt(e,ko):`https://${r.config.authDomain}/${Ro}`,t={apiKey:e.apiKey,appName:r.name,v:ne},i=No.get(r.config.apiHost);i&&(t.eid=i);let s=r._getFrameworks();return s.length&&(t.fw=s.join(",")),`${n}?${X(t).slice(1)}`}async function Lo(r){let e=await Oo(r),n=P().gapi;return p(n,r,"internal-error"),e.open({where:document.body,url:Do(r),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Po,dontclear:!0},t=>new Promise(async(i,s)=>{await t.restyle({setHideOnLeave:!1});let o=k(r,"network-request-failed"),a=P().setTimeout(()=>{s(o)},Co.get());function c(){P().clearTimeout(a),i(t)}t.ping(c).then(c,()=>{s(o)})}))}var Mo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xo=500,Uo=600,Fo="_blank",Vo="http://localhost",Ge=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Ho(r,e,n,t=xo,i=Uo){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-t)/2,0).toString(),a="",c=Object.assign(Object.assign({},Mo),{width:t.toString(),height:i.toString(),top:s,left:o}),l=I().toLowerCase();n&&(a=gr(l)?Fo:n),pr(l)&&(e=e||Vo,c.scrollbars="yes");let d=Object.entries(c).reduce((u,[f,m])=>`${u}${f}=${m},`,"");if(hs(l)&&a!=="_self")return jo(e||"",a),new Ge(null);let h=window.open(e||"",a,d);p(h,r,"popup-blocked");try{h.focus()}catch{}return new Ge(h)}function jo(r,e){let n=document.createElement("a");n.href=r,n.target=e;let t=document.createEvent("MouseEvent");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(t)}var qo="__/auth/handler",Wo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function er(r,e,n,t,i,s){p(r.config.authDomain,r,"auth-domain-config-required"),p(r.config.apiKey,r,"invalid-api-key");let o={apiKey:r.config.apiKey,appName:r.name,authType:n,redirectUrl:t,v:ne,eventId:i};if(e instanceof Fe){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",Sn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof K){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);let a=o;for(let d of Object.keys(a))a[d]===void 0&&delete a[d];let c=await r._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${$o(r)}?${X(a).slice(1)}${l}`}function $o({config:r}){return r.emulator?Zt(r,Wo):`https://${r.authDomain}/${qo}`}var Nt="webStorageSupport",Jt=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=on,this._completeRedirectFn=_o,this._overrideRedirectResult=po}async _openPopup(e,n,t,i){var s;x((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");let o=await er(e,n,t,Dt(),i);return Ho(e,o,an())}async _openRedirect(e,n,t,i){await this._originValidation(e);let s=await er(e,n,t,Dt(),i);return zs(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(x(s,"If manager is not set, promise should be"),s)}let t=this.initAndGetManager(e);return this.eventManagers[n]={promise:t},t.catch(()=>{delete this.eventManagers[n]}),t}async initAndGetManager(e){let n=await Lo(e),t=new Kt(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:t.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:t},this.iframes[e._key()]=n,t}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Nt,{type:Nt},i=>{var s;let o=(s=i?.[0])===null||s===void 0?void 0:s[Nt];o!==void 0&&n(!!o),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bo(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Er()||mr()||tn()}},Fr=Jt,Ke=class{constructor(e){this.factorId=e}_process(e,n,t){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,t);case"signin":return this._finalizeSignIn(e,n.credential);default:return R("unexpected MultiFactorSessionType")}}},Yt=class r extends Ke{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new r(e)}_finalizeEnroll(e,n,t){return Hs(e,{idToken:n,displayName:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return no(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Je=class{constructor(){}static assertion(e){return Yt._fromCredential(e)}};Je.FACTOR_ID="phone";var Ye=class{static assertionForEnrollment(e,n){return Xe._fromSecret(e,n)}static assertionForSignIn(e,n){return Xe._fromEnrollmentId(e,n)}static async generateSecret(e){var n;let t=e;p(typeof((n=t.user)===null||n===void 0?void 0:n.auth)<"u","internal-error");let i=await js(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Qe._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Ye.FACTOR_ID="totp";var Xe=class r extends Ke{constructor(e,n,t){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=t}static _fromSecret(e,n){return new r(n,void 0,e)}static _fromEnrollmentId(e,n){return new r(n,e)}async _finalizeEnroll(e,n,t){return p(typeof this.secret<"u",e,"argument-error"),qs(e,{idToken:n,displayName:t,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let t={verificationCode:this.otp};return ro(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:t})}},Qe=class r{constructor(e,n,t,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=t,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new r(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){var t;let i=!1;return(Ae(e)||Ae(n))&&(i=!0),i&&(Ae(e)&&(e=((t=this.auth.currentUser)===null||t===void 0?void 0:t.email)||"unknownuser"),Ae(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Ae(r){return typeof r>"u"||r?.length===0}var tr="@firebase/auth",nr="1.7.9";var Xt=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function zo(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Go(r){te(new O("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=t.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wr(r)},l=new Ht(t,i,s,c);return Es(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),te(new O("auth-internal",e=>{let n=j(e.getProvider("auth").getImmediate());return(t=>new Xt(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),F(tr,nr,zo(r)),F(tr,nr,"esm2017")}var Ko=5*60,Jo=pt("authIdTokenMaxAge")||Ko,rr=null,Yo=r=>async e=>{let n=e&&await e.getIdTokenResult(),t=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(t&&t>Jo)return;let i=n?.token;rr!==i&&(rr=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function cn(r=Vn()){let e=Rt(r,"auth");if(e.isInitialized())return e.getImmediate();let n=Sr(r,{popupRedirectResolver:Fr,persistence:[xr,Nr,on]}),t=pt("authTokenSyncURL");if(t&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(t,location.origin);if(location.origin===s.origin){let o=Yo(s.toString());Pr(n,o,()=>o(n.currentUser)),tt(n,a=>o(a))}}let i=_n("auth");return i&&et(n,`http://${i}`),n}function Xo(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}gs({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},t.type="text/javascript",t.charset="UTF-8",Xo().appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Go("Browser");ot.config.logAll=!0;var Qo=kt({apiKey:"demo-api-key",authDomain:"demo-project.firebaseapp.com",projectId:"demo-project"}),Ie=cn(Qo);(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&et(Ie,"http://"+window.location.hostname+":9099");var ln="";tt(Ie,async r=>{ln=await r?.getIdToken()??""});ot.on("htmx:config:request",r=>{ln&&(r.detail.ctx.request.headers.Authorization="Bearer "+ln)});window.firebaseSignIn=async(r,e,n)=>{let t=document.getElementById(n);try{t&&(t.innerText=""),await rn(Ie,r,e),window.location.href="?"}catch(i){if(i.code==="auth/user-not-found"||i.code==="auth/invalid-credential")try{await nn(Ie,r,e),window.location.href="?"}catch(s){t&&(t.innerText="Error creating demo user: "+s.message)}else t&&(t.innerText="Sign in error: "+i.message)}};window.firebaseSignOut=async()=>{await sn(Ie),window.location.href="?mode=signin"}; '''; diff --git a/Dart/htmx/dart-htmx/web/app.ts b/Dart/htmx/dart-htmx/web/app.ts index 1452370eed..546c2b4343 100644 --- a/Dart/htmx/dart-htmx/web/app.ts +++ b/Dart/htmx/dart-htmx/web/app.ts @@ -1,4 +1,8 @@ import htmx from 'htmx.org'; + +// Enable verbose HTMX logging to the browser console (HTMX v4 syntax) +htmx.config.logAll = true; + import { initializeApp } from 'firebase/app'; import { getAuth, @@ -30,8 +34,6 @@ onIdTokenChanged(auth, async (user: User | null) => { currentIdToken = (await user?.getIdToken()) ?? ''; }); -htmx.config.logAll = true; - // Configure HTMX to attach Authorization header (HTMX v4 context API) // NOTE: This manual header injection could potentially be replaced with native browser cookies // using `browserCookiePersistence` once it graduates from Beta/Public Preview.