cloudcommerce 0.0.97 → 0.0.99
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 +14 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/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/events/package.json +1 -1
- package/packages/firebase/lib/config.js +27 -25
- package/packages/firebase/lib/const.js +3 -2
- package/packages/firebase/lib/env.js +2 -1
- package/packages/firebase/lib/handlers/check-store-events.js +146 -145
- package/packages/firebase/lib/helpers/pubsub.js +20 -18
- package/packages/firebase/lib/helpers/update-app-data.js +38 -38
- package/packages/firebase/lib/index.js +9 -7
- package/packages/firebase/lib/init.js +2 -1
- package/packages/firebase/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/astro.config.mjs +1 -1
- package/packages/storefront/dist/client/LoginOffcanvas.c2faa1dc.js +1 -0
- package/packages/storefront/dist/client/admin/config.json +1 -0
- package/packages/storefront/dist/client/assets/_...522e6bf2.css +4 -0
- package/packages/storefront/dist/client/assets/_...a48b75c7.css +1 -0
- package/packages/storefront/dist/client/assets/cms-preview.css +274 -0
- package/packages/storefront/dist/client/assets/cms.css +114 -0
- package/packages/storefront/dist/client/assets/cvv.png +0 -0
- package/packages/storefront/dist/client/assets/icons/bootstrap-icons/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/feather-icons/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/font-awesome/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/line-awesome/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/tabler-icons/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/img-placeholder.png +0 -0
- package/packages/storefront/dist/client/assets/payments.png +0 -0
- package/packages/storefront/dist/client/assets/ssl-safe.png +0 -0
- package/packages/storefront/dist/client/chunks/LoginForm.3bcb85fb.js +1066 -0
- package/packages/storefront/dist/client/chunks/LoginOffcanvas.e48f274b.js +1 -0
- package/packages/storefront/dist/client/chunks/index.esm.84a649c7.js +331 -0
- package/packages/storefront/dist/client/chunks/preload-helper.f15ab524.js +1 -0
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.738639ee.js +1 -0
- package/packages/storefront/dist/client/chunks/workbox-window.prod.es5.4b654ae6.js +2 -0
- package/packages/storefront/dist/client/client.b552d86a.js +1 -0
- package/packages/storefront/dist/client/hoisted.054c36ac.js +1 -0
- package/packages/storefront/dist/client/img/icon.png +0 -0
- package/packages/storefront/dist/client/img/large-icon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner1.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner2.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner2.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/favicon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headless.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headphone.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headphone.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/icon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/large-icon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/logo.png +0 -0
- package/packages/storefront/dist/client/img/uploads/logo.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/og-image.png +0 -0
- package/packages/storefront/dist/client/img/uploads/passion.png +0 -0
- package/packages/storefront/dist/client/img/uploads/passion.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/pwa-reliable.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect8589.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect859.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect89.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect89.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/ssl-safe.png +0 -0
- package/packages/storefront/dist/client/manifest.webmanifest +1 -0
- package/packages/storefront/dist/client/page.3aa82516.js +1 -0
- package/packages/storefront/dist/client/robots.txt +8 -0
- package/packages/storefront/dist/client/sw.js +1 -0
- package/packages/storefront/dist/client/workbox-6f0d1f78.js +1 -0
- package/packages/storefront/dist/client/~partytown/partytown-atomics.js +2 -0
- package/packages/storefront/dist/client/~partytown/partytown-media.js +2 -0
- package/packages/storefront/dist/client/~partytown/partytown-sw.js +2 -0
- package/packages/storefront/dist/client/~partytown/partytown.js +2 -0
- package/packages/storefront/dist/server/entry.mjs +2852 -0
- package/packages/storefront/dist/server/manifest.webmanifest +1 -0
- package/packages/storefront/dist/server/registerSW.js +1 -0
- package/packages/storefront/package.json +2 -2
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +2 -1
- package/packages/storefront/tsconfig.json +1 -1
- package/packages/types/package.json +1 -1
|
@@ -0,0 +1,1066 @@
|
|
|
1
|
+
import{d as Lt,r as De,e as Mt,x as Ue,y as Fe,f as he,z as Dt,u as Ut,g as Ft,o as xt}from"./runtime-dom.esm-bundler.738639ee.js";import{i as Vt,_ as nt,g as Wt,d as jt,a as Ht,b as qt,c as xe,C as Ve,r as We,E as _e,L as zt,e as Bt,S as ne,f as V,h as Kt,j as f,k as Gt,l as $t,F as ve,m as Jt,q as W,n as Yt,o as L,p as M}from"./index.esm.84a649c7.js";import{i as Xt}from"./LoginOffcanvas.e48f274b.js";import"./preload-helper.f15ab524.js";/* empty css */const Qt=window.firebaseConfig||{apiKey:"AIzaSyCrVzemDgpyp9i6ni7Yc5ZuEVfXYwl-4J0",authDomain:"ecom2-002.firebaseapp.com",projectId:"ecom2-002",storageBucket:"ecom2-002.appspot.com",messagingSenderId:"402807248219",appId:"1:402807248219:web:cf7d57759751e74776367e",measurementId:"G-SC592CE0GB"};Vt(Qt);function Ie(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t}function it(){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 Zt=it,rt=new _e("auth","Firebase",it());/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 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
|
+
*/const je=new zt("@firebase/auth");function $(n,...e){je.logLevel<=$t.ERROR&&je.error(`Auth (${ne}): ${n}`,...e)}/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2020 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
|
+
*/function p(n,...e){throw ye(n,...e)}function g(n,...e){return ye(n,...e)}function en(n,e,t){const i=Object.assign(Object.assign({},Zt()),{[e]:t});return new _e("auth","Firebase",i).create(e,{appName:n.name})}function ye(n,...e){if(typeof n!="string"){const t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return rt.create(n,...e)}function l(n,e,...t){if(!n)throw ye(e,...t)}function v(n){const e="INTERNAL ASSERTION FAILED: "+n;throw $(e),new Error(e)}function y(n,e){n||v(e)}/**
|
|
32
|
+
* @license
|
|
33
|
+
* Copyright 2020 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
|
+
*/const He=new Map;function I(n){y(n instanceof Function,"Expected a class definition");let e=He.get(n);return e?(y(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,He.set(n,e),e)}/**
|
|
47
|
+
* @license
|
|
48
|
+
* Copyright 2020 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
|
+
*/function tn(n,e){const t=nt(n,"auth");if(t.isInitialized()){const r=t.getImmediate(),s=t.getOptions();if(jt(s,e??{}))return r;p(r,"already-initialized")}return t.initialize({options:e})}function nn(n,e){const t=e?.persistence||[],i=(Array.isArray(t)?t:[t]).map(I);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e?.popupRedirectResolver)}/**
|
|
62
|
+
* @license
|
|
63
|
+
* Copyright 2020 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
|
+
*/function ge(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function rn(){return qe()==="http:"||qe()==="https:"}function qe(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
|
|
77
|
+
* @license
|
|
78
|
+
* Copyright 2020 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
|
+
*/function sn(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(rn()||Bt()||"connection"in navigator)?navigator.onLine:!0}function on(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
|
|
92
|
+
* @license
|
|
93
|
+
* Copyright 2020 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
|
+
*/class j{constructor(e,t){this.shortDelay=e,this.longDelay=t,y(t>e,"Short delay should be less than long delay!"),this.isMobile=Ht()||qt()}get(){return sn()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
107
|
+
* @license
|
|
108
|
+
* Copyright 2020 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 we(n,e){y(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
|
|
122
|
+
* @license
|
|
123
|
+
* Copyright 2020 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
|
+
*/class st{static initialize(e,t,i){this.fetchImpl=e,t&&(this.headersImpl=t),i&&(this.responseImpl=i)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;v("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;v("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;v("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
137
|
+
* @license
|
|
138
|
+
* Copyright 2020 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
|
+
*/const an={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"};/**
|
|
152
|
+
* @license
|
|
153
|
+
* Copyright 2020 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
|
+
*/const cn=new j(3e4,6e4);function ie(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function H(n,e,t,i,r={}){return ot(n,r,async()=>{let s={},o={};i&&(e==="GET"?o=i:s={body:JSON.stringify(i)});const c=W(Object.assign({key:n.config.apiKey},o)).slice(1),a=await n._getAdditionalHeaders();return a["Content-Type"]="application/json",n.languageCode&&(a["X-Firebase-Locale"]=n.languageCode),st.fetch()(at(n,n.config.apiHost,t,c),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))})}async function ot(n,e,t){n._canInitEmulator=!1;const i=Object.assign(Object.assign({},an),e);try{const r=new ln(n),s=await Promise.race([t(),r.promise]);r.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw G(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const c=s.ok?o.errorMessage:o.error.message,[a,u]=c.split(" : ");if(a==="FEDERATED_USER_ID_ALREADY_LINKED")throw G(n,"credential-already-in-use",o);if(a==="EMAIL_EXISTS")throw G(n,"email-already-in-use",o);if(a==="USER_DISABLED")throw G(n,"user-disabled",o);const d=i[a]||a.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw en(n,d,u);p(n,d)}}catch(r){if(r instanceof ve)throw r;p(n,"network-request-failed")}}async function re(n,e,t,i,r={}){const s=await H(n,e,t,i,r);return"mfaPendingCredential"in s&&p(n,"multi-factor-auth-required",{_serverResponse:s}),s}function at(n,e,t,i){const r=`${e}${t}?${i}`;return n.config.emulator?we(n.config,r):`${n.config.apiScheme}://${r}`}class ln{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(g(this.auth,"network-request-failed")),cn.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function G(n,e,t){const i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);const r=g(n,e,i);return r.customData._tokenResponse=t,r}/**
|
|
167
|
+
* @license
|
|
168
|
+
* Copyright 2020 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
|
+
*/async function un(n,e){return H(n,"POST","/v1/accounts:delete",e)}async function dn(n,e){return H(n,"POST","/v1/accounts:lookup",e)}/**
|
|
182
|
+
* @license
|
|
183
|
+
* Copyright 2020 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
|
+
*/function D(n){if(!!n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function hn(n,e=!1){const t=V(n),i=await t.getIdToken(e),r=Te(i);l(r&&r.exp&&r.auth_time&&r.iat,t.auth,"internal-error");const s=typeof r.firebase=="object"?r.firebase:void 0,o=s?.sign_in_provider;return{claims:r,token:i,authTime:D(fe(r.auth_time)),issuedAtTime:D(fe(r.iat)),expirationTime:D(fe(r.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function fe(n){return Number(n)*1e3}function Te(n){var e;const[t,i,r]=n.split(".");if(t===void 0||i===void 0||r===void 0)return $("JWT malformed, contained fewer than 3 sections"),null;try{const s=Yt(i);return s?JSON.parse(s):($("Failed to decode base64 JWT payload"),null)}catch(s){return $("Caught error parsing JWT payload as JSON",(e=s)===null||e===void 0?void 0:e.toString()),null}}function fn(n){const e=Te(n);return l(e,"internal-error"),l(typeof e.exp<"u","internal-error"),l(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
|
|
197
|
+
* @license
|
|
198
|
+
* Copyright 2020 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
|
+
*/async function U(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof ve&&pn(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function pn({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
|
|
212
|
+
* @license
|
|
213
|
+
* Copyright 2020 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
|
+
*/class gn{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 i=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),i}else{this.errorBackoff=3e4;const r=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){var e;try{await this.user.getIdToken(!0)}catch(t){((e=t)===null||e===void 0?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
|
227
|
+
* @license
|
|
228
|
+
* Copyright 2020 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
|
+
*/class ct{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=D(this.lastLoginAt),this.creationTime=D(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
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
|
+
*/async function Q(n){var e;const t=n.auth,i=await n.getIdToken(),r=await U(n,dn(t,{idToken:i}));l(r?.users.length,t,"internal-error");const s=r.users[0];n._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?vn(s.providerUserInfo):[],c=_n(n.providerData,o),a=n.isAnonymous,u=!(n.email&&s.passwordHash)&&!c?.length,d=a?u:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:c,metadata:new ct(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(n,h)}async function mn(n){const e=V(n);await Q(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function _n(n,e){return[...n.filter(i=>!e.some(r=>r.providerId===i.providerId)),...e]}function vn(n){return n.map(e=>{var{providerId:t}=e,i=Ie(e,["providerId"]);return{providerId:t,uid:i.rawId||"",displayName:i.displayName||null,email:i.email||null,phoneNumber:i.phoneNumber||null,photoURL:i.photoUrl||null}})}/**
|
|
257
|
+
* @license
|
|
258
|
+
* Copyright 2020 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
|
+
*/async function In(n,e){const t=await ot(n,{},async()=>{const i=W({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=n.config,o=at(n,r,"/v1/token",`key=${s}`),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/x-www-form-urlencoded",st.fetch()(o,{method:"POST",headers:c,body:i})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}/**
|
|
272
|
+
* @license
|
|
273
|
+
* Copyright 2020 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
|
+
*/class F{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){l(e.idToken,"internal-error"),l(typeof e.idToken<"u","internal-error"),l(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):fn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return l(!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:i,refreshToken:r,expiresIn:s}=await In(e,t);this.updateTokensAndExpiration(i,r,Number(s))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){const{refreshToken:i,accessToken:r,expirationTime:s}=t,o=new F;return i&&(l(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),r&&(l(typeof r=="string","internal-error",{appName:e}),o.accessToken=r),s&&(l(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 F,this.toJSON())}_performRefresh(){return v("not implemented")}}/**
|
|
287
|
+
* @license
|
|
288
|
+
* Copyright 2020 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
|
+
*/function w(n,e){l(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class S{constructor(e){var{uid:t,auth:i,stsTokenManager:r}=e,s=Ie(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new gn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=i,this.stsTokenManager=r,this.accessToken=r.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 ct(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await U(this,this.stsTokenManager.getToken(this.auth,e));return l(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return hn(this,e)}reload(){return mn(this)}_assign(e){this!==e&&(l(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 S(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){l(!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 i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await Q(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await U(this,un(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 i,r,s,o,c,a,u,d;const h=(i=t.displayName)!==null&&i!==void 0?i:void 0,_=(r=t.email)!==null&&r!==void 0?r:void 0,B=(s=t.phoneNumber)!==null&&s!==void 0?s:void 0,K=(o=t.photoURL)!==null&&o!==void 0?o:void 0,Pe=(c=t.tenantId)!==null&&c!==void 0?c:void 0,ce=(a=t._redirectEventId)!==null&&a!==void 0?a:void 0,Oe=(u=t.createdAt)!==null&&u!==void 0?u:void 0,Ne=(d=t.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:le,emailVerified:Ce,isAnonymous:Le,providerData:ue,stsTokenManager:Me}=t;l(le&&Me,e,"internal-error");const Nt=F.fromJSON(this.name,Me);l(typeof le=="string",e,"internal-error"),w(h,e.name),w(_,e.name),l(typeof Ce=="boolean",e,"internal-error"),l(typeof Le=="boolean",e,"internal-error"),w(B,e.name),w(K,e.name),w(Pe,e.name),w(ce,e.name),w(Oe,e.name),w(Ne,e.name);const de=new S({uid:le,auth:e,email:_,emailVerified:Ce,displayName:h,isAnonymous:Le,photoURL:K,phoneNumber:B,tenantId:Pe,stsTokenManager:Nt,createdAt:Oe,lastLoginAt:Ne});return ue&&Array.isArray(ue)&&(de.providerData=ue.map(Ct=>Object.assign({},Ct))),ce&&(de._redirectEventId=ce),de}static async _fromIdTokenResponse(e,t,i=!1){const r=new F;r.updateFromServerResponse(t);const s=new S({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:i});return await Q(s),s}}/**
|
|
302
|
+
* @license
|
|
303
|
+
* Copyright 2019 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
|
+
*/class lt{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){}}lt.type="NONE";const ze=lt;/**
|
|
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 J(n,e,t){return`firebase:${n}:${e}:${t}`}class P{constructor(e,t,i){this.persistence=e,this.auth=t,this.userKey=i;const{config:r,name:s}=this.auth;this.fullUserKey=J(this.userKey,r.apiKey,s),this.fullPersistenceKey=J("persistence",r.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?S._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,i="authUser"){if(!t.length)return new P(I(ze),e,i);const r=(await Promise.all(t.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let s=r[0]||I(ze);const o=J(i,e.config.apiKey,e.name);let c=null;for(const u of t)try{const d=await u._get(o);if(d){const h=S._fromJSON(e,d);u!==s&&(c=h),s=u;break}}catch{}const a=r.filter(u=>u._shouldAllowMigration);return!s._shouldAllowMigration||!a.length?new P(s,e,i):(s=a[0],c&&await s._set(o,c.toJSON()),await Promise.all(t.map(async u=>{if(u!==s)try{await u._remove(o)}catch{}})),new P(s,e,i))}}/**
|
|
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
|
+
*/function Be(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ht(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(ut(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(pt(e))return"Blackberry";if(gt(e))return"Webos";if(Ee(e))return"Safari";if((e.includes("chrome/")||dt(e))&&!e.includes("edge/"))return"Chrome";if(ft(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if(i?.length===2)return i[1]}return"Other"}function ut(n=f()){return/firefox\//i.test(n)}function Ee(n=f()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function dt(n=f()){return/crios\//i.test(n)}function ht(n=f()){return/iemobile/i.test(n)}function ft(n=f()){return/android/i.test(n)}function pt(n=f()){return/blackberry/i.test(n)}function gt(n=f()){return/webos/i.test(n)}function se(n=f()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function yn(n=f()){var e;return se(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function wn(){return Gt()&&document.documentMode===10}function mt(n=f()){return se(n)||ft(n)||gt(n)||pt(n)||/windows phone/i.test(n)||ht(n)}function Tn(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
|
|
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 _t(n,e=[]){let t;switch(n){case"Browser":t=Be(f());break;case"Worker":t=`${Be(f())}-${n}`;break;default:t=n}const i=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${ne}/${i}`}/**
|
|
362
|
+
* @license
|
|
363
|
+
* Copyright 2022 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
|
+
*/class En{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const i=s=>new Promise((o,c)=>{try{const a=e(s);o(a)}catch(a){c(a)}});i.onAbort=t,this.queue.push(i);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){var t;if(this.auth.currentUser===e)return;const i=[];try{for(const r of this.queue)await r(e),r.onAbort&&i.push(r.onAbort)}catch(r){i.reverse();for(const s of i)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:(t=r)===null||t===void 0?void 0:t.message})}}}/**
|
|
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
|
+
*/class kn{constructor(e,t,i){this.app=e,this.heartbeatServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ke(this),this.idTokenSubscription=new Ke(this),this.beforeStateQueue=new En(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=rt,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=I(t)),this._initializationPromise=this.queue(async()=>{var i,r;if(!this._deleted&&(this.persistenceManager=await P.create(this,e),!this._deleted)){if(!((i=this._popupRedirectResolver)===null||i===void 0)&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((r=this.currentUser)===null||r===void 0?void 0:r.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 i=await this.assertedPersistence.getCurrentUser();let r=i,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=r?._redirectEventId,a=await this.tryRedirectSignIn(e);(!o||o===c)&&a?.user&&(r=a.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return l(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}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){var t;try{await Q(e)}catch(i){if(((t=i)===null||t===void 0?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=on()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?V(e):null;return t&&l(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&&l(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(I(e))})}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new _e("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}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 i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&I(e)||this._popupRedirectResolver;l(t,this,"argument-error"),this.redirectPersistenceManager=await P.create(this,[I(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,i;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((i=this.redirectUser)===null||i===void 0?void 0:i._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 i=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==i&&(this.lastNotifiedUid=i,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,i,r){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t),o=this._isInitialized?Promise.resolve():this._initializationPromise;return l(o,this,"internal-error"),o.then(()=>s(this.currentUser)),typeof t=="function"?e.addObserver(t,i,r):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 l(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=_t(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 i=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());return i&&(t["X-Firebase-Client"]=i),t}}function ke(n){return V(n)}class Ke{constructor(e){this.auth=e,this.observer=null,this.addObserver=Kt(t=>this.observer=t)}get next(){return l(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
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
|
+
*/class Re{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return v("not implemented")}_getIdTokenResponse(e){return v("not implemented")}_linkToIdToken(e,t){return v("not implemented")}_getReauthenticationResolver(e){return v("not implemented")}}async function Rn(n,e){return H(n,"POST","/v1/accounts:update",e)}/**
|
|
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
|
+
*/async function Sn(n,e){return re(n,"POST","/v1/accounts:signInWithPassword",ie(n,e))}/**
|
|
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
|
+
*/async function bn(n,e){return re(n,"POST","/v1/accounts:signInWithEmailLink",ie(n,e))}async function An(n,e){return re(n,"POST","/v1/accounts:signInWithEmailLink",ie(n,e))}/**
|
|
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
|
+
*/class x extends Re{constructor(e,t,i,r=null){super("password",i),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new x(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new x(e,t,"emailLink",i)}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 Sn(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return bn(e,{email:this._email,oobCode:this._password});default:p(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Rn(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return An(e,{idToken:t,email:this._email,oobCode:this._password});default:p(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
|
|
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
|
+
*/async function O(n,e){return re(n,"POST","/v1/accounts:signInWithIdp",ie(n,e))}/**
|
|
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 Pn="http://localhost";class b extends Re{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new b(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):p("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:i,signInMethod:r}=t,s=Ie(t,["providerId","signInMethod"]);if(!i||!r)return null;const o=new b(i,r);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 O(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,O(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,O(e,t)}buildRequest(){const e={requestUri:Pn,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=W(t)}return e}}/**
|
|
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
|
+
*/function On(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 Nn(n){const e=L(M(n)).link,t=e?L(M(e)).deep_link_id:null,i=L(M(n)).deep_link_id;return(i?L(M(i)).link:null)||i||t||e||n}class Se{constructor(e){var t,i,r,s,o,c;const a=L(M(e)),u=(t=a.apiKey)!==null&&t!==void 0?t:null,d=(i=a.oobCode)!==null&&i!==void 0?i:null,h=On((r=a.mode)!==null&&r!==void 0?r:null);l(u&&d&&h,"argument-error"),this.apiKey=u,this.operation=h,this.code=d,this.continueUrl=(s=a.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=a.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(c=a.tenantId)!==null&&c!==void 0?c:null}static parseLink(e){const t=Nn(e);try{return new Se(t)}catch{return null}}}/**
|
|
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
|
+
*/class C{constructor(){this.providerId=C.PROVIDER_ID}static credential(e,t){return x._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const i=Se.parseLink(t);return l(i,"argument-error"),x._fromEmailAndCode(e,i.code,i.tenantId)}}C.PROVIDER_ID="password";C.EMAIL_PASSWORD_SIGN_IN_METHOD="password";C.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
|
|
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
|
+
*/class vt{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}}/**
|
|
527
|
+
* @license
|
|
528
|
+
* Copyright 2019 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
|
+
*/class q extends vt{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
|
|
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 T extends q{constructor(){super("facebook.com")}static credential(e){return b._fromParams({providerId:T.PROVIDER_ID,signInMethod:T.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return T.credentialFromTaggedObject(e)}static credentialFromError(e){return T.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return T.credential(e.oauthAccessToken)}catch{return null}}}T.FACEBOOK_SIGN_IN_METHOD="facebook.com";T.PROVIDER_ID="facebook.com";/**
|
|
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 E extends q{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return b._fromParams({providerId:E.PROVIDER_ID,signInMethod:E.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return E.credentialFromTaggedObject(e)}static credentialFromError(e){return E.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return E.credential(t,i)}catch{return null}}}E.GOOGLE_SIGN_IN_METHOD="google.com";E.PROVIDER_ID="google.com";/**
|
|
572
|
+
* @license
|
|
573
|
+
* Copyright 2020 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
|
+
*/class k extends q{constructor(){super("github.com")}static credential(e){return b._fromParams({providerId:k.PROVIDER_ID,signInMethod:k.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return k.credentialFromTaggedObject(e)}static credentialFromError(e){return k.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return k.credential(e.oauthAccessToken)}catch{return null}}}k.GITHUB_SIGN_IN_METHOD="github.com";k.PROVIDER_ID="github.com";/**
|
|
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
|
+
*/class R extends q{constructor(){super("twitter.com")}static credential(e,t){return b._fromParams({providerId:R.PROVIDER_ID,signInMethod:R.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return R.credentialFromTaggedObject(e)}static credentialFromError(e){return R.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return R.credential(t,i)}catch{return null}}}R.TWITTER_SIGN_IN_METHOD="twitter.com";R.PROVIDER_ID="twitter.com";/**
|
|
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 N{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,i,r=!1){const s=await S._fromIdTokenResponse(e,i,r),o=Ge(i);return new N({user:s,providerId:o,_tokenResponse:i,operationType:t})}static async _forOperation(e,t,i){await e._updateTokensIfNecessary(i,!0);const r=Ge(i);return new N({user:e,providerId:r,_tokenResponse:i,operationType:t})}}function Ge(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
|
|
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
|
+
*/class Z extends ve{constructor(e,t,i,r){var s;super(t.code,t.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,Z.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,r){return new Z(e,t,i,r)}}function It(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Z._fromErrorAndOperation(n,s,e,i):s})}async function Cn(n,e,t=!1){const i=await U(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return N._forOperation(n,"link",i)}/**
|
|
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
|
+
*/async function Ln(n,e,t=!1){var i;const{auth:r}=n,s="reauthenticate";try{const o=await U(n,It(r,s,e,n),t);l(o.idToken,r,"internal-error");const c=Te(o.idToken);l(c,r,"internal-error");const{sub:a}=c;return l(n.uid===a,r,"user-mismatch"),N._forOperation(n,s,o)}catch(o){throw((i=o)===null||i===void 0?void 0:i.code)==="auth/user-not-found"&&p(r,"user-mismatch"),o}}/**
|
|
647
|
+
* @license
|
|
648
|
+
* Copyright 2020 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
|
+
*/async function yt(n,e,t=!1){const i="signIn",r=await It(n,i,e),s=await N._fromIdTokenResponse(n,i,r);return t||await n._updateCurrentUser(s.user),s}async function Mn(n,e){return yt(ke(n),e)}function Dn(n,e,t){return Mn(V(n),C.credential(e,t))}const ee="__sak";/**
|
|
662
|
+
* @license
|
|
663
|
+
* Copyright 2019 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
|
+
*/class wt{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(ee,"1"),this.storage.removeItem(ee),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()}}/**
|
|
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 Un(){const n=f();return Ee(n)||se(n)}const Fn=1e3,xn=10;class Tt extends wt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=Un()&&Tn(),this.fallbackToPolling=mt(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const i=this.storage.getItem(t),r=this.localCache[t];i!==r&&e(t,r,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,c,a)=>{this.notifyListeners(o,a)});return}const i=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(i);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(i,e.newValue):this.storage.removeItem(i);else if(this.localCache[i]===e.newValue&&!t)return}const r=()=>{const o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},s=this.storage.getItem(i);wn()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,xn):r()}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},Fn)}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]}}Tt.type="LOCAL";const Vn=Tt;/**
|
|
692
|
+
* @license
|
|
693
|
+
* Copyright 2020 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 Et extends wt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Et.type="SESSION";const kt=Et;/**
|
|
707
|
+
* @license
|
|
708
|
+
* Copyright 2019 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
|
+
*/function Wn(n){return Promise.all(n.map(async e=>{try{const t=await e;return{fulfilled:!0,value:t}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
|
|
722
|
+
* @license
|
|
723
|
+
* Copyright 2019 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 oe{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(r=>r.isListeningto(e));if(t)return t;const i=new oe(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:i,eventType:r,data:s}=t.data,o=this.handlersMap[r];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:r});const c=Array.from(o).map(async u=>u(t.origin,s)),a=await Wn(c);t.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:a})}_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)}}oe.receivers=[];/**
|
|
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
|
+
*/function be(n="",e=10){let t="";for(let i=0;i<e;i++)t+=Math.floor(Math.random()*10);return n+t}/**
|
|
752
|
+
* @license
|
|
753
|
+
* Copyright 2019 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
|
+
*/class jn{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,i=50){const r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,o;return new Promise((c,a)=>{const u=be("",20);r.port1.start();const d=setTimeout(()=>{a(new Error("unsupported_event"))},i);o={messageChannel:r,onMessage(h){const _=h;if(_.data.eventId===u)switch(_.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(_.data.response);break;default:clearTimeout(d),clearTimeout(s),a(new Error("invalid_response"));break}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:t},[r.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
|
|
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
|
+
*/function m(){return window}function Hn(n){m().location.href=n}/**
|
|
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
|
+
*/function Rt(){return typeof m().WorkerGlobalScope<"u"&&typeof m().importScripts=="function"}async function qn(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function zn(){var n;return((n=navigator?.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Bn(){return Rt()?self:null}/**
|
|
797
|
+
* @license
|
|
798
|
+
* Copyright 2019 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 St="firebaseLocalStorageDb",Kn=1,te="firebaseLocalStorage",bt="fbase_key";class z{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 ae(n,e){return n.transaction([te],e?"readwrite":"readonly").objectStore(te)}function Gn(){const n=indexedDB.deleteDatabase(St);return new z(n).toPromise()}function me(){const n=indexedDB.open(St,Kn);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const i=n.result;try{i.createObjectStore(te,{keyPath:bt})}catch(r){t(r)}}),n.addEventListener("success",async()=>{const i=n.result;i.objectStoreNames.contains(te)?e(i):(i.close(),await Gn(),e(await me()))})})}async function $e(n,e,t){const i=ae(n,!0).put({[bt]:e,value:t});return new z(i).toPromise()}async function $n(n,e){const t=ae(n,!1).get(e),i=await new z(t).toPromise();return i===void 0?null:i.value}function Je(n,e){const t=ae(n,!0).delete(e);return new z(t).toPromise()}const Jn=800,Yn=3;class At{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 me(),this.db)}async _withRetries(e){let t=0;for(;;)try{const i=await this._openDb();return await e(i)}catch(i){if(t++>Yn)throw i;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Rt()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=oe._getInstance(Bn()),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 qn(),!this.activeServiceWorker)return;this.sender=new jn(this.activeServiceWorker);const i=await this.sender._send("ping",{},800);!i||((e=i[0])===null||e===void 0?void 0:e.fulfilled)&&((t=i[0])===null||t===void 0?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||zn()!==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 me();return await $e(e,ee,"1"),await Je(e,ee),!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(i=>$e(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(i=>$n(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Je(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(r=>{const s=ae(r,!1).getAll();return new z(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],i=new Set;for(const{fbase_key:r,value:s}of e)i.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const r of Object.keys(this.localCache))this.localCache[r]&&!i.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Jn)}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()}}At.type="LOCAL";const Xn=At;/**
|
|
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 Qn(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}function Zn(n){return new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=r=>{const s=g("internal-error");s.customData=r,t(s)},i.type="text/javascript",i.charset="UTF-8",Qn().appendChild(i)})}function ei(n){return`__${n}${Math.floor(Math.random()*1e6)}`}new j(3e4,6e4);/**
|
|
827
|
+
* @license
|
|
828
|
+
* Copyright 2021 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
|
+
*/function ti(n,e){return e?I(e):(l(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
|
|
842
|
+
* @license
|
|
843
|
+
* Copyright 2019 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 Ae extends Re{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return O(e,this._buildIdpRequest())}_linkToIdToken(e,t){return O(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return O(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 ni(n){return yt(n.auth,new Ae(n),n.bypassAuthState)}function ii(n){const{auth:e,user:t}=n;return l(t,e,"internal-error"),Ln(t,new Ae(n),n.bypassAuthState)}async function ri(n){const{auth:e,user:t}=n;return l(t,e,"internal-error"),Cn(t,new Ae(n),n.bypassAuthState)}/**
|
|
857
|
+
* @license
|
|
858
|
+
* Copyright 2020 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 Pt{constructor(e,t,i,r,s=!1){this.auth=e,this.resolver=i,this.user=r,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(i){this.reject(i)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:i,postBody:r,tenantId:s,error:o,type:c}=e;if(o){this.reject(o);return}const a={auth:this.auth,requestUri:t,sessionId:i,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(a))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ni;case"linkViaPopup":case"linkViaRedirect":return ri;case"reauthViaPopup":case"reauthViaRedirect":return ii;default:p(this.auth,"internal-error")}}resolve(e){y(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){y(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()}}/**
|
|
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
|
+
*/const si=new j(2e3,1e4);class A extends Pt{constructor(e,t,i,r,s){super(e,t,r,s),this.provider=i,this.authWindow=null,this.pollId=null,A.currentPopupAction&&A.currentPopupAction.cancel(),A.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return l(e,this.auth,"internal-error"),e}async onExecution(){y(this.filter.length===1,"Popup operations only handle one event");const e=be();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(g(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(g(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,A.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,i;if(!((i=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||i===void 0)&&i.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(g(this.auth,"popup-closed-by-user"))},2e3);return}this.pollId=window.setTimeout(e,si.get())};e()}}A.currentPopupAction=null;/**
|
|
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
|
+
*/const oi="pendingRedirect",Y=new Map;class ai extends Pt{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=Y.get(this.auth._key());if(!e){try{const i=await ci(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}Y.set(this.auth._key(),e)}return this.bypassAuthState||Y.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 ci(n,e){const t=di(e),i=ui(n);if(!await i._isAvailable())return!1;const r=await i._get(t)==="true";return await i._remove(t),r}function li(n,e){Y.set(n._key(),e)}function ui(n){return I(n._redirectPersistence)}function di(n){return J(oi,n.config.apiKey,n.name)}async function hi(n,e,t=!1){const i=ke(n),r=ti(i,e),o=await new ai(i,r,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}/**
|
|
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
|
+
*/const fi=10*60*1e3;class pi{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(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!gi(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var i;if(e.error&&!Ot(e)){const r=((i=e.error.code)===null||i===void 0?void 0:i.split("auth/")[1])||"internal-error";t.onError(g(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=fi&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ye(e))}saveEventToCache(e){this.cachedEventUids.add(Ye(e)),this.lastProcessedEventTime=Date.now()}}function Ye(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Ot({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function gi(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ot(n);default:return!1}}/**
|
|
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
|
+
*/async function mi(n,e={}){return H(n,"GET","/v1/projects",e)}/**
|
|
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
|
+
*/const _i=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,vi=/^https?/;async function Ii(n){if(n.config.emulator)return;const{authorizedDomains:e}=await mi(n);for(const t of e)try{if(yi(t))return}catch{}p(n,"unauthorized-domain")}function yi(n){const e=ge(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!vi.test(t))return!1;if(_i.test(n))return i===n;const r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}/**
|
|
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
|
+
*/const wi=new j(3e4,6e4);function Xe(){const n=m().___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 Ti(n){return new Promise((e,t)=>{var i,r,s;function o(){Xe(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Xe(),t(g(n,"network-request-failed"))},timeout:wi.get()})}if(!((r=(i=m().gapi)===null||i===void 0?void 0:i.iframes)===null||r===void 0)&&r.Iframe)e(gapi.iframes.getContext());else if(!((s=m().gapi)===null||s===void 0)&&s.load)o();else{const c=ei("iframefcb");return m()[c]=()=>{gapi.load?o():t(g(n,"network-request-failed"))},Zn(`https://apis.google.com/js/api.js?onload=${c}`).catch(a=>t(a))}}).catch(e=>{throw X=null,e})}let X=null;function Ei(n){return X=X||Ti(n),X}/**
|
|
962
|
+
* @license
|
|
963
|
+
* Copyright 2020 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
|
+
*/const ki=new j(5e3,15e3),Ri="__/auth/iframe",Si="emulator/auth/iframe",bi={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ai=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Pi(n){const e=n.config;l(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?we(e,Si):`https://${n.config.authDomain}/${Ri}`,i={apiKey:e.apiKey,appName:n.name,v:ne},r=Ai.get(n.config.apiHost);r&&(i.eid=r);const s=n._getFrameworks();return s.length&&(i.fw=s.join(",")),`${t}?${W(i).slice(1)}`}async function Oi(n){const e=await Ei(n),t=m().gapi;return l(t,n,"internal-error"),e.open({where:document.body,url:Pi(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:bi,dontclear:!0},i=>new Promise(async(r,s)=>{await i.restyle({setHideOnLeave:!1});const o=g(n,"network-request-failed"),c=m().setTimeout(()=>{s(o)},ki.get());function a(){m().clearTimeout(c),r(i)}i.ping(a).then(a,()=>{s(o)})}))}/**
|
|
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
|
+
*/const Ni={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Ci=500,Li=600,Mi="_blank",Di="http://localhost";class Qe{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Ui(n,e,t,i=Ci,r=Li){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let c="";const a=Object.assign(Object.assign({},Ni),{width:i.toString(),height:r.toString(),top:s,left:o}),u=f().toLowerCase();t&&(c=dt(u)?Mi:t),ut(u)&&(e=e||Di,a.scrollbars="yes");const d=Object.entries(a).reduce((_,[B,K])=>`${_}${B}=${K},`,"");if(yn(u)&&c!=="_self")return Fi(e||"",c),new Qe(null);const h=window.open(e||"",c,d);l(h,n,"popup-blocked");try{h.focus()}catch{}return new Qe(h)}function Fi(n,e){const t=document.createElement("a");t.href=n,t.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}/**
|
|
992
|
+
* @license
|
|
993
|
+
* Copyright 2021 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
|
+
*/const xi="__/auth/handler",Vi="emulator/auth/handler";function Ze(n,e,t,i,r,s){l(n.config.authDomain,n,"auth-domain-config-required"),l(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:ne,eventId:r};if(e instanceof vt){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Jt(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[a,u]of Object.entries(s||{}))o[a]=u}if(e instanceof q){const a=e.getScopes().filter(u=>u!=="");a.length>0&&(o.scopes=a.join(","))}n.tenantId&&(o.tid=n.tenantId);const c=o;for(const a of Object.keys(c))c[a]===void 0&&delete c[a];return`${Wi(n)}?${W(c).slice(1)}`}function Wi({config:n}){return n.emulator?we(n,Vi):`https://${n.authDomain}/${xi}`}/**
|
|
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
|
+
*/const pe="webStorageSupport";class ji{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=kt,this._completeRedirectFn=hi,this._overrideRedirectResult=li}async _openPopup(e,t,i,r){var s;y((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=Ze(e,t,i,ge(),r);return Ui(e,o,be())}async _openRedirect(e,t,i,r){return await this._originValidation(e),Hn(Ze(e,t,i,ge(),r)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:r,promise:s}=this.eventManagers[t];return r?Promise.resolve(r):(y(s,"If manager is not set, promise should be"),s)}const i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){const t=await Oi(e),i=new pi(e);return t.register("authEvent",r=>(l(r?.authEvent,e,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(pe,{type:pe},r=>{var s;const o=(s=r?.[0])===null||s===void 0?void 0:s[pe];o!==void 0&&t(!!o),p(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Ii(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return mt()||Ee()||se()}}const Hi=ji;var et="@firebase/auth",tt="0.20.7";/**
|
|
1022
|
+
* @license
|
|
1023
|
+
* Copyright 2020 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 qi{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(i=>{var r;e(((r=i)===null||r===void 0?void 0: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(){l(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
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 zi(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}function Bi(n){xe(new Ve("auth",(e,{options:t})=>{const i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),{apiKey:s,authDomain:o}=i.options;return((c,a)=>{l(s&&!s.includes(":"),"invalid-api-key",{appName:c.name}),l(!o?.includes(":"),"argument-error",{appName:c.name});const u={apiKey:s,authDomain:o,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:_t(n)},d=new kn(c,a,u);return nn(d,t),d})(i,r)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),xe(new Ve("auth-internal",e=>{const t=ke(e.getProvider("auth").getImmediate());return(i=>new qi(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),We(et,tt,zi(n)),We(et,tt,"esm2017")}/**
|
|
1052
|
+
* @license
|
|
1053
|
+
* Copyright 2021 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
|
+
*/function Ki(n=Wt()){const e=nt(n,"auth");return e.isInitialized()?e.getImmediate():tn(n,{popupRedirectResolver:Hi,persistence:[Xn,Vn,kt]})}Bi("Browser");const Gi=["onSubmit"],$i={type:"submit",class:"btn btn-block btn-primary"},er=Lt({__name:"LoginForm",setup(n){const e=Ki(),t=De(""),i=De(""),r=()=>{Dn(e,t.value,i.value).then(s=>{const{user:o}=s;console.log(o)}).catch(s=>{console.warn(s.code),console.error(s)})};return(s,o)=>(xt(),Mt("form",{onSubmit:Ft(r,["prevent"])},[Ue(he("input",{ref:"input",type:"email",placeholder:"email@mail.com","onUpdate:modelValue":o[0]||(o[0]=c=>t.value=c),required:""},null,512),[[Fe,t.value]]),Ue(he("input",{ref:"input",type:"password",placeholder:"***","onUpdate:modelValue":o[1]||(o[1]=c=>i.value=c),required:""},null,512),[[Fe,i.value]]),he("button",$i,Dt(Ut(Xt)),1)],40,Gi))}});export{er as default};
|