1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 17:11:57 +00:00
musix-oss/node_modules/@firebase/firestore/dist/index.esm2017.min.js

3 lines
215 KiB
JavaScript
Raw Normal View History

2020-03-03 20:30:50 +00:00
import t from"@firebase/app";import{Logger as e,LogLevel as s}from"@firebase/logger";import{getUA as n,isReactNative as i,isElectron as r,isIE as o,isUWP as h,isBrowserExtension as a}from"@firebase/util";import{Component as u}from"@firebase/component";import{XhrIo as c,EventType as l,ErrorCode as _,createWebChannelTransport as d,WebChannel as f}from"@firebase/webchannel-wrapper";const m=t.SDK_VERSION,T=new e("@firebase/firestore");var E;function w(){return T.logLevel===s.DEBUG?E.DEBUG:T.logLevel===s.SILENT?E.SILENT:E.ERROR}function I(t){switch(t){case E.DEBUG:T.logLevel=s.DEBUG;break;case E.ERROR:T.logLevel=s.ERROR;break;case E.SILENT:T.logLevel=s.SILENT;break;default:T.error(`Firestore (${m}): Invalid value passed to \`setLogLevel\``)}}function R(t,e,...n){if(T.logLevel<=s.DEBUG){const s=n.map(P);T.debug(`Firestore (${m}) [${t}]: ${e}`,...s)}}function A(t,...e){if(T.logLevel<=s.ERROR){const s=e.map(P);T.error(`Firestore (${m}): ${t}`,...s)}}function P(t){if("string"==typeof t)return t;{const e=Ss.t();try{return e.s(t)}catch(e){return t}}}function V(t){const e=`FIRESTORE (${m}) INTERNAL ASSERTION FAILED: `+t;throw A(e),new Error(e)}function p(t,e){t||V(e)}!function(t){t[t.DEBUG=0]="DEBUG",t[t.ERROR=1]="ERROR",t[t.SILENT=2]="SILENT"}(E||(E={}));class g{static i(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";for(let s=0;s<20;s++)e+=t.charAt(Math.floor(Math.random()*t.length));return p(20===e.length,"Invalid auto ID: "+e),e}}function y(t,e){return t<e?-1:t>e?1:0}function b(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].isEqual(e[s]))return!1;return!0}function v(t){return t+"\0"}class S{constructor(t,e,s,n,i){this.o=t,this.persistenceKey=e,this.host=s,this.ssl=n,this.forceLongPolling=i}}const D="(default)";class C{constructor(t,e){this.projectId=t,this.database=e||D}get h(){return this.database===D}isEqual(t){return t instanceof C&&t.projectId===this.projectId&&t.database===this.database}u(t){return y(this.projectId,t.projectId)||y(this.database,t.database)}}var k,N,F,$;(N=k||(k={}))[N.l=0]="__PRIVATE_Unknown",N[N._=1]="__PRIVATE_Online",N[N.m=2]="__PRIVATE_Offline",($=F||(F={}))[$.T=0]="__PRIVATE_RemoteStore",$[$.I=1]="__PRIVATE_SharedClientState";class x{constructor(t){this.uid=t}R(){return null!=this.uid}A(){return this.R()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}x.UNAUTHENTICATED=new x(null),x.P=new x("google-credentials-uid"),x.V=new x("first-party-uid");const M={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class L extends Error{constructor(t,e){super(e),this.code=t,this.message=e,this.name="FirebaseError",this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class B{constructor(t,e){this.user=e,this.type="OAuth",this.p={},this.p.Authorization=`Bearer ${t}`}}class q{constructor(){this.g=null}getToken(){return Promise.resolve(null)}v(){}S(t){p(!this.g,"Can only call setChangeListener() once."),this.g=t,t(x.UNAUTHENTICATED)}D(){p(null!==this.g,"removeChangeListener() when no listener registered"),this.g=null}}class O{constructor(t){this.C=null,this.currentUser=x.UNAUTHENTICATED,this.k=!1,this.N=0,this.g=null,this.forceRefresh=!1,this.C=()=>{this.N++,this.currentUser=this.F(),this.k=!0,this.g&&this.g(this.currentUser)},this.N=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.C):(this.C(null),t.get().then(t=>{this.auth=t,this.C&&this.auth.addAuthTokenListener(this.C)},()=>{}))}getToken(){p(null!=this.C,"getToken cannot be called after listener removed.");const t=this.N,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(e=>
//# sourceMappingURL=index.esm2017.min.js.map