PageSourceSearch

https://fictionme.net/n_assets/CfIdR-PO.js

js fictionme.net collected 2026-09-24 19:23:31 UTC 156,747 bytes, 1,395 lines download raw bytes

1const wn=()=>{};var tt={};/**
2 * @license
3 * Copyright 2017 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *   http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */const Pt=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},bn=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=n[t++],o=n[t++],a=n[t++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const s=n[t++],o=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},Rt={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<n.length;i+=3){const s=n[i],o=i+1<n.length,a=o?n[i+1]:0,c=i+2<n.length,l=c?n[i+2]:0,d=s>>2,p=(s&3)<<4|a>>4;let u=(a&15)<<2|l>>6,m=l&63;c||(m=64,o||(u=64)),r.push(t[d],t[p],t[u],t[m])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Pt(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):bn(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){const s=t[n.charAt(i++)],a=i<n.length?t[n.charAt(i)]:0;++i;const l=i<n.length?t[n.charAt(i)]:64;++i;const p=i<n.length?t[n.charAt(i)]:64;if(++i,s==null||a==null||l==null||p==null)throw new En;const u=s<<2|a>>4;if(r.push(u),l!==64){const m=a<<4&240|l>>2;if(r.push(m),p!==64){const _=l<<6&192|p;r.push(_)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};
16class En extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const vn=function(n){const e=Pt(n);return Rt.encodeByteArray(e,!0)},Ot=function(n){return vn(n).replace(/\./g,"")},Dt=function(n){try{return Rt.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
17 * @license
18 * Copyright 2022 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 Tn(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
32 * @license
33 * Copyright 2022 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 Sn=()=>Tn().__FIREBASE_DEFAULTS__,Cn=()=>{if(typeof process>"u"||typeof tt>"u")return;const n=tt.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},An=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&Dt(n[1]);return e&&JSON.parse(e)},We=()=>{try{return wn()||Sn()||Cn()||An()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},kn=n=>We()?.emulatorHosts?.[n],Nt=()=>We()?.config,Lt=n=>We()?.[`_${n}`];
46/**
47 * @license
48 * Copyright 2017 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 */class Pn{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
62 * @license
63 * Copyright 2025 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 Ee(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Rn(n){return(await fetch(n,{credentials:"include"})).ok}const Z={};function On(){const n={prod:[],emulator:[]};for(const e of Object.keys(Z))Z[e]?n.emulator.push(e):n.prod.push(e);return n}function Dn(n){let e=document.getElementById(n),t=!1;return e||(e=document.createElement("div"),e.setAttribute("id",n),t=!0),{created:t,element:e}}let nt=!1;function Nn(n,e){if(typeof window>"u"||typeof document>"u"||!Ee(window.location.host)||Z[n]===e||Z[n]||nt)return;Z[n]=e;function t(u){return`__firebase__banner__${u}`}const r="__firebase__banner",s=On().prod.length>0;function o(){const u=document.getElementById(r);u&&u.remove()}function a(u){u.style.display="flex",u.style.background="#7faaf0",u.style.position="fixed",u.style.bottom="5px",u.style.left="5px",u.style.padding=".5em",u.style.borderRadius="5px",u.style.alignItems="center"}function c(u,m){u.setAttribute("width","24"),u.setAttribute("id",m),u.setAttribute("height","24"),u.setAttribute("viewBox","0 0 24 24"),u.setAttribute("fill","none"),u.style.marginLeft="-6px"}function l(){const u=document.createElement("span");return u.style.cursor="pointer",u.style.marginLeft="16px",u.style.fontSize="24px",u.innerHTML=" &times;",u.onclick=()=>{nt=!0,o()},u}function d(u,m){u.setAttribute("id",m),u.innerText="Learn more",u.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",u.setAttribute("target","__blank"),u.style.paddingLeft="5px",u.style.textDecoration="underline"}function p(){const u=Dn(r),m=t("text"),_=document.getElementById(m)||document.createElement("span"),X=t("learnmore"),le=document.getElementById(X)||document.createElement("a"),F=t("preprendIcon"),H=document.getElementById(F)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(u.created){const Ce=u.element;a(Ce),d(le,X);const yn=l();c(H,F),Ce.append(H,_,le,yn),document.body.appendChild(Ce)}s?(_.innerText="Preview backend disconnected.",H.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
77<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
78</g>
79<defs>
80<clipPath id="clip0_6013_33858">
81<rect width="24" height="24" fill="white"/>
82</clipPath>
83</defs>`):(H.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
84<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 
8412.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
85</g>
86<defs>
87<clipPath id="clip0_6083_34804">
88<rect width="24" height="24" fill="white"/>
89</clipPath>
90</defs>`,_.innerText="Preview backend running in this workspace."),_.setAttribute("id",m)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",p):p()}/**
91 * @license
92 * Copyright 2017 Google LLC
93 *
94 * Licensed under the Apache License, Version 2.0 (the "License");
95 * you may not use this file except in compliance with the License.
96 * You may obtain a copy of the License at
97 *
98 *   http://www.apache.org/licenses/LICENSE-2.0
99 *
100 * Unless required by applicable law or agreed to in writing, software
101 * distributed under the License is distributed on an "AS IS" BASIS,
102 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
103 * See the License for the specific language governing permissions and
104 * limitations under the License.
105 */function g(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Ln(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(g())}function Mn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Un(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function xn(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Bn(){const n=g();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Fn(){try{return typeof indexedDB=="object"}catch{return!1}}function Hn(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(t){e(t)}})}/**
106 * @license
107 * Copyright 2017 Google LLC
108 *
109 * Licensed under the Apache License, Version 2.0 (the "License");
110 * you may not use this file except in compliance with the License.
111 * You may obtain a copy of the License at
112 *
113 *   http://www.apache.org/licenses/LICENSE-2.0
114 *
115 * Unless required by applicable law or agreed to in writing, software
116 * distributed under the License is distributed on an "AS IS" BASIS,
117 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118 * See the License for the specific language governing permissions and
119 * limitations under the License.
120 */const $n="FirebaseError";class M extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=$n,Object.setPrototypeOf(this,M.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ie.prototype.create)}}class ie{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Vn(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new M(i,a,r)}}function Vn(n,e){return n.replace(Wn,(t,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const Wn=/\{\$([^}]+)}/g;function jn(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function z(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const i of t){if(!r.includes(i))return!1;const s=n[i],o=e[i];if(rt(s)&&rt(o)){if(!z(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!t.includes(i))return!1;return!0}function rt(n){return n!==null&&typeof n=="object"}/**
121 * @license
122 * Copyright 2017 Google LLC
123 *
124 * Licensed under the Apache License, Version 2.0 (the "License");
125 * you may not use this file except in compliance with the License.
126 * You may obtain a copy of the License at
127 *
128 *   http://www.apache.org/licenses/LICENSE-2.0
129 *
130 * Unless required by applicable law or agreed to in writing, software
131 * distributed under the License is distributed on an "AS IS" BASIS,
132 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133 * See the License for the specific language governing permissions and
134 * limitations under the License.
135 */function se(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function zn(n,e){const t=new Gn(n,e);return t.subscribe.bind(t)}class Gn{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");qn(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=Ae),i.error===void 0&&(i.error=Ae),i.complete===void 0&&(i.complete=Ae);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function qn(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Ae(){}/**
136 * @license
137 * Copyright 2021 Google LLC
138 *
139 * Licensed under the Apache License, Version 2.0 (the "License");
140 * you may not use this file except in compliance with the License.
141 * You may obtain a copy of the License at
142 *
143 *   http://www.apache.org/licenses/LICENSE-2.0
144 *
145 * Unless required by applicable law or agreed to in writing, software
146 * distributed under the License is distributed on an "AS IS" BASIS,
147 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
148 * See the License for the specific language governing permissions and
149 * limitations under the License.
150 */function K(n){return n&&n._delegate?n._delegate:n}class G{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
151 * @license
152 * Copyright 2019 Google LLC
153 *
154 * Licensed under the Apache License, Version 2.0 (the "License");
155 * you may not use this file except in compliance with the License.
156 * You may obtain a copy of the License at
157 *
158 *   http://www.apache.org/licenses/LICENSE-2.0
159 *
160 * Unless required by applicable law or agreed to in writing, software
161 * distributed under the License is distributed on an "AS IS" BASIS,
162 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163 * See the License for the specific language governing permissions and
164 * limitations under the License.
165 */const U="[DEFAULT]";/**
166 * @license
167 * Copyright 2019 Google LLC
168 *
169 * Licensed under the Apache License, Version 2.0 (the "License");
170 * you may not use this file except in compliance with the License.
171 * You may obtain a copy of the License at
172 *
173 *   http://www.apache.org/licenses/LICENSE-2.0
174 *
175 * Unless required by applicable law or agreed to in writing, software
176 * distributed under the License is distributed on an "AS IS" BASIS,
177 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
178 * See the License for the specific language governing permissions and
179 * limitations under the License.
180 */class Kn{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new Pn;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Yn(e))try{this.getOrInitializeService({instanceIdentifier:U})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(t);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=U){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=U){return this.instances.has(e)}getOptions(e=U){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,t){const r=this.normalizeInstanceIdentifier(t),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const i of r)try{i(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Jn(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=U){return this.component?this.component.multipleInstances?e:U:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Jn(n){return n===U?void 0:n}function Yn(n){return n.instantiationMode==="EAGER"}/**
181 * @license
182 * Copyright 2019 Google LLC
183 *
184 * Licensed under the Apache License, Version 2.0 (the "License");
185 * you may not use this file except in compliance with the License.
186 * You may obtain a copy of the License at
187 *
188 *   http://www.apache.org/licenses/LICENSE-2.0
189 *
190 * Unless required by applicable law or agreed to in writing, softw
190are
191 * distributed under the License is distributed on an "AS IS" BASIS,
192 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193 * See the License for the specific language governing permissions and
194 * limitations under the License.
195 */class Xn{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new Kn(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
196 * @license
197 * Copyright 2017 Google LLC
198 *
199 * Licensed under the Apache License, Version 2.0 (the "License");
200 * you may not use this file except in compliance with the License.
201 * You may obtain a copy of the License at
202 *
203 *   http://www.apache.org/licenses/LICENSE-2.0
204 *
205 * Unless required by applicable law or agreed to in writing, software
206 * distributed under the License is distributed on an "AS IS" BASIS,
207 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208 * See the License for the specific language governing permissions and
209 * limitations under the License.
210 */var f;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(f||(f={}));const Zn={debug:f.DEBUG,verbose:f.VERBOSE,info:f.INFO,warn:f.WARN,error:f.ERROR,silent:f.SILENT},Qn=f.INFO,er={[f.DEBUG]:"log",[f.VERBOSE]:"log",[f.INFO]:"info",[f.WARN]:"warn",[f.ERROR]:"error"},tr=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),i=er[e];if(i)console[i](`[${r}]  ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Mt{constructor(e){this.name=e,this._logLevel=Qn,this._logHandler=tr,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in f))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Zn[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,f.DEBUG,...e),this._logHandler(this,f.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,f.VERBOSE,...e),this._logHandler(this,f.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,f.INFO,...e),this._logHandler(this,f.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,f.WARN,...e),this._logHandler(this,f.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,f.ERROR,...e),this._logHandler(this,f.ERROR,...e)}}const nr=(n,e)=>e.some(t=>n instanceof t);let it,st;function rr(){return it||(it=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ir(){return st||(st=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ut=new WeakMap,Me=new WeakMap,xt=new WeakMap,ke=new WeakMap,je=new WeakMap;function sr(n){const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(N(n.result)),i()},o=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ut.set(t,n)}).catch(()=>{}),je.set(e,n),e}function or(n){if(Me.has(n))return;const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),i()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});Me.set(n,e)}let Ue={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Me.get(n);if(e==="objectStoreNames")return n.objectStoreNames||xt.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return N(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function ar(n){Ue=n(Ue)}
210function cr(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Pe(this),e,...t);return xt.set(r,e.sort?e.sort():[e]),N(r)}:ir().includes(n)?function(...e){return n.apply(Pe(this),e),N(Ut.get(this))}:function(...e){return N(n.apply(Pe(this),e))}}function lr(n){return typeof n=="function"?cr(n):(n instanceof IDBTransaction&&or(n),nr(n,rr())?new Proxy(n,Ue):n)}function N(n){if(n instanceof IDBRequest)return sr(n);if(ke.has(n))return ke.get(n);const e=lr(n);return e!==n&&(ke.set(n,e),je.set(e,n)),e}const Pe=n=>je.get(n);function ur(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(n,e),a=N(o);return r&&o.addEventListener("upgradeneeded",c=>{r(N(o.result),c.oldVersion,c.newVersion,N(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const hr=["get","getKey","getAll","getAllKeys","count"],dr=["put","add","delete","clear"],Re=new Map;function ot(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Re.get(e))return Re.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,i=dr.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||hr.includes(t)))return;const s=async function(o,...a){const c=this.transaction(o,i?"readwrite":"readonly");let l=c.store;return r&&(l=l.index(a.shift())),(await Promise.all([l[t](...a),i&&c.done]))[0]};return Re.set(e,s),s}ar(n=>({...n,get:(e,t,r)=>ot(e,t)||n.get(e,t,r),has:(e,t)=>!!ot(e,t)||n.has(e,t)}));/**
211 * @license
212 * Copyright 2019 Google LLC
213 *
214 * Licensed under the Apache License, Version 2.0 (the "License");
215 * you may not use this file except in compliance with the License.
216 * You may obtain a copy of the License at
217 *
218 *   http://www.apache.org/licenses/LICENSE-2.0
219 *
220 * Unless required by applicable law or agreed to in writing, software
221 * distributed under the License is distributed on an "AS IS" BASIS,
222 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
223 * See the License for the specific language governing permissions and
224 * limitations under the License.
225 */class fr{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(pr(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function pr(n){return n.getComponent()?.type==="VERSION"}const xe="@firebase/app",at="0.14.5";/**
226 * @license
227 * Copyright 2019 Google LLC
228 *
229 * Licensed under the Apache License, Version 2.0 (the "License");
230 * you may not use this file except in compliance with the License.
231 * You may obtain a copy of the License at
232 *
233 *   http://www.apache.org/licenses/LICENSE-2.0
234 *
235 * Unless required by applicable law or agreed to in writing, software
236 * distributed under the License is distributed on an "AS IS" BASIS,
237 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
238 * See the License for the specific language governing permissions and
239 * limitations under the License.
240 */const A=new Mt("@firebase/app"),mr="@firebase/app-compat",gr="@firebase/analytics-compat",_r="@firebase/analytics",Ir="@firebase/app-check-compat",yr="@firebase/app-check",wr="@firebase/auth",br="@firebase/auth-compat",Er="@firebase/database",vr="@firebase/data-connect",Tr="@firebase/database-compat",Sr="@firebase/functions",Cr="@firebase/functions-compat",Ar="@firebase/installations",kr="@firebase/installations-compat",Pr="@firebase/messaging",Rr="@firebase/messaging-compat",Or="@firebase/performance",Dr="@firebase/performance-compat",Nr="@firebase/remote-config",Lr="@firebase/remote-config-compat",Mr="@firebase/storage",Ur="@firebase/storage-compat",xr="@firebase/firestore",Br="@firebase/ai",Fr="@firebase/firestore-compat",Hr="firebase",$r="12.5.0";/**
241 * @license
242 * Copyright 2019 Google LLC
243 *
244 * Licensed under the Apache License, Version 2.0 (the "License");
245 * you may not use this file except in compliance with the License.
246 * You may obtain a copy of the License at
247 *
248 *   http://www.apache.org/licenses/LICENSE-2.0
249 *
250 * Unless required by applicable law or agreed to in writing, softw
250are
251 * distributed under the License is distributed on an "AS IS" BASIS,
252 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
253 * See the License for the specific language governing permissions and
254 * limitations under the License.
255 */const Be="[DEFAULT]",Vr={[xe]:"fire-core",[mr]:"fire-core-compat",[_r]:"fire-analytics",[gr]:"fire-analytics-compat",[yr]:"fire-app-check",[Ir]:"fire-app-check-compat",[wr]:"fire-auth",[br]:"fire-auth-compat",[Er]:"fire-rtdb",[vr]:"fire-data-connect",[Tr]:"fire-rtdb-compat",[Sr]:"fire-fn",[Cr]:"fire-fn-compat",[Ar]:"fire-iid",[kr]:"fire-iid-compat",[Pr]:"fire-fcm",[Rr]:"fire-fcm-compat",[Or]:"fire-perf",[Dr]:"fire-perf-compat",[Nr]:"fire-rc",[Lr]:"fire-rc-compat",[Mr]:"fire-gcs",[Ur]:"fire-gcs-compat",[xr]:"fire-fst",[Fr]:"fire-fst-compat",[Br]:"fire-vertex","fire-js":"fire-js",[Hr]:"fire-js-all"};/**
256 * @license
257 * Copyright 2019 Google LLC
258 *
259 * Licensed under the Apache License, Version 2.0 (the "License");
260 * you may not use this file except in compliance with the License.
261 * You may obtain a copy of the License at
262 *
263 *   http://www.apache.org/licenses/LICENSE-2.0
264 *
265 * Unless required by applicable law or agreed to in writing, software
266 * distributed under the License is distributed on an "AS IS" BASIS,
267 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268 * See the License for the specific language governing permissions and
269 * limitations under the License.
270 */const me=new Map,Wr=new Map,Fe=new Map;function ct(n,e){try{n.container.addComponent(e)}catch(t){A.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function te(n){const e=n.name;if(Fe.has(e))return A.debug(`There were multiple attempts to register component ${e}.`),!1;Fe.set(e,n);for(const t of me.values())ct(t,n);for(const t of Wr.values())ct(t,n);return!0}function Bt(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function w(n){return n==null?!1:n.settings!==void 0}/**
271 * @license
272 * Copyright 2019 Google LLC
273 *
274 * Licensed under the Apache License, Version 2.0 (the "License");
275 * you may not use this file except in compliance with the License.
276 * You may obtain a copy of the License at
277 *
278 *   http://www.apache.org/licenses/LICENSE-2.0
279 *
280 * Unless required by applicable law or agreed to in writing, software
281 * distributed under the License is distributed on an "AS IS" BASIS,
282 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
283 * See the License for the specific language governing permissions and
284 * limitations under the License.
285 */const jr={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
285d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},L=new ie("app","Firebase",jr);/**
286 * @license
287 * Copyright 2019 Google LLC
288 *
289 * Licensed under the Apache License, Version 2.0 (the "License");
290 * you may not use this file except in compliance with the License.
291 * You may obtain a copy of the License at
292 *
293 *   http://www.apache.org/licenses/LICENSE-2.0
294 *
295 * Unless required by applicable law or agreed to in writing, software
296 * distributed under the License is distributed on an "AS IS" BASIS,
297 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
298 * See the License for the specific language governing permissions and
299 * limitations under the License.
300 */class zr{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new G("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw L.create("app-deleted",{appName:this._name})}}/**
301 * @license
302 * Copyright 2019 Google LLC
303 *
304 * Licensed under the Apache License, Version 2.0 (the "License");
305 * you may not use this file except in compliance with the License.
306 * You may obtain a copy of the License at
307 *
308 *   http://www.apache.org/licenses/LICENSE-2.0
309 *
310 * Unless required by applicable law or agreed to in writing, software
311 * distributed under the License is distributed on an "AS IS" BASIS,
312 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313 * See the License for the specific language governing permissions and
314 * limitations under the License.
315 */const oe=$r;function Ft(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r={name:Be,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw L.create("bad-app-name",{appName:String(i)});if(t||(t=Nt()),!t)throw L.create("no-options");const s=me.get(i);if(s){if(z(t,s.options)&&z(r,s.config))return s;throw L.create("duplicate-app",{appName:i})}const o=new Xn(i);for(const c of Fe.values())o.addComponent(c);const a=new zr(t,r,o);return me.set(i,a),a}function Gr(n=Be){const e=me.get(n);if(!e&&n===Be&&Nt())return Ft();if(!e)throw L.create("no-app",{appName:n});return e}function $(n,e,t){let r=Vr[n]??n;t&&(r+=`-${t}`);const i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){const o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),A.warn(o.join(" "));return}te(new G(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
316 * @license
317 * Copyright 2021 Google LLC
318 *
319 * Licensed under the Apache License, Version 2.0 (the "License");
320 * you may not use this file except in compliance with the License.
321 * You may obtain a copy of the License at
322 *
323 *   http://www.apache.org/licenses/LICENSE-2.0
324 *
325 * Unless required by applicable law or agreed to in writing, softw
325are
326 * distributed under the License is distributed on an "AS IS" BASIS,
327 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
328 * See the License for the specific language governing permissions and
329 * limitations under the License.
330 */const qr="firebase-heartbeat-database",Kr=1,ne="firebase-heartbeat-store";let Oe=null;function Ht(){return Oe||(Oe=ur(qr,Kr,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(ne)}catch(t){console.warn(t)}}}}).catch(n=>{throw L.create("idb-open",{originalErrorMessage:n.message})})),Oe}async function Jr(n){try{const t=(await Ht()).transaction(ne),r=await t.objectStore(ne).get($t(n));return await t.done,r}catch(e){if(e instanceof M)A.warn(e.message);else{const t=L.create("idb-get",{originalErrorMessage:e?.message});A.warn(t.message)}}}async function lt(n,e){try{const r=(await Ht()).transaction(ne,"readwrite");await r.objectStore(ne).put(e,$t(n)),await r.done}catch(t){if(t instanceof M)A.warn(t.message);else{const r=L.create("idb-set",{originalErrorMessage:t?.message});A.warn(r.message)}}}function $t(n){return`${n.name}!${n.options.appId}`}/**
331 * @license
332 * Copyright 2021 Google LLC
333 *
334 * Licensed under the Apache License, Version 2.0 (the "License");
335 * you may not use this file except in compliance with the License.
336 * You may obtain a copy of the License at
337 *
338 *   http://www.apache.org/licenses/LICENSE-2.0
339 *
340 * Unless required by applicable law or agreed to in writing, software
341 * distributed under the License is distributed on an "AS IS" BASIS,
342 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
343 * See the License for the specific language governing permissions and
344 * limitations under the License.
345 */const Yr=1024,Xr=30;class Zr{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ei(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=ut();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats.length>Xr){const i=ti(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){A.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=ut(),{heartbeatsToSend:t,unsentEntries:r}=Qr(this._heartbeatsCache.heartbeats),i=Ot(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return A.warn(e),""}}}function ut(){return new Date().toISOString().substring(0,10)}function Qr(n,e=Yr){const t=[];let r=n.slice();for(const i of n){const s=t.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),ht(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),ht(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class ei{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Fn()?Hn().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await Jr(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return lt(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return lt(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function ht(n){return Ot(JSON.stringify({version:2,heartbeats:n})).length}function ti(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}/**
346 * @license
347 * Copyright 2019 Google LLC
348 *
349 * Licensed under the Apache License, Version 2.0 (the "License");
350 * you may not use this file except in compliance with the License.
351 * You may obtain a copy of the License at
352 *
353 *   http://www.apache.org/licenses/LICENSE-2.0
354 *
355 * Unless required by applicable law or agreed to in writing, software
356 * distributed under the License is distributed on an "AS IS" BASIS,
357 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
358 * See the License for the specific language governing permissions and
359 * limitations under the License.
360 */function ni(n){te(new G("platform-logger",e=>new fr(e),"PRIVATE")),te(new G("heartbeat",e=>new Zr(e),"PRIVATE")),$(xe,at,n),$(xe,at,"esm2020"),$("fire-js","")}ni("");var ri="firebase",ii="12.5.0";/**
361 * @license
362 * Copyright 2020 Google LLC
363 *
364 * Licensed under the Apache License, Version 2.0 (the "License");
365 * you may not use this file except in compliance with the License.
366 * You may obtain a copy of the License at
367 *
368 *   http://www.apache.org/licenses/LICENSE-2.0
369 *
370 * Unless required by applicable law or agreed to in writing, software
371 * distributed under the License is distributed on an "AS IS" BASIS,
372 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
373 * See the License for the specific language governing permissions and
374 * limitations under the License.
375 */$(ri,ii,"app");function Vt(){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 si=Vt,Wt=new ie("auth","Firebase",Vt());/**
376 * @license
377 * Copyright 2020 Google LLC
378 *
379 * Licensed under the Apache License, Version 2.0 (the "License");
380 * you may not use this file except in compliance with the License.
381 * You may obtain a copy of the License at
382 *
383 *   http://www.apache.org/licenses/LICENSE-2.0
384 *
385 * Unless required by applicable law or agreed to in writing, software
386 * distributed under the License is distributed on an "AS IS" BASIS,
387 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
388 * See the License for the specific language governing permissions and
389 * limitations under the License.
390 */const ge=new Mt("@firebase/auth");function oi(n,...e){ge.logLevel<=f.WARN&&ge.warn(`Auth (${oe}): ${n}`,...e)}function he(n,...e){ge.logLevel<=f.ERROR&&ge.error(`Auth (${oe}): ${n}`,...e)}/**
391 * @license
392 * Copyright 2020 Google LLC
393 *
394 * Licensed under the Apache License, Version 2.0 (the "License");
395 * you may not use this file except in compliance with the License.
396 * You may obtain a copy of the License at
397 *
398 *   http://www.apache.org/licenses/LICENSE-2.0
399 *
400 * Unless required by applicable law or agreed to in writing, software
401 * distributed under the License is distributed on an "AS IS" BASIS,
402 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
403 * See the License for the specific language governing permissions and
404 * limitations under the License.
405 */function E(n,...e){throw Ge(n,...e)}function y(n,...e){return Ge(n,...e)}function ze(n,e,t){const r={...si(),[e]:t};return new ie("auth","Firebase",r).create(e,{appName:n.name})}function B(n){return ze(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ai(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&E(n,"argument-error"),ze(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ge(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return Wt.create(n,...e)}function h(n,e,...t){if(!n)throw Ge(e,...t)}function S(n){const e="INTERNAL ASSERTION FAILED: "+n;throw he(e),new Error(e)}function k(n,e){n||S(e)}/**
406 * @license
407 * Copyright 2020 Google LLC
408 *
409 * Licensed under the Apache License, Version 2.0 (the "License");
410 * you may not use this file except in compliance with the License.
411 * You may obtain a copy of the License at
412 *
413 *   http://www.apache.org/licenses/LICENSE-2.0
414 *
415 * Unless required by applicable law or agreed to in writing, softw
415are
416 * distributed under the License is distributed on an "AS IS" BASIS,
417 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
418 * See the License for the specific language governing permissions and
419 * limitations under the License.
420 */function He(){return typeof self<"u"&&self.location?.href||""}function ci(){return dt()==="http:"||dt()==="https:"}function dt(){return typeof self<"u"&&self.location?.protocol||null}/**
421 * @license
422 * Copyright 2020 Google LLC
423 *
424 * Licensed under the Apache License, Version 2.0 (the "License");
425 * you may not use this file except in compliance with the License.
426 * You may obtain a copy of the License at
427 *
428 *   http://www.apache.org/licenses/LICENSE-2.0
429 *
430 * Unless required by applicable law or agreed to in writing, software
431 * distributed under the License is distributed on an "AS IS" BASIS,
432 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
433 * See the License for the specific language governing permissions and
434 * limitations under the License.
435 */function li(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(ci()||Un()||"connection"in navigator)?navigator.onLine:!0}function ui(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
436 * @license
437 * Copyright 2020 Google LLC
438 *
439 * Licensed under the Apache License, Version 2.0 (the "License");
440 * you may not use this file except in compliance with the License.
441 * You may obtain a copy of the License at
442 *
443 *   http://www.apache.org/licenses/LICENSE-2.0
444 *
445 * Unless required by applicable law or agreed to in writing, software
446 * distributed under the License is distributed on an "AS IS" BASIS,
447 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
448 * See the License for the specific language governing permissions and
449 * limitations under the License.
450 */class ae{constructor(e,t){this.shortDelay=e,this.longDelay=t,k(t>e,"Short delay should be less than long delay!"),this.isMobile=Ln()||xn()}get(){return li()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
451 * @license
452 * Copyright 2020 Google LLC
453 *
454 * Licensed under the Apache License, Version 2.0 (the "License");
455 * you may not use this file except in compliance with the License.
456 * You may obtain a copy of the License at
457 *
458 *   http://www.apache.org/licenses/LICENSE-2.0
459 *
460 * Unless required by applicable law or agreed to in writing, software
461 * distributed under the License is distributed on an "AS IS" BASIS,
462 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
463 * See the License for the specific language governing permissions and
464 * limitations under the License.
465 */function qe(n,e){k(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
466 * @license
467 * Copyright 2020 Google LLC
468 *
469 * Licensed under the Apache License, Version 2.0 (the "License");
470 * you may not use this file except in compliance with the License.
471 * You may obtain a copy of the License at
472 *
473 *   http://www.apache.org/licenses/LICENSE-2.0
474 *
475 * Unless required by applicable law or agreed to in writing, software
476 * distributed under the License is distributed on an "AS IS" BASIS,
477 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
478 * See the License for the specific language governing permissions and
479 * limitations under the License.
480 */class jt{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;S("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;S("Could not find Headers implementation, make sure you call FetchProvi
480der.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;S("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
481 * @license
482 * Copyright 2020 Google LLC
483 *
484 * Licensed under the Apache License, Version 2.0 (the "License");
485 * you may not use this file except in compliance with the License.
486 * You may obtain a copy of the License at
487 *
488 *   http://www.apache.org/licenses/LICENSE-2.0
489 *
490 * Unless required by applicable law or agreed to in writing, software
491 * distributed under the License is distributed on an "AS IS" BASIS,
492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
493 * See the License for the specific language governing permissions and
494 * limitations under the License.
495 */const hi={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
496 * @license
497 * Copyright 2020 Google LLC
498 *
499 * Licensed under the Apache License, Version 2.0 (the "License");
500 * you may not use this file except in compliance with the License.
501 * You may obtain a copy of the License at
502 *
503 *   http://www.apache.org/licenses/LICENSE-2.0
504 *
505 * Unless required by applicable law or agreed to in writing, software
506 * distributed under the License is distributed on an "AS IS" BASIS,
507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508 * See the License for the specific language governing permissions and
509 * limitations under the License.
510 */const di=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],fi=new ae(3e4,6e4);function Ke(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function J(n,e,t,r,i={}){return zt(n,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=se({key:n.config.apiKey,...o}).slice(1),c=await n._getAdditionalHeaders();c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode);const l={method:e,headers:c,...s};return Mn()||(l.referrerPolicy="no-referrer"),n.emulatorConfig&&Ee(n.emulatorConfig.host)&&(l.credentials="include"),jt.fetch()(await Gt(n,n.config.apiHost,t,a),l)})}async function zt(n,e,t){n._canInitEmulator=!1;const r={...hi,...e};try{const i=new mi(n),s=await Promise.race([t(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw ue(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ue(n,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ue(n,"email-already-in-use",o);if(c==="USER_DISABLED")throw ue(n,"user-disabled",o);const d=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ze(n,d,l);E(n,d)}}catch(i){if(i instanceof M)throw i;E(n,"network-request-failed",{message:String(i)})}}async function pi(n,e,t,r,i={}){const s=await J(n,e,t,r,i);return"mfaPendingCredential"in s&&E(n,"multi-factor-auth-required",{_serverResponse:s}),s}async function Gt(n,e,t,r){const i=`${e}${t}?${r}`,s=n,o=s.config.emulator?qe(n.config,i):`${n.config.apiScheme}://${i}`;return di.includes(t)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}class mi{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(y(this.auth,"network-request-failed")),fi.get())})}}function ue(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const i=y(n,e,r);return i.customData._tokenResponse=t,i}/**
511 * @license
512 * Copyright 2020 Google LLC
513 *
514 * Licensed under the Apache License, Version 2.0 (the "License");
515 * you may not use this file except in compliance with the License.
516 * You may obtain a copy of the License at
517 *
518 *   http://www.apache.org/licenses/LICENSE-2.0
519 *
520 * Unless required by applicable law or agreed to in writing, software
521 * distributed under the License is distributed on an "AS IS" BASIS,
522 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
523 * See the License for the specific language governing permissions and
524 * limitations under the License.
525 */async function gi(n,e){return J(n,"POST","/v1/accounts:delete",e)}async function _e(n,e){return J(n,"POST","/v1/accounts:lookup",e)}/**
526 * @license
527 * Copyright 2020 Google LLC
528 *
529 * Licensed under the Apache License, Version 2.0 (the "License");
530 * you may not use this file except in compliance with the License.
531 * You may obtain a copy of the License at
532 *
533 *   http://www.apache.org/licenses/LICENSE-2.0
534 *
535 * Unless required by applicable law or agreed to in writing, software
536 * distributed under the License is distributed on an "AS IS" BASIS,
537 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
538 * See the License for the specific language governing permissions and
539 * limitations under the License.
540 */function Q(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function _i(n,e=!1){const t=K(n),r=await t.getIdToken(e),i=Je(r);h(i&&i.exp&&i.auth_time&&i.iat,t.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:Q(De(i.auth_time)),issuedAtTime:Q(De(i.iat)),expirationTime:Q(De(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function De(n){return Number(n)*1e3}function Je(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return he("JWT malformed, contained fewer than 3 sections"),null;try{const i=Dt(t);return i?JSON.parse(i):(he("Failed to decode base64 JWT payload"),null)}catch(i){return he("Caught error parsing JWT payload as JSON",i?.toString()),null}}function ft(n){const e=Je(n);return h(e,"internal-error"),h(typeof e.exp<"u","internal-error"),h(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
541 * @license
542 * Copyright 2020 Google LLC
543 *
544 * Licensed under the Apache License, Version 2.0 (the "License");
545 * you may not use this file except in compliance with the License.
546 * You may obtain a copy of the License at
547 *
548 *   http://www.apache.org/licenses/LICENSE-2.0
549 *
550 * Unless required by applicable law or agreed to in writing, software
551 * distributed under the License is distributed on an "AS IS" BASIS,
552 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
553 * See the License for the specific language governing permissions and
554 * limitations under the License.
555 */async function re(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof M&&Ii(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function Ii({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
556 * @license
557 * Copyright 2020 Google LLC
558 *
559 * Licensed under the Apache License, Version 2.0 (the "License");
560 * you may not use this file except in compliance with the License.
561 * You may obtain a copy of the License at
562 *
563 *   http://www.apache.org/licenses/LICENSE-2.0
564 *
565 * Unless required by applicable law or agreed to in writing, software
566 * distributed under the License is distributed on an "AS IS" BASIS,
567 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
568 * See the License for the specific language governing permissions and
569 * limitations under the License.
570 */class yi{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){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??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(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
571 * @license
572 * Copyright 2020 Google LLC
573 *
574 * Licensed under the Apache License, Version 2.0 (the "License");
575 * you may not use this file except in compliance with the License.
576 * You may obtain a copy of the License at
577 *
578 *   http://www.apache.org/licenses/LICENSE-2.0
579 *
580 * Unless required by applicable law or agreed to in writing, software
581 * distributed under the License is distributed on an "AS IS" BASIS,
582 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
583 * See the License for the specific language governing permissions and
584 * limitations under the License.
585 */class $e{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Q(this.lastLoginAt),this.creationTime=Q(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
586 * @license
587 * Copyright 2019 Google LLC
588 *
589 * Licensed under the Apache License, Version 2.0 (the "License");
590 * you may not use this file except in compliance with the License.
591 * You may obtain a copy of the License at
592 *
593 *   http://www.apache.org/licenses/LICENSE-2.0
594 *
595 * Unless required by applicable law or agreed to in writing, software
596 * distributed under the License is distributed on an "AS IS" BASIS,
597 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
598 * See the License for the specific language governing permissions and
599 * limitations under the License.
600 */async function Ie(n){const e=n.auth,t=await n.getIdToken(),r=await re(n,_e(e,{idToken:t}));h(r?.users.length,e,"internal-error");const i=r.users[0];n._notifyReloadListener(i);const s=i.providerUserInfo?.length?qt(i.providerUserInfo):[],o=bi(n.providerData,s),a=n.isAnonymous,c=!(n.email&&i.passwordHash)&&!o?.length,l=a?c:!1,d={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new $e(i.createdAt,i.lastLoginAt),isAnonymous:l};Object.assign(n,d)}async function wi(n){const e=K(n);await Ie(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function bi(n,e){return[...n.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function qt(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}/**
601 * @license
602 * Copyright 2020 Google LLC
603 *
604 * Licensed under the Apache License, Version 2.0 (the "License");
605 * you may not use this file except in compliance with the License.
606 * You may obtain a copy of the License at
607 *
608 *   http://www.apache.org/licenses/LICENSE-2.0
609 *
610 * Unless required by applicable law or agreed to in writing, software
611 * distributed under the License is distributed on an "AS IS" BASIS,
612 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
613 * See the License for the specific language governing permissions and
614 * limitations under the License.
615 */async function Ei(n,e){const t=await zt(n,{},async()=>{const r=se({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=n.config,o=await Gt(n,i,"/v1/token",`key=${s}`),a=await n._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:a,body:r};return n.emulatorConfig&&Ee(n.emulatorConfig.host)&&(c.credentials="include"),jt.fetch()(o,c)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function vi(n,e){return J(n,"POST","/v2/accounts:revokeToken",Ke(n,e))}/**
616 * @license
617 * Copyright 2020 Google LLC
618 *
619 * Licensed under the Apache License, Version 2.0 (the "License");
620 * you may not use this file except in compliance with the License.
621 * You may obtain a copy of the License at
622 *
623 *   http://www.apache.org/licenses/LICENSE-2.0
624 *
625 * Unless required by applicable law or agreed to in writing, software
626 * distributed under the License is distributed on an "AS IS" BASIS,
627 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
628 * See the License for the specific language governing permissions and
629 * limitations under the License.
630 */class V{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){h(e.idToken,"internal-error"),h(typeof e.idToken<"u","internal-error"),h(typeof e.refreshToken<"u","internal-error");
630const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):ft(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){h(e.length!==0,"internal-error");const t=ft(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(h(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:i,expiresIn:s}=await Ei(e,t);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:i,expirationTime:s}=t,o=new V;return r&&(h(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(h(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(h(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 V,this.toJSON())}_performRefresh(){return S("not implemented")}}/**
631 * @license
632 * Copyright 2020 Google LLC
633 *
634 * Licensed under the Apache License, Version 2.0 (the "License");
635 * you may not use this file except in compliance with the License.
636 * You may obtain a copy of the License at
637 *
638 *   http://www.apache.org/licenses/LICENSE-2.0
639 *
640 * Unless required by applicable law or agreed to in writing, software
641 * distributed under the License is distributed on an "AS IS" BASIS,
642 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
643 * See the License for the specific language governing permissions and
644 * limitations under the License.
645 */function R(n,e){h(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class I{constructor({uid:e,auth:t,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new yi(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new $e(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await re(this,this.stsTokenManager.getToken(this.auth,e));return h(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return _i(this,e)}reload(){return wi(this)}_assign(e){this!==e&&(h(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=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new I({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){h(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Ie(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(w(this.auth.app))return Promise.reject(B(this.auth));const e=await this.getIdToken();return await re(this,gi(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
645nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...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){const r=t.displayName??void 0,i=t.email??void 0,s=t.phoneNumber??void 0,o=t.photoURL??void 0,a=t.tenantId??void 0,c=t._redirectEventId??void 0,l=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:p,emailVerified:u,isAnonymous:m,providerData:_,stsTokenManager:X}=t;h(p&&X,e,"internal-error");const le=V.fromJSON(this.name,X);h(typeof p=="string",e,"internal-error"),R(r,e.name),R(i,e.name),h(typeof u=="boolean",e,"internal-error"),h(typeof m=="boolean",e,"internal-error"),R(s,e.name),R(o,e.name),R(a,e.name),R(c,e.name),R(l,e.name),R(d,e.name);const F=new I({uid:p,auth:e,email:i,emailVerified:u,displayName:r,isAnonymous:m,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:le,createdAt:l,lastLoginAt:d});return _&&Array.isArray(_)&&(F.providerData=_.map(H=>({...H}))),c&&(F._redirectEventId=c),F}static async _fromIdTokenResponse(e,t,r=!1){const i=new V;i.updateFromServerResponse(t);const s=new I({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Ie(s),s}static async _fromGetAccountInfoResponse(e,t,r){const i=t.users[0];h(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?qt(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new V;a.updateFromIdToken(r);const c=new I({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new $e(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}}/**
646 * @license
647 * Copyright 2020 Google LLC
648 *
649 * Licensed under the Apache License, Version 2.0 (the "License");
650 * you may not use this file except in compliance with the License.
651 * You may obtain a copy of the License at
652 *
653 *   http://www.apache.org/licenses/LICENSE-2.0
654 *
655 * Unless required by applicable law or agreed to in writing, software
656 * distributed under the License is distributed on an "AS IS" BASIS,
657 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
658 * See the License for the specific language governing permissions and
659 * limitations under the License.
660 */const pt=new Map;function C(n){k(n instanceof Function,"Expected a class definition");let e=pt.get(n);return e?(k(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,pt.set(n,e),e)}/**
661 * @license
662 * Copyright 2019 Google LLC
663 *
664 * Licensed under the Apache License, Version 2.0 (the "License");
665 * you may not use this file except in compliance with the License.
666 * You may obtain a copy of the License at
667 *
668 *   http://www.apache.org/licenses/LICENSE-2.0
669 *
670 * Unless required by applicable law or agreed to in writing, software
671 * distributed under the License is distributed on an "AS IS" BASIS,
672 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
673 * See the License for the specific language governing permissions and
674 * limitations under the License.
675 */class Kt{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){}}Kt.type="NONE";const mt=Kt;/**
676 * @license
677 * Copyright 2019 Google LLC
678 *
679 * Licensed under the Apache License, Version 2.0 (the "License");
680 * you may not use this file except in compliance with the License.
681 * You may obtain a copy of the License at
682 *
683 *   http://www.apache.org/licenses/LICENSE-2.0
684 *
685 * Unless required by applicable law or agreed to in writing, software
686 * distributed under the License is distributed on an "AS IS" BASIS,
687 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
688 * See the License for the specific language governing permissions and
689 * limitations under the License.
690 */function de(n,e,t){return`firebase:${n}:${e}:${t}`}class W{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=de(this.userKey,i.apiKey,s),this.fullPersistenceKey=de("persistence",i.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await _e(this.auth,{idToken:e}).catch(()=>{});return t?I._fromGetAccountInfoResponse(this.auth,t,e):null}return I._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new W(C(mt),e,r);const i=(await Promise.all(t.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l);let s=i[0]||C(mt);const o=de(r,e.config.apiKey,e.name);let a=null;for(const l of t)try{const d=await l._get(o);if(d){let p;
690if(typeof d=="string"){const u=await _e(e,{idToken:d}).catch(()=>{});if(!u)break;p=await I._fromGetAccountInfoResponse(e,u,d)}else p=I._fromJSON(e,d);l!==s&&(a=p),s=l;break}}catch{}const c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new W(s,e,r):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(t.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new W(s,e,r))}}/**
691 * @license
692 * Copyright 2020 Google LLC
693 *
694 * Licensed under the Apache License, Version 2.0 (the "License");
695 * you may not use this file except in compliance with the License.
696 * You may obtain a copy of the License at
697 *
698 *   http://www.apache.org/licenses/LICENSE-2.0
699 *
700 * Unless required by applicable law or agreed to in writing, software
701 * distributed under the License is distributed on an "AS IS" BASIS,
702 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
703 * See the License for the specific language governing permissions and
704 * limitations under the License.
705 */function gt(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Zt(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Jt(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(en(e))return"Blackberry";if(tn(e))return"Webos";if(Yt(e))return"Safari";if((e.includes("chrome/")||Xt(e))&&!e.includes("edge/"))return"Chrome";if(Qt(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if(r?.length===2)return r[1]}return"Other"}function Jt(n=g()){return/firefox\//i.test(n)}function Yt(n=g()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Xt(n=g()){return/crios\//i.test(n)}function Zt(n=g()){return/iemobile/i.test(n)}function Qt(n=g()){return/android/i.test(n)}function en(n=g()){return/blackberry/i.test(n)}function tn(n=g()){return/webos/i.test(n)}function Ye(n=g()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Ti(n=g()){return Ye(n)&&!!window.navigator?.standalone}function Si(){return Bn()&&document.documentMode===10}function nn(n=g()){return Ye(n)||Qt(n)||tn(n)||en(n)||/windows phone/i.test(n)||Zt(n)}/**
706 * @license
707 * Copyright 2020 Google LLC
708 *
709 * Licensed under the Apache License, Version 2.0 (the "License");
710 * you may not use this file except in compliance with the License.
711 * You may obtain a copy of the License at
712 *
713 *   http://www.apache.org/licenses/LICENSE-2.0
714 *
715 * Unless required by applicable law or agreed to in writing, software
716 * distributed under the License is distributed on an "AS IS" BASIS,
717 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
718 * See the License for the specific language governing permissions and
719 * limitations under the License.
720 */function rn(n,e=[]){let t;switch(n){case"Browser":t=gt(g());break;case"Worker":t=`${gt(g())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${oe}/${r}`}/**
721 * @license
722 * Copyright 2022 Google LLC
723 *
724 * Licensed under the Apache License, Version 2.0 (the "License");
725 * you may not use this file except in compliance with the License.
726 * You may obtain a copy of the License at
727 *
728 *   http://www.apache.org/licenses/LICENSE-2.0
729 *
730 * Unless required by applicable law or agreed to in writing, software
731 * distributed under the License is distributed on an "AS IS" BASIS,
732 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
733 * See the License for the specific language governing permissions and
734 * limitations under the License.
735 */class Ci{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=s=>new Promise((o,a)=>{try{const c=e(s);o(c)}catch(c){a(c)}});r.onAbort=t,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const i of t)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}/**
736 * @license
737 * Copyright 2023 Google LLC
738 *
739 * Licensed under the Apache License, Version 2.0 (the "License");
740 * you may not use this file except in compliance with the License.
741 * You may obtain a copy of the License at
742 *
743 *   http://www.apache.org/licenses/LICENSE-2.0
744 *
745 * Unless required by applicable law or agreed to in writing, software
746 * distributed under the License is distributed on an "AS IS" BASIS,
747 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
748 * See the License for the specific language governing permissions and
749 * limitations under the License.
750 */async function Ai(n,e={}){return J(n,"GET","/v2/passwordPolicy",Ke(n,e))}/**
751 * @license
752 * Copyright 2023 Google LLC
753 *
754 * Licensed under the Apache License, Version 2.0 (the "License");
755 * you may not use this file except in compliance with the License.
756 * You may obtain a copy of the License at
757 *
758 *   http://www.apache.org/licenses/LICENSE-2.0
759 *
760 * Unless required by applicable law or agreed to in writing, software
761 * distributed under the License is distributed on an "AS IS" BASIS,
762 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
763 * See the License for the specific language governing permissions and
764 * limitations under the License.
765 */const ki=6;class Pi{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??ki,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/**
766 * @license
767 * Copyright 2020 Google LLC
768 *
769 * Licensed under the Apache License, Version 2.0 (the "License");
770 * you may not use this file except in compliance with the License.
771 * You may obtain a copy of the License at
772 *
773 *   http://www.apache.org/licenses/LICENSE-2.0
774 *
775 * Unless required by applicable law or agreed to in writing, software
776 * distributed under the License is distributed on an "AS IS" BASIS,
777 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
778 * See the License for the specific language governing permissions and
779 * limitations under the License.
780 */class Ri{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new _t(this),this.idTokenSubscription=new _t(this),this.beforeStateQueue=new Ci(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Wt,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=C(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await W.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.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 initializeCurrentUserFromIdToken(e){try{const t=await _e(this,{idToken:e}),r=await I._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(w(this.app)){const s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let r=t,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const s=this.redirectUser?._redirectEventId,o=r?._redirectEventId,a=await this.tryRedirectSignIn(e);(!s||s===o)&&a?.user&&(r=a.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return h(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){try{await Ie(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ui()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(w(this.app))return Promise.reject(B(this));const t=e?K(e):null;return t&&h(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&&h(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 w(this.app)?Promise.reject(B(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return w(this.app)?Promise.reject(B(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(C(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Ai(this),t=new Pi(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new ie("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>
780{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await vi(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&C(e)||this._popupRedirectResolver;h(t,this,"argument-error"),this.redirectPersistenceManager=await W.create(this,[C(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,i){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(h(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof t=="function"){const c=e.addObserver(t,r,i);return()=>{o=!0,c()}}else{const c=e.addObserver(t);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return h(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=rn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(w(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&oi(`Error while retrieving App Check token: ${e.error}`),e?.token}}function ve(n){return K(n)}class _t{constructor(e){this.auth=e,this.observer=null,this.addObserver=zn(t=>this.observer=t)}get next(){return h(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
781 * @license
782 * Copyright 2020 Google LLC
783 *
784 * Licensed under the Apache License, Version 2.0 (the "License");
785 * you may not use this file except in compliance with the License.
786 * You may obtain a copy of the License at
787 *
788 *   http://www.apache.org/licenses/LICENSE-2.0
789 *
790 * Unless required by applicable law or agreed to in writing, softw
790are
791 * distributed under the License is distributed on an "AS IS" BASIS,
792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
793 * See the License for the specific language governing permissions and
794 * limitations under the License.
795 */let Xe={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Oi(n){Xe=n}function Di(n){return Xe.loadJS(n)}function Ni(){return Xe.gapiScript}function Li(n){return`__${n}${Math.floor(Math.random()*1e6)}`}/**
796 * @license
797 * Copyright 2020 Google LLC
798 *
799 * Licensed under the Apache License, Version 2.0 (the "License");
800 * you may not use this file except in compliance with the License.
801 * You may obtain a copy of the License at
802 *
803 *   http://www.apache.org/licenses/LICENSE-2.0
804 *
805 * Unless required by applicable law or agreed to in writing, software
806 * distributed under the License is distributed on an "AS IS" BASIS,
807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
808 * See the License for the specific language governing permissions and
809 * limitations under the License.
810 */function Mi(n,e){const t=Bt(n,"auth");if(t.isInitialized()){const i=t.getImmediate(),s=t.getOptions();if(z(s,e??{}))return i;E(i,"already-initialized")}return t.initialize({options:e})}function Ui(n,e){const t=e?.persistence||[],r=(Array.isArray(t)?t:[t]).map(C);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e?.popupRedirectResolver)}function xi(n,e,t){const r=ve(n);
810h(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=sn(e),{host:o,port:a}=Bi(e),c=a===null?"":`:${a}`,l={url:`${s}//${o}${c}/`},d=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){h(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),h(z(l,r.config.emulator)&&z(d,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=l,r.emulatorConfig=d,r.settings.appVerificationDisabledForTesting=!0,Ee(o)?(Rn(`${s}//${o}${c}`),Nn("Auth",!0)):Fi()}function sn(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function Bi(n){const e=sn(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:It(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:It(o)}}}function It(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Fi(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
811 * @license
812 * Copyright 2020 Google LLC
813 *
814 * Licensed under the Apache License, Version 2.0 (the "License");
815 * you may not use this file except in compliance with the License.
816 * You may obtain a copy of the License at
817 *
818 *   http://www.apache.org/licenses/LICENSE-2.0
819 *
820 * Unless required by applicable law or agreed to in writing, software
821 * distributed under the License is distributed on an "AS IS" BASIS,
822 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
823 * See the License for the specific language governing permissions and
824 * limitations under the License.
825 */class on{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return S("not implemented")}_getIdTokenResponse(e){return S("not implemented")}_linkToIdToken(e,t){return S("not implemented")}_getReauthenticationResolver(e){return S("not implemented")}}/**
826 * @license
827 * Copyright 2020 Google LLC
828 *
829 * Licensed under the Apache License, Version 2.0 (the "License");
830 * you may not use this file except in compliance with the License.
831 * You may obtain a copy of the License at
832 *
833 *   http://www.apache.org/licenses/LICENSE-2.0
834 *
835 * Unless required by applicable law or agreed to in writing, software
836 * distributed under the License is distributed on an "AS IS" BASIS,
837 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
838 * See the License for the specific language governing permissions and
839 * limitations under the License.
840 */async function j(n,e){return pi(n,"POST","/v1/accounts:signInWithIdp",Ke(n,e))}/**
841 * @license
842 * Copyright 2020 Google LLC
843 *
844 * Licensed under the Apache License, Version 2.0 (the "License");
845 * you may not use this file except in compliance with the License.
846 * You may obtain a copy of the License at
847 *
848 *   http://www.apache.org/licenses/LICENSE-2.0
849 *
850 * Unless required by applicable law or agreed to in writing, software
851 * distributed under the License is distributed on an "AS IS" BASIS,
852 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
853 * See the License for the specific language governing permissions and
854 * limitations under the License.
855 */const Hi="http://localhost";class P extends on{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new P(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&&
855(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):E("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=t;if(!r||!i)return null;const o=new P(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return j(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,j(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,j(e,t)}buildRequest(){const e={requestUri:Hi,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=se(t)}return e}}/**
856 * @license
857 * Copyright 2020 Google LLC
858 *
859 * Licensed under the Apache License, Version 2.0 (the "License");
860 * you may not use this file except in compliance with the License.
861 * You may obtain a copy of the License at
862 *
863 *   http://www.apache.org/licenses/LICENSE-2.0
864 *
865 * Unless required by applicable law or agreed to in writing, software
866 * distributed under the License is distributed on an "AS IS" BASIS,
867 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
868 * See the License for the specific language governing permissions and
869 * limitations under the License.
870 */class Ze{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}}/**
871 * @license
872 * Copyright 2019 Google LLC
873 *
874 * Licensed under the Apache License, Version 2.0 (the "License");
875 * you may not use this file except in compliance with the License.
876 * You may obtain a copy of the License at
877 *
878 *   http://www.apache.org/licenses/LICENSE-2.0
879 *
880 * Unless required by applicable law or agreed to in writing, software
881 * distributed under the License is distributed on an "AS IS" BASIS,
882 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
883 * See the License for the specific language governing permissions and
884 * limitations under the License.
885 */class Y extends Ze{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ee extends Y{static credentialFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return h("providerId"in t&&"signInMethod"in t,"argument-error"),P._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return h(e.idToken||e.accessToken,"argument-error"),P._fromParams({...e,providerId:this.providerId,sign
885InMethod:this.providerId})}static credentialFromResult(e){return ee.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return ee.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:o,providerId:a}=e;if(!r&&!i&&!t&&!s||!a)return null;try{return new ee(a)._credential({idToken:t,accessToken:r,nonce:o,pendingToken:s})}catch{return null}}}/**
886 * @license
887 * Copyright 2020 Google LLC
888 *
889 * Licensed under the Apache License, Version 2.0 (the "License");
890 * you may not use this file except in compliance with the License.
891 * You may obtain a copy of the License at
892 *
893 *   http://www.apache.org/licenses/LICENSE-2.0
894 *
895 * Unless required by applicable law or agreed to in writing, software
896 * distributed under the License is distributed on an "AS IS" BASIS,
897 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
898 * See the License for the specific language governing permissions and
899 * limitations under the License.
900 */class v extends Y{constructor(){super("facebook.com")}static credential(e){return P._fromParams({providerId:v.PROVIDER_ID,signInMethod:v.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return v.credentialFromTaggedObject(e)}static credentialFromError(e){return v.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return v.credential(e.oauthAccessToken)}catch{return null}}}v.FACEBOOK_SIGN_IN_METHOD="facebook.com";v.PROVIDER_ID="facebook.com";/**
901 * @license
902 * Copyright 2020 Google LLC
903 *
904 * Licensed under the Apache License, Version 2.0 (the "License");
905 * you may not use this file except in compliance with the License.
906 * You may obtain a copy of the License at
907 *
908 *   http://www.apache.org/licenses/LICENSE-2.0
909 *
910 * Unless required by applicable law or agreed to in writing, software
911 * distributed under the License is distributed on an "AS IS" BASIS,
912 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
913 * See the License for the specific language governing permissions and
914 * limitations under the License.
915 */class T extends Y{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return P._fromParams({providerId:T.PROVIDER_ID,signInMethod:T.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return T.credentialFromTaggedObject(e)}static credentialFromError(e){return T.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return T.credential(t,r)}catch{return null}}}T.GOOGLE_SIGN_IN_METHOD="google.com";T.PROVIDER_ID="google.com";/**
916 * @license
917 * Copyright 2020 Google LLC
918 *
919 * Licensed under the Apache License, Version 2.0 (the "License");
920 * you may not use this file except in compliance with the License.
921 * You may obtain a copy of the License at
922 *
923 *   http://www.apache.org/licenses/LICENSE-2.0
924 *
925 * Unless required by applicable law or agreed to in writing, software
926 * distributed under the License is distributed on an "AS IS" BASIS,
927 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
928 * See the License for the specific language governing permissions and
929 * limitations under the License.
930 */class O extends Y{constructor(){super("github.com")}static credential(e){return P._fromParams({providerId:O.PROVIDER_ID,signInMethod:O.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return O.credentialFromTaggedObject(e)}static credentialFromError(e){return O.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return O.credential(e.oauthAccessToken)}catch{return null}}}O.GITHUB_SIGN_IN_METHOD="github.com";O.PROVIDER_ID="github.com";/**
931 * @license
932 * Copyright 2020 Google LLC
933 *
934 * Licensed under the Apache License, Version 2.0 (the "License");
935 * you may not use this file except in compliance with the License.
936 * You may obtain a copy of the License at
937 *
938 *   http://www.apache.org/licenses/LICENSE-2.0
939 *
940 * Unless required by applicable law or agreed to in writing, software
941 * distributed under the License is distributed on an "AS IS" BASIS,
942 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
943 * See the License for the specific language governing permissions and
944 * limitations under the License.
945 */class D extends Y{constructor(){super("twitter.com")}static credential(e,t){return P._fromParams({providerId:D.PROVIDER_ID,signInMethod:D.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return D.credentialFromTaggedObject(e)}static credentialFromError(e){return D.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return D.credential(t,r)}catch{return null}}}D.TWITTER_SIGN_IN_METHOD="twitter.com";D.PROVIDER_ID="twitter.com";/**
946 * @license
947 * Copyright 2020 Google LLC
948 *
949 * Licensed under the Apache License, Version 2.0 (the "License");
950 * you may not use this file except in compliance with the License.
951 * You may obtain a copy of the License at
952 *
953 *   http://www.apache.org/licenses/LICENSE-2.0
954 *
955 * Unless required by applicable law or agreed to in writing, software
956 * distributed under the License is distributed on an "AS IS" BASIS,
957 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
958 * See the License for the specific language governing permissions and
959 * limitations under the License.
960 */class q{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){const s=await I._fromIdTokenResponse(e,r,i),o=yt(r);return new q({user:s,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const i=yt(r);return new q({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function yt(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
961 * @license
962 * Copyright 2020 Google LLC
963 *
964 * Licensed under the Apache License, Version 2.0 (the "License");
965 * you may not use this file except in compliance with the License.
966 * You may obtain a copy of the License at
967 *
968 *   http://www.apache.org/licenses/LICENSE-2.0
969 *
970 * Unless required by applicable law or agreed to in writing, software
971 * distributed under the License is distributed on an "AS IS" BASIS,
972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
973 * See the License for the specific language governing permissions and
974 * limitations under the License.
975 */class ye extends M{constructor(e,t,r,i){super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,ye.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new ye(e,t,r,i)}}function an(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?ye._fromErrorAndOperation(n,s,e,r):s})}async function $i(n,e,t=!1){const r=await re(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return q._forOperation(n,"link",r)}/**
976 * @license
977 * Copyright 2019 Google LLC
978 *
979 * Licensed under the Apache License, Version 2.0 (the "License");
980 * you may not use this file except in compliance with the License.
981 * You may obtain a copy of the License at
982 *
983 *   http://www.apache.org/licenses/LICENSE-2.0
984 *
985 * Unless required by applicable law or agreed to in writing, software
986 * distributed under the License is distributed on an "AS IS" BASIS,
987 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
988 * See the License for the specific language governing permissions and
989 * limitations under the License.
990 */async function Vi(n,e,t=!1){const{auth:r}=n;if(w(r.app))return Promise.reject(B(r));const i="reauthenticate";try{const s=await re(n,an(r,i,e,n),t);h(s.idToken,r,"internal-error");const o=Je(s.idToken);h(o,r,"internal-error");const{sub:a}=o;return h(n.uid===a,r,"user-mismatch"),q._forOperation(n,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&E(r,"user-mismatch"),s}}/**
991 * @license
992 * Copyright 2020 Google LLC
993 *
994 * Licensed under the Apache License, Version 2.0 (the "License");
995 * you may not use this file except in compliance with the License.
996 * You may obtain a copy of the License at
997 *
998 *   http://www.apache.org/licenses/LICENSE-2.0
999 *
1000 * Unless required by applicable law or agreed to in writing, software
1001 * distributed under the License is distributed on an "AS IS" BASIS,
1002 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1003 * See the License for the specific language governing permissions and
1004 * limitations under the License.
1005 */async function Wi(n,e,t=!1){if(w(n.app))return Promise.reject(B(n));const r="signIn",i=await an(n,r,e),s=await q._fromIdTokenResponse(n,r,i);return t||await n._updateCurrentUser(s.user),s}function ji(n,e,t,r){return K(n).onIdTokenChanged(e,t,r)}function zi(n,e,t){return K(n).beforeAuthStateChanged(e,t)}const we="__sak";/**
1006 * @license
1007 * Copyright 2019 Google LLC
1008 *
1009 * Licensed under the Apache License, Version 2.0 (the "License");
1010 * you may not use this file except in compliance with the License.
1011 * You may obtain a copy of the License at
1012 *
1013 *   http://www.apache.org/licenses/LICENSE-2.0
1014 *
1015 * Unless required by applicable law or agreed to in writing, software
1016 * distributed under the License is distributed on an "AS IS" BASIS,
1017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1018 * See the License for the specific language governing permissions and
1019 * limitations under the License.
1020 */class cn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(we,"1"),this.storage.removeItem(we),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()}}/**
1021 * @license
1022 * Copyright 2020 Google LLC
1023 *
1024 * Licensed under the Apache License, Version 2.0 (the "License");
1025 * you may not use this file except in compliance with the License.
1026 * You may obtain a copy of the License at
1027 *
1028 *   http://www.apache.org/licenses/LICENSE-2.0
1029 *
1030 * Unless required by applicable law or agreed to in writing, software
1031 * distributed under the License is distributed on an "AS IS" BASIS,
1032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1033 * See the License for the specific language governing permissions and
1034 * limitations under the License.
1035 */const Gi=1e3,qi=10;class ln extends cn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=nn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}
1035onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const r=e.key;t?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);Si()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,qi):i()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},Gi)}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]),Ob
1035ject.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]}}ln.type="LOCAL";const Ki=ln;/**
1036 * @license
1037 * Copyright 2020 Google LLC
1038 *
1039 * Licensed under the Apache License, Version 2.0 (the "License");
1040 * you may not use this file except in compliance with the License.
1041 * You may obtain a copy of the License at
1042 *
1043 *   http://www.apache.org/licenses/LICENSE-2.0
1044 *
1045 * Unless required by applicable law or agreed to in writing, software
1046 * distributed under the License is distributed on an "AS IS" BASIS,
1047 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1048 * See the License for the specific language governing permissions and
1049 * limitations under the License.
1050 */class un extends cn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}un.type="SESSION";const hn=un;/**
1051 * @license
1052 * Copyright 2019 Google LLC
1053 *
1054 * Licensed under the Apache License, Version 2.0 (the "License");
1055 * you may not use this file except in compliance with the License.
1056 * You may obtain a copy of the License at
1057 *
1058 *   http://www.apache.org/licenses/LICENSE-2.0
1059 *
1060 * Unless required by applicable law or agreed to in writing, software
1061 * distributed under the License is distributed on an "AS IS" BASIS,
1062 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1063 * See the License for the specific language governing permissions and
1064 * limitations under the License.
1065 */function Ji(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1066 * @license
1067 * Copyright 2019 Google LLC
1068 *
1069 * Licensed under the Apache License, Version 2.0 (the "License");
1070 * you may not use this file except in compliance with the License.
1071 * You may obtain a copy of the License at
1072 *
1073 *   http://www.apache.org/licenses/LICENSE-2.0
1074 *
1075 * Unless required by applicable law or agreed to in writing, software
1076 * distributed under the License is distributed on an "AS IS" BASIS,
1077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1078 * See the License for the specific language governing permissions and
1079 * limitations under the License.
1080 */class Te{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(i=>i.isListeningto(e));if(t)return t;const r=new Te(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:i,data:s}=t.data,o=this.handlersMap[i];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async l=>l(t.origin,s)),c=await Ji(a);t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Te.receivers=[];/**
1081 * @license
1082 * Copyright 2020 Google LLC
1083 *
1084 * Licensed under the Apache License, Version 2.0 (the "License");
1085 * you may not use this file except in compliance with the License.
1086 * You may obtain a copy of the License at
1087 *
1088 *   http://www.apache.org/licenses/LICENSE-2.0
1089 *
1090 * Unless required by applicable law or agreed to in writing, software
1091 * distributed under the License is distributed on an "AS IS" BASIS,
1092 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1093 * See the License for the specific language governing permissions and
1094 * limitations under the License.
1095 */function Qe(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
1096 * @license
1097 * Copyright 2019 Google LLC
1098 *
1099 * Licensed under the Apache License, Version 2.0 (the "License");
1100 * you may not use this file except in compliance with the License.
1101 * You may obtain a copy of the License at
1102 *
1103 *   http://www.apache.org/licenses/LICENSE-2.0
1104 *
1105 * Unless required by applicable law or agreed to in writing, software
1106 * distributed under the License is distributed on an "AS IS" BASIS,
1107 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1108 * See the License for the specific language governing permissions and
1109 * limitations under the License.
1110 */class Yi{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,c)=>{const l=Qe("",20);i.port1.start();const d=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(p){const u=p;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(u.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
1111 * @license
1112 * Copyright 2020 Google LLC
1113 *
1114 * Licensed under the Apache License, Version 2.0 (the "License");
1115 * you may not use this file except in compliance with the License.
1116 * You may obtain a copy of the License at
1117 *
1118 *   http://www.apache.org/licenses/LICENSE-2.0
1119 *
1120 * Unless required by applicable law or agreed to in writing, software
1121 * distributed under the License is distributed on an "AS IS" BASIS,
1122 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1123 * See the License for the specific language governing permissions and
1124 * limitations under the License.
1125 */function b(){return window}function Xi(n){b().location.href=n}/**
1126 * @license
1127 * Copyright 2020 Google LLC.
1128 *
1129 * Licensed under the Apache License, Version 2.0 (the "License");
1130 * you may not use this file except in compliance with the License.
1131 * You may obtain a copy of the License at
1132 *
1133 *   http://www.apache.org/licenses/LICENSE-2.0
1134 *
1135 * Unless required by applicable law or agreed to in writing, software
1136 * distributed under the License is distributed on an "AS IS" BASIS,
1137 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1138 * See the License for the specific language governing permissions and
1139 * limitations under the License.
1140 */function dn(){return typeof b().WorkerGlobalScope<"u"&&typeof b().importScripts=="function"}async function Zi(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Qi(){return navigator?.serviceWorker?.controller||null}function es(){return dn()?self:null}/**
1141 * @license
1142 * Copyright 2019 Google LLC
1143 *
1144 * Licensed under the Apache License, Version 2.0 (the "License");
1145 * you may not use this file except in compliance with the License.
1146 * You may obtain a copy of the License at
1147 *
1148 *   http://www.apache.org/licenses/LICENSE-2.0
1149 *
1150 * Unless required by applicable law or agreed to in writing, software
1151 * distributed under the License is distributed on an "AS IS" BASIS,
1152 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1153 * See the License for the specific language governing permissions and
1154 * limitations under the License.
1155 */const fn="firebaseLocalStorageDb",ts=1,be="firebaseLocalStorage",pn="fbase_key";class ce{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 Se(n,e){return n.transaction([be],e?"readwrite":"readonly").objectStore(be)}function ns(){const n=indexedDB.deleteDatabase(fn);return new ce(n).toPromise()}function Ve(){const n=indexedDB.open(fn,ts);return new Promise((e,t)=>
1155{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(be,{keyPath:pn})}catch(i){t(i)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(be)?e(r):(r.close(),await ns(),e(await Ve()))})})}async function wt(n,e,t){const r=Se(n,!0).put({[pn]:e,value:t});return new ce(r).toPromise()}async function rs(n,e){const t=Se(n,!1).get(e),r=await new ce(t).toPromise();return r===void 0?null:r.value}function bt(n,e){const t=Se(n,!0).delete(e);return new ce(t).toPromise()}const is=800,ss=3;class mn{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 Ve(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>ss)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return dn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Te._getInstance(es()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await Zi(),!this.activeServiceWorker)return;this.sender=new Yi(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Qi()!==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 Ve();return await wt(e,we,"1"),await bt(e,we),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>wt(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>rs(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>bt(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Se(i,!1).getAll();return new ce(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),t.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),is)}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]),Ob
1155ject.keys(this.listeners).length===0&&this.stopPolling()}}mn.type="LOCAL";const os=mn;new ae(3e4,6e4);/**
1156 * @license
1157 * Copyright 2021 Google LLC
1158 *
1159 * Licensed under the Apache License, Version 2.0 (the "License");
1160 * you may not use this file except in compliance with the License.
1161 * You may obtain a copy of the License at
1162 *
1163 *   http://www.apache.org/licenses/LICENSE-2.0
1164 *
1165 * Unless required by applicable law or agreed to in writing, software
1166 * distributed under the License is distributed on an "AS IS" BASIS,
1167 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1168 * See the License for the specific language governing permissions and
1169 * limitations under the License.
1170 */function gn(n,e){return e?C(e):(h(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1171 * @license
1172 * Copyright 2019 Google LLC
1173 *
1174 * Licensed under the Apache License, Version 2.0 (the "License");
1175 * you may not use this file except in compliance with the License.
1176 * You may obtain a copy of the License at
1177 *
1178 *   http://www.apache.org/licenses/LICENSE-2.0
1179 *
1180 * Unless required by applicable law or agreed to in writing, software
1181 * distributed under the License is distributed on an "AS IS" BASIS,
1182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1183 * See the License for the specific language governing permissions and
1184 * limitations under the License.
1185 */class et extends on{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return j(e,this._buildIdpRequest())}_linkToIdToken(e,t){return j(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return j(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 as(n){return Wi(n.auth,new et(n),n.bypassAuthState)}function cs(n){const{auth:e,user:t}=n;return h(t,e,"internal-error"),Vi(t,new et(n),n.bypassAuthState)}async function ls(n){const{auth:e,user:t}=n;return h(t,e,"internal-error"),$i(t,new et(n),n.bypassAuthState)}/**
1186 * @license
1187 * Copyright 2020 Google LLC
1188 *
1189 * Licensed under the Apache License, Version 2.0 (the "License");
1190 * you may not use this file except in compliance with the License.
1191 * You may obtain a copy of the License at
1192 *
1193 *   http://www.apache.org/licenses/LICENSE-2.0
1194 *
1195 * Unless required by applicable law or agreed to in writing, software
1196 * distributed under the License is distributed on an "AS IS" BASIS,
1197 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1198 * See the License for the specific language governing permissions and
1199 * limitations under the License.
1200 */class _n{constructor(e,t,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:t,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return as;case"linkViaPopup":case"linkViaRedirect":return ls;case"reauthViaPopup":case"reauthViaRedirect":return cs;default:E(this.auth,"internal-error")}}resolve(e){k(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){k(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()}}/**
1201 * @license
1202 * Copyright 2020 Google LLC
1203 *
1204 * Licensed under the Apache License, Version 2.0 (the "License");
1205 * you may not use this file except in compliance with the License.
1206 * You may obtain a copy of the License at
1207 *
1208 *   http://www.apache.org/licenses/LICENSE-2.0
1209 *
1210 * Unless required by applicable law or agreed to in writing, software
1211 * distributed under the License is distributed on an "AS IS" BASIS,
1212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1213 * See the License for the specific language governing permissions and
1214 * limitations under the License.
1215 */const us=new ae(2e3,1e4);async function Ne(n,e,t){if(w(n.app))return Promise.reject(y(n,"operation-not-supported-in-this-environment"));const r=ve(n);ai(n,e,Ze);const i=gn(r,t);return new x(r,"signInViaPopup",e,i).executeNotNull()}class x extends _n{constructor(e,t,r,i,s){super(e,t,i,s),this.provider=r,this.authWindow=null,this.pollId=null,x.currentPopupAction&&x.currentPopupAction.cancel(),x.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return h(e,this.auth,"internal-error"),e}async onExecution(){k(this.filter.length===1,"Popup operations only handle one event");const e=Qe();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(y(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(y(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,x.
1215currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(y(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,us.get())};e()}}x.currentPopupAction=null;/**
1216 * @license
1217 * Copyright 2020 Google LLC
1218 *
1219 * Licensed under the Apache License, Version 2.0 (the "License");
1220 * you may not use this file except in compliance with the License.
1221 * You may obtain a copy of the License at
1222 *
1223 *   http://www.apache.org/licenses/LICENSE-2.0
1224 *
1225 * Unless required by applicable law or agreed to in writing, software
1226 * distributed under the License is distributed on an "AS IS" BASIS,
1227 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1228 * See the License for the specific language governing permissions and
1229 * limitations under the License.
1230 */const hs="pendingRedirect",fe=new Map;class ds extends _n{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=fe.get(this.auth._key());if(!e){try{const r=await fs(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}fe.set(this.auth._key(),e)}return this.bypassAuthState||fe.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 fs(n,e){const t=gs(e),r=ms(n);if(!await r._isAvailable())return!1;const i=await r._get(t)==="true";return await r._remove(t),i}function ps(n,e){fe.set(n._key(),e)}function ms(n){return C(n._redirectPersistence)}function gs(n){return de(hs,n.config.apiKey,n.name)}async function _s(n,e,t=!1){if(w(n.app))return Promise.reject(B(n));const r=ve(n),i=gn(r,e),o=await new ds(r,i,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
1231 * @license
1232 * Copyright 2020 Google LLC
1233 *
1234 * Licensed under the Apache License, Version 2.0 (the "License");
1235 * you may not use this file except in compliance with the License.
1236 * You may obtain a copy of the License at
1237 *
1238 *   http://www.apache.org/licenses/LICENSE-2.0
1239 *
1240 * Unless required by applicable law or agreed to in writing, software
1241 * distributed under the License is distributed on an "AS IS" BASIS,
1242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1243 * See the License for the specific language governing permissions and
1244 * limitations under the License.
1245 */const Is=600*1e3;class ys{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ws(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!In(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";t.onError(y(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=Is&&this.cachedEventUids.clear(),this.cachedEventUids.has(Et(e))}saveEventToCache(e){this.cachedEventUids.add(Et(e)),this.lastProcessedEventTime=Date.now()}}function Et(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function In({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function ws(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return In(n);default:return!1}}/**
1246 * @license
1247 * Copyright 2020 Google LLC
1248 *
1249 * Licensed under the Apache License, Version 2.0 (the "License");
1250 * you may not use this file except in compliance with the License.
1251 * You may obtain a copy of the License at
1252 *
1253 *   http://www.apache.org/licenses/LICENSE-2.0
1254 *
1255 * Unless required by applicable law or agreed to in writing, software
1256 * distributed under the License is distributed on an "AS IS" BASIS,
1257 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1258 * See the License for the specific language governing permissions and
1259 * limitations under the License.
1260 */async function bs(n,e={}){return J(n,"GET","/v1/projects",e)}/**
1261 * @license
1262 * Copyright 2020 Google LLC
1263 *
1264 * Licensed under the Apache License, Version 2.0 (the "License");
1265 * you may not use this file except in compliance with the License.
1266 * You may obtain a copy of the License at
1267 *
1268 *   http://www.apache.org/licenses/LICENSE-2.0
1269 *
1270 * Unless required by applicable law or agreed to in writing, software
1271 * distributed under the License is distributed on an "AS IS" BASIS,
1272 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1273 * See the License for the specific language governing permissions and
1274 * limitations under the License.
1275 */const Es=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,vs=/^https?/;async function Ts(n){if(n.config.emulator)return;const{authorizedDomains:e}=await bs(n);for(const t of e)try{if(Ss(t))return}catch{}E(n,"unauthorized-domain")}function Ss(n){const e=He(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===r}if(!vs.test(t))return!1;if(Es.test(n))return r===n;const i=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/**
1276 * @license
1277 * Copyright 2020 Google LLC.
1278 *
1279 * Licensed under the Apache License, Version 2.0 (the "License");
1280 * you may not use this file except in compliance with the License.
1281 * You may obtain a copy of the License at
1282 *
1283 *   http://www.apache.org/licenses/LICENSE-2.0
1284 *
1285 * Unless required by applicable law or agreed to in writing, software
1286 * distributed under the License is distributed on an "AS IS" BASIS,
1287 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1288 * See the License for the specific language governing permissions and
1289 * limitations under the License.
1290 */const Cs=new ae(3e4,6e4);function vt(){const n=b().___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 As(n){return new Promise((e,t)=>{function r(){vt(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{vt(),t(y(n,"network-request-failed"))},timeout:Cs.get()})}if(b().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(b().gapi?.load)r();else{const i=Li("iframefcb");return b()[i]=()=>{gapi.load?r():t(y(n,"network-request-failed"))},Di(`${Ni()}?onload=${i}`).catch(s=>t(s))}}).catch(e=>{throw pe=null,e})}let pe=null;function ks(n){return pe=pe||As(n),pe}/**
1291 * @license
1292 * Copyright 2020 Google LLC.
1293 *
1294 * Licensed under the Apache License, Version 2.0 (the "License");
1295 * you may not use this file except in compliance with the License.
1296 * You may obtain a copy of the License at
1297 *
1298 *   http://www.apache.org/licenses/LICENSE-2.0
1299 *
1300 * Unless required by applicable law or agreed to in writing, software
1301 * distributed under the License is distributed on an "AS IS" BASIS,
1302 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1303 * See the License for the specific language governing permissions and
1304 * limitations under the License.
1305 */const Ps=new ae(5e3,15e3),Rs="__/auth/iframe",Os="emulator/auth/iframe",Ds={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ns=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Ls(n){const e=n.config;h(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?qe(e,Os):`https://${n.config.authDomain}/${Rs}`,r={apiKey:e.apiKey,appName:n.name,v:oe},i=Ns.get(n.config.apiHost);i&&(r.eid=i);const s=n._getFrameworks();return s.length&&(r.fw=s.join(",")),`${t}?${se(r).slice(1)}`}async function Ms(n){const e=await ks(n),t=b().gapi;return h(t,n,"internal-error"),e.open({where:document.body,url:Ls(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Ds,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=y(n,"network-request-failed"),a=b().setTimeout(()=>{s(o)},Ps.get());function c(){b().clearTimeout(a),i(r)}r.ping(c).then(c,()=>{s(o)})}))}/**
1306 * @license
1307 * Copyright 2020 Google LLC.
1308 *
1309 * Licensed under the Apache License, Version 2.0 (the "License");
1310 * you may not use this file except in compliance with the License.
1311 * You may obtain a copy of the License at
1312 *
1313 *   http://www.apache.org/licenses/LICENSE-2.0
1314 *
1315 * Unless required by applicable law or agreed to in writing, software
1316 * distributed under the License is distributed on an "AS IS" BASIS,
1317 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1318 * See the License for the specific language governing permissions and
1319 * limitations under the License.
1320 */const Us={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xs=500,Bs=600,Fs="_blank",Hs="http://localhost";class Tt{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function $s(n,e,t,r=xs,i=Bs){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c={...Us,width:r.toString(),height:i.toString(),top:s,left:o},l=g().toLowerCase();t&&(a=Xt(l)?Fs:t),Jt(l)&&(e=e||Hs,c.scrollbars="yes");const d=Object.entries(c).reduce((u,[m,_])=>`${u}${m}=${_},`,"");if(Ti(l)&&a!=="_self")return Vs(e||"",a),new Tt(null);const p=window.open(e||"",a,d);h(p,n,"popup-blocked");try{p.focus()}catch{}return new Tt(p)}function Vs(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
1321 * @license
1322 * Copyright 2021 Google LLC
1323 *
1324 * Licensed under the Apache License, Version 2.0 (the "License");
1325 * you may not use this file except in compliance with the License.
1326 * You may obtain a copy of the License at
1327 *
1328 *   http://www.apache.org/licenses/LICENSE-2.0
1329 *
1330 * Unless required by applicable law or agreed to in writing, software
1331 * distributed under the License is distributed on an "AS IS" BASIS,
1332 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1333 * See the License for the specific language governing permissions and
1334 * limitations under the License.
1335 */const Ws="__/auth/handler",js="emulator/auth/handler",zs=encodeURIComponent("fac");async function St(n,e,t,r,i,s){h(n.config.authDomain,n,"auth-domain-config-required"),h(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:oe,eventId:i};if(e instanceof Ze){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",jn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,p]of Object.entries({}))o[d]=p}if(e instanceof Y){const d=e.getScopes().filter(p=>p!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const c=await n._getAppCheckToken(),l=c?`#${zs}=${encodeURIComponent(c)}`:"";return`${Gs(n)}?${se(a).slice(1)}${l}`}function Gs({config:n}){return n.emulator?qe(n,js):`https://${n.authDomain}/${Ws}`}/**
1336 * @license
1337 * Copyright 2020 Google LLC
1338 *
1339 * Licensed under the Apache License, Version 2.0 (the "License");
1340 * you may not use this file except in compliance with the License.
1341 * You may obtain a copy of the License at
1342 *
1343 *   http://www.apache.org/licenses/LICENSE-2.0
1344 *
1345 * Unless required by applicable law or agreed to in writing, software
1346 * distributed under the License is distributed on an "AS IS" BASIS,
1347 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1348 * See the License for the specific language governing permissions and
1349 * limitations under the License.
1350 */const Le="webStorageSupport";class qs{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=hn,this._completeRedirectFn=_s,this._overrideRedirectResult=ps}async _openPopup(e,t,r,i){k(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const s=await St(e,t,r,He(),i);return $s(e,s,Qe())}
1350async _openRedirect(e,t,r,i){await this._originValidation(e);const s=await St(e,t,r,He(),i);return Xi(s),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:i,promise:s}=this.eventManagers[t];return i?Promise.resolve(i):(k(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await Ms(e),r=new ys(e);return t.register("authEvent",i=>(h(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Le,{type:Le},i=>{const s=i?.[0]?.[Le];s!==void 0&&t(!!s),E(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Ts(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return nn()||Yt()||Ye()}}const Ks=qs;var Ct="@firebase/auth",At="1.11.1";/**
1351 * @license
1352 * Copyright 2020 Google LLC
1353 *
1354 * Licensed under the Apache License, Version 2.0 (the "License");
1355 * you may not use this file except in compliance with the License.
1356 * You may obtain a copy of the License at
1357 *
1358 *   http://www.apache.org/licenses/LICENSE-2.0
1359 *
1360 * Unless required by applicable law or agreed to in writing, software
1361 * distributed under the License is distributed on an "AS IS" BASIS,
1362 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1363 * See the License for the specific language governing permissions and
1364 * limitations under the License.
1365 */class Js{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){h(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1366 * @license
1367 * Copyright 2020 Google LLC
1368 *
1369 * Licensed under the Apache License, Version 2.0 (the "License");
1370 * you may not use this file except in compliance with the License.
1371 * You may obtain a copy of the License at
1372 *
1373 *   http://www.apache.org/licenses/LICENSE-2.0
1374 *
1375 * Unless required by applicable law or agreed to in writing, software
1376 * distributed under the License is distributed on an "AS IS" BASIS,
1377 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1378 * See the License for the specific language governing permissions and
1379 * limitations under the License.
1380 */function Ys(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Xs(n){te(new G("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;h(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:rn(n)},l=new Ri(r,i,s,c);return Ui(l,t),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),te(new G("auth-internal",e=>{const t=ve(e.getProvider("auth").getImmediate());return(r=>new Js(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),$(Ct,At,Ys(n)),$(Ct,At,"esm2020")}/**
1381 * @license
1382 * Copyright 2021 Google LLC
1383 *
1384 * Licensed under the Apache License, Version 2.0 (the "License");
1385 * you may not use this file except in compliance with the License.
1386 * You may obtain a copy of the License at
1387 *
1388 *   http://www.apache.org/licenses/LICENSE-2.0
1389 *
1390 * Unless required by applicable law or agreed to in writing, software
1391 * distributed under the License is distributed on an "AS IS" BASIS,
1392 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1393 * See the License for the specific language governing permissions and
1394 * limitations under the License.
1395 */const Zs=300,Qs=Lt("authIdTokenMaxAge")||Zs;let kt=null;const eo=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>Qs)return;const i=t?.token;kt!==i&&(kt=i,await fetch(n,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function to(n=Gr()){const e=Bt(n,"auth");if(e.isInitialized())return e.getImmediate();const t=Mi(n,{popupRedirectResolver:Ks,persistence:[os,Ki,hn]}),r=Lt("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=eo(s.toString());zi(t,o,()=>o(t.currentUser)),ji(t,a=>o(a))}}const i=kn("auth");return i&&xi(t,`http://${i}`),t}function no(){return document.getElementsByTagName("head")?.[0]??document}Oi({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=i=>{const s=y("internal-error");s.customData=i,t(s)},r.type="text/javascript",r.charset="UTF-8",no().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Xs("Browser");const ro=n=>{const e=Ft(n),t=to(e);return{signInWithGoogle:async()=>{const o=new T;return o.addScope("email"),(await Ne(t,o)).user},signInWithFacebook:async()=>{const o=new v;return o.addScope("email"),(await Ne(t,o)).user},signInWithApple:async()=>{const o=new ee("apple.com");return(await Ne(t,o)).user}}};export{ro as createFirebaseService};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.