UNPKG

70.4 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).firebase=t()}(this,(function(){"use strict";
2/**
3 * @license
4 * Copyright 2017 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18/**
19 * @license
20 * Copyright 2017 Google Inc.
21 *
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 * http://www.apache.org/licenses/LICENSE-2.0
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 */function e(t,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return n}for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(t[r],n[r]));return t}
34/**
35 * @license
36 * Copyright 2017 Google Inc.
37 *
38 * Licensed under the Apache License, Version 2.0 (the "License");
39 * you may not use this file except in compliance with the License.
40 * You may obtain a copy of the License at
41 *
42 * http://www.apache.org/licenses/LICENSE-2.0
43 *
44 * Unless required by applicable law or agreed to in writing, software
45 * distributed under the License is distributed on an "AS IS" BASIS,
46 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47 * See the License for the specific language governing permissions and
48 * limitations under the License.
49 */class t{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}
50/**
51 * @license
52 * Copyright 2017 Google Inc.
53 *
54 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
56 * You may obtain a copy of the License at
57 *
58 * http://www.apache.org/licenses/LICENSE-2.0
59 *
60 * Unless required by applicable law or agreed to in writing, software
61 * distributed under the License is distributed on an "AS IS" BASIS,
62 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63 * See the License for the specific language governing permissions and
64 * limitations under the License.
65 */class n extends Error{constructor(e,t){super(t),this.code=e,this.name="FirebaseError",Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,r.prototype.create)}}class r{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const r=t[0]||{},o=`${this.service}/${e}`,s=this.errors[e],a=s?function(e,t){return e.replace(i,(e,n)=>{const r=t[n];return null!=r?r.toString():`<${n}?>`})}(s,r):"Error",c=`${this.serviceName}: ${a} (${o}).`,u=new n(o,c);for(const e of Object.keys(r))"_"!==e.slice(-1)&&(e in u&&console.warn(`Overwriting FirebaseError base field "${e}" can cause unexpected behavior.`),u[e]=r[e]);return u}}const i=/\{\$([^}]+)}/g;
66/**
67 * @license
68 * Copyright 2017 Google Inc.
69 *
70 * Licensed under the Apache License, Version 2.0 (the "License");
71 * you may not use this file except in compliance with the License.
72 * You may obtain a copy of the License at
73 *
74 * http://www.apache.org/licenses/LICENSE-2.0
75 *
76 * Unless required by applicable law or agreed to in writing, software
77 * distributed under the License is distributed on an "AS IS" BASIS,
78 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
79 * See the License for the specific language governing permissions and
80 * limitations under the License.
81 */function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}class s{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}}
82/**
83 * @license
84 * Copyright 2019 Google Inc.
85 *
86 * Licensed under the Apache License, Version 2.0 (the "License");
87 * you may not use this file except in compliance with the License.
88 * You may obtain a copy of the License at
89 *
90 * http://www.apache.org/licenses/LICENSE-2.0
91 *
92 * Unless required by applicable law or agreed to in writing, software
93 * distributed under the License is distributed on an "AS IS" BASIS,
94 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95 * See the License for the specific language governing permissions and
96 * limitations under the License.
97 */
98/**
99 * @license
100 * Copyright 2019 Google Inc.
101 *
102 * Licensed under the Apache License, Version 2.0 (the "License");
103 * you may not use this file except in compliance with the License.
104 * You may obtain a copy of the License at
105 *
106 * http://www.apache.org/licenses/LICENSE-2.0
107 *
108 * Unless required by applicable law or agreed to in writing, software
109 * distributed under the License is distributed on an "AS IS" BASIS,
110 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111 * See the License for the specific language governing permissions and
112 * limitations under the License.
113 */
114class a{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}get(e="[DEFAULT]"){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const e=new t;this.instancesDeferred.set(n,e);try{const t=this.getOrInitializeService(n);t&&e.resolve(t)}catch(e){}}return this.instancesDeferred.get(n).promise}getImmediate(e){const{identifier:t,optional:n}=Object.assign({identifier:"[DEFAULT]",optional:!1},e),r=this.normalizeInstanceIdentifier(t);try{const e=this.getOrInitializeService(r);if(!e){if(n)return null;throw Error(`Service ${this.name} is not available`)}return e}catch(e){if(n)return null;throw e}}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,function(e){return"EAGER"===e.instantiationMode}
115/**
116 * @license
117 * Copyright 2019 Google Inc.
118 *
119 * Licensed under the Apache License, Version 2.0 (the "License");
120 * you may not use this file except in compliance with the License.
121 * You may obtain a copy of the License at
122 *
123 * http://www.apache.org/licenses/LICENSE-2.0
124 *
125 * Unless required by applicable law or agreed to in writing, software
126 * distributed under the License is distributed on an "AS IS" BASIS,
127 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128 * See the License for the specific language governing permissions and
129 * limitations under the License.
130 */(e))try{this.getOrInitializeService("[DEFAULT]")}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService(n);t.resolve(e)}catch(e){}}}clearInstance(e="[DEFAULT]"){this.instancesDeferred.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all(e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()))}isComponentSet(){return null!=this.component}getOrInitializeService(e){let t=this.instances.get(e);return!t&&this.component&&(t=this.component.instanceFactory(this.container,function(e){return"[DEFAULT]"===e?void 0:e}(e)),this.instances.set(e,t)),t||null}normalizeInstanceIdentifier(e){return this.component?this.component.multipleInstances?e:"[DEFAULT]":e}}class c{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 a(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}
131/**
132 * @license
133 * Copyright 2017 Google Inc.
134 *
135 * Licensed under the Apache License, Version 2.0 (the "License");
136 * you may not use this file except in compliance with the License.
137 * You may obtain a copy of the License at
138 *
139 * http://www.apache.org/licenses/LICENSE-2.0
140 *
141 * Unless required by applicable law or agreed to in writing, software
142 * distributed under the License is distributed on an "AS IS" BASIS,
143 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
144 * See the License for the specific language governing permissions and
145 * limitations under the License.
146 */const u=[];var l;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(l||(l={}));const p={debug:l.DEBUG,verbose:l.VERBOSE,info:l.INFO,warn:l.WARN,error:l.ERROR,silent:l.SILENT},f=l.INFO,h={[l.DEBUG]:"log",[l.VERBOSE]:"log",[l.INFO]:"info",[l.WARN]:"warn",[l.ERROR]:"error"},d=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),i=h[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${r}] ${e.name}:`,...n)};class g{constructor(e){this.name=e,this._logLevel=f,this._logHandler=d,this._userLogHandler=null,u.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in l))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,l.DEBUG,...e),this._logHandler(this,l.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,l.VERBOSE,...e),this._logHandler(this,l.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,l.INFO,...e),this._logHandler(this,l.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,l.WARN,...e),this._logHandler(this,l.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,l.ERROR,...e),this._logHandler(this,l.ERROR,...e)}}function m(e){const t="string"==typeof e?p[e]:e;u.forEach(e=>{e.logLevel=t})}
147/**
148 * @license
149 * Copyright 2019 Google Inc.
150 *
151 * Licensed under the Apache License, Version 2.0 (the "License");
152 * you may not use this file except in compliance with the License.
153 * You may obtain a copy of the License at
154 *
155 * http://www.apache.org/licenses/LICENSE-2.0
156 *
157 * Unless required by applicable law or agreed to in writing, software
158 * distributed under the License is distributed on an "AS IS" BASIS,
159 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
160 * See the License for the specific language governing permissions and
161 * limitations under the License.
162 */
163const b=new r("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists","app-deleted":"Firebase App named '{$appName}' already deleted","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function."}),w={"@firebase/app":"fire-core","@firebase/analytics":"fire-analytics","@firebase/auth":"fire-auth","@firebase/database":"fire-rtdb","@firebase/functions":"fire-fn","@firebase/installations":"fire-iid","@firebase/messaging":"fire-fcm","@firebase/performance":"fire-perf","@firebase/remote-config":"fire-rc","@firebase/storage":"fire-gcs","@firebase/firestore":"fire-fst","fire-js":"fire-js","firebase-wrapper":"fire-js-all"};
164/**
165 * @license
166 * Copyright 2019 Google Inc.
167 *
168 * Licensed under the Apache License, Version 2.0 (the "License");
169 * you may not use this file except in compliance with the License.
170 * You may obtain a copy of the License at
171 *
172 * http://www.apache.org/licenses/LICENSE-2.0
173 *
174 * Unless required by applicable law or agreed to in writing, software
175 * distributed under the License is distributed on an "AS IS" BASIS,
176 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
177 * See the License for the specific language governing permissions and
178 * limitations under the License.
179 */
180class v{constructor(t,n,r){this.firebase_=r,this.isDeleted_=!1,this.INTERNAL={},this.name_=n.name,this.automaticDataCollectionEnabled_=n.automaticDataCollectionEnabled||!1,this.options_=e(void 0,t),this.container=new c(n.name),this.container.addComponent(new s("app",()=>this,"PUBLIC"));for(const e of this.firebase_.INTERNAL.components.values())this.container.addComponent(e)}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_}delete(){return new Promise(e=>{this.checkDestroyed_(),e()}).then(()=>(this.firebase_.INTERNAL.removeApp(this.name_),Promise.all(this.container.getProviders().map(e=>e.delete())))).then(()=>{this.isDeleted_=!0})}_getService(e,t="[DEFAULT]"){return this.checkDestroyed_(),this.container.getProvider(e).getImmediate({identifier:t})}checkDestroyed_(){if(this.isDeleted_)throw b.create("app-deleted",{appName:this.name_})}}const y=new g("@firebase/app");
181/**
182 * @license
183 * Copyright 2019 Google Inc.
184 *
185 * Licensed under the Apache License, Version 2.0 (the "License");
186 * you may not use this file except in compliance with the License.
187 * You may obtain a copy of the License at
188 *
189 * http://www.apache.org/licenses/LICENSE-2.0
190 *
191 * Unless required by applicable law or agreed to in writing, software
192 * distributed under the License is distributed on an "AS IS" BASIS,
193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194 * See the License for the specific language governing permissions and
195 * limitations under the License.
196 */
197/**
198 * @license
199 * Copyright 2019 Google Inc.
200 *
201 * Licensed under the Apache License, Version 2.0 (the "License");
202 * you may not use this file except in compliance with the License.
203 * You may obtain a copy of the License at
204 *
205 * http://www.apache.org/licenses/LICENSE-2.0
206 *
207 * Unless required by applicable law or agreed to in writing, software
208 * distributed under the License is distributed on an "AS IS" BASIS,
209 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
210 * See the License for the specific language governing permissions and
211 * limitations under the License.
212 */
213function _(t){const n={},r=new Map,i={__esModule:!0,initializeApp:function(e,r={}){if("object"!=typeof r||null===r){r={name:r}}const s=r;void 0===s.name&&(s.name="[DEFAULT]");const{name:a}=s;if("string"!=typeof a||!a)throw b.create("bad-app-name",{appName:String(a)});if(o(n,a))throw b.create("duplicate-app",{appName:a});const c=new t(e,s,i);return n[a]=c,c},app:a,registerVersion:function(e,t,n){var r;let i=null!==(r=w[e])&&void 0!==r?r:e;n&&(i+=`-${n}`);const o=i.match(/\s|\//),a=t.match(/\s|\//);if(o||a){const e=[`Unable to register library "${i}" with version "${t}":`];return o&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),o&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void y.warn(e.join(" "))}c(new s(`${i}-version`,()=>({library:i,version:t}),"VERSION"))},setLogLevel:m,onLog:function(e,t){if(null!==e&&"function"!=typeof e)throw b.create("invalid-log-argument",{appName:name});!function(e,t){for(const n of u){let r=null;t&&t.level&&(r=p[t.level]),n.userLogHandler=null===e?null:(t,n,...i)=>{const o=i.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");n>=(null!=r?r:t.logLevel)&&e({level:l[n].toLowerCase(),message:o,args:i,type:t.name})}}}(e,t)},apps:null,SDK_VERSION:"7.13.1",INTERNAL:{registerComponent:c,removeApp:function(e){delete n[e]},components:r,useAsService:function(e,t){if("serverAuth"===t)return null;return t}}};function a(e){if(!o(n,e=e||"[DEFAULT]"))throw b.create("no-app",{appName:e});return n[e]}function c(o){const s=o.name;if(r.has(s))return y.debug(`There were multiple attempts to register component ${s}.`),"PUBLIC"===o.type?i[s]:null;if(r.set(s,o),"PUBLIC"===o.type){const n=(e=a())=>{if("function"!=typeof e[s])throw b.create("invalid-app-argument",{appName:s});return e[s]()};void 0!==o.serviceProps&&e(n,o.serviceProps),i[s]=n,t.prototype[s]=function(...e){return this._getService.bind(this,s).apply(this,o.multipleInstances?e:[])}}for(const e of Object.keys(n))n[e]._addComponent(o);return"PUBLIC"===o.type?i[s]:null}return i.default=i,Object.defineProperty(i,"apps",{get:function(){return Object.keys(n).map(e=>n[e])}}),a.App=t,i}
214/**
215 * @license
216 * Copyright 2019 Google Inc.
217 *
218 * Licensed under the Apache License, Version 2.0 (the "License");
219 * you may not use this file except in compliance with the License.
220 * You may obtain a copy of the License at
221 *
222 * http://www.apache.org/licenses/LICENSE-2.0
223 *
224 * Unless required by applicable law or agreed to in writing, software
225 * distributed under the License is distributed on an "AS IS" BASIS,
226 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
227 * See the License for the specific language governing permissions and
228 * limitations under the License.
229 */
230/**
231 * @license
232 * Copyright 2019 Google Inc.
233 *
234 * Licensed under the Apache License, Version 2.0 (the "License");
235 * you may not use this file except in compliance with the License.
236 * You may obtain a copy of the License at
237 *
238 * http://www.apache.org/licenses/LICENSE-2.0
239 *
240 * Unless required by applicable law or agreed to in writing, software
241 * distributed under the License is distributed on an "AS IS" BASIS,
242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
243 * See the License for the specific language governing permissions and
244 * limitations under the License.
245 */
246class I{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}
247/**
248 * @license
249 * Copyright 2019 Google Inc.
250 *
251 * Licensed under the Apache License, Version 2.0 (the "License");
252 * you may not use this file except in compliance with the License.
253 * You may obtain a copy of the License at
254 *
255 * http://www.apache.org/licenses/LICENSE-2.0
256 *
257 * Unless required by applicable law or agreed to in writing, software
258 * distributed under the License is distributed on an "AS IS" BASIS,
259 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
260 * See the License for the specific language governing permissions and
261 * limitations under the License.
262 */(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}
263/**
264 * @license
265 * Copyright 2019 Google Inc.
266 *
267 * Licensed under the Apache License, Version 2.0 (the "License");
268 * you may not use this file except in compliance with the License.
269 * You may obtain a copy of the License at
270 *
271 * http://www.apache.org/licenses/LICENSE-2.0
272 *
273 * Unless required by applicable law or agreed to in writing, software
274 * distributed under the License is distributed on an "AS IS" BASIS,
275 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
276 * See the License for the specific language governing permissions and
277 * limitations under the License.
278 */
279const E=function(){const e=_(v);e.SDK_VERSION=`${e.SDK_VERSION}_LITE`;const t=e.INTERNAL.registerComponent;return e.INTERNAL.registerComponent=function(e){if("PUBLIC"===e.type&&"performance"!==e.name&&"installations"!==e.name)throw Error(`${name} cannot register with the standalone perf instance`);return t(e)},e}();function S(e){return Array.prototype.slice.call(e)}function T(e){return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function A(e,t,n){var r,i=new Promise((function(i,o){T(r=e[t].apply(e,n)).then(i,o)}));return i.request=r,i}function N(e,t,n){var r=A(e,t,n);return r.then((function(e){if(e)return new D(e,r.request)}))}function O(e,t,n){n.forEach((function(n){Object.defineProperty(e.prototype,n,{get:function(){return this[t][n]},set:function(e){this[t][n]=e}})}))}function C(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return A(this[t],r,arguments)})}))}function k(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return this[t][r].apply(this[t],arguments)})}))}function P(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return N(this[t],r,arguments)})}))}function L(e){this._index=e}function D(e,t){this._cursor=e,this._request=t}function R(e){this._store=e}function j(e){this._tx=e,this.complete=new Promise((function(t,n){e.oncomplete=function(){t()},e.onerror=function(){n(e.error)},e.onabort=function(){n(e.error)}}))}function M(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new j(n)}function $(e){this._db=e}!function(e,t){e.INTERNAL.registerComponent(new s("platform-logger",e=>new I(e),"PRIVATE")),e.registerVersion("@firebase/app","0.6.0",t),e.registerVersion("fire-js","")}(E,"lite"),O(L,"_index",["name","keyPath","multiEntry","unique"]),C(L,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),P(L,"_index",IDBIndex,["openCursor","openKeyCursor"]),O(D,"_cursor",["direction","key","primaryKey","value"]),C(D,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach((function(e){e in IDBCursor.prototype&&(D.prototype[e]=function(){var t=this,n=arguments;return Promise.resolve().then((function(){return t._cursor[e].apply(t._cursor,n),T(t._request).then((function(e){if(e)return new D(e,t._request)}))}))})})),R.prototype.createIndex=function(){return new L(this._store.createIndex.apply(this._store,arguments))},R.prototype.index=function(){return new L(this._store.index.apply(this._store,arguments))},O(R,"_store",["name","keyPath","indexNames","autoIncrement"]),C(R,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),P(R,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),k(R,"_store",IDBObjectStore,["deleteIndex"]),j.prototype.objectStore=function(){return new R(this._tx.objectStore.apply(this._tx,arguments))},O(j,"_tx",["objectStoreNames","mode"]),k(j,"_tx",IDBTransaction,["abort"]),M.prototype.createObjectStore=function(){return new R(this._db.createObjectStore.apply(this._db,arguments))},O(M,"_db",["name","version","objectStoreNames"]),k(M,"_db",IDBDatabase,["deleteObjectStore","close"]),$.prototype.transaction=function(){return new j(this._db.transaction.apply(this._db,arguments))},O($,"_db",["name","version","objectStoreNames"]),k($,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach((function(e){[R,L].forEach((function(t){e in t.prototype&&(t.prototype[e.replace("open","iterate")]=function(){var t=S(arguments),n=t[t.length-1],r=this._store||this._index,i=r[e].apply(r,t.slice(0,-1));i.onsuccess=function(){n(i.result)}})}))})),[L,R].forEach((function(e){e.prototype.getAll||(e.prototype.getAll=function(e,t){var n=this,r=[];return new Promise((function(i){n.iterateCursor(e,(function(e){e?(r.push(e.value),void 0===t||r.length!=t?e.continue():i(r)):i(r)}))}))})}));const B=new r("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function F(e){return e instanceof n&&e.code.includes("request-failed")}
280/**
281 * @license
282 * Copyright 2019 Google Inc.
283 *
284 * Licensed under the Apache License, Version 2.0 (the "License");
285 * you may not use this file except in compliance with the License.
286 * You may obtain a copy of the License at
287 *
288 * http://www.apache.org/licenses/LICENSE-2.0
289 *
290 * Unless required by applicable law or agreed to in writing, software
291 * distributed under the License is distributed on an "AS IS" BASIS,
292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
293 * See the License for the specific language governing permissions and
294 * limitations under the License.
295 */function U({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function q(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function x(e,t){const n=(await t.json()).error;return B.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function H({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function V(e,{refreshToken:t}){const n=H(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}
296/**
297 * @license
298 * Copyright 2019 Google Inc.
299 *
300 * Licensed under the Apache License, Version 2.0 (the "License");
301 * you may not use this file except in compliance with the License.
302 * You may obtain a copy of the License at
303 *
304 * http://www.apache.org/licenses/LICENSE-2.0
305 *
306 * Unless required by applicable law or agreed to in writing, software
307 * distributed under the License is distributed on an "AS IS" BASIS,
308 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
309 * See the License for the specific language governing permissions and
310 * limitations under the License.
311 */(t)),n}async function K(e){const t=await e();return t.status>=500&&t.status<600?e():t}
312/**
313 * @license
314 * Copyright 2019 Google Inc.
315 *
316 * Licensed under the Apache License, Version 2.0 (the "License");
317 * you may not use this file except in compliance with the License.
318 * You may obtain a copy of the License at
319 *
320 * http://www.apache.org/licenses/LICENSE-2.0
321 *
322 * Unless required by applicable law or agreed to in writing, software
323 * distributed under the License is distributed on an "AS IS" BASIS,
324 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
325 * See the License for the specific language governing permissions and
326 * limitations under the License.
327 */
328function z(e){return new Promise(t=>{setTimeout(t,e)})}
329/**
330 * @license
331 * Copyright 2019 Google Inc.
332 *
333 * Licensed under the Apache License, Version 2.0 (the "License");
334 * you may not use this file except in compliance with the License.
335 * You may obtain a copy of the License at
336 *
337 * http://www.apache.org/licenses/LICENSE-2.0
338 *
339 * Unless required by applicable law or agreed to in writing, software
340 * distributed under the License is distributed on an "AS IS" BASIS,
341 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
342 * See the License for the specific language governing permissions and
343 * limitations under the License.
344 */
345/**
346 * @license
347 * Copyright 2019 Google Inc.
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 */
361const W=/^[cdef][\w-]{21}$/;function J(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}
362/**
363 * @license
364 * Copyright 2019 Google Inc.
365 *
366 * Licensed under the Apache License, Version 2.0 (the "License");
367 * you may not use this file except in compliance with the License.
368 * You may obtain a copy of the License at
369 *
370 * http://www.apache.org/licenses/LICENSE-2.0
371 *
372 * Unless required by applicable law or agreed to in writing, software
373 * distributed under the License is distributed on an "AS IS" BASIS,
374 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
375 * See the License for the specific language governing permissions and
376 * limitations under the License.
377 */(e);return W.test(t)?t:""}catch(e){return""}}function G(e){return`${e.appName}!${e.appId}`}
378/**
379 * @license
380 * Copyright 2019 Google Inc.
381 *
382 * Licensed under the Apache License, Version 2.0 (the "License");
383 * you may not use this file except in compliance with the License.
384 * You may obtain a copy of the License at
385 *
386 * http://www.apache.org/licenses/LICENSE-2.0
387 *
388 * Unless required by applicable law or agreed to in writing, software
389 * distributed under the License is distributed on an "AS IS" BASIS,
390 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
391 * See the License for the specific language governing permissions and
392 * limitations under the License.
393 */const Z=new Map;function Y(e,t){const n=G(e);Q(n,t),function(e,t){const n=ee();n&&n.postMessage({key:e,fid:t});te()}(n,t)}function Q(e,t){const n=Z.get(e);if(n)for(const e of n)e(t)}let X=null;function ee(){return!X&&"BroadcastChannel"in self&&(X=new BroadcastChannel("[Firebase] FID Change"),X.onmessage=e=>{Q(e.data.key,e.data.fid)}),X}function te(){0===Z.size&&X&&(X.close(),X=null)}
394/**
395 * @license
396 * Copyright 2019 Google Inc.
397 *
398 * Licensed under the Apache License, Version 2.0 (the "License");
399 * you may not use this file except in compliance with the License.
400 * You may obtain a copy of the License at
401 *
402 * http://www.apache.org/licenses/LICENSE-2.0
403 *
404 * Unless required by applicable law or agreed to in writing, software
405 * distributed under the License is distributed on an "AS IS" BASIS,
406 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
407 * See the License for the specific language governing permissions and
408 * limitations under the License.
409 */const ne="firebase-installations-store";let re=null;function ie(){return re||(re=function(e,t,n){var r=A(indexedDB,"open",[e,t]),i=r.request;return i&&(i.onupgradeneeded=function(e){n&&n(new M(i.result,e.oldVersion,i.transaction))}),r.then((function(e){return new $(e)}))}("firebase-installations-database",1,e=>{switch(e.oldVersion){case 0:e.createObjectStore(ne)}})),re}async function oe(e,t){const n=G(e),r=(await ie()).transaction(ne,"readwrite"),i=r.objectStore(ne),o=await i.get(n);return await i.put(t,n),await r.complete,o&&o.fid===t.fid||Y(e,t.fid),t}async function se(e){const t=G(e),n=(await ie()).transaction(ne,"readwrite");await n.objectStore(ne).delete(t),await n.complete}async function ae(e,t){const n=G(e),r=(await ie()).transaction(ne,"readwrite"),i=r.objectStore(ne),o=await i.get(n),s=t(o);return void 0===s?await i.delete(n):await i.put(s,n),await r.complete,!s||o&&o.fid===s.fid||Y(e,s.fid),s}
410/**
411 * @license
412 * Copyright 2019 Google Inc.
413 *
414 * Licensed under the Apache License, Version 2.0 (the "License");
415 * you may not use this file except in compliance with the License.
416 * You may obtain a copy of the License at
417 *
418 * http://www.apache.org/licenses/LICENSE-2.0
419 *
420 * Unless required by applicable law or agreed to in writing, software
421 * distributed under the License is distributed on an "AS IS" BASIS,
422 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
423 * See the License for the specific language governing permissions and
424 * limitations under the License.
425 */async function ce(e){let t;const n=await ae(e,n=>{const r=function(e){return pe(e||{fid:J(),registrationStatus:0})}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){const e=Promise.reject(B.create("app-offline"));return{installationEntry:t,registrationPromise:e}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(e,t){try{const n=await async function(e,{fid:t}){const n=U(e),r=H(e),i={fid:t,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.4.6"},o={method:"POST",headers:r,body:JSON.stringify(i)},s=await K(()=>fetch(n,o));if(s.ok){const e=await s.json();return{fid:e.fid||t,registrationStatus:2,refreshToken:e.refreshToken,authToken:q(e.authToken)}}throw await x("Create Installation",s)}(e,t);return oe(e,n)}catch(n){throw F(n)&&409===n.serverCode?await se(e):await oe(e,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:ue(e)}:{installationEntry:t}}(e,r);return t=i.registrationPromise,i.installationEntry});return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function ue(e){let t=await le(e);for(;1===t.registrationStatus;)await z(100),t=await le(e);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await ce(e);return n||t}return t}function le(e){return ae(e,e=>{if(!e)throw B.create("installation-not-found");return pe(e)})}function pe(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t;
426/**
427 * @license
428 * Copyright 2019 Google Inc.
429 *
430 * Licensed under the Apache License, Version 2.0 (the "License");
431 * you may not use this file except in compliance with the License.
432 * You may obtain a copy of the License at
433 *
434 * http://www.apache.org/licenses/LICENSE-2.0
435 *
436 * Unless required by applicable law or agreed to in writing, software
437 * distributed under the License is distributed on an "AS IS" BASIS,
438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
439 * See the License for the specific language governing permissions and
440 * limitations under the License.
441 */}async function fe({appConfig:e,platformLoggerProvider:t},n){const r=function(e,{fid:t}){return`${U(e)}/${t}/authTokens:generate`}
442/**
443 * @license
444 * Copyright 2019 Google Inc.
445 *
446 * Licensed under the Apache License, Version 2.0 (the "License");
447 * you may not use this file except in compliance with the License.
448 * You may obtain a copy of the License at
449 *
450 * http://www.apache.org/licenses/LICENSE-2.0
451 *
452 * Unless required by applicable law or agreed to in writing, software
453 * distributed under the License is distributed on an "AS IS" BASIS,
454 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
455 * See the License for the specific language governing permissions and
456 * limitations under the License.
457 */(e,n),i=V(e,n),o=t.getImmediate({optional:!0});o&&i.append("x-firebase-client",o.getPlatformInfoString());const s={installation:{sdkVersion:"w:0.4.6"}},a={method:"POST",headers:i,body:JSON.stringify(s)},c=await K(()=>fetch(r,a));if(c.ok){return q(await c.json())}throw await x("Generate Auth Token",c)}async function he(e,t=!1){let n;const r=await ae(e.appConfig,r=>{if(!ge(r))throw B.create("not-registered");const i=r.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(i))return r;if(1===i.requestStatus)return n=async function(e,t){let n=await de(e.appConfig);for(;1===n.authToken.requestStatus;)await z(100),n=await de(e.appConfig);const r=n.authToken;return 0===r.requestStatus?he(e,t):r}(e,t),r;{if(!navigator.onLine)throw B.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(r);return n=async function(e,t){try{const n=await fe(e,t),r=Object.assign(Object.assign({},t),{authToken:n});return await oe(e.appConfig,r),n}catch(n){if(!F(n)||401!==n.serverCode&&404!==n.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await oe(e.appConfig,n)}else await se(e.appConfig);throw n}}(e,t),t}});return n?await n:r.authToken}function de(e){return ae(e,e=>{if(!ge(e))throw B.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n;
458/**
459 * @license
460 * Copyright 2019 Google Inc.
461 *
462 * Licensed under the Apache License, Version 2.0 (the "License");
463 * you may not use this file except in compliance with the License.
464 * You may obtain a copy of the License at
465 *
466 * http://www.apache.org/licenses/LICENSE-2.0
467 *
468 * Unless required by applicable law or agreed to in writing, software
469 * distributed under the License is distributed on an "AS IS" BASIS,
470 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
471 * See the License for the specific language governing permissions and
472 * limitations under the License.
473 */})}function ge(e){return void 0!==e&&2===e.registrationStatus}
474/**
475 * @license
476 * Copyright 2019 Google Inc.
477 *
478 * Licensed under the Apache License, Version 2.0 (the "License");
479 * you may not use this file except in compliance with the License.
480 * You may obtain a copy of the License at
481 *
482 * http://www.apache.org/licenses/LICENSE-2.0
483 *
484 * Unless required by applicable law or agreed to in writing, software
485 * distributed under the License is distributed on an "AS IS" BASIS,
486 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
487 * See the License for the specific language governing permissions and
488 * limitations under the License.
489 */
490async function me(e,t=!1){return await async function(e){const{registrationPromise:t}=await ce(e);t&&await t}
491/**
492 * @license
493 * Copyright 2019 Google Inc.
494 *
495 * Licensed under the Apache License, Version 2.0 (the "License");
496 * you may not use this file except in compliance with the License.
497 * You may obtain a copy of the License at
498 *
499 * http://www.apache.org/licenses/LICENSE-2.0
500 *
501 * Unless required by applicable law or agreed to in writing, software
502 * distributed under the License is distributed on an "AS IS" BASIS,
503 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
504 * See the License for the specific language governing permissions and
505 * limitations under the License.
506 */(e.appConfig),(await he(e,t)).token}async function be(e,t){const n=function(e,{fid:t}){return`${U(e)}/${t}`}
507/**
508 * @license
509 * Copyright 2019 Google Inc.
510 *
511 * Licensed under the Apache License, Version 2.0 (the "License");
512 * you may not use this file except in compliance with the License.
513 * You may obtain a copy of the License at
514 *
515 * http://www.apache.org/licenses/LICENSE-2.0
516 *
517 * Unless required by applicable law or agreed to in writing, software
518 * distributed under the License is distributed on an "AS IS" BASIS,
519 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
520 * See the License for the specific language governing permissions and
521 * limitations under the License.
522 */(e,t),r={method:"DELETE",headers:V(e,t)},i=await K(()=>fetch(n,r));if(!i.ok)throw await x("Delete Installation",i)}
523/**
524 * @license
525 * Copyright 2019 Google Inc.
526 *
527 * Licensed under the Apache License, Version 2.0 (the "License");
528 * you may not use this file except in compliance with the License.
529 * You may obtain a copy of the License at
530 *
531 * http://www.apache.org/licenses/LICENSE-2.0
532 *
533 * Unless required by applicable law or agreed to in writing, software
534 * distributed under the License is distributed on an "AS IS" BASIS,
535 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
536 * See the License for the specific language governing permissions and
537 * limitations under the License.
538 */
539function we({appConfig:e},t){return function(e,t){ee();const n=G(e);let r=Z.get(n);r||(r=new Set,Z.set(n,r)),r.add(t)}(e,t),()=>{!function(e,t){const n=G(e),r=Z.get(n);r&&(r.delete(t),0===r.size&&Z.delete(n),te())}(e,t)}}
540/**
541 * @license
542 * Copyright 2019 Google Inc.
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 */function ve(e){return B.create("missing-app-config-values",{valueName:e})}
556/**
557 * @license
558 * Copyright 2019 Google Inc.
559 *
560 * Licensed under the Apache License, Version 2.0 (the "License");
561 * you may not use this file except in compliance with the License.
562 * You may obtain a copy of the License at
563 *
564 * http://www.apache.org/licenses/LICENSE-2.0
565 *
566 * Unless required by applicable law or agreed to in writing, software
567 * distributed under the License is distributed on an "AS IS" BASIS,
568 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
569 * See the License for the specific language governing permissions and
570 * limitations under the License.
571 */var ye;(ye=E).INTERNAL.registerComponent(new s("installations",e=>{const t=e.getProvider("app").getImmediate(),n={appConfig:function(e){if(!e||!e.options)throw ve("App Configuration");if(!e.name)throw ve("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ve(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),platformLoggerProvider:e.getProvider("platform-logger")};return{app:t,getId:()=>async function(e){const{installationEntry:t,registrationPromise:n}=await ce(e.appConfig);return n?n.catch(console.error):he(e).catch(console.error),t.fid}(n),getToken:e=>me(n,e),delete:()=>async function(e){const{appConfig:t}=e,n=await ae(t,e=>{if(!e||0!==e.registrationStatus)return e});if(n){if(1===n.registrationStatus)throw B.create("delete-pending-registration");if(2===n.registrationStatus){if(!navigator.onLine)throw B.create("app-offline");await be(t,n),await se(t)}}}(n),onIdChange:e=>we(n,e)}},"PUBLIC")),ye.registerVersion("@firebase/installations","0.4.6");const _e=new r("performance","Performance",{"trace started":"Trace {$traceName} was started before.","trace stopped":"Trace {$traceName} is not running.","no window":"Window is not available.","no app id":"App id is not available.","no project id":"Project id is not available.","no api key":"Api key is not available.","invalid cc log":"Attempted to queue invalid cc event","FB not default":"Performance can only start when Firebase app instance is the default one.","RC response not ok":"RC response is not ok","invalid attribute name":"Attribute name {$attributeName} is invalid.","invalid attribute value":"Attribute value {$attributeValue} is invalid.","invalide custom metric name":"Custom metric name {$customMetricName} is invalid"});
572/**
573 * @license
574 * Copyright 2019 Google Inc.
575 *
576 * Licensed under the Apache License, Version 2.0 (the "License");
577 * you may not use this file except in compliance with the License.
578 * You may obtain a copy of the License at
579 *
580 * http://www.apache.org/licenses/LICENSE-2.0
581 *
582 * Unless required by applicable law or agreed to in writing, software
583 * distributed under the License is distributed on an "AS IS" BASIS,
584 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
585 * See the License for the specific language governing permissions and
586 * limitations under the License.
587 */
588let Ie,Ee,Se,Te;class Ae{constructor(e){if(this.window=e,!e)throw _e.create("no window");this.performance=e.performance,this.PerformanceObserver=e.PerformanceObserver,this.windowLocation=e.location,this.navigator=e.navigator,this.document=e.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=e.localStorage),e.perfMetrics&&e.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=e.perfMetrics.onFirstInputDelay)}getUrl(){return this.windowLocation.href.split("?")[0]}mark(e){this.performance&&this.performance.mark&&this.performance.mark(e)}measure(e,t,n){this.performance&&this.performance.measure&&this.performance.measure(e,t,n)}getEntriesByType(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]}getEntriesByName(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]}getTimeOrigin(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)}requiredApisAvailable(){return!!(fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled)}setupObserver(e,t){if(!this.PerformanceObserver)return;new this.PerformanceObserver(e=>{for(const n of e.getEntries())t(n)}).observe({entryTypes:[e]})}static getInstance(){return void 0===Ie&&(Ie=new Ae(Ee)),Ie}}class Ne{constructor(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}getAppId(){const e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!e)throw _e.create("no app id");return e}getProjectId(){const e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!e)throw _e.create("no project id");return e}getApiKey(){const e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!e)throw _e.create("no api key");return e}static getInstance(){return void 0===Se&&(Se=new Ne),Se}}
589/**
590 * @license
591 * Copyright 2019 Google Inc.
592 *
593 * Licensed under the Apache License, Version 2.0 (the "License");
594 * you may not use this file except in compliance with the License.
595 * You may obtain a copy of the License at
596 *
597 * http://www.apache.org/licenses/LICENSE-2.0
598 *
599 * Unless required by applicable law or agreed to in writing, software
600 * distributed under the License is distributed on an "AS IS" BASIS,
601 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
602 * See the License for the specific language governing permissions and
603 * limitations under the License.
604 */function Oe(){return Te}
605/**
606 * @license
607 * Copyright 2019 Google Inc.
608 *
609 * Licensed under the Apache License, Version 2.0 (the "License");
610 * you may not use this file except in compliance with the License.
611 * You may obtain a copy of the License at
612 *
613 * http://www.apache.org/licenses/LICENSE-2.0
614 *
615 * Unless required by applicable law or agreed to in writing, software
616 * distributed under the License is distributed on an "AS IS" BASIS,
617 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
618 * See the License for the specific language governing permissions and
619 * limitations under the License.
620 */
621var Ce;!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.VISIBLE=1]="VISIBLE",e[e.HIDDEN=2]="HIDDEN"}(Ce||(Ce={}));const ke=["firebase_","google_","ga_"],Pe=new RegExp("^[a-zA-Z]\\w*$");function Le(){const e=Ae.getInstance().navigator;return"serviceWorker"in e?e.serviceWorker.controller?2:3:1}function De(){switch(Ae.getInstance().document.visibilityState){case"visible":return Ce.VISIBLE;case"hidden":return Ce.HIDDEN;default:return Ce.UNKNOWN}}function Re(){const e=Ae.getInstance().navigator.connection;switch(e&&e.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}
622/**
623 * @license
624 * Copyright 2019 Google Inc.
625 *
626 * Licensed under the Apache License, Version 2.0 (the "License");
627 * you may not use this file except in compliance with the License.
628 * You may obtain a copy of the License at
629 *
630 * http://www.apache.org/licenses/LICENSE-2.0
631 *
632 * Unless required by applicable law or agreed to in writing, software
633 * distributed under the License is distributed on an "AS IS" BASIS,
634 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
635 * See the License for the specific language governing permissions and
636 * limitations under the License.
637 */
638const je=new g("Performance");je.logLevel=l.INFO;
639/**
640 * @license
641 * Copyright 2019 Google Inc.
642 *
643 * Licensed under the Apache License, Version 2.0 (the "License");
644 * you may not use this file except in compliance with the License.
645 * You may obtain a copy of the License at
646 *
647 * http://www.apache.org/licenses/LICENSE-2.0
648 *
649 * Unless required by applicable law or agreed to in writing, software
650 * distributed under the License is distributed on an "AS IS" BASIS,
651 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
652 * See the License for the specific language governing permissions and
653 * limitations under the License.
654 */
655const Me=!0;function $e(e){const t=function(){const e=Ae.getInstance().localStorage;if(!e)return;const t=e.getItem("@firebase/performance/configexpire");if(!(t&&(n=t,Number(n)>Date.now())))return;var n;const r=e.getItem("@firebase/performance/config");if(!r)return;try{return JSON.parse(r)}catch(e){return}}();return t?(Be(t),Promise.resolve()):function(e){return function(){const e=Ne.getInstance().installationsService.getToken();return e.then(e=>{}),e}().then(t=>{const n=`https://firebaseremoteconfig.googleapis.com/v1/projects/${Ne.getInstance().getProjectId()}/namespaces/fireperf:fetch?key=${Ne.getInstance().getApiKey()}`,r=new Request(n,{method:"POST",headers:{Authorization:`FIREBASE_INSTALLATIONS_AUTH ${t}`},body:JSON.stringify({app_instance_id:e,app_instance_id_token:t,app_id:Ne.getInstance().getAppId(),app_version:"0.2.36",sdk_version:"0.0.1"})});return fetch(r).then(e=>{if(e.ok)return e.json();throw _e.create("RC response not ok")})}).catch(()=>{je.info("Could not fetch config, will use default configs")})}(e).then(e=>Be(e)).then(e=>function(e){const t=Ae.getInstance().localStorage;if(!e||!t)return;t.setItem("@firebase/performance/config",JSON.stringify(e)),t.setItem("@firebase/performance/configexpire",String(Date.now()+60*Ne.getInstance().configTimeToLive*60*1e3))}(e),()=>{})}function Be(e){if(!e)return e;const t=Ne.getInstance(),n=e.entries||{};return void 0!==n.fpr_enabled?t.loggingEnabled="true"===String(n.fpr_enabled):t.loggingEnabled=Me,n.fpr_log_source&&(t.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(t.logEndPointUrl=n.fpr_log_endpoint_url),void 0!==n.fpr_vc_network_request_sampling_rate&&(t.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(t.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),t.logTraceAfterSampling=Fe(t.tracesSamplingRate),t.logNetworkAfterSampling=Fe(t.networkRequestsSamplingRate),e}function Fe(e){return Math.random()<=e}
656/**
657 * @license
658 * Copyright 2019 Google Inc.
659 *
660 * Licensed under the Apache License, Version 2.0 (the "License");
661 * you may not use this file except in compliance with the License.
662 * You may obtain a copy of the License at
663 *
664 * http://www.apache.org/licenses/LICENSE-2.0
665 *
666 * Unless required by applicable law or agreed to in writing, software
667 * distributed under the License is distributed on an "AS IS" BASIS,
668 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
669 * See the License for the specific language governing permissions and
670 * limitations under the License.
671 */let Ue,qe=1;function xe(){return qe=2,Ue=Ue||function(){const e=Ae.getInstance().document;return new Promise(t=>{if(e&&"complete"!==e.readyState){const n=()=>{"complete"===e.readyState&&(e.removeEventListener("readystatechange",n),t())};e.addEventListener("readystatechange",n)}else t()})}().then(()=>function(){const e=Ne.getInstance().installationsService.getId();return e.then(e=>{Te=e}),e}()).then(e=>$e(e)).then(()=>He(),()=>He()),Ue}function He(){qe=3}
672/**
673 * @license
674 * Copyright 2019 Google Inc.
675 *
676 * Licensed under the Apache License, Version 2.0 (the "License");
677 * you may not use this file except in compliance with the License.
678 * You may obtain a copy of the License at
679 *
680 * http://www.apache.org/licenses/LICENSE-2.0
681 *
682 * Unless required by applicable law or agreed to in writing, software
683 * distributed under the License is distributed on an "AS IS" BASIS,
684 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
685 * See the License for the specific language governing permissions and
686 * limitations under the License.
687 */let Ve,Ke=3,ze=[],We=!1;function Je(){We||(!function e(t){setTimeout(()=>{if(0===Ke)return;if(!ze.length)return e(1e4);const t=[...ze];ze=[];const n=t.map(e=>({source_extension_json_proto3:e.message,event_time_ms:String(e.eventTime)})),r={request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:Ne.getInstance().logSource,log_event:n};fetch(Ne.getInstance().logEndPointUrl,{method:"POST",body:JSON.stringify(r)}).then(e=>(e.ok||je.info("Call to Firebase backend failed."),e.json())).then(t=>{const n=Number(t.next_request_wait_millis),r=isNaN(n)?1e4:Math.max(1e4,n);Ke=3,e(r)}).catch(()=>{ze=[...t,...ze],Ke--,je.info(`Tries left: ${Ke}.`),e(1e4)})},t)}(5500),We=!0)}function Ge(e){return(...t)=>{!function(e){if(!e.eventTime||!e.message)throw _e.create("invalid cc log");ze=[...ze,e]}({message:e(...t),eventTime:Date.now()})}}
688/**
689 * @license
690 * Copyright 2019 Google Inc.
691 *
692 * Licensed under the Apache License, Version 2.0 (the "License");
693 * you may not use this file except in compliance with the License.
694 * You may obtain a copy of the License at
695 *
696 * http://www.apache.org/licenses/LICENSE-2.0
697 *
698 * Unless required by applicable law or agreed to in writing, software
699 * distributed under the License is distributed on an "AS IS" BASIS,
700 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
701 * See the License for the specific language governing permissions and
702 * limitations under the License.
703 */function Ze(e,t){Ve||(Ve=Ge(Xe)),Ve(e,t)}function Ye(e){const t=Ne.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&Ae.getInstance().requiredApisAvailable()&&(e.isAuto&&De()!==Ce.VISIBLE||t.loggingEnabled&&t.logTraceAfterSampling&&(3===qe?Qe(e):xe().then(()=>Qe(e),()=>Qe(e))))}function Qe(e){Oe()&&setTimeout(()=>Ze(e,1),0)}function Xe(e,t){return 0===t?function(e){const t={url:e.url,http_method:e.httpMethod||0,http_response_code:200,response_payload_bytes:e.responsePayloadBytes,client_start_time_us:e.startTimeUs,time_to_response_initiated_us:e.timeToResponseInitiatedUs,time_to_response_completed_us:e.timeToResponseCompletedUs},n={application_info:et(),network_request_metric:t};return JSON.stringify(n)}(e):function(e){const t={name:e.name,is_auto:e.isAuto,client_start_time_us:e.startTimeUs,duration_us:e.durationUs};0!==Object.keys(e.counters).length&&(t.counters=e.counters);const n=e.getAttributes();0!==Object.keys(n).length&&(t.custom_attributes=n);const r={application_info:et(),trace_metric:t};return JSON.stringify(r)}(e)}function et(){return{google_app_id:Ne.getInstance().getAppId(),app_instance_id:Oe(),web_app_info:{sdk_version:"0.2.36",page_url:Ae.getInstance().getUrl(),service_worker_status:Le(),visibility_state:De(),effective_connection_type:Re()},application_process_state:0}}
704/**
705 * @license
706 * Copyright 2019 Google Inc.
707 *
708 * Licensed under the Apache License, Version 2.0 (the "License");
709 * you may not use this file except in compliance with the License.
710 * You may obtain a copy of the License at
711 *
712 * http://www.apache.org/licenses/LICENSE-2.0
713 *
714 * Unless required by applicable law or agreed to in writing, software
715 * distributed under the License is distributed on an "AS IS" BASIS,
716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
717 * See the License for the specific language governing permissions and
718 * limitations under the License.
719 */const tt=["_fp","_fcp","_fid"];
720/**
721 * @license
722 * Copyright 2019 Google Inc.
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 */
736class nt{constructor(e,t=!1,n){this.name=e,this.isAuto=t,this.state=1,this.customAttributes={},this.counters={},this.api=Ae.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark=`FB-PERF-TRACE-START-${this.randomId}-${this.name}`,this.traceStopMark=`FB-PERF-TRACE-STOP-${this.randomId}-${this.name}`,this.traceMeasure=n||`FB-PERF-TRACE-MEASURE-${this.randomId}-${this.name}`,n&&this.calculateTraceMetrics())}start(){if(1!==this.state)throw _e.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2}stop(){if(2!==this.state)throw _e.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),Ye(this)}record(e,t,n){if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),n&&n.attributes&&(this.customAttributes=Object.assign({},n.attributes)),n&&n.metrics)for(const e of Object.keys(n.metrics))isNaN(Number(n.metrics[e]))||(this.counters[e]=Number(Math.floor(n.metrics[e])));Ye(this)}incrementMetric(e,t=1){void 0===this.counters[e]&&this.putMetric(e,0),this.counters[e]+=t}putMetric(e,t){if(!function(e,t){return!(0===e.length||e.length>100)&&(t&&t.startsWith("_wt_")&&tt.indexOf(e)>-1||!e.startsWith("_"))}(e,this.name))throw _e.create("invalide custom metric name",{customMetricName:e});this.counters[e]=t}getMetric(e){return this.counters[e]||0}putAttribute(e,t){const n=function(e){return!(0===e.length||e.length>40)&&(!ke.some(t=>e.startsWith(t))&&!!e.match(Pe))}(e),r=function(e){return 0!==e.length&&e.length<=100}(t);if(n&&r)this.customAttributes[e]=t;else{if(!n)throw _e.create("invalid attribute name",{attributeName:e});if(!r)throw _e.create("invalid attribute value",{attributeValue:t})}}getAttribute(e){return this.customAttributes[e]}removeAttribute(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]}getAttributes(){return Object.assign({},this.customAttributes)}setStartTime(e){this.startTimeUs=e}setDuration(e){this.durationUs=e}calculateTraceMetrics(){const e=this.api.getEntriesByName(this.traceMeasure),t=e&&e[0];t&&(this.durationUs=Math.floor(1e3*t.duration),this.startTimeUs=Math.floor(1e3*(t.startTime+this.api.getTimeOrigin())))}static createOobTrace(e,t,n){const r=Ae.getInstance().getUrl();if(!r)return;const i=new nt("_wt_"+r,!0),o=Math.floor(1e3*Ae.getInstance().getTimeOrigin());i.setStartTime(o),e&&e[0]&&(i.setDuration(Math.floor(1e3*e[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*e[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*e[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*e[0].loadEventEnd)));if(t){const e=t.find(e=>"first-paint"===e.name);e&&e.startTime&&i.putMetric("_fp",Math.floor(1e3*e.startTime));const r=t.find(e=>"first-contentful-paint"===e.name);r&&r.startTime&&i.putMetric("_fcp",Math.floor(1e3*r.startTime)),n&&i.putMetric("_fid",Math.floor(1e3*n))}Ye(i)}static createUserTimingTrace(e){Ye(new nt(e,!1,e))}}
737/**
738 * @license
739 * Copyright 2019 Google Inc.
740 *
741 * Licensed under the Apache License, Version 2.0 (the "License");
742 * you may not use this file except in compliance with the License.
743 * You may obtain a copy of the License at
744 *
745 * http://www.apache.org/licenses/LICENSE-2.0
746 *
747 * Unless required by applicable law or agreed to in writing, software
748 * distributed under the License is distributed on an "AS IS" BASIS,
749 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
750 * See the License for the specific language governing permissions and
751 * limitations under the License.
752 */function rt(e){const t=e;if(!t||void 0===t.responseStart)return;const n=Ae.getInstance().getTimeOrigin(),r=Math.floor(1e3*(t.startTime+n)),i=t.responseStart?Math.floor(1e3*(t.responseStart-t.startTime)):void 0,o=Math.floor(1e3*(t.responseEnd-t.startTime));!function(e){const t=Ne.getInstance();t.instrumentationEnabled&&e.url!==t.logEndPointUrl.split("?")[0]&&t.loggingEnabled&&t.logNetworkAfterSampling&&setTimeout(()=>Ze(e,0),0)}({url:t.name&&t.name.split("?")[0],responsePayloadBytes:t.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}
753/**
754 * @license
755 * Copyright 2019 Google Inc.
756 *
757 * Licensed under the Apache License, Version 2.0 (the "License");
758 * you may not use this file except in compliance with the License.
759 * You may obtain a copy of the License at
760 *
761 * http://www.apache.org/licenses/LICENSE-2.0
762 *
763 * Unless required by applicable law or agreed to in writing, software
764 * distributed under the License is distributed on an "AS IS" BASIS,
765 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
766 * See the License for the specific language governing permissions and
767 * limitations under the License.
768 */function it(){Oe()&&(setTimeout(()=>function(){const e=Ae.getInstance(),t=e.getEntriesByType("navigation"),n=e.getEntriesByType("paint");if(e.onFirstInputDelay){let r=setTimeout(()=>{nt.createOobTrace(t,n),r=void 0},5e3);e.onFirstInputDelay(e=>{r&&(clearTimeout(r),nt.createOobTrace(t,n,e))})}else nt.createOobTrace(t,n)}(),0),setTimeout(()=>function(){const e=Ae.getInstance(),t=e.getEntriesByType("resource");for(const e of t)rt(e);e.setupObserver("resource",rt)}(),0),setTimeout(()=>function(){const e=Ae.getInstance(),t=e.getEntriesByType("measure");for(const e of t)ot(e);e.setupObserver("measure",ot)}(),0))}function ot(e){const t=e.name;"FB-PERF-TRACE-MEASURE"!==t.substring(0,"FB-PERF-TRACE-MEASURE".length)&&nt.createUserTimingTrace(t)}
769/**
770 * @license
771 * Copyright 2019 Google Inc.
772 *
773 * Licensed under the Apache License, Version 2.0 (the "License");
774 * you may not use this file except in compliance with the License.
775 * You may obtain a copy of the License at
776 *
777 * http://www.apache.org/licenses/LICENSE-2.0
778 *
779 * Unless required by applicable law or agreed to in writing, software
780 * distributed under the License is distributed on an "AS IS" BASIS,
781 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
782 * See the License for the specific language governing permissions and
783 * limitations under the License.
784 */class st{constructor(e){this.app=e,Ae.getInstance().requiredApisAvailable()?(Je(),xe().then(it,it)):je.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.")}trace(e){return new nt(e)}set instrumentationEnabled(e){Ne.getInstance().instrumentationEnabled=e}get instrumentationEnabled(){return Ne.getInstance().instrumentationEnabled}set dataCollectionEnabled(e){Ne.getInstance().dataCollectionEnabled=e}get dataCollectionEnabled(){return Ne.getInstance().dataCollectionEnabled}}
785/**
786 * @license
787 * Copyright 2019 Google Inc.
788 *
789 * Licensed under the Apache License, Version 2.0 (the "License");
790 * you may not use this file except in compliance with the License.
791 * You may obtain a copy of the License at
792 *
793 * http://www.apache.org/licenses/LICENSE-2.0
794 *
795 * Unless required by applicable law or agreed to in writing, software
796 * distributed under the License is distributed on an "AS IS" BASIS,
797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
798 * See the License for the specific language governing permissions and
799 * limitations under the License.
800 */!function(e){const t=(e,t)=>{if("[DEFAULT]"!==e.name)throw _e.create("FB not default");if("undefined"==typeof window)throw _e.create("no window");return function(e){Ee=e}
801/**
802 * @license
803 * Copyright 2019 Google Inc.
804 *
805 * Licensed under the Apache License, Version 2.0 (the "License");
806 * you may not use this file except in compliance with the License.
807 * You may obtain a copy of the License at
808 *
809 * http://www.apache.org/licenses/LICENSE-2.0
810 *
811 * Unless required by applicable law or agreed to in writing, software
812 * distributed under the License is distributed on an "AS IS" BASIS,
813 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
814 * See the License for the specific language governing permissions and
815 * limitations under the License.
816 */(window),Ne.getInstance().firebaseAppInstance=e,Ne.getInstance().installationsService=t,new st(e)};e.INTERNAL.registerComponent(new s("performance",e=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("installations").getImmediate();return t(n,r)},"PUBLIC")),e.registerVersion("@firebase/performance","0.2.36")}(E);
817/**
818 * @license
819 * Copyright 2019 Google Inc.
820 *
821 * Licensed under the Apache License, Version 2.0 (the "License");
822 * you may not use this file except in compliance with the License.
823 * You may obtain a copy of the License at
824 *
825 * http://www.apache.org/licenses/LICENSE-2.0
826 *
827 * Unless required by applicable law or agreed to in writing, software
828 * distributed under the License is distributed on an "AS IS" BASIS,
829 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830 * See the License for the specific language governing permissions and
831 * limitations under the License.
832 */
833return E.registerVersion("firebase","7.13.1","lite"),E}));
834//# sourceMappingURL=firebase-performance-standalone.es2017.js.map