cloudcommerce 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/action.yml +4 -0
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +2 -2
- package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
- package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +6 -6
- package/ecomplus-stores/monocard/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/core/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/events/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/modules/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/passport/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/ssr/package.json +8 -7
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-acucares.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-barras.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-bebidas-em-po.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-cookies.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-granola-tia-sonia.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-integrais.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-naturais.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-pastas-tia-sonia.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-snacks.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-ultrabar.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/daniel-cady.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/granola-tradicional-lata-verso.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/granola-tradicional-lata.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/machu-picchu-1500.jpg +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-ibd-120-80.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-organico-120-80.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-usda-120-80.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-vegano-120-80.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/tia-sonia-real.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/trustvox.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/AboutUs.astro +77 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/BrandTestimonials.vue +134 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/CategoriesGrid.vue +32 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/CategoriesSlider.vue +105 -7
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/HeroBanner.vue +2 -2
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Base.astro +5 -1
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Pages.astro +1 -1
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Home.astro +116 -25
- package/ecomplus-stores/tia-sonia/package.json +1 -1
- package/package.json +12 -12
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/CHANGELOG.md +1 -0
- package/packages/apps/datafrete/README.md +1 -0
- package/packages/apps/datafrete/lib/datafrete-webhook.d.ts +4 -0
- package/packages/apps/datafrete/lib/datafrete-webhook.js +108 -0
- package/packages/apps/datafrete/lib/datafrete-webhook.js.map +1 -0
- package/packages/apps/datafrete/lib/datafrete.d.ts +2 -0
- package/packages/apps/datafrete/lib/datafrete.js +6 -0
- package/packages/apps/datafrete/lib/datafrete.js.map +1 -0
- package/packages/apps/datafrete/lib/index.d.ts +1 -0
- package/packages/apps/datafrete/lib/index.js +2 -0
- package/packages/apps/datafrete/lib/index.js.map +1 -0
- package/packages/apps/datafrete/lib-mjs/calculate-datafrete.mjs +277 -0
- package/packages/apps/datafrete/package.json +37 -0
- package/packages/apps/datafrete/src/datafrete-webhook.ts +131 -0
- package/packages/apps/datafrete/src/datafrete.ts +7 -0
- package/packages/apps/datafrete/src/index.ts +1 -0
- package/packages/apps/datafrete/tsconfig.json +6 -0
- package/packages/apps/datafrete/webhook.js +1 -0
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +2 -2
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js +3 -2
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js.map +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/galaxpay/src/functions-lib/galaxpay/webhook.ts +3 -2
- package/packages/apps/google-analytics/CHANGELOG.md +1 -0
- package/packages/apps/google-analytics/README.md +1 -0
- package/packages/apps/google-analytics/lib/google-analytics-events.js +113 -0
- package/packages/apps/google-analytics/lib/google-analytics-events.js.map +1 -0
- package/packages/apps/google-analytics/lib/index.js +2 -0
- package/packages/apps/google-analytics/lib/index.js.map +1 -0
- package/packages/apps/google-analytics/package.json +32 -0
- package/packages/apps/google-analytics/src/google-analytics-events.ts +151 -0
- package/packages/apps/google-analytics/src/index.ts +1 -0
- package/packages/apps/google-analytics/tsconfig.json +3 -0
- package/packages/apps/google-analytics/types.d.ts +43 -0
- package/packages/apps/infinitepay/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mercadopago/lib/mp-create-transaction.js +1 -1
- package/packages/apps/mercadopago/lib/mp-create-transaction.js.map +1 -1
- package/packages/apps/mercadopago/lib/mp-webhook.js +2 -7
- package/packages/apps/mercadopago/lib/mp-webhook.js.map +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/mercadopago/src/mp-create-transaction.ts +1 -1
- package/packages/apps/mercadopago/src/mp-webhook.ts +3 -8
- package/packages/apps/pagarme/lib/pagarme-webhook.js +1 -1
- package/packages/apps/pagarme/lib/pagarme-webhook.js.map +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/pagarme/src/pagarme-webhook.ts +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +2 -2
- package/packages/events/lib/firebase.js +4 -0
- package/packages/events/lib/firebase.js.map +1 -1
- package/packages/events/package.json +3 -1
- package/packages/events/src/firebase.ts +4 -0
- package/packages/firebase/lib/config.d.ts +7 -0
- package/packages/firebase/lib/config.js +10 -0
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/firebase/src/config.ts +11 -0
- package/packages/i18n/package.json +1 -1
- package/packages/modules/lib/firebase/call-app-module.js +5 -0
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/package.json +3 -2
- package/packages/modules/src/firebase/call-app-module.ts +5 -0
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +4 -3
- package/packages/storefront/.eslintrc.cjs +5 -1
- package/packages/storefront/astro.config.mjs +9 -24
- package/packages/storefront/client.d.ts +6 -8
- package/packages/storefront/dist/client/PitchBar.afe7ff5c.js +1 -0
- package/packages/storefront/dist/client/Prices.eaf8a32c.js +1 -0
- package/packages/storefront/dist/client/ProductCard.1106b153.js +1 -0
- package/packages/storefront/dist/client/assets/_...slug_.fea84512.css +1 -0
- package/packages/storefront/dist/client/assets/index.90df622b.css +1 -0
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.781b6501.js +1 -0
- package/packages/storefront/dist/client/chunks/ecom-utils.63984324.js +1 -0
- package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.fa6cdb60.js +1 -0
- package/packages/storefront/dist/client/client.367a6497.js +1 -0
- package/packages/storefront/dist/client/hoisted.4671ed15.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/client/workbox-e2ee76b5.js +1 -0
- package/packages/storefront/dist/server/entry.mjs +359 -537
- package/packages/storefront/package.json +10 -9
- package/packages/storefront/src/env.d.ts +9 -0
- package/packages/storefront/src/lib/assets/tooltip.css +6 -5
- package/packages/storefront/src/lib/components/Carousel.vue +259 -0
- package/packages/storefront/src/lib/components/CarouselControl.vue +29 -0
- package/packages/storefront/src/lib/components/LoginDrawer.vue +1 -1
- package/packages/storefront/src/lib/components/PitchBar.vue +44 -0
- package/packages/storefront/src/lib/components/Prices.vue +13 -17
- package/packages/storefront/src/lib/components/ProductCard.vue +1 -1
- package/packages/storefront/src/lib/components/_injection-keys.ts +9 -0
- package/packages/storefront/src/lib/components/globals/ALink.vue +26 -0
- package/packages/storefront/src/lib/layouts/BaseBody.astro +1 -5
- package/packages/storefront/src/lib/layouts/BaseHead.astro +7 -2
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +38 -0
- package/packages/storefront/src/lib/pages/_vue.ts +3 -2
- package/packages/storefront/src/lib/ssr-context.ts +6 -0
- package/packages/storefront/src/vue-globals.d.ts +5 -5
- package/packages/storefront/tailwind.config.cjs +12 -6
- package/packages/storefront/tsconfig.json +2 -2
- package/packages/storefront/uno.config.cjs +4 -4
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/HeaderButtons.6f668467.js +0 -1
- package/packages/storefront/dist/client/Prices.2ada125b.js +0 -1
- package/packages/storefront/dist/client/ProductCard.e5bdea60.js +0 -1
- package/packages/storefront/dist/client/assets/_...slug_.81b9a00c.css +0 -1
- package/packages/storefront/dist/client/assets/index.e6a09532.css +0 -1
- package/packages/storefront/dist/client/chunks/HeaderButtons.cfa275db.js +0 -1
- package/packages/storefront/dist/client/chunks/LoginForm.1ba3ad0d.js +0 -1441
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.9a6ab0d6.js +0 -1
- package/packages/storefront/dist/client/chunks/_plugin-vue_export-helper.0d33cd48.js +0 -1
- package/packages/storefront/dist/client/chunks/ecom-utils.b0a26608.js +0 -1
- package/packages/storefront/dist/client/chunks/preload-helper.1de719f8.js +0 -1
- package/packages/storefront/dist/client/chunks/price.ecf7fed4.js +0 -1
- package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.45ba83fa.js +0 -1
- package/packages/storefront/dist/client/client.4d2b3a73.js +0 -1
- package/packages/storefront/dist/client/hoisted.f6ee2883.js +0 -1
- package/packages/storefront/dist/client/page.5a6f3db5.js +0 -1
- package/packages/storefront/dist/client/workbox-abdc68aa.js +0 -1
- package/packages/storefront/dist/client/~partytown/partytown-atomics.js +0 -2
- package/packages/storefront/dist/client/~partytown/partytown-media.js +0 -2
- package/packages/storefront/dist/client/~partytown/partytown-sw.js +0 -2
- package/packages/storefront/dist/client/~partytown/partytown.js +0 -2
|
@@ -1,1441 +0,0 @@
|
|
|
1
|
-
import{v as bt,b as Jn,w as $e}from"./_plugin-vue_export-helper.0d33cd48.js";import{i as Yn,a as Xn,b as Qn,c as Zn,d as er,e as tr,f as nr,g as wt,h as rr}from"./HeaderButtons.cfa275db.js";import{r as ir,q as Qe,c as de,d as sr,k as He,o as Ve,a as je,b as Et,f as $,t as ne,u as v,n as Tt,g as St,e as kt,Y as We,Z as or,h as ar,F as cr}from"./runtime-core.esm-bundler.45ba83fa.js";import"./ecom-utils.b0a26608.js";import"./preload-helper.1de719f8.js";/* empty css */const lr=n=>{if(n){if(n.display_name)return n.display_name;if(n.name&&n.name.given_name)return n.name.given_name}return""},ur=lr;/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*//**
|
|
17
|
-
* @license
|
|
18
|
-
* Copyright 2017 Google LLC
|
|
19
|
-
*
|
|
20
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
-
* you may not use this file except in compliance with the License.
|
|
22
|
-
* You may obtain a copy of the License at
|
|
23
|
-
*
|
|
24
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
-
*
|
|
26
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
-
* See the License for the specific language governing permissions and
|
|
30
|
-
* limitations under the License.
|
|
31
|
-
*/const Zt=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},dr=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=n[t++],o=n[t++],a=n[t++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const s=n[t++],o=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},en={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(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<n.length;i+=3){const s=n[i],o=i+1<n.length,a=o?n[i+1]:0,c=i+2<n.length,l=c?n[i+2]:0,d=s>>2,f=(s&3)<<4|a>>4;let p=(a&15)<<2|l>>6,y=l&63;c||(y=64,o||(p=64)),r.push(t[d],t[f],t[p],t[y])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Zt(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):dr(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){const s=t[n.charAt(i++)],a=i<n.length?t[n.charAt(i)]:0;++i;const l=i<n.length?t[n.charAt(i)]:64;++i;const f=i<n.length?t[n.charAt(i)]:64;if(++i,s==null||a==null||l==null||f==null)throw Error();const p=s<<2|a>>4;if(r.push(p),l!==64){const y=a<<4&240|l>>2;if(r.push(y),f!==64){const O=l<<6&192|f;r.push(O)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},hr=function(n){const e=Zt(n);return en.encodeByteArray(e,!0)},tn=function(n){return hr(n).replace(/\./g,"")},nn=function(n){try{return en.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
|
|
32
|
-
* @license
|
|
33
|
-
* Copyright 2017 Google LLC
|
|
34
|
-
*
|
|
35
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
-
* you may not use this file except in compliance with the License.
|
|
37
|
-
* You may obtain a copy of the License at
|
|
38
|
-
*
|
|
39
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
-
*
|
|
41
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
43
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
-
* See the License for the specific language governing permissions and
|
|
45
|
-
* limitations under the License.
|
|
46
|
-
*/function m(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function fr(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(m())}function pr(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function mr(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function gr(){const n=m();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function _r(){try{return typeof indexedDB=="object"}catch{return!1}}function vr(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(t){e(t)}})}function Ir(){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.")}/**
|
|
47
|
-
* @license
|
|
48
|
-
* Copyright 2022 Google LLC
|
|
49
|
-
*
|
|
50
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
51
|
-
* you may not use this file except in compliance with the License.
|
|
52
|
-
* You may obtain a copy of the License at
|
|
53
|
-
*
|
|
54
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
-
*
|
|
56
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
58
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
-
* See the License for the specific language governing permissions and
|
|
60
|
-
* limitations under the License.
|
|
61
|
-
*/const yr=()=>Ir().__FIREBASE_DEFAULTS__,br=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n={}.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},wr=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&nn(n[1]);return e&&JSON.parse(e)},at=()=>{try{return yr()||br()||wr()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Er=n=>{var e,t;return(t=(e=at())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Tr=()=>{var n;return(n=at())===null||n===void 0?void 0:n.config},rn=n=>{var e;return(e=at())===null||e===void 0?void 0:e[`_${n}`]};/**
|
|
62
|
-
* @license
|
|
63
|
-
* Copyright 2017 Google LLC
|
|
64
|
-
*
|
|
65
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
66
|
-
* you may not use this file except in compliance with the License.
|
|
67
|
-
* You may obtain a copy of the License at
|
|
68
|
-
*
|
|
69
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
70
|
-
*
|
|
71
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
72
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
73
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
74
|
-
* See the License for the specific language governing permissions and
|
|
75
|
-
* limitations under the License.
|
|
76
|
-
*/class Sr{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
|
|
77
|
-
* @license
|
|
78
|
-
* Copyright 2017 Google LLC
|
|
79
|
-
*
|
|
80
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
81
|
-
* you may not use this file except in compliance with the License.
|
|
82
|
-
* You may obtain a copy of the License at
|
|
83
|
-
*
|
|
84
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
85
|
-
*
|
|
86
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
87
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
88
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
|
-
* See the License for the specific language governing permissions and
|
|
90
|
-
* limitations under the License.
|
|
91
|
-
*/const kr="FirebaseError";class F extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=kr,Object.setPrototypeOf(this,F.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,he.prototype.create)}}class he{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Ar(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new F(i,a,r)}}function Ar(n,e){return n.replace(Rr,(t,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const Rr=/\{\$([^}]+)}/g;function Or(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Te(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const i of t){if(!r.includes(i))return!1;const s=n[i],o=e[i];if(At(s)&&At(o)){if(!Te(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!t.includes(i))return!1;return!0}function At(n){return n!==null&&typeof n=="object"}/**
|
|
92
|
-
* @license
|
|
93
|
-
* Copyright 2017 Google LLC
|
|
94
|
-
*
|
|
95
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
96
|
-
* you may not use this file except in compliance with the License.
|
|
97
|
-
* You may obtain a copy of the License at
|
|
98
|
-
*
|
|
99
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
100
|
-
*
|
|
101
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
102
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
103
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
104
|
-
* See the License for the specific language governing permissions and
|
|
105
|
-
* limitations under the License.
|
|
106
|
-
*/function fe(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function re(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function ie(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function Cr(n,e){const t=new Dr(n,e);return t.subscribe.bind(t)}class Dr{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");Pr(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=ze),i.error===void 0&&(i.error=ze),i.complete===void 0&&(i.complete=ze);const 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 t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}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 Pr(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function ze(){}/**
|
|
107
|
-
* @license
|
|
108
|
-
* Copyright 2021 Google LLC
|
|
109
|
-
*
|
|
110
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
-
* you may not use this file except in compliance with the License.
|
|
112
|
-
* You may obtain a copy of the License at
|
|
113
|
-
*
|
|
114
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
-
*
|
|
116
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
-
* See the License for the specific language governing permissions and
|
|
120
|
-
* limitations under the License.
|
|
121
|
-
*/function T(n){return n&&n._delegate?n._delegate:n}class X{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,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}}/**
|
|
122
|
-
* @license
|
|
123
|
-
* Copyright 2019 Google LLC
|
|
124
|
-
*
|
|
125
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
126
|
-
* you may not use this file except in compliance with the License.
|
|
127
|
-
* You may obtain a copy of the License at
|
|
128
|
-
*
|
|
129
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
130
|
-
*
|
|
131
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
132
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
133
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
|
-
* See the License for the specific language governing permissions and
|
|
135
|
-
* limitations under the License.
|
|
136
|
-
*/const H="[DEFAULT]";/**
|
|
137
|
-
* @license
|
|
138
|
-
* Copyright 2019 Google LLC
|
|
139
|
-
*
|
|
140
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
-
* you may not use this file except in compliance with the License.
|
|
142
|
-
* You may obtain a copy of the License at
|
|
143
|
-
*
|
|
144
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
-
*
|
|
146
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
-
* See the License for the specific language governing permissions and
|
|
150
|
-
* limitations under the License.
|
|
151
|
-
*/class Nr{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new Sr;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e?.identifier),i=(t=e?.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}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(Mr(e))try{this.getOrInitializeService({instanceIdentifier:H})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(t);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=H){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=H){return this.instances.has(e)}getOptions(e=H){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,t){var r;const i=this.normalizeInstanceIdentifier(t),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(!!r)for(const i of r)try{i(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Lr(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=H){return this.component?this.component.multipleInstances?e:H:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Lr(n){return n===H?void 0:n}function Mr(n){return n.instantiationMode==="EAGER"}/**
|
|
152
|
-
* @license
|
|
153
|
-
* Copyright 2019 Google LLC
|
|
154
|
-
*
|
|
155
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
156
|
-
* you may not use this file except in compliance with the License.
|
|
157
|
-
* You may obtain a copy of the License at
|
|
158
|
-
*
|
|
159
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
160
|
-
*
|
|
161
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
162
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
163
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
-
* See the License for the specific language governing permissions and
|
|
165
|
-
* limitations under the License.
|
|
166
|
-
*/class Ur{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.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);const t=new Nr(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
|
|
167
|
-
* @license
|
|
168
|
-
* Copyright 2017 Google LLC
|
|
169
|
-
*
|
|
170
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
|
-
* you may not use this file except in compliance with the License.
|
|
172
|
-
* You may obtain a copy of the License at
|
|
173
|
-
*
|
|
174
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
175
|
-
*
|
|
176
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
177
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
178
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
|
-
* See the License for the specific language governing permissions and
|
|
180
|
-
* limitations under the License.
|
|
181
|
-
*/var h;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(h||(h={}));const xr={debug:h.DEBUG,verbose:h.VERBOSE,info:h.INFO,warn:h.WARN,error:h.ERROR,silent:h.SILENT},Br=h.INFO,Fr={[h.DEBUG]:"log",[h.VERBOSE]:"log",[h.INFO]:"info",[h.WARN]:"warn",[h.ERROR]:"error"},$r=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),i=Fr[e];if(i)console[i](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class sn{constructor(e){this.name=e,this._logLevel=Br,this._logHandler=$r,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in h))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?xr[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,h.DEBUG,...e),this._logHandler(this,h.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,h.VERBOSE,...e),this._logHandler(this,h.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,h.INFO,...e),this._logHandler(this,h.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,h.WARN,...e),this._logHandler(this,h.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,h.ERROR,...e),this._logHandler(this,h.ERROR,...e)}}const Hr=(n,e)=>e.some(t=>n instanceof t);let Rt,Ot;function Vr(){return Rt||(Rt=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function jr(){return Ot||(Ot=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const on=new WeakMap,Ze=new WeakMap,an=new WeakMap,Ge=new WeakMap,ct=new WeakMap;function Wr(n){const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(x(n.result)),i()},o=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&on.set(t,n)}).catch(()=>{}),ct.set(e,n),e}function zr(n){if(Ze.has(n))return;const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),i()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});Ze.set(n,e)}let et={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Ze.get(n);if(e==="objectStoreNames")return n.objectStoreNames||an.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return x(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Gr(n){et=n(et)}function Kr(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Ke(this),e,...t);return an.set(r,e.sort?e.sort():[e]),x(r)}:jr().includes(n)?function(...e){return n.apply(Ke(this),e),x(on.get(this))}:function(...e){return x(n.apply(Ke(this),e))}}function qr(n){return typeof n=="function"?Kr(n):(n instanceof IDBTransaction&&zr(n),Hr(n,Vr())?new Proxy(n,et):n)}function x(n){if(n instanceof IDBRequest)return Wr(n);if(Ge.has(n))return Ge.get(n);const e=qr(n);return e!==n&&(Ge.set(n,e),ct.set(e,n)),e}const Ke=n=>ct.get(n);function Jr(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(n,e),a=x(o);return r&&o.addEventListener("upgradeneeded",c=>{r(x(o.result),c.oldVersion,c.newVersion,x(o.transaction))}),t&&o.addEventListener("blocked",()=>t()),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}const Yr=["get","getKey","getAll","getAllKeys","count"],Xr=["put","add","delete","clear"],qe=new Map;function Ct(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(qe.get(e))return qe.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,i=Xr.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Yr.includes(t)))return;const s=async function(o,...a){const c=this.transaction(o,i?"readwrite":"readonly");let l=c.store;return r&&(l=l.index(a.shift())),(await Promise.all([l[t](...a),i&&c.done]))[0]};return qe.set(e,s),s}Gr(n=>({...n,get:(e,t,r)=>Ct(e,t)||n.get(e,t,r),has:(e,t)=>!!Ct(e,t)||n.has(e,t)}));/**
|
|
182
|
-
* @license
|
|
183
|
-
* Copyright 2019 Google LLC
|
|
184
|
-
*
|
|
185
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
186
|
-
* you may not use this file except in compliance with the License.
|
|
187
|
-
* You may obtain a copy of the License at
|
|
188
|
-
*
|
|
189
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
190
|
-
*
|
|
191
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
192
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
193
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
194
|
-
* See the License for the specific language governing permissions and
|
|
195
|
-
* limitations under the License.
|
|
196
|
-
*/class Qr{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Zr(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Zr(n){const e=n.getComponent();return e?.type==="VERSION"}const tt="@firebase/app",Dt="0.9.0";/**
|
|
197
|
-
* @license
|
|
198
|
-
* Copyright 2019 Google LLC
|
|
199
|
-
*
|
|
200
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
201
|
-
* you may not use this file except in compliance with the License.
|
|
202
|
-
* You may obtain a copy of the License at
|
|
203
|
-
*
|
|
204
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
205
|
-
*
|
|
206
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
207
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
208
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
|
-
* See the License for the specific language governing permissions and
|
|
210
|
-
* limitations under the License.
|
|
211
|
-
*/const j=new sn("@firebase/app"),ei="@firebase/app-compat",ti="@firebase/analytics-compat",ni="@firebase/analytics",ri="@firebase/app-check-compat",ii="@firebase/app-check",si="@firebase/auth",oi="@firebase/auth-compat",ai="@firebase/database",ci="@firebase/database-compat",li="@firebase/functions",ui="@firebase/functions-compat",di="@firebase/installations",hi="@firebase/installations-compat",fi="@firebase/messaging",pi="@firebase/messaging-compat",mi="@firebase/performance",gi="@firebase/performance-compat",_i="@firebase/remote-config",vi="@firebase/remote-config-compat",Ii="@firebase/storage",yi="@firebase/storage-compat",bi="@firebase/firestore",wi="@firebase/firestore-compat",Ei="firebase",Ti="9.15.0";/**
|
|
212
|
-
* @license
|
|
213
|
-
* Copyright 2019 Google LLC
|
|
214
|
-
*
|
|
215
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
216
|
-
* you may not use this file except in compliance with the License.
|
|
217
|
-
* You may obtain a copy of the License at
|
|
218
|
-
*
|
|
219
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
220
|
-
*
|
|
221
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
222
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
223
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
|
-
* See the License for the specific language governing permissions and
|
|
225
|
-
* limitations under the License.
|
|
226
|
-
*/const nt="[DEFAULT]",Si={[tt]:"fire-core",[ei]:"fire-core-compat",[ni]:"fire-analytics",[ti]:"fire-analytics-compat",[ii]:"fire-app-check",[ri]:"fire-app-check-compat",[si]:"fire-auth",[oi]:"fire-auth-compat",[ai]:"fire-rtdb",[ci]:"fire-rtdb-compat",[li]:"fire-fn",[ui]:"fire-fn-compat",[di]:"fire-iid",[hi]:"fire-iid-compat",[fi]:"fire-fcm",[pi]:"fire-fcm-compat",[mi]:"fire-perf",[gi]:"fire-perf-compat",[_i]:"fire-rc",[vi]:"fire-rc-compat",[Ii]:"fire-gcs",[yi]:"fire-gcs-compat",[bi]:"fire-fst",[wi]:"fire-fst-compat","fire-js":"fire-js",[Ei]:"fire-js-all"};/**
|
|
227
|
-
* @license
|
|
228
|
-
* Copyright 2019 Google LLC
|
|
229
|
-
*
|
|
230
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
231
|
-
* you may not use this file except in compliance with the License.
|
|
232
|
-
* You may obtain a copy of the License at
|
|
233
|
-
*
|
|
234
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
235
|
-
*
|
|
236
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
237
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
238
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
239
|
-
* See the License for the specific language governing permissions and
|
|
240
|
-
* limitations under the License.
|
|
241
|
-
*/const Se=new Map,rt=new Map;function ki(n,e){try{n.container.addComponent(e)}catch(t){j.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function oe(n){const e=n.name;if(rt.has(e))return j.debug(`There were multiple attempts to register component ${e}.`),!1;rt.set(e,n);for(const t of Se.values())ki(t,n);return!0}function cn(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}/**
|
|
242
|
-
* @license
|
|
243
|
-
* Copyright 2019 Google LLC
|
|
244
|
-
*
|
|
245
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
246
|
-
* you may not use this file except in compliance with the License.
|
|
247
|
-
* You may obtain a copy of the License at
|
|
248
|
-
*
|
|
249
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
250
|
-
*
|
|
251
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
252
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
253
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
254
|
-
* See the License for the specific language governing permissions and
|
|
255
|
-
* limitations under the License.
|
|
256
|
-
*/const Ai={["no-app"]:"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",["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",["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}."},B=new he("app","Firebase",Ai);/**
|
|
257
|
-
* @license
|
|
258
|
-
* Copyright 2019 Google LLC
|
|
259
|
-
*
|
|
260
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
261
|
-
* you may not use this file except in compliance with the License.
|
|
262
|
-
* You may obtain a copy of the License at
|
|
263
|
-
*
|
|
264
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
265
|
-
*
|
|
266
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
267
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
268
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
269
|
-
* See the License for the specific language governing permissions and
|
|
270
|
-
* limitations under the License.
|
|
271
|
-
*/class Ri{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new X("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 B.create("app-deleted",{appName:this._name})}}/**
|
|
272
|
-
* @license
|
|
273
|
-
* Copyright 2019 Google LLC
|
|
274
|
-
*
|
|
275
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
276
|
-
* you may not use this file except in compliance with the License.
|
|
277
|
-
* You may obtain a copy of the License at
|
|
278
|
-
*
|
|
279
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
280
|
-
*
|
|
281
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
282
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
283
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
|
-
* See the License for the specific language governing permissions and
|
|
285
|
-
* limitations under the License.
|
|
286
|
-
*/const De=Ti;function ln(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:nt,automaticDataCollectionEnabled:!1},e),i=r.name;if(typeof i!="string"||!i)throw B.create("bad-app-name",{appName:String(i)});if(t||(t=Tr()),!t)throw B.create("no-options");const s=Se.get(i);if(s){if(Te(t,s.options)&&Te(r,s.config))return s;throw B.create("duplicate-app",{appName:i})}const o=new Ur(i);for(const c of rt.values())o.addComponent(c);const a=new Ri(t,r,o);return Se.set(i,a),a}function Oi(n=nt){const e=Se.get(n);if(!e&&n===nt)return ln();if(!e)throw B.create("no-app",{appName:n});return e}function q(n,e,t){var r;let i=(r=Si[n])!==null&&r!==void 0?r:n;t&&(i+=`-${t}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const 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 "/")`),j.warn(a.join(" "));return}oe(new X(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}/**
|
|
287
|
-
* @license
|
|
288
|
-
* Copyright 2021 Google LLC
|
|
289
|
-
*
|
|
290
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
291
|
-
* you may not use this file except in compliance with the License.
|
|
292
|
-
* You may obtain a copy of the License at
|
|
293
|
-
*
|
|
294
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
295
|
-
*
|
|
296
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
297
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
298
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
299
|
-
* See the License for the specific language governing permissions and
|
|
300
|
-
* limitations under the License.
|
|
301
|
-
*/const Ci="firebase-heartbeat-database",Di=1,ae="firebase-heartbeat-store";let Je=null;function un(){return Je||(Je=Jr(Ci,Di,{upgrade:(n,e)=>{switch(e){case 0:n.createObjectStore(ae)}}}).catch(n=>{throw B.create("idb-open",{originalErrorMessage:n.message})})),Je}async function Pi(n){try{return(await un()).transaction(ae).objectStore(ae).get(dn(n))}catch(e){if(e instanceof F)j.warn(e.message);else{const t=B.create("idb-get",{originalErrorMessage:e?.message});j.warn(t.message)}}}async function Pt(n,e){try{const r=(await un()).transaction(ae,"readwrite");return await r.objectStore(ae).put(e,dn(n)),r.done}catch(t){if(t instanceof F)j.warn(t.message);else{const r=B.create("idb-set",{originalErrorMessage:t?.message});j.warn(r.message)}}}function dn(n){return`${n.name}!${n.options.appId}`}/**
|
|
302
|
-
* @license
|
|
303
|
-
* Copyright 2021 Google LLC
|
|
304
|
-
*
|
|
305
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
306
|
-
* you may not use this file except in compliance with the License.
|
|
307
|
-
* You may obtain a copy of the License at
|
|
308
|
-
*
|
|
309
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
310
|
-
*
|
|
311
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
312
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
313
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
314
|
-
* See the License for the specific language governing permissions and
|
|
315
|
-
* limitations under the License.
|
|
316
|
-
*/const Ni=1024,Li=30*24*60*60*1e3;class Mi{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new xi(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Nt();if(this._heartbeatsCache===null&&(this._heartbeatsCache=await this._heartbeatsCachePromise),!(this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r)))return this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(i=>{const s=new Date(i.date).valueOf();return Date.now()-s<=Li}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache===null||this._heartbeatsCache.heartbeats.length===0)return"";const e=Nt(),{heartbeatsToSend:t,unsentEntries:r}=Ui(this._heartbeatsCache.heartbeats),i=tn(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function Nt(){return new Date().toISOString().substring(0,10)}function Ui(n,e=Ni){const t=[];let r=n.slice();for(const i of n){const s=t.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Lt(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),Lt(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class xi{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return _r()?vr().then(()=>!0).catch(()=>!1):!1}async read(){return await this._canUseIndexedDBPromise?await Pi(this.app)||{heartbeats:[]}:{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return Pt(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return Pt(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function Lt(n){return tn(JSON.stringify({version:2,heartbeats:n})).length}/**
|
|
317
|
-
* @license
|
|
318
|
-
* Copyright 2019 Google LLC
|
|
319
|
-
*
|
|
320
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
321
|
-
* you may not use this file except in compliance with the License.
|
|
322
|
-
* You may obtain a copy of the License at
|
|
323
|
-
*
|
|
324
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
325
|
-
*
|
|
326
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
327
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
328
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
|
-
* See the License for the specific language governing permissions and
|
|
330
|
-
* limitations under the License.
|
|
331
|
-
*/function Bi(n){oe(new X("platform-logger",e=>new Qr(e),"PRIVATE")),oe(new X("heartbeat",e=>new Mi(e),"PRIVATE")),q(tt,Dt,n),q(tt,Dt,"esm2017"),q("fire-js","")}Bi("");function lt(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function hn(){return{["dependent-sdk-initialized-before-auth"]:"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Fi=hn,fn=new he("auth","Firebase",hn());/**
|
|
332
|
-
* @license
|
|
333
|
-
* Copyright 2020 Google LLC
|
|
334
|
-
*
|
|
335
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
336
|
-
* you may not use this file except in compliance with the License.
|
|
337
|
-
* You may obtain a copy of the License at
|
|
338
|
-
*
|
|
339
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
340
|
-
*
|
|
341
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
342
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
343
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
344
|
-
* See the License for the specific language governing permissions and
|
|
345
|
-
* limitations under the License.
|
|
346
|
-
*/const Mt=new sn("@firebase/auth");function ye(n,...e){Mt.logLevel<=h.ERROR&&Mt.error(`Auth (${De}): ${n}`,...e)}/**
|
|
347
|
-
* @license
|
|
348
|
-
* Copyright 2020 Google LLC
|
|
349
|
-
*
|
|
350
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
351
|
-
* you may not use this file except in compliance with the License.
|
|
352
|
-
* You may obtain a copy of the License at
|
|
353
|
-
*
|
|
354
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
355
|
-
*
|
|
356
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
357
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
358
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
359
|
-
* See the License for the specific language governing permissions and
|
|
360
|
-
* limitations under the License.
|
|
361
|
-
*/function b(n,...e){throw ut(n,...e)}function w(n,...e){return ut(n,...e)}function $i(n,e,t){const r=Object.assign(Object.assign({},Fi()),{[e]:t});return new he("auth","Firebase",r).create(e,{appName:n.name})}function ut(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return fn.create(n,...e)}function u(n,e,...t){if(!n)throw ut(e,...t)}function S(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ye(e),new Error(e)}function A(n,e){n||S(e)}/**
|
|
362
|
-
* @license
|
|
363
|
-
* Copyright 2020 Google LLC
|
|
364
|
-
*
|
|
365
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
366
|
-
* you may not use this file except in compliance with the License.
|
|
367
|
-
* You may obtain a copy of the License at
|
|
368
|
-
*
|
|
369
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
370
|
-
*
|
|
371
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
372
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
373
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
374
|
-
* See the License for the specific language governing permissions and
|
|
375
|
-
* limitations under the License.
|
|
376
|
-
*/const Ut=new Map;function k(n){A(n instanceof Function,"Expected a class definition");let e=Ut.get(n);return e?(A(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Ut.set(n,e),e)}/**
|
|
377
|
-
* @license
|
|
378
|
-
* Copyright 2020 Google LLC
|
|
379
|
-
*
|
|
380
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
381
|
-
* you may not use this file except in compliance with the License.
|
|
382
|
-
* You may obtain a copy of the License at
|
|
383
|
-
*
|
|
384
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
385
|
-
*
|
|
386
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
387
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
388
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
389
|
-
* See the License for the specific language governing permissions and
|
|
390
|
-
* limitations under the License.
|
|
391
|
-
*/function Hi(n,e){const t=cn(n,"auth");if(t.isInitialized()){const i=t.getImmediate(),s=t.getOptions();if(Te(s,e??{}))return i;b(i,"already-initialized")}return t.initialize({options:e})}function Vi(n,e){const t=e?.persistence||[],r=(Array.isArray(t)?t:[t]).map(k);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e?.popupRedirectResolver)}/**
|
|
392
|
-
* @license
|
|
393
|
-
* Copyright 2020 Google LLC
|
|
394
|
-
*
|
|
395
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
396
|
-
* you may not use this file except in compliance with the License.
|
|
397
|
-
* You may obtain a copy of the License at
|
|
398
|
-
*
|
|
399
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
400
|
-
*
|
|
401
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
402
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
403
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
404
|
-
* See the License for the specific language governing permissions and
|
|
405
|
-
* limitations under the License.
|
|
406
|
-
*/function ke(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function ji(){return xt()==="http:"||xt()==="https:"}function xt(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
|
|
407
|
-
* @license
|
|
408
|
-
* Copyright 2020 Google LLC
|
|
409
|
-
*
|
|
410
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
411
|
-
* you may not use this file except in compliance with the License.
|
|
412
|
-
* You may obtain a copy of the License at
|
|
413
|
-
*
|
|
414
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
415
|
-
*
|
|
416
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
417
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
418
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
419
|
-
* See the License for the specific language governing permissions and
|
|
420
|
-
* limitations under the License.
|
|
421
|
-
*/function Wi(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(ji()||pr()||"connection"in navigator)?navigator.onLine:!0}function zi(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
|
|
422
|
-
* @license
|
|
423
|
-
* Copyright 2020 Google LLC
|
|
424
|
-
*
|
|
425
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
426
|
-
* you may not use this file except in compliance with the License.
|
|
427
|
-
* You may obtain a copy of the License at
|
|
428
|
-
*
|
|
429
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
430
|
-
*
|
|
431
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
432
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
433
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
434
|
-
* See the License for the specific language governing permissions and
|
|
435
|
-
* limitations under the License.
|
|
436
|
-
*/class pe{constructor(e,t){this.shortDelay=e,this.longDelay=t,A(t>e,"Short delay should be less than long delay!"),this.isMobile=fr()||mr()}get(){return Wi()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
437
|
-
* @license
|
|
438
|
-
* Copyright 2020 Google LLC
|
|
439
|
-
*
|
|
440
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
441
|
-
* you may not use this file except in compliance with the License.
|
|
442
|
-
* You may obtain a copy of the License at
|
|
443
|
-
*
|
|
444
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
445
|
-
*
|
|
446
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
447
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
448
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
449
|
-
* See the License for the specific language governing permissions and
|
|
450
|
-
* limitations under the License.
|
|
451
|
-
*/function dt(n,e){A(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
|
|
452
|
-
* @license
|
|
453
|
-
* Copyright 2020 Google LLC
|
|
454
|
-
*
|
|
455
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
456
|
-
* you may not use this file except in compliance with the License.
|
|
457
|
-
* You may obtain a copy of the License at
|
|
458
|
-
*
|
|
459
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
460
|
-
*
|
|
461
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
462
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
463
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
464
|
-
* See the License for the specific language governing permissions and
|
|
465
|
-
* limitations under the License.
|
|
466
|
-
*/class pn{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;S("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;S("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;S("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
467
|
-
* @license
|
|
468
|
-
* Copyright 2020 Google LLC
|
|
469
|
-
*
|
|
470
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
471
|
-
* you may not use this file except in compliance with the License.
|
|
472
|
-
* You may obtain a copy of the License at
|
|
473
|
-
*
|
|
474
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
475
|
-
*
|
|
476
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
477
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
478
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
479
|
-
* See the License for the specific language governing permissions and
|
|
480
|
-
* limitations under the License.
|
|
481
|
-
*/const Gi={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:"internal-error",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",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"};/**
|
|
482
|
-
* @license
|
|
483
|
-
* Copyright 2020 Google LLC
|
|
484
|
-
*
|
|
485
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
486
|
-
* you may not use this file except in compliance with the License.
|
|
487
|
-
* You may obtain a copy of the License at
|
|
488
|
-
*
|
|
489
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
490
|
-
*
|
|
491
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
492
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
493
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
494
|
-
* See the License for the specific language governing permissions and
|
|
495
|
-
* limitations under the License.
|
|
496
|
-
*/const Ki=new pe(3e4,6e4);function me(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function ee(n,e,t,r,i={}){return mn(n,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=fe(Object.assign({key:n.config.apiKey},o)).slice(1),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode),pn.fetch()(gn(n,n.config.apiHost,t,a),Object.assign({method:e,headers:c,referrerPolicy:"no-referrer"},s))})}async function mn(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},Gi),e);try{const i=new qi(n),s=await Promise.race([t(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw Ie(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw Ie(n,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw Ie(n,"email-already-in-use",o);if(c==="USER_DISABLED")throw Ie(n,"user-disabled",o);const d=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw $i(n,d,l);b(n,d)}}catch(i){if(i instanceof F)throw i;b(n,"network-request-failed")}}async function Pe(n,e,t,r,i={}){const s=await ee(n,e,t,r,i);return"mfaPendingCredential"in s&&b(n,"multi-factor-auth-required",{_serverResponse:s}),s}function gn(n,e,t,r){const i=`${e}${t}?${r}`;return n.config.emulator?dt(n.config,i):`${n.config.apiScheme}://${i}`}class qi{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(w(this.auth,"network-request-failed")),Ki.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ie(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const i=w(n,e,r);return i.customData._tokenResponse=t,i}/**
|
|
497
|
-
* @license
|
|
498
|
-
* Copyright 2020 Google LLC
|
|
499
|
-
*
|
|
500
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
501
|
-
* you may not use this file except in compliance with the License.
|
|
502
|
-
* You may obtain a copy of the License at
|
|
503
|
-
*
|
|
504
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
505
|
-
*
|
|
506
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
507
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
508
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
509
|
-
* See the License for the specific language governing permissions and
|
|
510
|
-
* limitations under the License.
|
|
511
|
-
*/async function Ji(n,e){return ee(n,"POST","/v1/accounts:delete",e)}async function Yi(n,e){return ee(n,"POST","/v1/accounts:lookup",e)}/**
|
|
512
|
-
* @license
|
|
513
|
-
* Copyright 2020 Google LLC
|
|
514
|
-
*
|
|
515
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
516
|
-
* you may not use this file except in compliance with the License.
|
|
517
|
-
* You may obtain a copy of the License at
|
|
518
|
-
*
|
|
519
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
520
|
-
*
|
|
521
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
522
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
523
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
524
|
-
* See the License for the specific language governing permissions and
|
|
525
|
-
* limitations under the License.
|
|
526
|
-
*/function se(n){if(!!n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Xi(n,e=!1){const t=T(n),r=await t.getIdToken(e),i=ht(r);u(i&&i.exp&&i.auth_time&&i.iat,t.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:se(Ye(i.auth_time)),issuedAtTime:se(Ye(i.iat)),expirationTime:se(Ye(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Ye(n){return Number(n)*1e3}function ht(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ye("JWT malformed, contained fewer than 3 sections"),null;try{const i=nn(t);return i?JSON.parse(i):(ye("Failed to decode base64 JWT payload"),null)}catch(i){return ye("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Qi(n){const e=ht(n);return u(e,"internal-error"),u(typeof e.exp<"u","internal-error"),u(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
|
|
527
|
-
* @license
|
|
528
|
-
* Copyright 2020 Google LLC
|
|
529
|
-
*
|
|
530
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
531
|
-
* you may not use this file except in compliance with the License.
|
|
532
|
-
* You may obtain a copy of the License at
|
|
533
|
-
*
|
|
534
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
535
|
-
*
|
|
536
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
537
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
538
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
539
|
-
* See the License for the specific language governing permissions and
|
|
540
|
-
* limitations under the License.
|
|
541
|
-
*/async function ce(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof F&&Zi(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function Zi({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
|
|
542
|
-
* @license
|
|
543
|
-
* Copyright 2020 Google LLC
|
|
544
|
-
*
|
|
545
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
546
|
-
* you may not use this file except in compliance with the License.
|
|
547
|
-
* You may obtain a copy of the License at
|
|
548
|
-
*
|
|
549
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
550
|
-
*
|
|
551
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
552
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
553
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
554
|
-
* See the License for the specific language governing permissions and
|
|
555
|
-
* limitations under the License.
|
|
556
|
-
*/class es{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 t;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const i=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
|
557
|
-
* @license
|
|
558
|
-
* Copyright 2020 Google LLC
|
|
559
|
-
*
|
|
560
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
561
|
-
* you may not use this file except in compliance with the License.
|
|
562
|
-
* You may obtain a copy of the License at
|
|
563
|
-
*
|
|
564
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
565
|
-
*
|
|
566
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
567
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
568
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
569
|
-
* See the License for the specific language governing permissions and
|
|
570
|
-
* limitations under the License.
|
|
571
|
-
*/class _n{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=se(this.lastLoginAt),this.creationTime=se(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
572
|
-
* @license
|
|
573
|
-
* Copyright 2019 Google LLC
|
|
574
|
-
*
|
|
575
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
576
|
-
* you may not use this file except in compliance with the License.
|
|
577
|
-
* You may obtain a copy of the License at
|
|
578
|
-
*
|
|
579
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
580
|
-
*
|
|
581
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
582
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
583
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
584
|
-
* See the License for the specific language governing permissions and
|
|
585
|
-
* limitations under the License.
|
|
586
|
-
*/async function Ae(n){var e;const t=n.auth,r=await n.getIdToken(),i=await ce(n,Yi(t,{idToken:r}));u(i?.users.length,t,"internal-error");const s=i.users[0];n._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?rs(s.providerUserInfo):[],a=ns(n.providerData,o),c=n.isAnonymous,l=!(n.email&&s.passwordHash)&&!a?.length,d=c?l:!1,f={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 _n(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(n,f)}async function ts(n){const e=T(n);await Ae(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ns(n,e){return[...n.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function rs(n){return n.map(e=>{var{providerId:t}=e,r=lt(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
|
|
587
|
-
* @license
|
|
588
|
-
* Copyright 2020 Google LLC
|
|
589
|
-
*
|
|
590
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
591
|
-
* you may not use this file except in compliance with the License.
|
|
592
|
-
* You may obtain a copy of the License at
|
|
593
|
-
*
|
|
594
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
595
|
-
*
|
|
596
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
597
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
598
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
599
|
-
* See the License for the specific language governing permissions and
|
|
600
|
-
* limitations under the License.
|
|
601
|
-
*/async function is(n,e){const t=await mn(n,{},async()=>{const r=fe({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=n.config,o=gn(n,i,"/v1/token",`key=${s}`),a=await n._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",pn.fetch()(o,{method:"POST",headers:a,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}/**
|
|
602
|
-
* @license
|
|
603
|
-
* Copyright 2020 Google LLC
|
|
604
|
-
*
|
|
605
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
606
|
-
* you may not use this file except in compliance with the License.
|
|
607
|
-
* You may obtain a copy of the License at
|
|
608
|
-
*
|
|
609
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
610
|
-
*
|
|
611
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
612
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
613
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
614
|
-
* See the License for the specific language governing permissions and
|
|
615
|
-
* limitations under the License.
|
|
616
|
-
*/class le{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){u(e.idToken,"internal-error"),u(typeof e.idToken<"u","internal-error"),u(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Qi(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return u(!this.accessToken||this.refreshToken,e,"user-token-expired"),!t&&this.accessToken&&!this.isExpired?this.accessToken:this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:i,expiresIn:s}=await is(e,t);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:i,expirationTime:s}=t,o=new le;return r&&(u(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(u(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(u(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 le,this.toJSON())}_performRefresh(){return S("not implemented")}}/**
|
|
617
|
-
* @license
|
|
618
|
-
* Copyright 2020 Google LLC
|
|
619
|
-
*
|
|
620
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
621
|
-
* you may not use this file except in compliance with the License.
|
|
622
|
-
* You may obtain a copy of the License at
|
|
623
|
-
*
|
|
624
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
625
|
-
*
|
|
626
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
627
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
628
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
629
|
-
* See the License for the specific language governing permissions and
|
|
630
|
-
* limitations under the License.
|
|
631
|
-
*/function D(n,e){u(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class V{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,s=lt(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new es(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,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 _n(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await ce(this,this.stsTokenManager.getToken(this.auth,e));return u(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Xi(this,e)}reload(){return ts(this)}_assign(e){this!==e&&(u(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(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){return new V(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){u(!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,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Ae(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await ce(this,Ji(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,t){var r,i,s,o,a,c,l,d;const f=(r=t.displayName)!==null&&r!==void 0?r:void 0,p=(i=t.email)!==null&&i!==void 0?i:void 0,y=(s=t.phoneNumber)!==null&&s!==void 0?s:void 0,O=(o=t.photoURL)!==null&&o!==void 0?o:void 0,g=(a=t.tenantId)!==null&&a!==void 0?a:void 0,_=(c=t._redirectEventId)!==null&&c!==void 0?c:void 0,C=(l=t.createdAt)!==null&&l!==void 0?l:void 0,ve=(d=t.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:te,emailVerified:vt,isAnonymous:It,providerData:Be,stsTokenManager:yt}=t;u(te&&yt,e,"internal-error");const Kn=le.fromJSON(this.name,yt);u(typeof te=="string",e,"internal-error"),D(f,e.name),D(p,e.name),u(typeof vt=="boolean",e,"internal-error"),u(typeof It=="boolean",e,"internal-error"),D(y,e.name),D(O,e.name),D(g,e.name),D(_,e.name),D(C,e.name),D(ve,e.name);const Fe=new V({uid:te,auth:e,email:p,emailVerified:vt,displayName:f,isAnonymous:It,photoURL:O,phoneNumber:y,tenantId:g,stsTokenManager:Kn,createdAt:C,lastLoginAt:ve});return Be&&Array.isArray(Be)&&(Fe.providerData=Be.map(qn=>Object.assign({},qn))),_&&(Fe._redirectEventId=_),Fe}static async _fromIdTokenResponse(e,t,r=!1){const i=new le;i.updateFromServerResponse(t);const s=new V({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Ae(s),s}}/**
|
|
632
|
-
* @license
|
|
633
|
-
* Copyright 2019 Google LLC
|
|
634
|
-
*
|
|
635
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
636
|
-
* you may not use this file except in compliance with the License.
|
|
637
|
-
* You may obtain a copy of the License at
|
|
638
|
-
*
|
|
639
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
640
|
-
*
|
|
641
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
642
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
643
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
644
|
-
* See the License for the specific language governing permissions and
|
|
645
|
-
* limitations under the License.
|
|
646
|
-
*/class vn{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}vn.type="NONE";const Bt=vn;/**
|
|
647
|
-
* @license
|
|
648
|
-
* Copyright 2019 Google LLC
|
|
649
|
-
*
|
|
650
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
651
|
-
* you may not use this file except in compliance with the License.
|
|
652
|
-
* You may obtain a copy of the License at
|
|
653
|
-
*
|
|
654
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
655
|
-
*
|
|
656
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
657
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
658
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
659
|
-
* See the License for the specific language governing permissions and
|
|
660
|
-
* limitations under the License.
|
|
661
|
-
*/function be(n,e,t){return`firebase:${n}:${e}:${t}`}class J{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=be(this.userKey,i.apiKey,s),this.fullPersistenceKey=be("persistence",i.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?V._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;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new J(k(Bt),e,r);const i=(await Promise.all(t.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l);let s=i[0]||k(Bt);const o=be(r,e.config.apiKey,e.name);let a=null;for(const l of t)try{const d=await l._get(o);if(d){const f=V._fromJSON(e,d);l!==s&&(a=f),s=l;break}}catch{}const c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new J(s,e,r):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(t.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new J(s,e,r))}}/**
|
|
662
|
-
* @license
|
|
663
|
-
* Copyright 2020 Google LLC
|
|
664
|
-
*
|
|
665
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
666
|
-
* you may not use this file except in compliance with the License.
|
|
667
|
-
* You may obtain a copy of the License at
|
|
668
|
-
*
|
|
669
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
670
|
-
*
|
|
671
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
672
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
673
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
674
|
-
* See the License for the specific language governing permissions and
|
|
675
|
-
* limitations under the License.
|
|
676
|
-
*/function Ft(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(bn(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(In(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(En(e))return"Blackberry";if(Tn(e))return"Webos";if(ft(e))return"Safari";if((e.includes("chrome/")||yn(e))&&!e.includes("edge/"))return"Chrome";if(wn(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if(r?.length===2)return r[1]}return"Other"}function In(n=m()){return/firefox\//i.test(n)}function ft(n=m()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function yn(n=m()){return/crios\//i.test(n)}function bn(n=m()){return/iemobile/i.test(n)}function wn(n=m()){return/android/i.test(n)}function En(n=m()){return/blackberry/i.test(n)}function Tn(n=m()){return/webos/i.test(n)}function Ne(n=m()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function ss(n=m()){var e;return Ne(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function os(){return gr()&&document.documentMode===10}function Sn(n=m()){return Ne(n)||wn(n)||Tn(n)||En(n)||/windows phone/i.test(n)||bn(n)}function as(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
|
|
677
|
-
* @license
|
|
678
|
-
* Copyright 2020 Google LLC
|
|
679
|
-
*
|
|
680
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
681
|
-
* you may not use this file except in compliance with the License.
|
|
682
|
-
* You may obtain a copy of the License at
|
|
683
|
-
*
|
|
684
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
685
|
-
*
|
|
686
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
687
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
688
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
689
|
-
* See the License for the specific language governing permissions and
|
|
690
|
-
* limitations under the License.
|
|
691
|
-
*/function kn(n,e=[]){let t;switch(n){case"Browser":t=Ft(m());break;case"Worker":t=`${Ft(m())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${De}/${r}`}/**
|
|
692
|
-
* @license
|
|
693
|
-
* Copyright 2022 Google LLC
|
|
694
|
-
*
|
|
695
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
696
|
-
* you may not use this file except in compliance with the License.
|
|
697
|
-
* You may obtain a copy of the License at
|
|
698
|
-
*
|
|
699
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
700
|
-
*
|
|
701
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
702
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
703
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
704
|
-
* See the License for the specific language governing permissions and
|
|
705
|
-
* limitations under the License.
|
|
706
|
-
*/class cs{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=s=>new Promise((o,a)=>{try{const c=e(s);o(c)}catch(c){a(c)}});r.onAbort=t,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const i of t)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}/**
|
|
707
|
-
* @license
|
|
708
|
-
* Copyright 2020 Google LLC
|
|
709
|
-
*
|
|
710
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
711
|
-
* you may not use this file except in compliance with the License.
|
|
712
|
-
* You may obtain a copy of the License at
|
|
713
|
-
*
|
|
714
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
715
|
-
*
|
|
716
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
717
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
718
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
719
|
-
* See the License for the specific language governing permissions and
|
|
720
|
-
* limitations under the License.
|
|
721
|
-
*/class ls{constructor(e,t,r){this.app=e,this.heartbeatServiceProvider=t,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new $t(this),this.idTokenSubscription=new $t(this),this.beforeStateQueue=new cs(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=fn,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=k(t)),this._initializationPromise=this.queue(async()=>{var r,i;if(!this._deleted&&(this.persistenceManager=await J.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),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;const 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 initializeCurrentUser(e){var t;const r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._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=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return u(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 t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Ae(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=zi()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?T(e):null;return t&&u(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&u(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(k(e))})}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new he("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}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,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&k(e)||this._popupRedirectResolver;u(t,this,"argument-error"),this.redirectPersistenceManager=await J.create(this,[k(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._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,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,i){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t),o=this._isInitialized?Promise.resolve():this._initializationPromise;return u(o,this,"internal-error"),o.then(()=>s(this.currentUser)),typeof t=="function"?e.addObserver(t,r,i):e.addObserver(t)}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 u(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=kn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={["X-Client-Version"]:this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());return r&&(t["X-Firebase-Client"]=r),t}}function Le(n){return T(n)}class $t{constructor(e){this.auth=e,this.observer=null,this.addObserver=Cr(t=>this.observer=t)}get next(){return u(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function us(n,e,t){const r=Le(n);u(r._canInitEmulator,r,"emulator-config-failed"),u(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!t?.disableWarnings,s=An(e),{host:o,port:a}=ds(e),c=a===null?"":`:${a}`;r.config.emulator={url:`${s}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||hs()}function An(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function ds(n){const e=An(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:Ht(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:Ht(o)}}}function Ht(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function hs(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.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",n):n())}/**
|
|
722
|
-
* @license
|
|
723
|
-
* Copyright 2020 Google LLC
|
|
724
|
-
*
|
|
725
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
726
|
-
* you may not use this file except in compliance with the License.
|
|
727
|
-
* You may obtain a copy of the License at
|
|
728
|
-
*
|
|
729
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
730
|
-
*
|
|
731
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
732
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
733
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
734
|
-
* See the License for the specific language governing permissions and
|
|
735
|
-
* limitations under the License.
|
|
736
|
-
*/class pt{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return S("not implemented")}_getIdTokenResponse(e){return S("not implemented")}_linkToIdToken(e,t){return S("not implemented")}_getReauthenticationResolver(e){return S("not implemented")}}async function fs(n,e){return ee(n,"POST","/v1/accounts:update",e)}/**
|
|
737
|
-
* @license
|
|
738
|
-
* Copyright 2020 Google LLC
|
|
739
|
-
*
|
|
740
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
741
|
-
* you may not use this file except in compliance with the License.
|
|
742
|
-
* You may obtain a copy of the License at
|
|
743
|
-
*
|
|
744
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
745
|
-
*
|
|
746
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
747
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
748
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
749
|
-
* See the License for the specific language governing permissions and
|
|
750
|
-
* limitations under the License.
|
|
751
|
-
*/async function ps(n,e){return Pe(n,"POST","/v1/accounts:signInWithPassword",me(n,e))}async function ms(n,e){return ee(n,"POST","/v1/accounts:sendOobCode",me(n,e))}async function gs(n,e){return ms(n,e)}/**
|
|
752
|
-
* @license
|
|
753
|
-
* Copyright 2020 Google LLC
|
|
754
|
-
*
|
|
755
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
756
|
-
* you may not use this file except in compliance with the License.
|
|
757
|
-
* You may obtain a copy of the License at
|
|
758
|
-
*
|
|
759
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
760
|
-
*
|
|
761
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
762
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
763
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
764
|
-
* See the License for the specific language governing permissions and
|
|
765
|
-
* limitations under the License.
|
|
766
|
-
*/async function _s(n,e){return Pe(n,"POST","/v1/accounts:signInWithEmailLink",me(n,e))}async function vs(n,e){return Pe(n,"POST","/v1/accounts:signInWithEmailLink",me(n,e))}/**
|
|
767
|
-
* @license
|
|
768
|
-
* Copyright 2020 Google LLC
|
|
769
|
-
*
|
|
770
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
771
|
-
* you may not use this file except in compliance with the License.
|
|
772
|
-
* You may obtain a copy of the License at
|
|
773
|
-
*
|
|
774
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
775
|
-
*
|
|
776
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
777
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
778
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
779
|
-
* See the License for the specific language governing permissions and
|
|
780
|
-
* limitations under the License.
|
|
781
|
-
*/class ue extends pt{constructor(e,t,r,i=null){super("password",r),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new ue(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new ue(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return ps(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return _s(e,{email:this._email,oobCode:this._password});default:b(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return fs(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return vs(e,{idToken:t,email:this._email,oobCode:this._password});default:b(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
|
|
782
|
-
* @license
|
|
783
|
-
* Copyright 2020 Google LLC
|
|
784
|
-
*
|
|
785
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
786
|
-
* you may not use this file except in compliance with the License.
|
|
787
|
-
* You may obtain a copy of the License at
|
|
788
|
-
*
|
|
789
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
790
|
-
*
|
|
791
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
792
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
793
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
794
|
-
* See the License for the specific language governing permissions and
|
|
795
|
-
* limitations under the License.
|
|
796
|
-
*/async function Y(n,e){return Pe(n,"POST","/v1/accounts:signInWithIdp",me(n,e))}/**
|
|
797
|
-
* @license
|
|
798
|
-
* Copyright 2020 Google LLC
|
|
799
|
-
*
|
|
800
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
801
|
-
* you may not use this file except in compliance with the License.
|
|
802
|
-
* You may obtain a copy of the License at
|
|
803
|
-
*
|
|
804
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
805
|
-
*
|
|
806
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
807
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
808
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
809
|
-
* See the License for the specific language governing permissions and
|
|
810
|
-
* limitations under the License.
|
|
811
|
-
*/const Is="http://localhost";class W extends pt{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new W(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):b("argument-error"),t}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){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i}=t,s=lt(t,["providerId","signInMethod"]);if(!r||!i)return null;const o=new W(r,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){const t=this.buildRequest();return Y(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,Y(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Y(e,t)}buildRequest(){const e={requestUri:Is,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=fe(t)}return e}}/**
|
|
812
|
-
* @license
|
|
813
|
-
* Copyright 2020 Google LLC
|
|
814
|
-
*
|
|
815
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
816
|
-
* you may not use this file except in compliance with the License.
|
|
817
|
-
* You may obtain a copy of the License at
|
|
818
|
-
*
|
|
819
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
820
|
-
*
|
|
821
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
822
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
823
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
824
|
-
* See the License for the specific language governing permissions and
|
|
825
|
-
* limitations under the License.
|
|
826
|
-
*/function ys(n){switch(n){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 bs(n){const e=re(ie(n)).link,t=e?re(ie(e)).deep_link_id:null,r=re(ie(n)).deep_link_id;return(r?re(ie(r)).link:null)||r||t||e||n}class Me{constructor(e){var t,r,i,s,o,a;const c=re(ie(e)),l=(t=c.apiKey)!==null&&t!==void 0?t:null,d=(r=c.oobCode)!==null&&r!==void 0?r:null,f=ys((i=c.mode)!==null&&i!==void 0?i:null);u(l&&d&&f,"argument-error"),this.apiKey=l,this.operation=f,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){const t=bs(e);try{return new Me(t)}catch{return null}}}/**
|
|
827
|
-
* @license
|
|
828
|
-
* Copyright 2020 Google LLC
|
|
829
|
-
*
|
|
830
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
831
|
-
* you may not use this file except in compliance with the License.
|
|
832
|
-
* You may obtain a copy of the License at
|
|
833
|
-
*
|
|
834
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
835
|
-
*
|
|
836
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
837
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
838
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
839
|
-
* See the License for the specific language governing permissions and
|
|
840
|
-
* limitations under the License.
|
|
841
|
-
*/class z{constructor(){this.providerId=z.PROVIDER_ID}static credential(e,t){return ue._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Me.parseLink(t);return u(r,"argument-error"),ue._fromEmailAndCode(e,r.code,r.tenantId)}}z.PROVIDER_ID="password";z.EMAIL_PASSWORD_SIGN_IN_METHOD="password";z.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
|
|
842
|
-
* @license
|
|
843
|
-
* Copyright 2020 Google LLC
|
|
844
|
-
*
|
|
845
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
846
|
-
* you may not use this file except in compliance with the License.
|
|
847
|
-
* You may obtain a copy of the License at
|
|
848
|
-
*
|
|
849
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
850
|
-
*
|
|
851
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
852
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
853
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
854
|
-
* See the License for the specific language governing permissions and
|
|
855
|
-
* limitations under the License.
|
|
856
|
-
*/class Rn{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}}/**
|
|
857
|
-
* @license
|
|
858
|
-
* Copyright 2019 Google LLC
|
|
859
|
-
*
|
|
860
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
861
|
-
* you may not use this file except in compliance with the License.
|
|
862
|
-
* You may obtain a copy of the License at
|
|
863
|
-
*
|
|
864
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
865
|
-
*
|
|
866
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
867
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
868
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
869
|
-
* See the License for the specific language governing permissions and
|
|
870
|
-
* limitations under the License.
|
|
871
|
-
*/class ge extends Rn{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
|
|
872
|
-
* @license
|
|
873
|
-
* Copyright 2020 Google LLC
|
|
874
|
-
*
|
|
875
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
876
|
-
* you may not use this file except in compliance with the License.
|
|
877
|
-
* You may obtain a copy of the License at
|
|
878
|
-
*
|
|
879
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
880
|
-
*
|
|
881
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
882
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
883
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
884
|
-
* See the License for the specific language governing permissions and
|
|
885
|
-
* limitations under the License.
|
|
886
|
-
*/class N extends ge{constructor(){super("facebook.com")}static credential(e){return W._fromParams({providerId:N.PROVIDER_ID,signInMethod:N.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return N.credentialFromTaggedObject(e)}static credentialFromError(e){return N.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return N.credential(e.oauthAccessToken)}catch{return null}}}N.FACEBOOK_SIGN_IN_METHOD="facebook.com";N.PROVIDER_ID="facebook.com";/**
|
|
887
|
-
* @license
|
|
888
|
-
* Copyright 2020 Google LLC
|
|
889
|
-
*
|
|
890
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
891
|
-
* you may not use this file except in compliance with the License.
|
|
892
|
-
* You may obtain a copy of the License at
|
|
893
|
-
*
|
|
894
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
895
|
-
*
|
|
896
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
897
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
898
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
899
|
-
* See the License for the specific language governing permissions and
|
|
900
|
-
* limitations under the License.
|
|
901
|
-
*/class L extends ge{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return W._fromParams({providerId:L.PROVIDER_ID,signInMethod:L.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return L.credentialFromTaggedObject(e)}static credentialFromError(e){return L.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return L.credential(t,r)}catch{return null}}}L.GOOGLE_SIGN_IN_METHOD="google.com";L.PROVIDER_ID="google.com";/**
|
|
902
|
-
* @license
|
|
903
|
-
* Copyright 2020 Google LLC
|
|
904
|
-
*
|
|
905
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
906
|
-
* you may not use this file except in compliance with the License.
|
|
907
|
-
* You may obtain a copy of the License at
|
|
908
|
-
*
|
|
909
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
910
|
-
*
|
|
911
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
912
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
913
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
914
|
-
* See the License for the specific language governing permissions and
|
|
915
|
-
* limitations under the License.
|
|
916
|
-
*/class M extends ge{constructor(){super("github.com")}static credential(e){return W._fromParams({providerId:M.PROVIDER_ID,signInMethod:M.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return M.credentialFromTaggedObject(e)}static credentialFromError(e){return M.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return M.credential(e.oauthAccessToken)}catch{return null}}}M.GITHUB_SIGN_IN_METHOD="github.com";M.PROVIDER_ID="github.com";/**
|
|
917
|
-
* @license
|
|
918
|
-
* Copyright 2020 Google LLC
|
|
919
|
-
*
|
|
920
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
921
|
-
* you may not use this file except in compliance with the License.
|
|
922
|
-
* You may obtain a copy of the License at
|
|
923
|
-
*
|
|
924
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
925
|
-
*
|
|
926
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
927
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
928
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
929
|
-
* See the License for the specific language governing permissions and
|
|
930
|
-
* limitations under the License.
|
|
931
|
-
*/class U extends ge{constructor(){super("twitter.com")}static credential(e,t){return W._fromParams({providerId:U.PROVIDER_ID,signInMethod:U.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return U.credentialFromTaggedObject(e)}static credentialFromError(e){return U.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return U.credential(t,r)}catch{return null}}}U.TWITTER_SIGN_IN_METHOD="twitter.com";U.PROVIDER_ID="twitter.com";/**
|
|
932
|
-
* @license
|
|
933
|
-
* Copyright 2020 Google LLC
|
|
934
|
-
*
|
|
935
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
936
|
-
* you may not use this file except in compliance with the License.
|
|
937
|
-
* You may obtain a copy of the License at
|
|
938
|
-
*
|
|
939
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
940
|
-
*
|
|
941
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
942
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
943
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
944
|
-
* See the License for the specific language governing permissions and
|
|
945
|
-
* limitations under the License.
|
|
946
|
-
*/class Q{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){const s=await V._fromIdTokenResponse(e,r,i),o=Vt(r);return new Q({user:s,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const i=Vt(r);return new Q({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function Vt(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
|
|
947
|
-
* @license
|
|
948
|
-
* Copyright 2020 Google LLC
|
|
949
|
-
*
|
|
950
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
951
|
-
* you may not use this file except in compliance with the License.
|
|
952
|
-
* You may obtain a copy of the License at
|
|
953
|
-
*
|
|
954
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
955
|
-
*
|
|
956
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
957
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
958
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
959
|
-
* See the License for the specific language governing permissions and
|
|
960
|
-
* limitations under the License.
|
|
961
|
-
*/class Re extends F{constructor(e,t,r,i){var s;super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,Re.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new Re(e,t,r,i)}}function On(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Re._fromErrorAndOperation(n,s,e,r):s})}async function ws(n,e,t=!1){const r=await ce(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Q._forOperation(n,"link",r)}/**
|
|
962
|
-
* @license
|
|
963
|
-
* Copyright 2019 Google LLC
|
|
964
|
-
*
|
|
965
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
966
|
-
* you may not use this file except in compliance with the License.
|
|
967
|
-
* You may obtain a copy of the License at
|
|
968
|
-
*
|
|
969
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
970
|
-
*
|
|
971
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
972
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
973
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
974
|
-
* See the License for the specific language governing permissions and
|
|
975
|
-
* limitations under the License.
|
|
976
|
-
*/async function Es(n,e,t=!1){const{auth:r}=n,i="reauthenticate";try{const s=await ce(n,On(r,i,e,n),t);u(s.idToken,r,"internal-error");const o=ht(s.idToken);u(o,r,"internal-error");const{sub:a}=o;return u(n.uid===a,r,"user-mismatch"),Q._forOperation(n,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&b(r,"user-mismatch"),s}}/**
|
|
977
|
-
* @license
|
|
978
|
-
* Copyright 2020 Google LLC
|
|
979
|
-
*
|
|
980
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
981
|
-
* you may not use this file except in compliance with the License.
|
|
982
|
-
* You may obtain a copy of the License at
|
|
983
|
-
*
|
|
984
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
985
|
-
*
|
|
986
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
987
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
988
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
989
|
-
* See the License for the specific language governing permissions and
|
|
990
|
-
* limitations under the License.
|
|
991
|
-
*/async function Cn(n,e,t=!1){const r="signIn",i=await On(n,r,e),s=await Q._fromIdTokenResponse(n,r,i);return t||await n._updateCurrentUser(s.user),s}async function Dn(n,e){return Cn(Le(n),e)}/**
|
|
992
|
-
* @license
|
|
993
|
-
* Copyright 2020 Google LLC
|
|
994
|
-
*
|
|
995
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
996
|
-
* you may not use this file except in compliance with the License.
|
|
997
|
-
* You may obtain a copy of the License at
|
|
998
|
-
*
|
|
999
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1000
|
-
*
|
|
1001
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1002
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1003
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1004
|
-
* See the License for the specific language governing permissions and
|
|
1005
|
-
* limitations under the License.
|
|
1006
|
-
*/function Ts(n,e,t){var r;u(((r=t.url)===null||r===void 0?void 0:r.length)>0,n,"invalid-continue-uri"),u(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(u(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(u(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}function Ss(n,e,t){return Dn(T(n),z.credential(e,t))}/**
|
|
1007
|
-
* @license
|
|
1008
|
-
* Copyright 2020 Google LLC
|
|
1009
|
-
*
|
|
1010
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1011
|
-
* you may not use this file except in compliance with the License.
|
|
1012
|
-
* You may obtain a copy of the License at
|
|
1013
|
-
*
|
|
1014
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1015
|
-
*
|
|
1016
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1017
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1018
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1019
|
-
* See the License for the specific language governing permissions and
|
|
1020
|
-
* limitations under the License.
|
|
1021
|
-
*/async function ks(n,e,t){const r=T(n),i={requestType:"EMAIL_SIGNIN",email:e};u(t.handleCodeInApp,r,"argument-error"),t&&Ts(r,i,t),await gs(r,i)}function As(n,e){const t=Me.parseLink(e);return t?.operation==="EMAIL_SIGNIN"}async function Rs(n,e,t){const r=T(n),i=z.credentialWithLink(e,t||ke());return u(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),Dn(r,i)}function Os(n,e,t,r){return T(n).onIdTokenChanged(e,t,r)}function Cs(n,e,t){return T(n).beforeAuthStateChanged(e,t)}function Ds(n,e,t,r){return T(n).onAuthStateChanged(e,t,r)}const Oe="__sak";/**
|
|
1022
|
-
* @license
|
|
1023
|
-
* Copyright 2019 Google LLC
|
|
1024
|
-
*
|
|
1025
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1026
|
-
* you may not use this file except in compliance with the License.
|
|
1027
|
-
* You may obtain a copy of the License at
|
|
1028
|
-
*
|
|
1029
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1030
|
-
*
|
|
1031
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1032
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1033
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1034
|
-
* See the License for the specific language governing permissions and
|
|
1035
|
-
* limitations under the License.
|
|
1036
|
-
*/class Pn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Oe,"1"),this.storage.removeItem(Oe),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
|
|
1037
|
-
* @license
|
|
1038
|
-
* Copyright 2020 Google LLC
|
|
1039
|
-
*
|
|
1040
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1041
|
-
* you may not use this file except in compliance with the License.
|
|
1042
|
-
* You may obtain a copy of the License at
|
|
1043
|
-
*
|
|
1044
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1045
|
-
*
|
|
1046
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1047
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1048
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1049
|
-
* See the License for the specific language governing permissions and
|
|
1050
|
-
* limitations under the License.
|
|
1051
|
-
*/function Ps(){const n=m();return ft(n)||Ne(n)}const Ns=1e3,Ls=10;class Nn extends Pn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=Ps()&&as(),this.fallbackToPolling=Sn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const r=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(r);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!t)return}const i=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);os()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Ls):i()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},Ns)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){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(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Nn.type="LOCAL";const Ms=Nn;/**
|
|
1052
|
-
* @license
|
|
1053
|
-
* Copyright 2020 Google LLC
|
|
1054
|
-
*
|
|
1055
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1056
|
-
* you may not use this file except in compliance with the License.
|
|
1057
|
-
* You may obtain a copy of the License at
|
|
1058
|
-
*
|
|
1059
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1060
|
-
*
|
|
1061
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1062
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1063
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1064
|
-
* See the License for the specific language governing permissions and
|
|
1065
|
-
* limitations under the License.
|
|
1066
|
-
*/class Ln extends Pn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Ln.type="SESSION";const Mn=Ln;/**
|
|
1067
|
-
* @license
|
|
1068
|
-
* Copyright 2019 Google LLC
|
|
1069
|
-
*
|
|
1070
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1071
|
-
* you may not use this file except in compliance with the License.
|
|
1072
|
-
* You may obtain a copy of the License at
|
|
1073
|
-
*
|
|
1074
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1075
|
-
*
|
|
1076
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1077
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1078
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1079
|
-
* See the License for the specific language governing permissions and
|
|
1080
|
-
* limitations under the License.
|
|
1081
|
-
*/function Us(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
|
|
1082
|
-
* @license
|
|
1083
|
-
* Copyright 2019 Google LLC
|
|
1084
|
-
*
|
|
1085
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1086
|
-
* you may not use this file except in compliance with the License.
|
|
1087
|
-
* You may obtain a copy of the License at
|
|
1088
|
-
*
|
|
1089
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1090
|
-
*
|
|
1091
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1092
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1093
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1094
|
-
* See the License for the specific language governing permissions and
|
|
1095
|
-
* limitations under the License.
|
|
1096
|
-
*/class Ue{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(i=>i.isListeningto(e));if(t)return t;const r=new Ue(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:i,data:s}=t.data,o=this.handlersMap[i];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async l=>l(t.origin,s)),c=await Us(a);t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Ue.receivers=[];/**
|
|
1097
|
-
* @license
|
|
1098
|
-
* Copyright 2020 Google LLC
|
|
1099
|
-
*
|
|
1100
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1101
|
-
* you may not use this file except in compliance with the License.
|
|
1102
|
-
* You may obtain a copy of the License at
|
|
1103
|
-
*
|
|
1104
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1105
|
-
*
|
|
1106
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1107
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1108
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1109
|
-
* See the License for the specific language governing permissions and
|
|
1110
|
-
* limitations under the License.
|
|
1111
|
-
*/function mt(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
|
|
1112
|
-
* @license
|
|
1113
|
-
* Copyright 2019 Google LLC
|
|
1114
|
-
*
|
|
1115
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1116
|
-
* you may not use this file except in compliance with the License.
|
|
1117
|
-
* You may obtain a copy of the License at
|
|
1118
|
-
*
|
|
1119
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1120
|
-
*
|
|
1121
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1122
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1123
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1124
|
-
* See the License for the specific language governing permissions and
|
|
1125
|
-
* limitations under the License.
|
|
1126
|
-
*/class xs{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,c)=>{const l=mt("",20);i.port1.start();const d=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(f){const p=f;if(p.data.eventId===l)switch(p.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(p.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:t},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
|
|
1127
|
-
* @license
|
|
1128
|
-
* Copyright 2020 Google LLC
|
|
1129
|
-
*
|
|
1130
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1131
|
-
* you may not use this file except in compliance with the License.
|
|
1132
|
-
* You may obtain a copy of the License at
|
|
1133
|
-
*
|
|
1134
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1135
|
-
*
|
|
1136
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1137
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1138
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1139
|
-
* See the License for the specific language governing permissions and
|
|
1140
|
-
* limitations under the License.
|
|
1141
|
-
*/function E(){return window}function Bs(n){E().location.href=n}/**
|
|
1142
|
-
* @license
|
|
1143
|
-
* Copyright 2020 Google LLC.
|
|
1144
|
-
*
|
|
1145
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1146
|
-
* you may not use this file except in compliance with the License.
|
|
1147
|
-
* You may obtain a copy of the License at
|
|
1148
|
-
*
|
|
1149
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1150
|
-
*
|
|
1151
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1152
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1153
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1154
|
-
* See the License for the specific language governing permissions and
|
|
1155
|
-
* limitations under the License.
|
|
1156
|
-
*/function Un(){return typeof E().WorkerGlobalScope<"u"&&typeof E().importScripts=="function"}async function Fs(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function $s(){var n;return((n=navigator?.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Hs(){return Un()?self:null}/**
|
|
1157
|
-
* @license
|
|
1158
|
-
* Copyright 2019 Google LLC
|
|
1159
|
-
*
|
|
1160
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1161
|
-
* you may not use this file except in compliance with the License.
|
|
1162
|
-
* You may obtain a copy of the License at
|
|
1163
|
-
*
|
|
1164
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1165
|
-
*
|
|
1166
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1167
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1168
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1169
|
-
* See the License for the specific language governing permissions and
|
|
1170
|
-
* limitations under the License.
|
|
1171
|
-
*/const xn="firebaseLocalStorageDb",Vs=1,Ce="firebaseLocalStorage",Bn="fbase_key";class _e{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function xe(n,e){return n.transaction([Ce],e?"readwrite":"readonly").objectStore(Ce)}function js(){const n=indexedDB.deleteDatabase(xn);return new _e(n).toPromise()}function it(){const n=indexedDB.open(xn,Vs);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Ce,{keyPath:Bn})}catch(i){t(i)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Ce)?e(r):(r.close(),await js(),e(await it()))})})}async function jt(n,e,t){const r=xe(n,!0).put({[Bn]:e,value:t});return new _e(r).toPromise()}async function Ws(n,e){const t=xe(n,!1).get(e),r=await new _e(t).toPromise();return r===void 0?null:r.value}function Wt(n,e){const t=xe(n,!0).delete(e);return new _e(t).toPromise()}const zs=800,Gs=3;class Fn{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 it(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>Gs)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Un()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ue._getInstance(Hs()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await Fs(),!this.activeServiceWorker)return;this.sender=new xs(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);!r||((e=r[0])===null||e===void 0?void 0:e.fulfilled)&&((t=r[0])===null||t===void 0?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||$s()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await it();return await jt(e,Oe,"1"),await Wt(e,Oe),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>jt(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>Ws(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Wt(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=xe(i,!1).getAll();return new _e(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),t.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),zs)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}Fn.type="LOCAL";const Ks=Fn;/**
|
|
1172
|
-
* @license
|
|
1173
|
-
* Copyright 2020 Google LLC
|
|
1174
|
-
*
|
|
1175
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1176
|
-
* you may not use this file except in compliance with the License.
|
|
1177
|
-
* You may obtain a copy of the License at
|
|
1178
|
-
*
|
|
1179
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1180
|
-
*
|
|
1181
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1182
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1183
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1184
|
-
* See the License for the specific language governing permissions and
|
|
1185
|
-
* limitations under the License.
|
|
1186
|
-
*/function qs(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}function Js(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=i=>{const s=w("internal-error");s.customData=i,t(s)},r.type="text/javascript",r.charset="UTF-8",qs().appendChild(r)})}function Ys(n){return`__${n}${Math.floor(Math.random()*1e6)}`}new pe(3e4,6e4);/**
|
|
1187
|
-
* @license
|
|
1188
|
-
* Copyright 2021 Google LLC
|
|
1189
|
-
*
|
|
1190
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1191
|
-
* you may not use this file except in compliance with the License.
|
|
1192
|
-
* You may obtain a copy of the License at
|
|
1193
|
-
*
|
|
1194
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1195
|
-
*
|
|
1196
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1197
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1198
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1199
|
-
* See the License for the specific language governing permissions and
|
|
1200
|
-
* limitations under the License.
|
|
1201
|
-
*/function Xs(n,e){return e?k(e):(u(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
|
|
1202
|
-
* @license
|
|
1203
|
-
* Copyright 2019 Google LLC
|
|
1204
|
-
*
|
|
1205
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1206
|
-
* you may not use this file except in compliance with the License.
|
|
1207
|
-
* You may obtain a copy of the License at
|
|
1208
|
-
*
|
|
1209
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1210
|
-
*
|
|
1211
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1212
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1213
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1214
|
-
* See the License for the specific language governing permissions and
|
|
1215
|
-
* limitations under the License.
|
|
1216
|
-
*/class gt extends pt{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Y(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Y(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Y(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={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&&(t.idToken=e),t}}function Qs(n){return Cn(n.auth,new gt(n),n.bypassAuthState)}function Zs(n){const{auth:e,user:t}=n;return u(t,e,"internal-error"),Es(t,new gt(n),n.bypassAuthState)}async function eo(n){const{auth:e,user:t}=n;return u(t,e,"internal-error"),ws(t,new gt(n),n.bypassAuthState)}/**
|
|
1217
|
-
* @license
|
|
1218
|
-
* Copyright 2020 Google LLC
|
|
1219
|
-
*
|
|
1220
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1221
|
-
* you may not use this file except in compliance with the License.
|
|
1222
|
-
* You may obtain a copy of the License at
|
|
1223
|
-
*
|
|
1224
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1225
|
-
*
|
|
1226
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1227
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1228
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1229
|
-
* See the License for the specific language governing permissions and
|
|
1230
|
-
* limitations under the License.
|
|
1231
|
-
*/class $n{constructor(e,t,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:t,sessionId:r,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 Qs;case"linkViaPopup":case"linkViaRedirect":return eo;case"reauthViaPopup":case"reauthViaRedirect":return Zs;default:b(this.auth,"internal-error")}}resolve(e){A(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){A(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()}}/**
|
|
1232
|
-
* @license
|
|
1233
|
-
* Copyright 2020 Google LLC
|
|
1234
|
-
*
|
|
1235
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1236
|
-
* you may not use this file except in compliance with the License.
|
|
1237
|
-
* You may obtain a copy of the License at
|
|
1238
|
-
*
|
|
1239
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1240
|
-
*
|
|
1241
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1242
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1243
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1244
|
-
* See the License for the specific language governing permissions and
|
|
1245
|
-
* limitations under the License.
|
|
1246
|
-
*/const to=new pe(2e3,1e4);class K extends $n{constructor(e,t,r,i,s){super(e,t,i,s),this.provider=r,this.authWindow=null,this.pollId=null,K.currentPopupAction&&K.currentPopupAction.cancel(),K.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return u(e,this.auth,"internal-error"),e}async onExecution(){A(this.filter.length===1,"Popup operations only handle one event");const e=mt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(w(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(w(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,K.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if(!((r=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(w(this.auth,"popup-closed-by-user"))},2e3);return}this.pollId=window.setTimeout(e,to.get())};e()}}K.currentPopupAction=null;/**
|
|
1247
|
-
* @license
|
|
1248
|
-
* Copyright 2020 Google LLC
|
|
1249
|
-
*
|
|
1250
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1251
|
-
* you may not use this file except in compliance with the License.
|
|
1252
|
-
* You may obtain a copy of the License at
|
|
1253
|
-
*
|
|
1254
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1255
|
-
*
|
|
1256
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1257
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1258
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1259
|
-
* See the License for the specific language governing permissions and
|
|
1260
|
-
* limitations under the License.
|
|
1261
|
-
*/const no="pendingRedirect",we=new Map;class ro extends $n{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=we.get(this.auth._key());if(!e){try{const r=await io(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}we.set(this.auth._key(),e)}return this.bypassAuthState||we.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){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function io(n,e){const t=ao(e),r=oo(n);if(!await r._isAvailable())return!1;const i=await r._get(t)==="true";return await r._remove(t),i}function so(n,e){we.set(n._key(),e)}function oo(n){return k(n._redirectPersistence)}function ao(n){return be(no,n.config.apiKey,n.name)}async function co(n,e,t=!1){const r=Le(n),i=Xs(r,e),o=await new ro(r,i,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
|
|
1262
|
-
* @license
|
|
1263
|
-
* Copyright 2020 Google LLC
|
|
1264
|
-
*
|
|
1265
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1266
|
-
* you may not use this file except in compliance with the License.
|
|
1267
|
-
* You may obtain a copy of the License at
|
|
1268
|
-
*
|
|
1269
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1270
|
-
*
|
|
1271
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1272
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1273
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1274
|
-
* See the License for the specific language governing permissions and
|
|
1275
|
-
* limitations under the License.
|
|
1276
|
-
*/const lo=10*60*1e3;class uo{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 t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ho(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!Hn(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(w(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=lo&&this.cachedEventUids.clear(),this.cachedEventUids.has(zt(e))}saveEventToCache(e){this.cachedEventUids.add(zt(e)),this.lastProcessedEventTime=Date.now()}}function zt(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Hn({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function ho(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Hn(n);default:return!1}}/**
|
|
1277
|
-
* @license
|
|
1278
|
-
* Copyright 2020 Google LLC
|
|
1279
|
-
*
|
|
1280
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1281
|
-
* you may not use this file except in compliance with the License.
|
|
1282
|
-
* You may obtain a copy of the License at
|
|
1283
|
-
*
|
|
1284
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1285
|
-
*
|
|
1286
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1287
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1288
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1289
|
-
* See the License for the specific language governing permissions and
|
|
1290
|
-
* limitations under the License.
|
|
1291
|
-
*/async function fo(n,e={}){return ee(n,"GET","/v1/projects",e)}/**
|
|
1292
|
-
* @license
|
|
1293
|
-
* Copyright 2020 Google LLC
|
|
1294
|
-
*
|
|
1295
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1296
|
-
* you may not use this file except in compliance with the License.
|
|
1297
|
-
* You may obtain a copy of the License at
|
|
1298
|
-
*
|
|
1299
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1300
|
-
*
|
|
1301
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1302
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1303
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1304
|
-
* See the License for the specific language governing permissions and
|
|
1305
|
-
* limitations under the License.
|
|
1306
|
-
*/const po=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,mo=/^https?/;async function go(n){if(n.config.emulator)return;const{authorizedDomains:e}=await fo(n);for(const t of e)try{if(_o(t))return}catch{}b(n,"unauthorized-domain")}function _o(n){const e=ke(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===r}if(!mo.test(t))return!1;if(po.test(n))return r===n;const i=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/**
|
|
1307
|
-
* @license
|
|
1308
|
-
* Copyright 2020 Google LLC.
|
|
1309
|
-
*
|
|
1310
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1311
|
-
* you may not use this file except in compliance with the License.
|
|
1312
|
-
* You may obtain a copy of the License at
|
|
1313
|
-
*
|
|
1314
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1315
|
-
*
|
|
1316
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1317
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1318
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1319
|
-
* See the License for the specific language governing permissions and
|
|
1320
|
-
* limitations under the License.
|
|
1321
|
-
*/const vo=new pe(3e4,6e4);function Gt(){const n=E().___jsl;if(n?.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function Io(n){return new Promise((e,t)=>{var r,i,s;function o(){Gt(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Gt(),t(w(n,"network-request-failed"))},timeout:vo.get()})}if(!((i=(r=E().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=E().gapi)===null||s===void 0)&&s.load)o();else{const a=Ys("iframefcb");return E()[a]=()=>{gapi.load?o():t(w(n,"network-request-failed"))},Js(`https://apis.google.com/js/api.js?onload=${a}`).catch(c=>t(c))}}).catch(e=>{throw Ee=null,e})}let Ee=null;function yo(n){return Ee=Ee||Io(n),Ee}/**
|
|
1322
|
-
* @license
|
|
1323
|
-
* Copyright 2020 Google LLC.
|
|
1324
|
-
*
|
|
1325
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1326
|
-
* you may not use this file except in compliance with the License.
|
|
1327
|
-
* You may obtain a copy of the License at
|
|
1328
|
-
*
|
|
1329
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1330
|
-
*
|
|
1331
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1332
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1333
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1334
|
-
* See the License for the specific language governing permissions and
|
|
1335
|
-
* limitations under the License.
|
|
1336
|
-
*/const bo=new pe(5e3,15e3),wo="__/auth/iframe",Eo="emulator/auth/iframe",To={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},So=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ko(n){const e=n.config;u(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?dt(e,Eo):`https://${n.config.authDomain}/${wo}`,r={apiKey:e.apiKey,appName:n.name,v:De},i=So.get(n.config.apiHost);i&&(r.eid=i);const s=n._getFrameworks();return s.length&&(r.fw=s.join(",")),`${t}?${fe(r).slice(1)}`}async function Ao(n){const e=await yo(n),t=E().gapi;return u(t,n,"internal-error"),e.open({where:document.body,url:ko(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:To,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=w(n,"network-request-failed"),a=E().setTimeout(()=>{s(o)},bo.get());function c(){E().clearTimeout(a),i(r)}r.ping(c).then(c,()=>{s(o)})}))}/**
|
|
1337
|
-
* @license
|
|
1338
|
-
* Copyright 2020 Google LLC.
|
|
1339
|
-
*
|
|
1340
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1341
|
-
* you may not use this file except in compliance with the License.
|
|
1342
|
-
* You may obtain a copy of the License at
|
|
1343
|
-
*
|
|
1344
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1345
|
-
*
|
|
1346
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1347
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1348
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1349
|
-
* See the License for the specific language governing permissions and
|
|
1350
|
-
* limitations under the License.
|
|
1351
|
-
*/const Ro={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Oo=500,Co=600,Do="_blank",Po="http://localhost";class Kt{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function No(n,e,t,r=Oo,i=Co){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},Ro),{width:r.toString(),height:i.toString(),top:s,left:o}),l=m().toLowerCase();t&&(a=yn(l)?Do:t),In(l)&&(e=e||Po,c.scrollbars="yes");const d=Object.entries(c).reduce((p,[y,O])=>`${p}${y}=${O},`,"");if(ss(l)&&a!=="_self")return Lo(e||"",a),new Kt(null);const f=window.open(e||"",a,d);u(f,n,"popup-blocked");try{f.focus()}catch{}return new Kt(f)}function Lo(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
|
|
1352
|
-
* @license
|
|
1353
|
-
* Copyright 2021 Google LLC
|
|
1354
|
-
*
|
|
1355
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1356
|
-
* you may not use this file except in compliance with the License.
|
|
1357
|
-
* You may obtain a copy of the License at
|
|
1358
|
-
*
|
|
1359
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1360
|
-
*
|
|
1361
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1362
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1363
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1364
|
-
* See the License for the specific language governing permissions and
|
|
1365
|
-
* limitations under the License.
|
|
1366
|
-
*/const Mo="__/auth/handler",Uo="emulator/auth/handler";function qt(n,e,t,r,i,s){u(n.config.authDomain,n,"auth-domain-config-required"),u(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:De,eventId:i};if(e instanceof Rn){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Or(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[c,l]of Object.entries(s||{}))o[c]=l}if(e instanceof ge){const c=e.getScopes().filter(l=>l!=="");c.length>0&&(o.scopes=c.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];return`${xo(n)}?${fe(a).slice(1)}`}function xo({config:n}){return n.emulator?dt(n,Uo):`https://${n.authDomain}/${Mo}`}/**
|
|
1367
|
-
* @license
|
|
1368
|
-
* Copyright 2020 Google LLC
|
|
1369
|
-
*
|
|
1370
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1371
|
-
* you may not use this file except in compliance with the License.
|
|
1372
|
-
* You may obtain a copy of the License at
|
|
1373
|
-
*
|
|
1374
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1375
|
-
*
|
|
1376
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1377
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1378
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1379
|
-
* See the License for the specific language governing permissions and
|
|
1380
|
-
* limitations under the License.
|
|
1381
|
-
*/const Xe="webStorageSupport";class Bo{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Mn,this._completeRedirectFn=co,this._overrideRedirectResult=so}async _openPopup(e,t,r,i){var s;A((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=qt(e,t,r,ke(),i);return No(e,o,mt())}async _openRedirect(e,t,r,i){return await this._originValidation(e),Bs(qt(e,t,r,ke(),i)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:i,promise:s}=this.eventManagers[t];return i?Promise.resolve(i):(A(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await Ao(e),r=new uo(e);return t.register("authEvent",i=>(u(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Xe,{type:Xe},i=>{var s;const o=(s=i?.[0])===null||s===void 0?void 0:s[Xe];o!==void 0&&t(!!o),b(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=go(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Sn()||ft()||Ne()}}const Fo=Bo;var Jt="@firebase/auth",Yt="0.21.0";/**
|
|
1382
|
-
* @license
|
|
1383
|
-
* Copyright 2020 Google LLC
|
|
1384
|
-
*
|
|
1385
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1386
|
-
* you may not use this file except in compliance with the License.
|
|
1387
|
-
* You may obtain a copy of the License at
|
|
1388
|
-
*
|
|
1389
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1390
|
-
*
|
|
1391
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1392
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1393
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1394
|
-
* See the License for the specific language governing permissions and
|
|
1395
|
-
* limitations under the License.
|
|
1396
|
-
*/class $o{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;const t=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);!t||(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){u(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1397
|
-
* @license
|
|
1398
|
-
* Copyright 2020 Google LLC
|
|
1399
|
-
*
|
|
1400
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1401
|
-
* you may not use this file except in compliance with the License.
|
|
1402
|
-
* You may obtain a copy of the License at
|
|
1403
|
-
*
|
|
1404
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1405
|
-
*
|
|
1406
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1407
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1408
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1409
|
-
* See the License for the specific language governing permissions and
|
|
1410
|
-
* limitations under the License.
|
|
1411
|
-
*/function Ho(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}function Vo(n){oe(new X("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),{apiKey:s,authDomain:o}=r.options;return((a,c)=>{u(s&&!s.includes(":"),"invalid-api-key",{appName:a.name}),u(!o?.includes(":"),"argument-error",{appName:a.name});const l={apiKey:s,authDomain:o,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:kn(n)},d=new ls(a,c,l);return Vi(d,t),d})(r,i)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),oe(new X("auth-internal",e=>{const t=Le(e.getProvider("auth").getImmediate());return(r=>new $o(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),q(Jt,Yt,Ho(n)),q(Jt,Yt,"esm2017")}/**
|
|
1412
|
-
* @license
|
|
1413
|
-
* Copyright 2021 Google LLC
|
|
1414
|
-
*
|
|
1415
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1416
|
-
* you may not use this file except in compliance with the License.
|
|
1417
|
-
* You may obtain a copy of the License at
|
|
1418
|
-
*
|
|
1419
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1420
|
-
*
|
|
1421
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1422
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1423
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1424
|
-
* See the License for the specific language governing permissions and
|
|
1425
|
-
* limitations under the License.
|
|
1426
|
-
*/const jo=5*60,Wo=rn("authIdTokenMaxAge")||jo;let Xt=null;const zo=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>Wo)return;const i=t?.token;Xt!==i&&(Xt=i,await fetch(n,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function Vn(n=Oi()){const e=cn(n,"auth");if(e.isInitialized())return e.getImmediate();const t=Hi(n,{popupRedirectResolver:Fo,persistence:[Ks,Ms,Mn]}),r=rn("authTokenSyncURL");if(r){const s=zo(r);Cs(t,s,()=>s(t.currentUser)),Os(t,o=>s(o))}const i=Er("auth");return i&&us(t,`http://${i}`),t}Vo("Browser");globalThis.__apiCache||(globalThis.__apiCache={});const G={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0};class Qt extends Error{constructor(e,t,r,i=!1){t?(super(t.statusText),this.data=t.data,this.statusCode=t.status):super(r||"Request error"),this.config=e,this.response=t,this.isTimeout=i}}const Go={middleware(n){const e={...n.headers};if(!n.isNoAuth)if(n.accessToken)e.Authorization=`Bearer ${n.accessToken}`;else{const s=n.authenticationId||G.ECOM_AUTHENTICATION_ID,o=n.apiKey||G.ECOM_API_KEY;if(s&&o){const a=`${s}:${o}`,c=typeof Buffer=="function"?Buffer.from(a).toString("base64"):btoa(a);e.Authorization=`Basic ${c}`}}let t=n.baseUrl||G.API_BASE_URL||"https://ecomplus.io/v2";const{endpoint:r,params:i}=n;if(r!=="login"&&r!=="authenticate"&&r!=="ask-auth-callback"&&r!=="check-username"){const s=n.storeId||G.ECOM_STORE_ID;if(!s)throw new Error("`storeId` must be set in config or `ECOM_STORE_ID` env var");t+=`/:${s}`;const o=n.lang||G.ECOM_LANG;o&&(t+=`,lang:${o}`)}if(t+=`/${r}`,i){if(typeof i=="string")t+=`?${i}`;else if(typeof i=="object"){const s=new URLSearchParams;Object.keys(i).forEach(o=>{const a=i[o];Array.isArray(a)?a.forEach(c=>{s.append(o,c)}):s.append(o,a)}),t+=`?${s.toString()}`}}return{url:t,headers:e}}},I=async(n,e=0)=>{const{url:t,headers:r}=Go.middleware(n),{method:i="get",timeout:s=2e4,maxRetries:o=3,cacheMaxAge:a=6e5}=n,c=i==="get"&&(n.canCache||n.canCache===void 0&&G.SSR);let l;if(c){l=`${t}${JSON.stringify(r)}`;const _=globalThis.__apiCache[l];if(_&&Date.now()-_.timestamp<=a)return{..._.res,config:n}}const d=n.body||n.data;let f;d&&(f=JSON.stringify(d),r["Content-Type"]="application/json",r["Content-Length"]=f.length.toString());const p=new AbortController;let y=!1;const O=setTimeout(()=>{p.abort(),y=!0},s);let g;try{g=await(n.fetch||fetch)(t,{method:i,headers:r,body:f,signal:p.signal})}catch(_){throw new Qt(n,g,_.message,y)}if(clearTimeout(O),g){if(g.ok){const C={...g,data:await g.json()};return c&&l&&(globalThis.__apiCache[l]={timestamp:Date.now(),res:C}),{...C,config:n}}const{status:_}=g;if(o<e&&(_===429||_>=500)){const C=g.headers.get("retry-after");return new Promise((ve,te)=>{setTimeout(()=>{I(n,e+1).then(ve).catch(te)},C&&parseInt(C,10)||5e3)})}}try{g.data=await g?.json()}catch{}throw new Qt(n,g)},Ko=(n,e)=>I({...e,endpoint:n}),qo=(n,e,t)=>I({...t,method:"post",endpoint:n,body:e}),Jo=(n,e,t)=>I({...t,method:"put",endpoint:n,body:e}),Yo=(n,e,t)=>I({...t,method:"patch",endpoint:n,body:e}),jn=(n,e)=>I({...e,method:"delete",endpoint:n});I.get=Ko;I.post=qo;I.put=Jo;I.patch=Yo;I.del=jn;I.delete=jn;const Xo=(n,e,t=localStorage)=>{let r;const i=t.getItem(n);if(i)try{r=JSON.parse(i)}catch{r=null,t.removeItem(n)}const s=ir(r||e);return Qe(s,()=>{t.setItem(n,JSON.stringify(s))}),s};var Qo="firebase",Zo="9.15.0";/**
|
|
1427
|
-
* @license
|
|
1428
|
-
* Copyright 2020 Google LLC
|
|
1429
|
-
*
|
|
1430
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1431
|
-
* you may not use this file except in compliance with the License.
|
|
1432
|
-
* You may obtain a copy of the License at
|
|
1433
|
-
*
|
|
1434
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1435
|
-
*
|
|
1436
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1437
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1438
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1439
|
-
* See the License for the specific language governing permissions and
|
|
1440
|
-
* limitations under the License.
|
|
1441
|
-
*/q(Qo,Zo,"app");ln(window.firebaseConfig);const Wn="SESSION",st={customer:{display_name:"",main_email:""},auth:null},R=Xo(Wn,st),_t=de(()=>{const{auth:n}=R;return n&&new Date(n.expires).getTime()-Date.now()>1e3*10}),zn=de(()=>R.customer),ot=de(()=>ur(zn.value)),P=de({get(){return zn.value.main_email},set(n){R.customer.main_email=n}}),Z=Vn();if(As(Z,window.location.href)){const e=new URLSearchParams(window.location.search).get("email");e&&Rs(Z,e,window.location.href).catch(console.error)}const ea=de(()=>_t.value||!!Z.currentUser),ta=()=>{R.auth=st.auth,R.customer=st.customer,localStorage.removeItem(Wn),Z.signOut()},Gn=async()=>{const n=await Z.currentUser.getIdToken(),{domain:e}=window.storefront.settings;try{const t=await fetch(`https://${e}/api/passport/token`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});R.auth=await t.json()}catch(t){console.error(t)}},na=async()=>(_t.value||await Gn(),R.auth.access_token),ra=async()=>{const n=await na(),{data:e}=await I.get(`customers/${R.auth.customer_id}`,{accessToken:n});return R.customer=e,e};Ds(Z,async n=>{if(n){if(n.emailVerified){const e=n.email!==P.value;(e||!_t.value)&&(await Gn(),(e||!ot.value)&&await ra())}}else ta()});const ia={class:"text-xl font-medium mb-5"},sa=["onSubmit"],oa={key:0,for:"login-form-email"},aa=["placeholder"],ca={class:"text-right lowercase"},la={type:"submit"},ga=sr({__name:"LoginForm",emits:["login","logout"],setup(n,{emit:e}){Qe(ea,o=>{e(o?"login":"logout")},{immediate:!0});const t=He(!0),r=He(!1);Qe(r,o=>{o&&(t.value=!0)});const i=He(""),s=async()=>{const o=Vn();window.localStorage.setItem("emailForSignIn",P.value);try{if(t.value){const a=new URL(window.location.toString());a.searchParams.append("email",P.value),await ks(o,P.value,{url:a.toString(),handleCodeInApp:!0})}else await Ss(o,P.value,i.value)}catch(a){console.warn(a.code),console.error(a)}};return(o,a)=>(Ve(),je(cr,null,[Et(o.$slots,"greetings",Tt(St({customerName:v(ot)})),()=>[$("div",ia,ne(`${v(Yn)} ${v(ot)||v(Xn)}`),1)]),$("form",{class:"login-form text-base",onSubmit:$e(s,["prevent"])},[t.value?(Ve(),je("label",oa,ne(v(Qn)),1)):kt("",!0),We($("input",{id:"login-form-email",type:"email",placeholder:"email@mail.com","onUpdate:modelValue":a[0]||(a[0]=c=>or(P)?P.value=c:null),required:""},null,512),[[bt,v(P)]]),t.value?kt("",!0):We((Ve(),je("input",{key:1,type:"password",class:"lowercase",placeholder:v(Zn),"onUpdate:modelValue":a[1]||(a[1]=c=>i.value=c),required:""},null,8,aa)),[[bt,i.value]]),We($("small",ca,[$("a",{href:"#",class:"text-muted",onClick:a[2]||(a[2]=$e(c=>t.value=!t.value,["prevent"]))},ne(t.value?v(er):v(tr)),1)],512),[[Jn,!r.value]]),$("button",la,[Et(o.$slots,"button-content",Tt(St({isSignUp:r.value})),()=>[ar(ne(r.value?v(nr):v(wt)),1)])]),$("a",{href:"#",class:"block text-center",onClick:a[3]||(a[3]=$e(c=>r.value=!r.value,["prevent"]))},ne(r.value?v(wt):v(rr)),1)],40,sa)],64))}});export{ga as default};
|