!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],t):t((e=e||self).firebase)}(this,function(et){"use strict";try{(function(){et=et&&et.hasOwnProperty("default")?et.default:et;var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function e(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;ns[0]&&t[1]"})}(i,r):"Error",a=this.serviceName+": "+s+" ("+o+").",c=new h(o,a),u=0,f=Object.keys(r);u=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(["projectId","apiKey","appId"]),o=r.next();!o.done;o=r.next()){var i=o.value;if(!e.options[i])throw W(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}function W(e){return A.create("missing-app-config-values",{valueName:e})}function U(e){var t=e.projectId;return j+"/projects/"+t+"/installations"}function F(e){return{token:e.token,requestStatus:2,expiresIn:function(e){return Number(e.replace("s","000"))}(e.expiresIn),creationTime:Date.now()}}function R(r,o){return l(this,void 0,void 0,function(){var t,n;return d(this,function(e){switch(e.label){case 0:return[4,o.json()];case 1:return t=e.sent(),n=t.error,[2,A.create("request-failed",{requestName:r,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})]}})})}function L(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function B(e,t){var n=t.refreshToken,r=L(e);return r.append("Authorization",function(e){return x+" "+e}(n)),r}function H(n){return l(this,void 0,void 0,function(){var t;return d(this,function(e){switch(e.label){case 0:return[4,n()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,n()]:[2,t]}})})}function $(t){return new Promise(function(e){setTimeout(e,t)})}var G=/^[cdef][\w-]{21}$/,z="";function J(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=function(e){return function(e){return btoa(String.fromCharCode.apply(String,o(e))).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22)}(e);return G.test(t)?t:z}catch(e){return z}}var Y,Q="firebase-installations-database",X=1,Z="firebase-installations-store",ee=null;function te(){return ee=ee||function(e,t,n){var r=y(indexedDB,"open",[e,t]),o=r.request;return o&&(o.onupgradeneeded=function(e){n&&n(new D(o.result,e.oldVersion,o.transaction))}),r.then(function(e){return new M(e)})}(Q,X,function(e){switch(e.oldVersion){case 0:e.createObjectStore(Z)}})}function ne(o,i){return l(this,void 0,void 0,function(){var t,n,r;return d(this,function(e){switch(e.label){case 0:return t=ie(o),[4,te()];case 1:return n=e.sent(),[4,(r=n.transaction(Z,"readwrite")).objectStore(Z).put(i,t)];case 2:return e.sent(),[4,r.complete];case 3:return e.sent(),[2,i]}})})}function re(o){return l(this,void 0,void 0,function(){var t,n,r;return d(this,function(e){switch(e.label){case 0:return t=ie(o),[4,te()];case 1:return n=e.sent(),[4,(r=n.transaction(Z,"readwrite")).objectStore(Z).delete(t)];case 2:return e.sent(),[4,r.complete];case 3:return e.sent(),[2]}})})}function oe(a,c){return l(this,void 0,void 0,function(){var t,n,r,o,i,s;return d(this,function(e){switch(e.label){case 0:return t=ie(a),[4,te()];case 1:return n=e.sent(),r=n.transaction(Z,"readwrite"),[4,(o=r.objectStore(Z)).get(t)];case 2:return i=e.sent(),void 0!==(s=c(i))?[3,4]:[4,o.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,o.put(s,t)];case 5:e.sent(),e.label=6;case 6:return[4,r.complete];case 7:return e.sent(),[2,s]}})})}function ie(e){return e.appName+"!"+e.appId}function se(o){return l(this,void 0,void 0,function(){var r,t,n;return d(this,function(e){switch(e.label){case 0:return[4,oe(o,function(e){var t=function(e){return ce(e||{fid:J(),registrationStatus:0})}(e),n=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(i){return l(this,void 0,void 0,function(){var t,n,r,o;return d(this,function(e){switch(e.label){case 0:return[4,ae(i)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,$(100)];case 3:return e.sent(),[4,ae(i)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,se(i)];case 6:return n=e.sent(),r=n.installationEntry,(o=n.registrationPromise)?[2,o]:[2,r];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(A.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},o=function(r,o){return l(this,void 0,void 0,function(){var t,n;return d(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(a,e){var c=e.fid;return l(this,void 0,void 0,function(){var t,n,r,o,i,s;return d(this,function(e){switch(e.label){case 0:return t=U(a),n=L(a),r={fid:c,authVersion:x,appId:a.appId,sdkVersion:N},o={method:"POST",headers:n,body:JSON.stringify(r)},[4,H(function(){return fetch(t,o)})];case 1:return(i=e.sent()).ok?[4,i.json()]:[3,3];case 2:return s=e.sent(),[2,{fid:s.fid||c,registrationStatus:2,refreshToken:s.refreshToken,authToken:F(s.authToken)}];case 3:return[4,R("Create Installation",i)];case 4:throw e.sent()}})})}(r,o)];case 1:return t=e.sent(),[2,ne(r,t)];case 2:return V(n=e.sent())&&409===n.serverCode?[4,re(r)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,ne(r,{fid:o.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw n;case 7:return[2]}})})}(e,r);return{installationEntry:r,registrationPromise:o}}}(o,t);return r=n.registrationPromise,n.installationEntry})];case 1:return(t=e.sent()).fid!==z?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=e.sent(),n)];case 3:return[2,{installationEntry:t,registrationPromise:r}]}})})}function ae(e){return oe(e,function(e){if(!e)throw A.create("installation-not-found");return ce(e)})}function ce(e){return function(e){return 1===e.registrationStatus&&e.registrationTime+Es&&console.warn("This browser only supports "+s+" actions.The remaining actions will not be displayed."),[2,o.showNotification(r,n)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(t)]:[3,5];case 4:return e.sent(),[2];case 5:return[2]}})})},$e.prototype.onSubChange_=function(e){return l(this,void 0,void 0,function(){var t,n,r,o;return d(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return t=e.sent(),[3,3];case 2:throw n=e.sent(),ye.create("unable-to-resubscribe",{errorInfo:n});case 3:return e.trys.push([3,5,,8]),[4,t.pushManager.getSubscription()];case 4:return e.sent(),[3,8];case 5:return r=e.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(t.scope)];case 6:if(!(o=e.sent()))throw r;return[4,this.deleteToken(o.fcmToken)];case 7:throw e.sent(),r;case 8:return[2]}})})},$e.prototype.onNotificationClick_=function(i){return l(this,void 0,void 0,function(){var t,n,r,o;return d(this,function(e){switch(e.label){case 0:if(!(i.notification&&i.notification.data&&i.notification.data[Be]))return[2];if(i.action)return[2];if(i.stopImmediatePropagation(),i.notification.close(),!(t=i.notification.data[Be]).notification)return[2];if(!(n=t.fcmOptions&&t.fcmOptions.link||t.notification.click_action)){if(!(t.data&&me in t.data))return[2];n=self.location.origin}return[4,this.getWindowClient_(n)];case 1:return(r=e.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return r=e.sent(),[4,function(t){return new Promise(function(e){setTimeout(e,t)})}(3e3)];case 3:return e.sent(),[3,6];case 4:return[4,r.focus()];case 5:r=e.sent(),e.label=6;case 6:return r?(delete t.notification,delete t.fcmOptions,o=ze(ve.NOTIFICATION_CLICKED,t),[2,this.attemptToMessageClient_(r,o)]):[2]}})})},$e.prototype.getNotificationData_=function(e){var t;if(e&&"object"==typeof e.notification){var n=s({},e.notification);return n.data=s(s({},e.notification.data),((t={})[Be]=e,t)),n}},$e.prototype.setBackgroundMessageHandler=function(e){if(!e||"function"!=typeof e)throw ye.create("bg-handler-function-expected");this.bgMessageHandler=e},$e.prototype.getWindowClient_=function(i){return l(this,void 0,void 0,function(){var t,n,r,o;return d(this,function(e){switch(e.label){case 0:return t=new URL(i,self.location.href).href,[4,Ge()];case 1:for(n=e.sent(),r=null,o=0;o