nervoscan-js-sdk 1.0.4 → 1.0.6-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nervoscan-js-sdk.js +108 -108
- package/dist/nervoscan-js-sdk.mjs +1053 -1030
- package/dist/nervoscan-js-sdk.umd.js +108 -108
- package/package.json +1 -1
- package/src/api/utils/backend_repository/backendRepository.ts +22 -31
- package/src/api/utils/error_handler.ts +8 -1
- package/src/api/utils/error_registry.ts +3 -0
- package/src/api/utils/errors.ts +34 -1
package/dist/nervoscan-js-sdk.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var dc=Object.defineProperty;var fc=(n,e,t)=>e in n?dc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var k=(n,e,t)=>fc(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class U extends Error{constructor(e){super(e)}}class ki extends U{constructor(e){super(e)}}class Oi extends U{constructor(e){super(e)}}class xi extends U{constructor(e){super(e)}}class Pi extends U{constructor(e){super(e)}}class Di extends U{constructor(e){super(e)}}class Li extends U{constructor(e){super(e)}}class Fi extends U{constructor(e){super(e)}}class Mi extends U{constructor(e){super(e)}}class Bi extends U{constructor(e){super(e)}}class Ui extends U{constructor(e){super(e)}}class qi extends U{constructor(e){super(e)}}class Wi extends U{constructor(e){super(e)}}class Hi extends U{constructor(e){super(e)}}class Vi extends U{constructor(e){super(e)}}class $i extends U{constructor(e){super(e)}}class zi extends U{constructor(e){super(e)}}class ji extends U{constructor(e){super(e)}}class Ki extends U{constructor(e){super(e)}}class Ps extends U{constructor(t){super(t.message);k(this,"errorCode");this.errorCode=t.code}}const q={NotInitializedError:ki,EmptyVideoError:Oi,VideoTypeError:xi,InvalidUsernameError:Pi,InvalidPasswordError:Di,NoScansAvailableError:Li,InvalidAccessTokenError:Fi,NoScanDataError:Mi,InvalidServerTypeError:Bi,NotImplementedError:Ui,LowFPSError:qi,FPSCalculationError:Wi,FaceNotCenteredError:Hi,FaceTooFarError:Vi,FaceTooCloseError:$i,FaceLookingLeftError:zi,FaceLookingRightError:ji,ErrorCallbackNotSetError:Ki,UnhandledScanError:Ps},R={NotInitializedError:new q.NotInitializedError("Nervoscan Client not initialized!"),EmptyVideoError:new q.EmptyVideoError("Video is empty!"),VideoTypeError:new q.VideoTypeError("Video is not a Blob!"),InvalidUsernameError:new q.InvalidUsernameError("Invalid username!"),InvalidPasswordError:new q.InvalidPasswordError("Invalid password!"),NoScansAvailableError:new q.NoScansAvailableError("No scans available, Please purchase a plan!"),InvalidAccessTokenError:new q.InvalidAccessTokenError("Invalid access token!"),NoScanDataError:new q.NoScanDataError("No scan data found!"),InvalidServerTypeError:new q.InvalidServerTypeError("Invalid server type!"),NotImplementedError:new q.NotImplementedError("Not implemented!"),LowFPSError:new q.LowFPSError("Low FPS!"),FPSCalculationError:new q.FPSCalculationError("Error calculating FPS!"),FaceNotCenteredError:new q.FaceNotCenteredError("Face not centered!"),FaceTooFarError:new q.FaceTooFarError("Face too far!"),FaceTooCloseError:new q.FaceTooCloseError("Face too close!"),FaceLookingLeftError:new q.FaceLookingLeftError("Face looking left!"),FaceLookingRightError:new q.FaceLookingRightError("Face looking right!"),ErrorCallbackNotSetError:new q.ErrorCallbackNotSetError("Error callback not set!")},te=class te{constructor(){}static getInstance(){return te.instance||(te.instance=new te),te.instance}static throwKnownError(e){throw e}static throwUnknownError(e){throw e}static handleErrorResponse(e){var t,s,r,i,o,a,c,l,h,u,d,_,p;((r=(s=(t=e.response)==null?void 0:t.data)==null?void 0:s.error)==null?void 0:r.code)==="INVALID_USERNAME"?te.throwKnownError(R.InvalidUsernameError):((a=(o=(i=e.response)==null?void 0:i.data)==null?void 0:o.error)==null?void 0:a.code)==="INVALID_PASSWORD"?te.throwKnownError(R.InvalidPasswordError):(((h=(l=(c=e.response)==null?void 0:c.data)==null?void 0:l.error)==null?void 0:h.code)==="NO_SCANS_AVAILABLE"||((d=(u=e.response)==null?void 0:u.data)==null?void 0:d.message)==="No packages available!"||((p=(_=e.response)==null?void 0:_.data)==null?void 0:p.message)==="No scans available!")&&te.throwKnownError(R.NoScansAvailableError)}static handleScanError(e){return e.code==="LOW_FPS_ERROR"?R.LowFPSError:e.code==="FPS_CALCULATION_ERROR"?R.FPSCalculationError:e.code==="FACE_NOT_CENTERED_ERROR"?R.FaceNotCenteredError:e.code==="FACE_TOO_FAR_ERROR"?R.FaceTooFarError:e.code==="FACE_TOO_CLOSE_ERROR"?R.FaceTooCloseError:e.code==="FACE_LOOKING_LEFT_ERROR"?R.FaceLookingLeftError:e.code==="FACE_LOOKING_RIGHT_ERROR"?R.FaceLookingRightError:new Ps(e)}};k(te,"instance");let T=te;function Gi(n,e){return function(){return n.apply(e,arguments)}}const{toString:pc}=Object.prototype,{getPrototypeOf:Ds}=Object,wn=(n=>e=>{const t=pc.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),le=n=>(n=n.toLowerCase(),e=>wn(e)===n),vn=n=>e=>typeof e===n,{isArray:Xe}=Array,mt=vn("undefined");function _c(n){return n!==null&&!mt(n)&&n.constructor!==null&&!mt(n.constructor)&&Z(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Yi=le("ArrayBuffer");function mc(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Yi(n.buffer),e}const gc=vn("string"),Z=vn("function"),Qi=vn("number"),bn=n=>n!==null&&typeof n=="object",yc=n=>n===!0||n===!1,Wt=n=>{if(wn(n)!=="object")return!1;const e=Ds(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Ec=le("Date"),wc=le("File"),vc=le("Blob"),bc=le("FileList"),Cc=n=>bn(n)&&Z(n.pipe),Sc=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Z(n.append)&&((e=wn(n))==="formdata"||e==="object"&&Z(n.toString)&&n.toString()==="[object FormData]"))},Tc=le("URLSearchParams"),[Rc,Ic,Nc,Ac]=["ReadableStream","Request","Response","Headers"].map(le),kc=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function It(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let s,r;if(typeof n!="object"&&(n=[n]),Xe(n))for(s=0,r=n.length;s<r;s++)e.call(null,n[s],s,n);else{const i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let a;for(s=0;s<o;s++)a=i[s],e.call(null,n[a],a,n)}}function Ji(n,e){e=e.toLowerCase();const t=Object.keys(n);let s=t.length,r;for(;s-- >0;)if(r=t[s],e===r.toLowerCase())return r;return null}const ke=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Xi=n=>!mt(n)&&n!==ke;function ts(){const{caseless:n}=Xi(this)&&this||{},e={},t=(s,r)=>{const i=n&&Ji(e,r)||r;Wt(e[i])&&Wt(s)?e[i]=ts(e[i],s):Wt(s)?e[i]=ts({},s):Xe(s)?e[i]=s.slice():e[i]=s};for(let s=0,r=arguments.length;s<r;s++)arguments[s]&&It(arguments[s],t);return e}const Oc=(n,e,t,{allOwnKeys:s}={})=>(It(e,(r,i)=>{t&&Z(r)?n[i]=Gi(r,t):n[i]=r},{allOwnKeys:s}),n),xc=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Pc=(n,e,t,s)=>{n.prototype=Object.create(e.prototype,s),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Dc=(n,e,t,s)=>{let r,i,o;const a={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),i=r.length;i-- >0;)o=r[i],(!s||s(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&Ds(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Lc=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const s=n.indexOf(e,t);return s!==-1&&s===t},Fc=n=>{if(!n)return null;if(Xe(n))return n;let e=n.length;if(!Qi(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},Mc=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Ds(Uint8Array)),Bc=(n,e)=>{const s=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=s.next())&&!r.done;){const i=r.value;e.call(n,i[0],i[1])}},Uc=(n,e)=>{let t;const s=[];for(;(t=n.exec(e))!==null;)s.push(t);return s},qc=le("HTMLFormElement"),Wc=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,r){return s.toUpperCase()+r}),br=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Hc=le("RegExp"),Zi=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),s={};It(t,(r,i)=>{let o;(o=e(r,i,n))!==!1&&(s[i]=o||r)}),Object.defineProperties(n,s)},Vc=n=>{Zi(n,(e,t)=>{if(Z(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=n[t];if(Z(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},$c=(n,e)=>{const t={},s=r=>{r.forEach(i=>{t[i]=!0})};return Xe(n)?s(n):s(String(n).split(e)),t},zc=()=>{},jc=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function Kc(n){return!!(n&&Z(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Gc=n=>{const e=new Array(10),t=(s,r)=>{if(bn(s)){if(e.indexOf(s)>=0)return;if(!("toJSON"in s)){e[r]=s;const i=Xe(s)?[]:{};return It(s,(o,a)=>{const c=t(o,r+1);!mt(c)&&(i[a]=c)}),e[r]=void 0,i}}return s};return t(n,0)},Yc=le("AsyncFunction"),Qc=n=>n&&(bn(n)||Z(n))&&Z(n.then)&&Z(n.catch),eo=((n,e)=>n?setImmediate:e?((t,s)=>(ke.addEventListener("message",({source:r,data:i})=>{r===ke&&i===t&&s.length&&s.shift()()},!1),r=>{s.push(r),ke.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Z(ke.postMessage)),Jc=typeof queueMicrotask<"u"?queueMicrotask.bind(ke):typeof process<"u"&&process.nextTick||eo,f={isArray:Xe,isArrayBuffer:Yi,isBuffer:_c,isFormData:Sc,isArrayBufferView:mc,isString:gc,isNumber:Qi,isBoolean:yc,isObject:bn,isPlainObject:Wt,isReadableStream:Rc,isRequest:Ic,isResponse:Nc,isHeaders:Ac,isUndefined:mt,isDate:Ec,isFile:wc,isBlob:vc,isRegExp:Hc,isFunction:Z,isStream:Cc,isURLSearchParams:Tc,isTypedArray:Mc,isFileList:bc,forEach:It,merge:ts,extend:Oc,trim:kc,stripBOM:xc,inherits:Pc,toFlatObject:Dc,kindOf:wn,kindOfTest:le,endsWith:Lc,toArray:Fc,forEachEntry:Bc,matchAll:Uc,isHTMLForm:qc,hasOwnProperty:br,hasOwnProp:br,reduceDescriptors:Zi,freezeMethods:Vc,toObjectSet:$c,toCamelCase:Wc,noop:zc,toFiniteNumber:jc,findKey:Ji,global:ke,isContextDefined:Xi,isSpecCompliantForm:Kc,toJSONObject:Gc,isAsyncFn:Yc,isThenable:Qc,setImmediate:eo,asap:Jc};function w(n,e,t,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}f.inherits(w,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:f.toJSONObject(this.config),code:this.code,status:this.status}}});const to=w.prototype,no={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{no[n]={value:n}});Object.defineProperties(w,no);Object.defineProperty(to,"isAxiosError",{value:!0});w.from=(n,e,t,s,r,i)=>{const o=Object.create(to);return f.toFlatObject(n,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),w.call(o,n.message,e,t,s,r),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};const Xc=null;function ns(n){return f.isPlainObject(n)||f.isArray(n)}function so(n){return f.endsWith(n,"[]")?n.slice(0,-2):n}function Cr(n,e,t){return n?n.concat(e).map(function(r,i){return r=so(r),!t&&i?"["+r+"]":r}).join(t?".":""):e}function Zc(n){return f.isArray(n)&&!n.some(ns)}const el=f.toFlatObject(f,{},null,function(e){return/^is[A-Z]/.test(e)});function Cn(n,e,t){if(!f.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=f.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,g){return!f.isUndefined(g[y])});const s=t.metaTokens,r=t.visitor||h,i=t.dots,o=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&f.isSpecCompliantForm(e);if(!f.isFunction(r))throw new TypeError("visitor must be a function");function l(p){if(p===null)return"";if(f.isDate(p))return p.toISOString();if(!c&&f.isBlob(p))throw new w("Blob is not supported. Use a Buffer instead.");return f.isArrayBuffer(p)||f.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function h(p,y,g){let A=p;if(p&&!g&&typeof p=="object"){if(f.endsWith(y,"{}"))y=s?y:y.slice(0,-2),p=JSON.stringify(p);else if(f.isArray(p)&&Zc(p)||(f.isFileList(p)||f.endsWith(y,"[]"))&&(A=f.toArray(p)))return y=so(y),A.forEach(function(F,se){!(f.isUndefined(F)||F===null)&&e.append(o===!0?Cr([y],se,i):o===null?y:y+"[]",l(F))}),!1}return ns(p)?!0:(e.append(Cr(g,y,i),l(p)),!1)}const u=[],d=Object.assign(el,{defaultVisitor:h,convertValue:l,isVisitable:ns});function _(p,y){if(!f.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));u.push(p),f.forEach(p,function(A,L){(!(f.isUndefined(A)||A===null)&&r.call(e,A,f.isString(L)?L.trim():L,y,d))===!0&&_(A,y?y.concat(L):[L])}),u.pop()}}if(!f.isObject(n))throw new TypeError("data must be an object");return _(n),e}function Sr(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ls(n,e){this._pairs=[],n&&Cn(n,this,e)}const ro=Ls.prototype;ro.append=function(e,t){this._pairs.push([e,t])};ro.toString=function(e){const t=e?function(s){return e.call(this,s,Sr)}:Sr;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function tl(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function io(n,e,t){if(!e)return n;const s=t&&t.encode||tl;f.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let i;if(r?i=r(e,t):i=f.isURLSearchParams(e)?e.toString():new Ls(e,t).toString(s),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}class Tr{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){f.forEach(this.handlers,function(s){s!==null&&e(s)})}}const oo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},nl=typeof URLSearchParams<"u"?URLSearchParams:Ls,sl=typeof FormData<"u"?FormData:null,rl=typeof Blob<"u"?Blob:null,il={isBrowser:!0,classes:{URLSearchParams:nl,FormData:sl,Blob:rl},protocols:["http","https","file","blob","url","data"]},Fs=typeof window<"u"&&typeof document<"u",ss=typeof navigator=="object"&&navigator||void 0,ol=Fs&&(!ss||["ReactNative","NativeScript","NS"].indexOf(ss.product)<0),al=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",cl=Fs&&window.location.href||"http://localhost",ll=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Fs,hasStandardBrowserEnv:ol,hasStandardBrowserWebWorkerEnv:al,navigator:ss,origin:cl},Symbol.toStringTag,{value:"Module"})),K={...ll,...il};function hl(n,e){return Cn(n,new K.classes.URLSearchParams,Object.assign({visitor:function(t,s,r,i){return K.isNode&&f.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function ul(n){return f.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function dl(n){const e={},t=Object.keys(n);let s;const r=t.length;let i;for(s=0;s<r;s++)i=t[s],e[i]=n[i];return e}function ao(n){function e(t,s,r,i){let o=t[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=t.length;return o=!o&&f.isArray(r)?r.length:o,c?(f.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!a):((!r[o]||!f.isObject(r[o]))&&(r[o]=[]),e(t,s,r[o],i)&&f.isArray(r[o])&&(r[o]=dl(r[o])),!a)}if(f.isFormData(n)&&f.isFunction(n.entries)){const t={};return f.forEachEntry(n,(s,r)=>{e(ul(s),r,t,0)}),t}return null}function fl(n,e,t){if(f.isString(n))try{return(e||JSON.parse)(n),f.trim(n)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(n)}const Nt={transitional:oo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",r=s.indexOf("application/json")>-1,i=f.isObject(e);if(i&&f.isHTMLForm(e)&&(e=new FormData(e)),f.isFormData(e))return r?JSON.stringify(ao(e)):e;if(f.isArrayBuffer(e)||f.isBuffer(e)||f.isStream(e)||f.isFile(e)||f.isBlob(e)||f.isReadableStream(e))return e;if(f.isArrayBufferView(e))return e.buffer;if(f.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return hl(e,this.formSerializer).toString();if((a=f.isFileList(e))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Cn(a?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),fl(e)):e}],transformResponse:[function(e){const t=this.transitional||Nt.transitional,s=t&&t.forcedJSONParsing,r=this.responseType==="json";if(f.isResponse(e)||f.isReadableStream(e))return e;if(e&&f.isString(e)&&(s&&!this.responseType||r)){const o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?w.from(a,w.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:K.classes.FormData,Blob:K.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};f.forEach(["delete","get","head","post","put","patch"],n=>{Nt.headers[n]={}});const pl=f.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),_l=n=>{const e={};let t,s,r;return n&&n.split(`
|
|
2
|
-
`).forEach(function(o){r=o.indexOf(":"),t=o.substring(0,r).trim().toLowerCase(),s=o.substring(r+1).trim(),!(!t||e[t]&&
|
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(r=>s.set(r)),s}static accessor(e){const s=(this[Rr]=this[Rr]={accessors:{}}).accessors,r=this.prototype;function i(o){const a=rt(o);s[a]||(El(r,o),s[a]=!0)}return f.isArray(e)?e.forEach(i):i(e),this}};J.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);f.reduceDescriptors(J.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(s){this[t]=s}}});f.freezeMethods(J);function Un(n,e){const t=this||Nt,s=e||t,r=J.from(s.headers);let i=s.data;return f.forEach(n,function(a){i=a.call(t,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function co(n){return!!(n&&n.__CANCEL__)}function Ze(n,e,t){w.call(this,n??"canceled",w.ERR_CANCELED,e,t),this.name="CanceledError"}f.inherits(Ze,w,{__CANCEL__:!0});function lo(n,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?n(t):e(new w("Request failed with status code "+t.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function wl(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function vl(n,e){n=n||10;const t=new Array(n),s=new Array(n);let r=0,i=0,o;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),h=s[i];o||(o=l),t[r]=c,s[r]=l;let u=i,d=0;for(;u!==r;)d+=t[u++],u=u%n;if(r=(r+1)%n,r===i&&(i=(i+1)%n),l-o<e)return;const _=h&&l-h;return _?Math.round(d*1e3/_):void 0}}function bl(n,e){let t=0,s=1e3/e,r,i;const o=(l,h=Date.now())=>{t=h,r=null,i&&(clearTimeout(i),i=null),n.apply(null,l)};return[(...l)=>{const h=Date.now(),u=h-t;u>=s?o(l,h):(r=l,i||(i=setTimeout(()=>{i=null,o(r)},s-u)))},()=>r&&o(r)]}const Xt=(n,e,t=3)=>{let s=0;const r=vl(50,250);return bl(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=o-s,l=r(c),h=o<=a;s=o;const u={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&h?(a-o)/l:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(u)},t)},Ir=(n,e)=>{const t=n!=null;return[s=>e[0]({lengthComputable:t,total:n,loaded:s}),e[1]]},Nr=n=>(...e)=>f.asap(()=>n(...e)),Cl=K.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,K.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(K.origin),K.navigator&&/(msie|trident)/i.test(K.navigator.userAgent)):()=>!0,Sl=K.hasStandardBrowserEnv?{write(n,e,t,s,r,i){const o=[n+"="+encodeURIComponent(e)];f.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),f.isString(s)&&o.push("path="+s),f.isString(r)&&o.push("domain="+r),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Tl(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Rl(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function ho(n,e,t){let s=!Tl(e);return n&&(s||t==!1)?Rl(n,e):e}const Ar=n=>n instanceof J?{...n}:n;function Pe(n,e){e=e||{};const t={};function s(l,h,u,d){return f.isPlainObject(l)&&f.isPlainObject(h)?f.merge.call({caseless:d},l,h):f.isPlainObject(h)?f.merge({},h):f.isArray(h)?h.slice():h}function r(l,h,u,d){if(f.isUndefined(h)){if(!f.isUndefined(l))return s(void 0,l,u,d)}else return s(l,h,u,d)}function i(l,h){if(!f.isUndefined(h))return s(void 0,h)}function o(l,h){if(f.isUndefined(h)){if(!f.isUndefined(l))return s(void 0,l)}else return s(void 0,h)}function a(l,h,u){if(u in e)return s(l,h);if(u in n)return s(void 0,l)}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,h,u)=>r(Ar(l),Ar(h),u,!0)};return f.forEach(Object.keys(Object.assign({},n,e)),function(h){const u=c[h]||r,d=u(n[h],e[h],h);f.isUndefined(d)&&u!==a||(t[h]=d)}),t}const uo=n=>{const e=Pe({},n);let{data:t,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:i,headers:o,auth:a}=e;e.headers=o=J.from(o),e.url=io(ho(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(f.isFormData(t)){if(K.hasStandardBrowserEnv||K.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[l,...h]=c?c.split(";").map(u=>u.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...h].join("; "))}}if(K.hasStandardBrowserEnv&&(s&&f.isFunction(s)&&(s=s(e)),s||s!==!1&&Cl(e.url))){const l=r&&i&&Sl.read(i);l&&o.set(r,l)}return e},Il=typeof XMLHttpRequest<"u",Nl=Il&&function(n){return new Promise(function(t,s){const r=uo(n);let i=r.data;const o=J.from(r.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=r,h,u,d,_,p;function y(){_&&_(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let g=new XMLHttpRequest;g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout;function A(){if(!g)return;const F=J.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),G={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:F,config:n,request:g};lo(function(Te){t(Te),y()},function(Te){s(Te),y()},G),g=null}"onloadend"in g?g.onloadend=A:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(A)},g.onabort=function(){g&&(s(new w("Request aborted",w.ECONNABORTED,n,g)),g=null)},g.onerror=function(){s(new w("Network Error",w.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let se=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const G=r.transitional||oo;r.timeoutErrorMessage&&(se=r.timeoutErrorMessage),s(new w(se,G.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,n,g)),g=null},i===void 0&&o.setContentType(null),"setRequestHeader"in g&&f.forEach(o.toJSON(),function(se,G){g.setRequestHeader(G,se)}),f.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),a&&a!=="json"&&(g.responseType=r.responseType),l&&([d,p]=Xt(l,!0),g.addEventListener("progress",d)),c&&g.upload&&([u,_]=Xt(c),g.upload.addEventListener("progress",u),g.upload.addEventListener("loadend",_)),(r.cancelToken||r.signal)&&(h=F=>{g&&(s(!F||F.type?new Ze(null,n,g):F),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const L=wl(r.url);if(L&&K.protocols.indexOf(L)===-1){s(new w("Unsupported protocol "+L+":",w.ERR_BAD_REQUEST,n));return}g.send(i||null)})},Al=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let s=new AbortController,r;const i=function(l){if(!r){r=!0,a();const h=l instanceof Error?l:this.reason;s.abort(h instanceof w?h:new Ze(h instanceof Error?h.message:h))}};let o=e&&setTimeout(()=>{o=null,i(new w(`timeout ${e} of ms exceeded`,w.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),n=null)};n.forEach(l=>l.addEventListener("abort",i));const{signal:c}=s;return c.unsubscribe=()=>f.asap(a),c}},kl=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let s=0,r;for(;s<t;)r=s+e,yield n.slice(s,r),s=r},Ol=async function*(n,e){for await(const t of xl(n))yield*kl(t,e)},xl=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},kr=(n,e,t,s)=>{const r=Ol(n,e);let i=0,o,a=c=>{o||(o=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:l,value:h}=await r.next();if(l){a(),c.close();return}let u=h.byteLength;if(t){let d=i+=u;t(d)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),r.return()}},{highWaterMark:2})},Sn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",fo=Sn&&typeof ReadableStream=="function",Pl=Sn&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),po=(n,...e)=>{try{return!!n(...e)}catch{return!1}},Dl=fo&&po(()=>{let n=!1;const e=new Request(K.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),Or=64*1024,rs=fo&&po(()=>f.isReadableStream(new Response("").body)),Zt={stream:rs&&(n=>n.body)};Sn&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Zt[e]&&(Zt[e]=f.isFunction(n[e])?t=>t[e]():(t,s)=>{throw new w(`Response type '${e}' is not supported`,w.ERR_NOT_SUPPORT,s)})})})(new Response);const Ll=async n=>{if(n==null)return 0;if(f.isBlob(n))return n.size;if(f.isSpecCompliantForm(n))return(await new Request(K.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(f.isArrayBufferView(n)||f.isArrayBuffer(n))return n.byteLength;if(f.isURLSearchParams(n)&&(n=n+""),f.isString(n))return(await Pl(n)).byteLength},Fl=async(n,e)=>{const t=f.toFiniteNumber(n.getContentLength());return t??Ll(e)},Ml=Sn&&(async n=>{let{url:e,method:t,data:s,signal:r,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:u="same-origin",fetchOptions:d}=uo(n);l=l?(l+"").toLowerCase():"text";let _=Al([r,i&&i.toAbortSignal()],o),p;const y=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let g;try{if(c&&Dl&&t!=="get"&&t!=="head"&&(g=await Fl(h,s))!==0){let G=new Request(e,{method:"POST",body:s,duplex:"half"}),ye;if(f.isFormData(s)&&(ye=G.headers.get("content-type"))&&h.setContentType(ye),G.body){const[Te,Ft]=Ir(g,Xt(Nr(c)));s=kr(G.body,Or,Te,Ft)}}f.isString(u)||(u=u?"include":"omit");const A="credentials"in Request.prototype;p=new Request(e,{...d,signal:_,method:t.toUpperCase(),headers:h.normalize().toJSON(),body:s,duplex:"half",credentials:A?u:void 0});let L=await fetch(p);const F=rs&&(l==="stream"||l==="response");if(rs&&(a||F&&y)){const G={};["status","statusText","headers"].forEach(vr=>{G[vr]=L[vr]});const ye=f.toFiniteNumber(L.headers.get("content-length")),[Te,Ft]=a&&Ir(ye,Xt(Nr(a),!0))||[];L=new Response(kr(L.body,Or,Te,()=>{Ft&&Ft(),y&&y()}),G)}l=l||"text";let se=await Zt[f.findKey(Zt,l)||"text"](L,n);return!F&&y&&y(),await new Promise((G,ye)=>{lo(G,ye,{data:se,headers:J.from(L.headers),status:L.status,statusText:L.statusText,config:n,request:p})})}catch(A){throw y&&y(),A&&A.name==="TypeError"&&/fetch/i.test(A.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,n,p),{cause:A.cause||A}):w.from(A,A&&A.code,n,p)}}),is={http:Xc,xhr:Nl,fetch:Ml};f.forEach(is,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const xr=n=>`- ${n}`,Bl=n=>f.isFunction(n)||n===null||n===!1,_o={getAdapter:n=>{n=f.isArray(n)?n:[n];const{length:e}=n;let t,s;const r={};for(let i=0;i<e;i++){t=n[i];let o;if(s=t,!Bl(t)&&(s=is[(o=String(t)).toLowerCase()],s===void 0))throw new w(`Unknown adapter '${o}'`);if(s)break;r[o||"#"+i]=s}if(!s){const i=Object.entries(r).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
|
|
4
|
-
`+i.map(
|
|
5
|
-
`):" "+
|
|
6
|
-
`+i):s.stack=i}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Pe(this.defaults,t);const{transitional:s,paramsSerializer:r,headers:i}=t;s!==void 0&&Vt.assertOptions(s,{silentJSONParsing:he.transitional(he.boolean),forcedJSONParsing:he.transitional(he.boolean),clarifyTimeoutError:he.transitional(he.boolean)},!1),r!=null&&(f.isFunction(r)?t.paramsSerializer={serialize:r}:Vt.assertOptions(r,{encode:he.function,serialize:he.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Vt.assertOptions(t,{baseUrl:he.spelling("baseURL"),withXsrfToken:he.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&f.merge(i.common,i[t.method]);i&&f.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=J.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(t)===!1||(c=c&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const l=[];this.interceptors.response.forEach(function(y){l.push(y.fulfilled,y.rejected)});let h,u=0,d;if(!c){const p=[Pr.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,l),d=p.length,h=Promise.resolve(t);u<d;)h=h.then(p[u++],p[u++]);return h}d=a.length;let _=t;for(u=0;u<d;){const p=a[u++],y=a[u++];try{_=p(_)}catch(g){y.call(this,g);break}}try{h=Pr.call(this,_)}catch(p){return Promise.reject(p)}for(u=0,d=l.length;u<d;)h=h.then(l[u++],l[u++]);return h}getUri(e){e=Pe(this.defaults,e);const t=ho(e.baseURL,e.url,e.allowAbsoluteUrls);return io(t,e.params,e.paramsSerializer)}};f.forEach(["delete","get","head","options"],function(e){xe.prototype[e]=function(t,s){return this.request(Pe(s||{},{method:e,url:t,data:(s||{}).data}))}});f.forEach(["post","put","patch"],function(e){function t(s){return function(i,o,a){return this.request(Pe(a||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}xe.prototype[e]=t(),xe.prototype[e+"Form"]=t(!0)});let ql=class go{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const s=this;this.promise.then(r=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](r);s._listeners=null}),this.promise.then=r=>{let i;const o=new Promise(a=>{s.subscribe(a),i=a}).then(r);return o.cancel=function(){s.unsubscribe(i)},o},e(function(i,o,a){s.reason||(s.reason=new Ze(i,o,a),t(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=s=>{e.abort(s)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new go(function(r){e=r}),cancel:e}}};function Wl(n){return function(t){return n.apply(null,t)}}function Hl(n){return f.isObject(n)&&n.isAxiosError===!0}const os={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(os).forEach(([n,e])=>{os[e]=n});function yo(n){const e=new xe(n),t=Gi(xe.prototype.request,e);return f.extend(t,xe.prototype,e,{allOwnKeys:!0}),f.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return yo(Pe(n,r))},t}const I=yo(Nt);I.Axios=xe;I.CanceledError=Ze;I.CancelToken=ql;I.isCancel=co;I.VERSION=mo;I.toFormData=Cn;I.AxiosError=w;I.Cancel=I.CanceledError;I.all=function(e){return Promise.all(e)};I.spread=Wl;I.isAxiosError=Hl;I.mergeConfig=Pe;I.AxiosHeaders=J;I.formToJSON=n=>ao(f.isHTMLForm(n)?new FormData(n):n);I.getAdapter=_o.getAdapter;I.HttpStatusCode=os;I.default=I;const{Axios:D_,AxiosError:L_,CanceledError:F_,isCancel:M_,CancelToken:B_,VERSION:U_,all:q_,Cancel:W_,isAxiosError:H_,spread:V_,toFormData:$_,AxiosHeaders:z_,HttpStatusCode:j_,formToJSON:K_,getAdapter:G_,mergeConfig:Y_}=I,ue=Object.create(null);ue.open="0";ue.close="1";ue.ping="2";ue.pong="3";ue.message="4";ue.upgrade="5";ue.noop="6";const $t=Object.create(null);Object.keys(ue).forEach(n=>{$t[ue[n]]=n});const as={type:"error",data:"parser error"},Eo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",wo=typeof ArrayBuffer=="function",vo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Ms=({type:n,data:e},t,s)=>Eo&&e instanceof Blob?t?s(e):Lr(e,s):wo&&(e instanceof ArrayBuffer||vo(e))?t?s(e):Lr(new Blob([e]),s):s(ue[n]+(e||"")),Lr=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function Fr(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Wn;function Vl(n,e){if(Eo&&n.data instanceof Blob)return n.data.arrayBuffer().then(Fr).then(e);if(wo&&(n.data instanceof ArrayBuffer||vo(n.data)))return e(Fr(n.data));Ms(n,!1,t=>{Wn||(Wn=new TextEncoder),e(Wn.encode(t))})}const Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ht=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Mr.length;n++)ht[Mr.charCodeAt(n)]=n;const $l=n=>{let e=n.length*.75,t=n.length,s,r=0,i,o,a,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const l=new ArrayBuffer(e),h=new Uint8Array(l);for(s=0;s<t;s+=4)i=ht[n.charCodeAt(s)],o=ht[n.charCodeAt(s+1)],a=ht[n.charCodeAt(s+2)],c=ht[n.charCodeAt(s+3)],h[r++]=i<<2|o>>4,h[r++]=(o&15)<<4|a>>2,h[r++]=(a&3)<<6|c&63;return l},zl=typeof ArrayBuffer=="function",Bs=(n,e)=>{if(typeof n!="string")return{type:"message",data:bo(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:jl(n.substring(1),e)}:$t[t]?n.length>1?{type:$t[t],data:n.substring(1)}:{type:$t[t]}:as},jl=(n,e)=>{if(zl){const t=$l(n);return bo(t,e)}else return{base64:!0,data:n}},bo=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Co="",Kl=(n,e)=>{const t=n.length,s=new Array(t);let r=0;n.forEach((i,o)=>{Ms(i,!1,a=>{s[o]=a,++r===t&&e(s.join(Co))})})},Gl=(n,e)=>{const t=n.split(Co),s=[];for(let r=0;r<t.length;r++){const i=Bs(t[r],e);if(s.push(i),i.type==="error")break}return s};function Yl(){return new TransformStream({transform(n,e){Vl(n,t=>{const s=t.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Hn;function Mt(n){return n.reduce((e,t)=>e+t.length,0)}function Bt(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let r=0;r<e;r++)t[r]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function Ql(n,e){Hn||(Hn=new TextDecoder);const t=[];let s=0,r=-1,i=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(s===0){if(Mt(t)<1)break;const c=Bt(t,1);i=(c[0]&128)===128,r=c[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if(Mt(t)<2)break;const c=Bt(t,2);r=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(Mt(t)<8)break;const c=Bt(t,8),l=new DataView(c.buffer,c.byteOffset,c.length),h=l.getUint32(0);if(h>Math.pow(2,21)-1){a.enqueue(as);break}r=h*Math.pow(2,32)+l.getUint32(4),s=3}else{if(Mt(t)<r)break;const c=Bt(t,r);a.enqueue(Bs(i?c:Hn.decode(c),e)),s=0}if(r===0||r>n){a.enqueue(as);break}}}})}const So=4;function B(n){if(n)return Jl(n)}function Jl(n){for(var e in B.prototype)n[e]=B.prototype[e];return n}B.prototype.on=B.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};B.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};B.prototype.off=B.prototype.removeListener=B.prototype.removeAllListeners=B.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,r=0;r<t.length;r++)if(s=t[r],s===e||s.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+n],this};B.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,r=t.length;s<r;++s)t[s].apply(this,e)}return this};B.prototype.emitReserved=B.prototype.emit;B.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};B.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Rn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ne=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Xl="arraybuffer";function To(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const Zl=ne.setTimeout,eh=ne.clearTimeout;function In(n,e){e.useNativeTimers?(n.setTimeoutFn=Zl.bind(ne),n.clearTimeoutFn=eh.bind(ne)):(n.setTimeoutFn=ne.setTimeout.bind(ne),n.clearTimeoutFn=ne.clearTimeout.bind(ne))}const th=1.33;function nh(n){return typeof n=="string"?sh(n):Math.ceil((n.byteLength||n.size)*th)}function sh(n){let e=0,t=0;for(let s=0,r=n.length;s<r;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function Ro(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function rh(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function ih(n){let e={},t=n.split("&");for(let s=0,r=t.length;s<r;s++){let i=t[s].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class oh extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class Us extends B{constructor(e){super(),this.writable=!1,In(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new oh(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Bs(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=rh(e);return t.length?"?"+t:""}}class ah extends Us{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Gl(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Kl(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Ro()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Io=!1;try{Io=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ch=Io;function lh(){}class hh extends ah{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}let Ve=class zt extends B{constructor(e,t,s){super(),this.createRequest=e,In(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=To(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=zt.requestsCount++,zt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=lh,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete zt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Ve.requestsCount=0;Ve.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Br);else if(typeof addEventListener=="function"){const n="onpagehide"in ne?"pagehide":"unload";addEventListener(n,Br,!1)}}function Br(){for(let n in Ve.requests)Ve.requests.hasOwnProperty(n)&&Ve.requests[n].abort()}const uh=function(){const n=No({xdomain:!1});return n&&n.responseType!==null}();class dh extends hh{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=uh&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ve(No,this.uri(),e)}}function No(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ch))return new XMLHttpRequest}catch{}if(!e)try{return new ne[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ao=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class fh extends Us{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=Ao?{}:To(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;Ms(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}r&&Rn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ro()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Vn=ne.WebSocket||ne.MozWebSocket;class ph extends fh{createSocket(e,t,s){return Ao?new Vn(e,t,s):t?new Vn(e,t):new Vn(e)}doWrite(e,t){this.ws.send(t)}}class _h extends Us{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Ql(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),r=Yl();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{s.read().then(({done:a,value:c})=>{a||(this.onPacket(c),i())}).catch(a=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;this._writer.write(s).then(()=>{r&&Rn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const mh={websocket:ph,webtransport:_h,polling:dh},gh=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yh=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function cs(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let r=gh.exec(n||""),i={},o=14;for(;o--;)i[yh[o]]=r[o]||"";return t!=-1&&s!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Eh(i,i.path),i.queryKey=wh(i,i.query),i}function Eh(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function wh(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,i){r&&(t[r]=i)}),t}const ls=typeof addEventListener=="function"&&typeof removeEventListener=="function",jt=[];ls&&addEventListener("offline",()=>{jt.forEach(n=>n())},!1);class Ee extends B{constructor(e,t){if(super(),this.binaryType=Xl,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=cs(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=cs(t.host).host);In(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ih(this.opts.query)),ls&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},jt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=So,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ee.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",Ee.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(t+=nh(r)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Rn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,r){if(typeof t=="function"&&(r=t,t=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:e,data:t,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(Ee.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ls&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=jt.indexOf(this._offlineEventListener);s!==-1&&jt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Ee.protocol=So;class vh extends Ee{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;Ee.priorWebsocketSuccess=!1;const r=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",u=>{if(!s)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ee.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function i(){s||(s=!0,h(),t.close(),t=null)}const o=u=>{const d=new Error("probe error: "+u);d.transport=t.name,i(),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function c(){o("socket closed")}function l(u){t&&u.name!==t.name&&i()}const h=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",l)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let bh=class extends vh{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>mh[r]).filter(r=>!!r)),super(e,s)}};function Ch(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=cs(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+e,s.href=s.protocol+"://"+i+(t&&t.port===s.port?"":":"+s.port),s}const Sh=typeof ArrayBuffer=="function",Th=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,ko=Object.prototype.toString,Rh=typeof Blob=="function"||typeof Blob<"u"&&ko.call(Blob)==="[object BlobConstructor]",Ih=typeof File=="function"||typeof File<"u"&&ko.call(File)==="[object FileConstructor]";function qs(n){return Sh&&(n instanceof ArrayBuffer||Th(n))||Rh&&n instanceof Blob||Ih&&n instanceof File}function Kt(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(Kt(n[t]))return!0;return!1}if(qs(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Kt(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Kt(n[t]))return!0;return!1}function Nh(n){const e=[],t=n.data,s=n;return s.data=hs(t,e),s.attachments=e.length,{packet:s,buffers:e}}function hs(n,e){if(!n)return n;if(qs(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=hs(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=hs(n[s],e));return t}return n}function Ah(n,e){return n.data=us(n.data,e),delete n.attachments,n}function us(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=us(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=us(n[t],e));return n}const kh=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Oh=5;var S;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(S||(S={}));class xh{constructor(e){this.replacer=e}encode(e){return(e.type===S.EVENT||e.type===S.ACK)&&Kt(e)?this.encodeAsBinary({type:e.type===S.EVENT?S.BINARY_EVENT:S.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===S.BINARY_EVENT||e.type===S.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Nh(e),s=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(s),r}}function Ur(n){return Object.prototype.toString.call(n)==="[object Object]"}class Ws extends B{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===S.BINARY_EVENT;s||t.type===S.BINARY_ACK?(t.type=s?S.EVENT:S.ACK,this.reconstructor=new Ph(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(qs(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(S[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===S.BINARY_EVENT||s.type===S.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(i,t)}else s.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Ws.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case S.CONNECT:return Ur(t);case S.DISCONNECT:return t===void 0;case S.CONNECT_ERROR:return typeof t=="string"||Ur(t);case S.EVENT:case S.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&kh.indexOf(t[0])===-1);case S.ACK:case S.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ph{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Ah(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Dh=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ws,Encoder:xh,get PacketType(){return S},protocol:Oh},Symbol.toStringTag,{value:"Module"}));function re(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Lh=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Oo extends B{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[re(e,"open",this.onopen.bind(this)),re(e,"packet",this.onpacket.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,r,i;if(Lh.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:S.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,u=t.pop();this._registerAckCallback(h,u),o.id=h}const a=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...i)=>s!==this._queue[0]?void 0:(r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:S.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case S.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case S.EVENT:case S.BINARY_EVENT:this.onevent(e);break;case S.ACK:case S.BINARY_ACK:this.onack(e);break;case S.DISCONNECT:this.ondisconnect();break;case S.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...r){s||(s=!0,t.packet({type:S.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:S.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function et(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}et.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};et.prototype.reset=function(){this.attempts=0};et.prototype.setMin=function(n){this.ms=n};et.prototype.setMax=function(n){this.max=n};et.prototype.setJitter=function(n){this.jitter=n};class ds extends B{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,In(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new et({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Dh;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new bh(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=re(t,"open",function(){s.onopen(),e&&e()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=re(t,"error",i);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(re(e,"ping",this.onping.bind(this)),re(e,"data",this.ondata.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this)),re(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Rn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new Oo(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const it={};function Gt(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Ch(n,e.path||"/socket.io"),s=t.source,r=t.id,i=t.path,o=it[r]&&i in it[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return a?c=new ds(s,e):(it[r]||(it[r]=new ds(s,e)),c=it[r]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Gt,{Manager:ds,Socket:Oo,io:Gt,connect:Gt});const Fh=()=>{};/**
|
|
1
|
+
"use strict";var _c=Object.defineProperty;var mc=(n,e,t)=>e in n?_c(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var A=(n,e,t)=>mc(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class F extends Error{constructor(e){super(e)}}class Ai extends F{constructor(e){super(e)}}class xi extends F{constructor(e){super(e)}}class Oi extends F{constructor(e){super(e)}}class Pi extends F{constructor(e){super(e)}}class Di extends F{constructor(e){super(e)}}class Li extends F{constructor(e){super(e)}}class Fi extends F{constructor(e){super(e)}}class Mi extends F{constructor(e){super(e)}}class Bi extends F{constructor(e){super(e)}}class Ui extends F{constructor(e){super(e)}}class qi extends F{constructor(e){super(e)}}class Wi extends F{constructor(e){super(e)}}class Hi extends F{constructor(e){super(e)}}class Vi extends F{constructor(e){super(e)}}class $i extends F{constructor(e){super(e)}}class zi extends F{constructor(e){super(e)}}class ji extends F{constructor(e){super(e)}}class Ki extends F{constructor(e){super(e)}}class Ps extends F{constructor(t){super(t.message);A(this,"errorCode");this.errorCode=t.code}}class Gi extends F{constructor(e){super(e)}}class Yi extends F{constructor(e){super(e)}}class Qi extends F{constructor(e){super(e)}}const B={NotInitializedError:Ai,EmptyVideoError:xi,VideoTypeError:Oi,InvalidUsernameError:Pi,InvalidPasswordError:Di,NoScansAvailableError:Li,InvalidAccessTokenError:Fi,NoScanDataError:Mi,InvalidServerTypeError:Bi,NotImplementedError:Ui,LowFPSError:qi,FPSCalculationError:Wi,FaceNotCenteredError:Hi,FaceTooFarError:Vi,FaceTooCloseError:$i,FaceLookingLeftError:zi,FaceLookingRightError:ji,ErrorCallbackNotSetError:Ki,UnhandledScanError:Ps,SkinExtractionError:Gi,InvalidContentTypeError:Yi,UnhandledError:Qi},T={NotInitializedError:new B.NotInitializedError("Nervoscan Client not initialized!"),EmptyVideoError:new B.EmptyVideoError("Video is empty!"),VideoTypeError:new B.VideoTypeError("Video is not a Blob!"),InvalidUsernameError:new B.InvalidUsernameError("Invalid username!"),InvalidPasswordError:new B.InvalidPasswordError("Invalid password!"),NoScansAvailableError:new B.NoScansAvailableError("No scans available, Please purchase a plan!"),InvalidAccessTokenError:new B.InvalidAccessTokenError("Invalid access token!"),NoScanDataError:new B.NoScanDataError("No scan data found!"),InvalidServerTypeError:new B.InvalidServerTypeError("Invalid server type!"),NotImplementedError:new B.NotImplementedError("Not implemented!"),LowFPSError:new B.LowFPSError("Low FPS!"),FPSCalculationError:new B.FPSCalculationError("Error calculating FPS!"),FaceNotCenteredError:new B.FaceNotCenteredError("Face not centered!"),FaceTooFarError:new B.FaceTooFarError("Face too far!"),FaceTooCloseError:new B.FaceTooCloseError("Face too close!"),FaceLookingLeftError:new B.FaceLookingLeftError("Face looking left!"),FaceLookingRightError:new B.FaceLookingRightError("Face looking right!"),ErrorCallbackNotSetError:new B.ErrorCallbackNotSetError("Error callback not set!"),SkinExtractionError:new B.SkinExtractionError("Skin extraction error! Please use a better lighting!"),InvalidContentTypeError:new B.InvalidContentTypeError("Invalid content type!"),UnhandledError:new B.UnhandledError("Unhandled error! Please contact support!")},Y=class Y{constructor(){}static getInstance(){return Y.instance||(Y.instance=new Y),Y.instance}static throwKnownError(e){throw e}static throwUnknownError(e){throw T.UnhandledError}static handleErrorResponse(e){var t,s,r,i,o,a,c,l,h,u,d,_,p,y;((r=(s=(t=e.response)==null?void 0:t.data)==null?void 0:s.error)==null?void 0:r.code)==="INVALID_USERNAME"?Y.throwKnownError(T.InvalidUsernameError):((a=(o=(i=e.response)==null?void 0:i.data)==null?void 0:o.error)==null?void 0:a.code)==="INVALID_PASSWORD"?Y.throwKnownError(T.InvalidPasswordError):((h=(l=(c=e.response)==null?void 0:c.data)==null?void 0:l.error)==null?void 0:h.code)==="NO_SCANS_AVAILABLE"||((d=(u=e.response)==null?void 0:u.data)==null?void 0:d.message)==="No packages available!"||((p=(_=e.response)==null?void 0:_.data)==null?void 0:p.message)==="No scans available!"?Y.throwKnownError(T.NoScansAvailableError):((y=e.error)==null?void 0:y.code)==="INVALID_CONTENT_TYPE"?Y.throwKnownError(T.InvalidContentTypeError):Y.throwUnknownError(e)}static handleScanError(e){return e.code==="LOW_FPS_ERROR"?T.LowFPSError:e.code==="FPS_CALCULATION_ERROR"?T.FPSCalculationError:e.code==="FACE_NOT_CENTERED_ERROR"?T.FaceNotCenteredError:e.code==="FACE_TOO_FAR_ERROR"?T.FaceTooFarError:e.code==="FACE_TOO_CLOSE_ERROR"?T.FaceTooCloseError:e.code==="FACE_LOOKING_LEFT_ERROR"?T.FaceLookingLeftError:e.code==="FACE_LOOKING_RIGHT_ERROR"?T.FaceLookingRightError:e.code==="SKIN_EXTRACTION_ERROR"?T.SkinExtractionError:new Ps(e)}};A(Y,"instance");let R=Y;function Ji(n,e){return function(){return n.apply(e,arguments)}}const{toString:gc}=Object.prototype,{getPrototypeOf:Ds}=Object,wn=(n=>e=>{const t=gc.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),le=n=>(n=n.toLowerCase(),e=>wn(e)===n),vn=n=>e=>typeof e===n,{isArray:Xe}=Array,mt=vn("undefined");function yc(n){return n!==null&&!mt(n)&&n.constructor!==null&&!mt(n.constructor)&&ee(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Xi=le("ArrayBuffer");function Ec(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Xi(n.buffer),e}const wc=vn("string"),ee=vn("function"),Zi=vn("number"),bn=n=>n!==null&&typeof n=="object",vc=n=>n===!0||n===!1,Wt=n=>{if(wn(n)!=="object")return!1;const e=Ds(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},bc=le("Date"),Cc=le("File"),Sc=le("Blob"),Tc=le("FileList"),Rc=n=>bn(n)&&ee(n.pipe),Ic=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||ee(n.append)&&((e=wn(n))==="formdata"||e==="object"&&ee(n.toString)&&n.toString()==="[object FormData]"))},Nc=le("URLSearchParams"),[kc,Ac,xc,Oc]=["ReadableStream","Request","Response","Headers"].map(le),Pc=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function It(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let s,r;if(typeof n!="object"&&(n=[n]),Xe(n))for(s=0,r=n.length;s<r;s++)e.call(null,n[s],s,n);else{const i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let a;for(s=0;s<o;s++)a=i[s],e.call(null,n[a],a,n)}}function eo(n,e){e=e.toLowerCase();const t=Object.keys(n);let s=t.length,r;for(;s-- >0;)if(r=t[s],e===r.toLowerCase())return r;return null}const Ae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,to=n=>!mt(n)&&n!==Ae;function ts(){const{caseless:n}=to(this)&&this||{},e={},t=(s,r)=>{const i=n&&eo(e,r)||r;Wt(e[i])&&Wt(s)?e[i]=ts(e[i],s):Wt(s)?e[i]=ts({},s):Xe(s)?e[i]=s.slice():e[i]=s};for(let s=0,r=arguments.length;s<r;s++)arguments[s]&&It(arguments[s],t);return e}const Dc=(n,e,t,{allOwnKeys:s}={})=>(It(e,(r,i)=>{t&&ee(r)?n[i]=Ji(r,t):n[i]=r},{allOwnKeys:s}),n),Lc=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Fc=(n,e,t,s)=>{n.prototype=Object.create(e.prototype,s),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Mc=(n,e,t,s)=>{let r,i,o;const a={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),i=r.length;i-- >0;)o=r[i],(!s||s(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&Ds(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Bc=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const s=n.indexOf(e,t);return s!==-1&&s===t},Uc=n=>{if(!n)return null;if(Xe(n))return n;let e=n.length;if(!Zi(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},qc=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Ds(Uint8Array)),Wc=(n,e)=>{const s=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=s.next())&&!r.done;){const i=r.value;e.call(n,i[0],i[1])}},Hc=(n,e)=>{let t;const s=[];for(;(t=n.exec(e))!==null;)s.push(t);return s},Vc=le("HTMLFormElement"),$c=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,r){return s.toUpperCase()+r}),br=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),zc=le("RegExp"),no=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),s={};It(t,(r,i)=>{let o;(o=e(r,i,n))!==!1&&(s[i]=o||r)}),Object.defineProperties(n,s)},jc=n=>{no(n,(e,t)=>{if(ee(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=n[t];if(ee(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Kc=(n,e)=>{const t={},s=r=>{r.forEach(i=>{t[i]=!0})};return Xe(n)?s(n):s(String(n).split(e)),t},Gc=()=>{},Yc=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function Qc(n){return!!(n&&ee(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Jc=n=>{const e=new Array(10),t=(s,r)=>{if(bn(s)){if(e.indexOf(s)>=0)return;if(!("toJSON"in s)){e[r]=s;const i=Xe(s)?[]:{};return It(s,(o,a)=>{const c=t(o,r+1);!mt(c)&&(i[a]=c)}),e[r]=void 0,i}}return s};return t(n,0)},Xc=le("AsyncFunction"),Zc=n=>n&&(bn(n)||ee(n))&&ee(n.then)&&ee(n.catch),so=((n,e)=>n?setImmediate:e?((t,s)=>(Ae.addEventListener("message",({source:r,data:i})=>{r===Ae&&i===t&&s.length&&s.shift()()},!1),r=>{s.push(r),Ae.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",ee(Ae.postMessage)),el=typeof queueMicrotask<"u"?queueMicrotask.bind(Ae):typeof process<"u"&&process.nextTick||so,f={isArray:Xe,isArrayBuffer:Xi,isBuffer:yc,isFormData:Ic,isArrayBufferView:Ec,isString:wc,isNumber:Zi,isBoolean:vc,isObject:bn,isPlainObject:Wt,isReadableStream:kc,isRequest:Ac,isResponse:xc,isHeaders:Oc,isUndefined:mt,isDate:bc,isFile:Cc,isBlob:Sc,isRegExp:zc,isFunction:ee,isStream:Rc,isURLSearchParams:Nc,isTypedArray:qc,isFileList:Tc,forEach:It,merge:ts,extend:Dc,trim:Pc,stripBOM:Lc,inherits:Fc,toFlatObject:Mc,kindOf:wn,kindOfTest:le,endsWith:Bc,toArray:Uc,forEachEntry:Wc,matchAll:Hc,isHTMLForm:Vc,hasOwnProperty:br,hasOwnProp:br,reduceDescriptors:no,freezeMethods:jc,toObjectSet:Kc,toCamelCase:$c,noop:Gc,toFiniteNumber:Yc,findKey:eo,global:Ae,isContextDefined:to,isSpecCompliantForm:Qc,toJSONObject:Jc,isAsyncFn:Xc,isThenable:Zc,setImmediate:so,asap:el};function w(n,e,t,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}f.inherits(w,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:f.toJSONObject(this.config),code:this.code,status:this.status}}});const ro=w.prototype,io={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{io[n]={value:n}});Object.defineProperties(w,io);Object.defineProperty(ro,"isAxiosError",{value:!0});w.from=(n,e,t,s,r,i)=>{const o=Object.create(ro);return f.toFlatObject(n,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),w.call(o,n.message,e,t,s,r),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};const tl=null;function ns(n){return f.isPlainObject(n)||f.isArray(n)}function oo(n){return f.endsWith(n,"[]")?n.slice(0,-2):n}function Cr(n,e,t){return n?n.concat(e).map(function(r,i){return r=oo(r),!t&&i?"["+r+"]":r}).join(t?".":""):e}function nl(n){return f.isArray(n)&&!n.some(ns)}const sl=f.toFlatObject(f,{},null,function(e){return/^is[A-Z]/.test(e)});function Cn(n,e,t){if(!f.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=f.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,g){return!f.isUndefined(g[y])});const s=t.metaTokens,r=t.visitor||h,i=t.dots,o=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&f.isSpecCompliantForm(e);if(!f.isFunction(r))throw new TypeError("visitor must be a function");function l(p){if(p===null)return"";if(f.isDate(p))return p.toISOString();if(!c&&f.isBlob(p))throw new w("Blob is not supported. Use a Buffer instead.");return f.isArrayBuffer(p)||f.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function h(p,y,g){let k=p;if(p&&!g&&typeof p=="object"){if(f.endsWith(y,"{}"))y=s?y:y.slice(0,-2),p=JSON.stringify(p);else if(f.isArray(p)&&nl(p)||(f.isFileList(p)||f.endsWith(y,"[]"))&&(k=f.toArray(p)))return y=oo(y),k.forEach(function(M,se){!(f.isUndefined(M)||M===null)&&e.append(o===!0?Cr([y],se,i):o===null?y:y+"[]",l(M))}),!1}return ns(p)?!0:(e.append(Cr(g,y,i),l(p)),!1)}const u=[],d=Object.assign(sl,{defaultVisitor:h,convertValue:l,isVisitable:ns});function _(p,y){if(!f.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));u.push(p),f.forEach(p,function(k,L){(!(f.isUndefined(k)||k===null)&&r.call(e,k,f.isString(L)?L.trim():L,y,d))===!0&&_(k,y?y.concat(L):[L])}),u.pop()}}if(!f.isObject(n))throw new TypeError("data must be an object");return _(n),e}function Sr(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ls(n,e){this._pairs=[],n&&Cn(n,this,e)}const ao=Ls.prototype;ao.append=function(e,t){this._pairs.push([e,t])};ao.toString=function(e){const t=e?function(s){return e.call(this,s,Sr)}:Sr;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function rl(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function co(n,e,t){if(!e)return n;const s=t&&t.encode||rl;f.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let i;if(r?i=r(e,t):i=f.isURLSearchParams(e)?e.toString():new Ls(e,t).toString(s),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}class Tr{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){f.forEach(this.handlers,function(s){s!==null&&e(s)})}}const lo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},il=typeof URLSearchParams<"u"?URLSearchParams:Ls,ol=typeof FormData<"u"?FormData:null,al=typeof Blob<"u"?Blob:null,cl={isBrowser:!0,classes:{URLSearchParams:il,FormData:ol,Blob:al},protocols:["http","https","file","blob","url","data"]},Fs=typeof window<"u"&&typeof document<"u",ss=typeof navigator=="object"&&navigator||void 0,ll=Fs&&(!ss||["ReactNative","NativeScript","NS"].indexOf(ss.product)<0),hl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ul=Fs&&window.location.href||"http://localhost",dl=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Fs,hasStandardBrowserEnv:ll,hasStandardBrowserWebWorkerEnv:hl,navigator:ss,origin:ul},Symbol.toStringTag,{value:"Module"})),K={...dl,...cl};function fl(n,e){return Cn(n,new K.classes.URLSearchParams,Object.assign({visitor:function(t,s,r,i){return K.isNode&&f.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function pl(n){return f.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function _l(n){const e={},t=Object.keys(n);let s;const r=t.length;let i;for(s=0;s<r;s++)i=t[s],e[i]=n[i];return e}function ho(n){function e(t,s,r,i){let o=t[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=t.length;return o=!o&&f.isArray(r)?r.length:o,c?(f.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!a):((!r[o]||!f.isObject(r[o]))&&(r[o]=[]),e(t,s,r[o],i)&&f.isArray(r[o])&&(r[o]=_l(r[o])),!a)}if(f.isFormData(n)&&f.isFunction(n.entries)){const t={};return f.forEachEntry(n,(s,r)=>{e(pl(s),r,t,0)}),t}return null}function ml(n,e,t){if(f.isString(n))try{return(e||JSON.parse)(n),f.trim(n)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(n)}const Nt={transitional:lo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",r=s.indexOf("application/json")>-1,i=f.isObject(e);if(i&&f.isHTMLForm(e)&&(e=new FormData(e)),f.isFormData(e))return r?JSON.stringify(ho(e)):e;if(f.isArrayBuffer(e)||f.isBuffer(e)||f.isStream(e)||f.isFile(e)||f.isBlob(e)||f.isReadableStream(e))return e;if(f.isArrayBufferView(e))return e.buffer;if(f.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return fl(e,this.formSerializer).toString();if((a=f.isFileList(e))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Cn(a?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),ml(e)):e}],transformResponse:[function(e){const t=this.transitional||Nt.transitional,s=t&&t.forcedJSONParsing,r=this.responseType==="json";if(f.isResponse(e)||f.isReadableStream(e))return e;if(e&&f.isString(e)&&(s&&!this.responseType||r)){const o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?w.from(a,w.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:K.classes.FormData,Blob:K.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};f.forEach(["delete","get","head","post","put","patch"],n=>{Nt.headers[n]={}});const gl=f.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),yl=n=>{const e={};let t,s,r;return n&&n.split(`
|
|
2
|
+
`).forEach(function(o){r=o.indexOf(":"),t=o.substring(0,r).trim().toLowerCase(),s=o.substring(r+1).trim(),!(!t||e[t]&&gl[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},Rr=Symbol("internals");function rt(n){return n&&String(n).trim().toLowerCase()}function Ht(n){return n===!1||n==null?n:f.isArray(n)?n.map(Ht):String(n)}function El(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(n);)e[s[1]]=s[2];return e}const wl=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Bn(n,e,t,s,r){if(f.isFunction(s))return s.call(this,e,t);if(r&&(e=t),!!f.isString(e)){if(f.isString(s))return e.indexOf(s)!==-1;if(f.isRegExp(s))return s.test(e)}}function vl(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function bl(n,e){const t=f.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(n,s+t,{value:function(r,i,o){return this[s].call(this,e,r,i,o)},configurable:!0})})}let X=class{constructor(e){e&&this.set(e)}set(e,t,s){const r=this;function i(a,c,l){const h=rt(c);if(!h)throw new Error("header name must be a non-empty string");const u=f.findKey(r,h);(!u||r[u]===void 0||l===!0||l===void 0&&r[u]!==!1)&&(r[u||c]=Ht(a))}const o=(a,c)=>f.forEach(a,(l,h)=>i(l,h,c));if(f.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(f.isString(e)&&(e=e.trim())&&!wl(e))o(yl(e),t);else if(f.isHeaders(e))for(const[a,c]of e.entries())i(c,a,s);else e!=null&&i(t,e,s);return this}get(e,t){if(e=rt(e),e){const s=f.findKey(this,e);if(s){const r=this[s];if(!t)return r;if(t===!0)return El(r);if(f.isFunction(t))return t.call(this,r,s);if(f.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=rt(e),e){const s=f.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||Bn(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let r=!1;function i(o){if(o=rt(o),o){const a=f.findKey(s,o);a&&(!t||Bn(s,s[a],a,t))&&(delete s[a],r=!0)}}return f.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let s=t.length,r=!1;for(;s--;){const i=t[s];(!e||Bn(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const t=this,s={};return f.forEach(this,(r,i)=>{const o=f.findKey(s,i);if(o){t[o]=Ht(r),delete t[i];return}const a=e?vl(i):String(i).trim();a!==i&&delete t[i],t[a]=Ht(r),s[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return f.forEach(this,(s,r)=>{s!=null&&s!==!1&&(t[r]=e&&f.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(r=>s.set(r)),s}static accessor(e){const s=(this[Rr]=this[Rr]={accessors:{}}).accessors,r=this.prototype;function i(o){const a=rt(o);s[a]||(bl(r,o),s[a]=!0)}return f.isArray(e)?e.forEach(i):i(e),this}};X.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);f.reduceDescriptors(X.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(s){this[t]=s}}});f.freezeMethods(X);function Un(n,e){const t=this||Nt,s=e||t,r=X.from(s.headers);let i=s.data;return f.forEach(n,function(a){i=a.call(t,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function uo(n){return!!(n&&n.__CANCEL__)}function Ze(n,e,t){w.call(this,n??"canceled",w.ERR_CANCELED,e,t),this.name="CanceledError"}f.inherits(Ze,w,{__CANCEL__:!0});function fo(n,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?n(t):e(new w("Request failed with status code "+t.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Cl(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Sl(n,e){n=n||10;const t=new Array(n),s=new Array(n);let r=0,i=0,o;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),h=s[i];o||(o=l),t[r]=c,s[r]=l;let u=i,d=0;for(;u!==r;)d+=t[u++],u=u%n;if(r=(r+1)%n,r===i&&(i=(i+1)%n),l-o<e)return;const _=h&&l-h;return _?Math.round(d*1e3/_):void 0}}function Tl(n,e){let t=0,s=1e3/e,r,i;const o=(l,h=Date.now())=>{t=h,r=null,i&&(clearTimeout(i),i=null),n.apply(null,l)};return[(...l)=>{const h=Date.now(),u=h-t;u>=s?o(l,h):(r=l,i||(i=setTimeout(()=>{i=null,o(r)},s-u)))},()=>r&&o(r)]}const Xt=(n,e,t=3)=>{let s=0;const r=Sl(50,250);return Tl(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=o-s,l=r(c),h=o<=a;s=o;const u={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&h?(a-o)/l:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(u)},t)},Ir=(n,e)=>{const t=n!=null;return[s=>e[0]({lengthComputable:t,total:n,loaded:s}),e[1]]},Nr=n=>(...e)=>f.asap(()=>n(...e)),Rl=K.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,K.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(K.origin),K.navigator&&/(msie|trident)/i.test(K.navigator.userAgent)):()=>!0,Il=K.hasStandardBrowserEnv?{write(n,e,t,s,r,i){const o=[n+"="+encodeURIComponent(e)];f.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),f.isString(s)&&o.push("path="+s),f.isString(r)&&o.push("domain="+r),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Nl(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function kl(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function po(n,e,t){let s=!Nl(e);return n&&(s||t==!1)?kl(n,e):e}const kr=n=>n instanceof X?{...n}:n;function Pe(n,e){e=e||{};const t={};function s(l,h,u,d){return f.isPlainObject(l)&&f.isPlainObject(h)?f.merge.call({caseless:d},l,h):f.isPlainObject(h)?f.merge({},h):f.isArray(h)?h.slice():h}function r(l,h,u,d){if(f.isUndefined(h)){if(!f.isUndefined(l))return s(void 0,l,u,d)}else return s(l,h,u,d)}function i(l,h){if(!f.isUndefined(h))return s(void 0,h)}function o(l,h){if(f.isUndefined(h)){if(!f.isUndefined(l))return s(void 0,l)}else return s(void 0,h)}function a(l,h,u){if(u in e)return s(l,h);if(u in n)return s(void 0,l)}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,h,u)=>r(kr(l),kr(h),u,!0)};return f.forEach(Object.keys(Object.assign({},n,e)),function(h){const u=c[h]||r,d=u(n[h],e[h],h);f.isUndefined(d)&&u!==a||(t[h]=d)}),t}const _o=n=>{const e=Pe({},n);let{data:t,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:i,headers:o,auth:a}=e;e.headers=o=X.from(o),e.url=co(po(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(f.isFormData(t)){if(K.hasStandardBrowserEnv||K.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[l,...h]=c?c.split(";").map(u=>u.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...h].join("; "))}}if(K.hasStandardBrowserEnv&&(s&&f.isFunction(s)&&(s=s(e)),s||s!==!1&&Rl(e.url))){const l=r&&i&&Il.read(i);l&&o.set(r,l)}return e},Al=typeof XMLHttpRequest<"u",xl=Al&&function(n){return new Promise(function(t,s){const r=_o(n);let i=r.data;const o=X.from(r.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=r,h,u,d,_,p;function y(){_&&_(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let g=new XMLHttpRequest;g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout;function k(){if(!g)return;const M=X.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),G={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:M,config:n,request:g};fo(function(Te){t(Te),y()},function(Te){s(Te),y()},G),g=null}"onloadend"in g?g.onloadend=k:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(k)},g.onabort=function(){g&&(s(new w("Request aborted",w.ECONNABORTED,n,g)),g=null)},g.onerror=function(){s(new w("Network Error",w.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let se=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const G=r.transitional||lo;r.timeoutErrorMessage&&(se=r.timeoutErrorMessage),s(new w(se,G.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,n,g)),g=null},i===void 0&&o.setContentType(null),"setRequestHeader"in g&&f.forEach(o.toJSON(),function(se,G){g.setRequestHeader(G,se)}),f.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),a&&a!=="json"&&(g.responseType=r.responseType),l&&([d,p]=Xt(l,!0),g.addEventListener("progress",d)),c&&g.upload&&([u,_]=Xt(c),g.upload.addEventListener("progress",u),g.upload.addEventListener("loadend",_)),(r.cancelToken||r.signal)&&(h=M=>{g&&(s(!M||M.type?new Ze(null,n,g):M),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const L=Cl(r.url);if(L&&K.protocols.indexOf(L)===-1){s(new w("Unsupported protocol "+L+":",w.ERR_BAD_REQUEST,n));return}g.send(i||null)})},Ol=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let s=new AbortController,r;const i=function(l){if(!r){r=!0,a();const h=l instanceof Error?l:this.reason;s.abort(h instanceof w?h:new Ze(h instanceof Error?h.message:h))}};let o=e&&setTimeout(()=>{o=null,i(new w(`timeout ${e} of ms exceeded`,w.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),n=null)};n.forEach(l=>l.addEventListener("abort",i));const{signal:c}=s;return c.unsubscribe=()=>f.asap(a),c}},Pl=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let s=0,r;for(;s<t;)r=s+e,yield n.slice(s,r),s=r},Dl=async function*(n,e){for await(const t of Ll(n))yield*Pl(t,e)},Ll=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},Ar=(n,e,t,s)=>{const r=Dl(n,e);let i=0,o,a=c=>{o||(o=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:l,value:h}=await r.next();if(l){a(),c.close();return}let u=h.byteLength;if(t){let d=i+=u;t(d)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),r.return()}},{highWaterMark:2})},Sn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",mo=Sn&&typeof ReadableStream=="function",Fl=Sn&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),go=(n,...e)=>{try{return!!n(...e)}catch{return!1}},Ml=mo&&go(()=>{let n=!1;const e=new Request(K.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),xr=64*1024,rs=mo&&go(()=>f.isReadableStream(new Response("").body)),Zt={stream:rs&&(n=>n.body)};Sn&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Zt[e]&&(Zt[e]=f.isFunction(n[e])?t=>t[e]():(t,s)=>{throw new w(`Response type '${e}' is not supported`,w.ERR_NOT_SUPPORT,s)})})})(new Response);const Bl=async n=>{if(n==null)return 0;if(f.isBlob(n))return n.size;if(f.isSpecCompliantForm(n))return(await new Request(K.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(f.isArrayBufferView(n)||f.isArrayBuffer(n))return n.byteLength;if(f.isURLSearchParams(n)&&(n=n+""),f.isString(n))return(await Fl(n)).byteLength},Ul=async(n,e)=>{const t=f.toFiniteNumber(n.getContentLength());return t??Bl(e)},ql=Sn&&(async n=>{let{url:e,method:t,data:s,signal:r,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:u="same-origin",fetchOptions:d}=_o(n);l=l?(l+"").toLowerCase():"text";let _=Ol([r,i&&i.toAbortSignal()],o),p;const y=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let g;try{if(c&&Ml&&t!=="get"&&t!=="head"&&(g=await Ul(h,s))!==0){let G=new Request(e,{method:"POST",body:s,duplex:"half"}),ye;if(f.isFormData(s)&&(ye=G.headers.get("content-type"))&&h.setContentType(ye),G.body){const[Te,Ft]=Ir(g,Xt(Nr(c)));s=Ar(G.body,xr,Te,Ft)}}f.isString(u)||(u=u?"include":"omit");const k="credentials"in Request.prototype;p=new Request(e,{...d,signal:_,method:t.toUpperCase(),headers:h.normalize().toJSON(),body:s,duplex:"half",credentials:k?u:void 0});let L=await fetch(p);const M=rs&&(l==="stream"||l==="response");if(rs&&(a||M&&y)){const G={};["status","statusText","headers"].forEach(vr=>{G[vr]=L[vr]});const ye=f.toFiniteNumber(L.headers.get("content-length")),[Te,Ft]=a&&Ir(ye,Xt(Nr(a),!0))||[];L=new Response(Ar(L.body,xr,Te,()=>{Ft&&Ft(),y&&y()}),G)}l=l||"text";let se=await Zt[f.findKey(Zt,l)||"text"](L,n);return!M&&y&&y(),await new Promise((G,ye)=>{fo(G,ye,{data:se,headers:X.from(L.headers),status:L.status,statusText:L.statusText,config:n,request:p})})}catch(k){throw y&&y(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,n,p),{cause:k.cause||k}):w.from(k,k&&k.code,n,p)}}),is={http:tl,xhr:xl,fetch:ql};f.forEach(is,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const Or=n=>`- ${n}`,Wl=n=>f.isFunction(n)||n===null||n===!1,yo={getAdapter:n=>{n=f.isArray(n)?n:[n];const{length:e}=n;let t,s;const r={};for(let i=0;i<e;i++){t=n[i];let o;if(s=t,!Wl(t)&&(s=is[(o=String(t)).toLowerCase()],s===void 0))throw new w(`Unknown adapter '${o}'`);if(s)break;r[o||"#"+i]=s}if(!s){const i=Object.entries(r).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
|
|
4
|
+
`+i.map(Or).join(`
|
|
5
|
+
`):" "+Or(i[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s},adapters:is};function qn(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Ze(null,n)}function Pr(n){return qn(n),n.headers=X.from(n.headers),n.data=Un.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),yo.getAdapter(n.adapter||Nt.adapter)(n).then(function(s){return qn(n),s.data=Un.call(n,n.transformResponse,s),s.headers=X.from(s.headers),s},function(s){return uo(s)||(qn(n),s&&s.response&&(s.response.data=Un.call(n,n.transformResponse,s.response),s.response.headers=X.from(s.response.headers))),Promise.reject(s)})}const Eo="1.8.4",Tn={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{Tn[n]=function(s){return typeof s===n||"a"+(e<1?"n ":" ")+n}});const Dr={};Tn.transitional=function(e,t,s){function r(i,o){return"[Axios v"+Eo+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return(i,o,a)=>{if(e===!1)throw new w(r(o," has been removed"+(t?" in "+t:"")),w.ERR_DEPRECATED);return t&&!Dr[o]&&(Dr[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,a):!0}};Tn.spelling=function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function Hl(n,e,t){if(typeof n!="object")throw new w("options must be an object",w.ERR_BAD_OPTION_VALUE);const s=Object.keys(n);let r=s.length;for(;r-- >0;){const i=s[r],o=e[i];if(o){const a=n[i],c=a===void 0||o(a,i,n);if(c!==!0)throw new w("option "+i+" must be "+c,w.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new w("Unknown option "+i,w.ERR_BAD_OPTION)}}const Vt={assertOptions:Hl,validators:Tn},he=Vt.validators;let Oe=class{constructor(e){this.defaults=e,this.interceptors={request:new Tr,response:new Tr}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
6
|
+
`+i):s.stack=i}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Pe(this.defaults,t);const{transitional:s,paramsSerializer:r,headers:i}=t;s!==void 0&&Vt.assertOptions(s,{silentJSONParsing:he.transitional(he.boolean),forcedJSONParsing:he.transitional(he.boolean),clarifyTimeoutError:he.transitional(he.boolean)},!1),r!=null&&(f.isFunction(r)?t.paramsSerializer={serialize:r}:Vt.assertOptions(r,{encode:he.function,serialize:he.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Vt.assertOptions(t,{baseUrl:he.spelling("baseURL"),withXsrfToken:he.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&f.merge(i.common,i[t.method]);i&&f.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=X.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(t)===!1||(c=c&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const l=[];this.interceptors.response.forEach(function(y){l.push(y.fulfilled,y.rejected)});let h,u=0,d;if(!c){const p=[Pr.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,l),d=p.length,h=Promise.resolve(t);u<d;)h=h.then(p[u++],p[u++]);return h}d=a.length;let _=t;for(u=0;u<d;){const p=a[u++],y=a[u++];try{_=p(_)}catch(g){y.call(this,g);break}}try{h=Pr.call(this,_)}catch(p){return Promise.reject(p)}for(u=0,d=l.length;u<d;)h=h.then(l[u++],l[u++]);return h}getUri(e){e=Pe(this.defaults,e);const t=po(e.baseURL,e.url,e.allowAbsoluteUrls);return co(t,e.params,e.paramsSerializer)}};f.forEach(["delete","get","head","options"],function(e){Oe.prototype[e]=function(t,s){return this.request(Pe(s||{},{method:e,url:t,data:(s||{}).data}))}});f.forEach(["post","put","patch"],function(e){function t(s){return function(i,o,a){return this.request(Pe(a||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Oe.prototype[e]=t(),Oe.prototype[e+"Form"]=t(!0)});let Vl=class wo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const s=this;this.promise.then(r=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](r);s._listeners=null}),this.promise.then=r=>{let i;const o=new Promise(a=>{s.subscribe(a),i=a}).then(r);return o.cancel=function(){s.unsubscribe(i)},o},e(function(i,o,a){s.reason||(s.reason=new Ze(i,o,a),t(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=s=>{e.abort(s)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new wo(function(r){e=r}),cancel:e}}};function $l(n){return function(t){return n.apply(null,t)}}function zl(n){return f.isObject(n)&&n.isAxiosError===!0}const os={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(os).forEach(([n,e])=>{os[e]=n});function vo(n){const e=new Oe(n),t=Ji(Oe.prototype.request,e);return f.extend(t,Oe.prototype,e,{allOwnKeys:!0}),f.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return vo(Pe(n,r))},t}const N=vo(Nt);N.Axios=Oe;N.CanceledError=Ze;N.CancelToken=Vl;N.isCancel=uo;N.VERSION=Eo;N.toFormData=Cn;N.AxiosError=w;N.Cancel=N.CanceledError;N.all=function(e){return Promise.all(e)};N.spread=$l;N.isAxiosError=zl;N.mergeConfig=Pe;N.AxiosHeaders=X;N.formToJSON=n=>ho(f.isHTMLForm(n)?new FormData(n):n);N.getAdapter=yo.getAdapter;N.HttpStatusCode=os;N.default=N;const{Axios:M_,AxiosError:B_,CanceledError:U_,isCancel:q_,CancelToken:W_,VERSION:H_,all:V_,Cancel:$_,isAxiosError:z_,spread:j_,toFormData:K_,AxiosHeaders:G_,HttpStatusCode:Y_,formToJSON:Q_,getAdapter:J_,mergeConfig:X_}=N,ue=Object.create(null);ue.open="0";ue.close="1";ue.ping="2";ue.pong="3";ue.message="4";ue.upgrade="5";ue.noop="6";const $t=Object.create(null);Object.keys(ue).forEach(n=>{$t[ue[n]]=n});const as={type:"error",data:"parser error"},bo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Co=typeof ArrayBuffer=="function",So=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Ms=({type:n,data:e},t,s)=>bo&&e instanceof Blob?t?s(e):Lr(e,s):Co&&(e instanceof ArrayBuffer||So(e))?t?s(e):Lr(new Blob([e]),s):s(ue[n]+(e||"")),Lr=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function Fr(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Wn;function jl(n,e){if(bo&&n.data instanceof Blob)return n.data.arrayBuffer().then(Fr).then(e);if(Co&&(n.data instanceof ArrayBuffer||So(n.data)))return e(Fr(n.data));Ms(n,!1,t=>{Wn||(Wn=new TextEncoder),e(Wn.encode(t))})}const Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ht=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Mr.length;n++)ht[Mr.charCodeAt(n)]=n;const Kl=n=>{let e=n.length*.75,t=n.length,s,r=0,i,o,a,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const l=new ArrayBuffer(e),h=new Uint8Array(l);for(s=0;s<t;s+=4)i=ht[n.charCodeAt(s)],o=ht[n.charCodeAt(s+1)],a=ht[n.charCodeAt(s+2)],c=ht[n.charCodeAt(s+3)],h[r++]=i<<2|o>>4,h[r++]=(o&15)<<4|a>>2,h[r++]=(a&3)<<6|c&63;return l},Gl=typeof ArrayBuffer=="function",Bs=(n,e)=>{if(typeof n!="string")return{type:"message",data:To(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Yl(n.substring(1),e)}:$t[t]?n.length>1?{type:$t[t],data:n.substring(1)}:{type:$t[t]}:as},Yl=(n,e)=>{if(Gl){const t=Kl(n);return To(t,e)}else return{base64:!0,data:n}},To=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Ro="",Ql=(n,e)=>{const t=n.length,s=new Array(t);let r=0;n.forEach((i,o)=>{Ms(i,!1,a=>{s[o]=a,++r===t&&e(s.join(Ro))})})},Jl=(n,e)=>{const t=n.split(Ro),s=[];for(let r=0;r<t.length;r++){const i=Bs(t[r],e);if(s.push(i),i.type==="error")break}return s};function Xl(){return new TransformStream({transform(n,e){jl(n,t=>{const s=t.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Hn;function Mt(n){return n.reduce((e,t)=>e+t.length,0)}function Bt(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let r=0;r<e;r++)t[r]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function Zl(n,e){Hn||(Hn=new TextDecoder);const t=[];let s=0,r=-1,i=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(s===0){if(Mt(t)<1)break;const c=Bt(t,1);i=(c[0]&128)===128,r=c[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if(Mt(t)<2)break;const c=Bt(t,2);r=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(Mt(t)<8)break;const c=Bt(t,8),l=new DataView(c.buffer,c.byteOffset,c.length),h=l.getUint32(0);if(h>Math.pow(2,21)-1){a.enqueue(as);break}r=h*Math.pow(2,32)+l.getUint32(4),s=3}else{if(Mt(t)<r)break;const c=Bt(t,r);a.enqueue(Bs(i?c:Hn.decode(c),e)),s=0}if(r===0||r>n){a.enqueue(as);break}}}})}const Io=4;function q(n){if(n)return eh(n)}function eh(n){for(var e in q.prototype)n[e]=q.prototype[e];return n}q.prototype.on=q.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};q.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};q.prototype.off=q.prototype.removeListener=q.prototype.removeAllListeners=q.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,r=0;r<t.length;r++)if(s=t[r],s===e||s.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+n],this};q.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,r=t.length;s<r;++s)t[s].apply(this,e)}return this};q.prototype.emitReserved=q.prototype.emit;q.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};q.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Rn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ne=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),th="arraybuffer";function No(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const nh=ne.setTimeout,sh=ne.clearTimeout;function In(n,e){e.useNativeTimers?(n.setTimeoutFn=nh.bind(ne),n.clearTimeoutFn=sh.bind(ne)):(n.setTimeoutFn=ne.setTimeout.bind(ne),n.clearTimeoutFn=ne.clearTimeout.bind(ne))}const rh=1.33;function ih(n){return typeof n=="string"?oh(n):Math.ceil((n.byteLength||n.size)*rh)}function oh(n){let e=0,t=0;for(let s=0,r=n.length;s<r;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function ko(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function ah(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function ch(n){let e={},t=n.split("&");for(let s=0,r=t.length;s<r;s++){let i=t[s].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class lh extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class Us extends q{constructor(e){super(),this.writable=!1,In(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new lh(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Bs(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=ah(e);return t.length?"?"+t:""}}class hh extends Us{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Jl(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Ql(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=ko()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Ao=!1;try{Ao=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const uh=Ao;function dh(){}class fh extends hh{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}let Ve=class zt extends q{constructor(e,t,s){super(),this.createRequest=e,In(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=No(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=zt.requestsCount++,zt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=dh,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete zt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Ve.requestsCount=0;Ve.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Br);else if(typeof addEventListener=="function"){const n="onpagehide"in ne?"pagehide":"unload";addEventListener(n,Br,!1)}}function Br(){for(let n in Ve.requests)Ve.requests.hasOwnProperty(n)&&Ve.requests[n].abort()}const ph=function(){const n=xo({xdomain:!1});return n&&n.responseType!==null}();class _h extends fh{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=ph&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ve(xo,this.uri(),e)}}function xo(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||uh))return new XMLHttpRequest}catch{}if(!e)try{return new ne[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Oo=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class mh extends Us{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=Oo?{}:No(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;Ms(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}r&&Rn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ko()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Vn=ne.WebSocket||ne.MozWebSocket;class gh extends mh{createSocket(e,t,s){return Oo?new Vn(e,t,s):t?new Vn(e,t):new Vn(e)}doWrite(e,t){this.ws.send(t)}}class yh extends Us{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Zl(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),r=Xl();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{s.read().then(({done:a,value:c})=>{a||(this.onPacket(c),i())}).catch(a=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;this._writer.write(s).then(()=>{r&&Rn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Eh={websocket:gh,webtransport:yh,polling:_h},wh=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vh=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function cs(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let r=wh.exec(n||""),i={},o=14;for(;o--;)i[vh[o]]=r[o]||"";return t!=-1&&s!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=bh(i,i.path),i.queryKey=Ch(i,i.query),i}function bh(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Ch(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,i){r&&(t[r]=i)}),t}const ls=typeof addEventListener=="function"&&typeof removeEventListener=="function",jt=[];ls&&addEventListener("offline",()=>{jt.forEach(n=>n())},!1);class Ee extends q{constructor(e,t){if(super(),this.binaryType=th,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=cs(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=cs(t.host).host);In(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ch(this.opts.query)),ls&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},jt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Io,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ee.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",Ee.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(t+=ih(r)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Rn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,r){if(typeof t=="function"&&(r=t,t=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:e,data:t,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(Ee.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ls&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=jt.indexOf(this._offlineEventListener);s!==-1&&jt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Ee.protocol=Io;class Sh extends Ee{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;Ee.priorWebsocketSuccess=!1;const r=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",u=>{if(!s)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ee.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function i(){s||(s=!0,h(),t.close(),t=null)}const o=u=>{const d=new Error("probe error: "+u);d.transport=t.name,i(),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function c(){o("socket closed")}function l(u){t&&u.name!==t.name&&i()}const h=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",l)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let Th=class extends Sh{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>Eh[r]).filter(r=>!!r)),super(e,s)}};function Rh(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=cs(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+e,s.href=s.protocol+"://"+i+(t&&t.port===s.port?"":":"+s.port),s}const Ih=typeof ArrayBuffer=="function",Nh=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Po=Object.prototype.toString,kh=typeof Blob=="function"||typeof Blob<"u"&&Po.call(Blob)==="[object BlobConstructor]",Ah=typeof File=="function"||typeof File<"u"&&Po.call(File)==="[object FileConstructor]";function qs(n){return Ih&&(n instanceof ArrayBuffer||Nh(n))||kh&&n instanceof Blob||Ah&&n instanceof File}function Kt(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(Kt(n[t]))return!0;return!1}if(qs(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Kt(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Kt(n[t]))return!0;return!1}function xh(n){const e=[],t=n.data,s=n;return s.data=hs(t,e),s.attachments=e.length,{packet:s,buffers:e}}function hs(n,e){if(!n)return n;if(qs(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=hs(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=hs(n[s],e));return t}return n}function Oh(n,e){return n.data=us(n.data,e),delete n.attachments,n}function us(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=us(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=us(n[t],e));return n}const Ph=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Dh=5;var S;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(S||(S={}));class Lh{constructor(e){this.replacer=e}encode(e){return(e.type===S.EVENT||e.type===S.ACK)&&Kt(e)?this.encodeAsBinary({type:e.type===S.EVENT?S.BINARY_EVENT:S.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===S.BINARY_EVENT||e.type===S.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=xh(e),s=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(s),r}}function Ur(n){return Object.prototype.toString.call(n)==="[object Object]"}class Ws extends q{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===S.BINARY_EVENT;s||t.type===S.BINARY_ACK?(t.type=s?S.EVENT:S.ACK,this.reconstructor=new Fh(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(qs(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(S[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===S.BINARY_EVENT||s.type===S.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(i,t)}else s.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Ws.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case S.CONNECT:return Ur(t);case S.DISCONNECT:return t===void 0;case S.CONNECT_ERROR:return typeof t=="string"||Ur(t);case S.EVENT:case S.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ph.indexOf(t[0])===-1);case S.ACK:case S.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Fh{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Oh(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Mh=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ws,Encoder:Lh,get PacketType(){return S},protocol:Dh},Symbol.toStringTag,{value:"Module"}));function re(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Bh=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Do extends q{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[re(e,"open",this.onopen.bind(this)),re(e,"packet",this.onpacket.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,r,i;if(Bh.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:S.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,u=t.pop();this._registerAckCallback(h,u),o.id=h}const a=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...i)=>s!==this._queue[0]?void 0:(r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:S.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case S.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case S.EVENT:case S.BINARY_EVENT:this.onevent(e);break;case S.ACK:case S.BINARY_ACK:this.onack(e);break;case S.DISCONNECT:this.ondisconnect();break;case S.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...r){s||(s=!0,t.packet({type:S.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:S.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function et(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}et.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};et.prototype.reset=function(){this.attempts=0};et.prototype.setMin=function(n){this.ms=n};et.prototype.setMax=function(n){this.max=n};et.prototype.setJitter=function(n){this.jitter=n};class ds extends q{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,In(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new et({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Mh;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Th(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=re(t,"open",function(){s.onopen(),e&&e()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=re(t,"error",i);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(re(e,"ping",this.onping.bind(this)),re(e,"data",this.ondata.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this)),re(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Rn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new Do(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const it={};function Gt(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Rh(n,e.path||"/socket.io"),s=t.source,r=t.id,i=t.path,o=it[r]&&i in it[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return a?c=new ds(s,e):(it[r]||(it[r]=new ds(s,e)),c=it[r]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Gt,{Manager:ds,Socket:Do,io:Gt,connect:Gt});const Uh=()=>{};/**
|
|
7
7
|
* @license
|
|
8
8
|
* Copyright 2017 Google LLC
|
|
9
9
|
*
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
|
-
*/const
|
|
21
|
+
*/const Lo={NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2017 Google LLC
|
|
24
24
|
*
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
34
34
|
* See the License for the specific language governing permissions and
|
|
35
35
|
* limitations under the License.
|
|
36
|
-
*/const m=function(n,e){if(!n)throw tt(e)},tt=function(n){return new Error("Firebase Database ("+
|
|
36
|
+
*/const m=function(n,e){if(!n)throw tt(e)},tt=function(n){return new Error("Firebase Database ("+Lo.SDK_VERSION+") INTERNAL ASSERT FAILED: "+n)};/**
|
|
37
37
|
* @license
|
|
38
38
|
* Copyright 2017 Google LLC
|
|
39
39
|
*
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
49
49
|
* See the License for the specific language governing permissions and
|
|
50
50
|
* limitations under the License.
|
|
51
|
-
*/const
|
|
51
|
+
*/const Fo=function(n){const e=[];let t=0;for(let s=0;s<n.length;s++){let r=n.charCodeAt(s);r<128?e[t++]=r:r<2048?(e[t++]=r>>6|192,e[t++]=r&63|128):(r&64512)===55296&&s+1<n.length&&(n.charCodeAt(s+1)&64512)===56320?(r=65536+((r&1023)<<10)+(n.charCodeAt(++s)&1023),e[t++]=r>>18|240,e[t++]=r>>12&63|128,e[t++]=r>>6&63|128,e[t++]=r&63|128):(e[t++]=r>>12|224,e[t++]=r>>6&63|128,e[t++]=r&63|128)}return e},qh=function(n){const e=[];let t=0,s=0;for(;t<n.length;){const r=n[t++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){const i=n[t++];e[s++]=String.fromCharCode((r&31)<<6|i&63)}else if(r>239&&r<365){const i=n[t++],o=n[t++],a=n[t++],c=((r&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[s++]=String.fromCharCode(55296+(c>>10)),e[s++]=String.fromCharCode(56320+(c&1023))}else{const i=n[t++],o=n[t++];e[s++]=String.fromCharCode((r&15)<<12|(i&63)<<6|o&63)}}return e.join("")},Hs={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_,s=[];for(let r=0;r<n.length;r+=3){const i=n[r],o=r+1<n.length,a=o?n[r+1]:0,c=r+2<n.length,l=c?n[r+2]:0,h=i>>2,u=(i&3)<<4|a>>4;let d=(a&15)<<2|l>>6,_=l&63;c||(_=64,o||(d=64)),s.push(t[h],t[u],t[d],t[_])}return s.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Fo(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):qh(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let r=0;r<n.length;){const i=t[n.charAt(r++)],a=r<n.length?t[n.charAt(r)]:0;++r;const l=r<n.length?t[n.charAt(r)]:64;++r;const u=r<n.length?t[n.charAt(r)]:64;if(++r,i==null||a==null||l==null||u==null)throw new Wh;const d=i<<2|a>>4;if(s.push(d),l!==64){const _=a<<4&240|l>>2;if(s.push(_),u!==64){const p=l<<6&192|u;s.push(p)}}}return s},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)}}};class Wh extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Mo=function(n){const e=Fo(n);return Hs.encodeByteArray(e,!0)},en=function(n){return Mo(n).replace(/\./g,"")},fs=function(n){try{return Hs.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright 2017 Google LLC
|
|
54
54
|
*
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
64
64
|
* See the License for the specific language governing permissions and
|
|
65
65
|
* limitations under the License.
|
|
66
|
-
*/function
|
|
66
|
+
*/function Hh(n){return Bo(void 0,n)}function Bo(n,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:const t=e;return new Date(t.getTime());case Object:n===void 0&&(n={});break;case Array:n=[];break;default:return e}for(const t in e)!e.hasOwnProperty(t)||!Vh(t)||(n[t]=Bo(n[t],e[t]));return n}function Vh(n){return n!=="__proto__"}/**
|
|
67
67
|
* @license
|
|
68
68
|
* Copyright 2022 Google LLC
|
|
69
69
|
*
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
79
79
|
* See the License for the specific language governing permissions and
|
|
80
80
|
* limitations under the License.
|
|
81
|
-
*/function
|
|
81
|
+
*/function $h(){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.")}/**
|
|
82
82
|
* @license
|
|
83
83
|
* Copyright 2022 Google LLC
|
|
84
84
|
*
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
94
94
|
* See the License for the specific language governing permissions and
|
|
95
95
|
* limitations under the License.
|
|
96
|
-
*/const
|
|
96
|
+
*/const zh=()=>$h().__FIREBASE_DEFAULTS__,jh=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Kh=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&fs(n[1]);return e&&JSON.parse(e)},Uo=()=>{try{return Uh()||zh()||jh()||Kh()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Gh=n=>{var e,t;return(t=(e=Uo())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Yh=n=>{const e=Gh(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const s=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),s]:[e.substring(0,t),s]},qo=()=>{var n;return(n=Uo())===null||n===void 0?void 0:n.config};/**
|
|
97
97
|
* @license
|
|
98
98
|
* Copyright 2017 Google LLC
|
|
99
99
|
*
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
124
124
|
* See the License for the specific language governing permissions and
|
|
125
125
|
* limitations under the License.
|
|
126
|
-
*/function
|
|
126
|
+
*/function Qh(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},s=e||"demo-project",r=n.iat||0,i=n.sub||n.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${s}`,aud:s,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},n);return[en(JSON.stringify(t)),en(JSON.stringify(o)),""].join(".")}/**
|
|
127
127
|
* @license
|
|
128
128
|
* Copyright 2017 Google LLC
|
|
129
129
|
*
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
139
139
|
* See the License for the specific language governing permissions and
|
|
140
140
|
* limitations under the License.
|
|
141
|
-
*/function
|
|
141
|
+
*/function Jh(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Wo(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Jh())}function Xh(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Zh(){return Lo.NODE_ADMIN===!0}function eu(){try{return typeof indexedDB=="object"}catch{return!1}}function tu(){return new Promise((n,e)=>{try{let t=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),t||self.indexedDB.deleteDatabase(s),n(!0)},r.onupgradeneeded=()=>{t=!1},r.onerror=()=>{var i;e(((i=r.error)===null||i===void 0?void 0:i.message)||"")}}catch(t){e(t)}})}/**
|
|
142
142
|
* @license
|
|
143
143
|
* Copyright 2017 Google LLC
|
|
144
144
|
*
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
154
154
|
* See the License for the specific language governing permissions and
|
|
155
155
|
* limitations under the License.
|
|
156
|
-
*/const
|
|
156
|
+
*/const nu="FirebaseError";class kt extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name=nu,Object.setPrototypeOf(this,kt.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ho.prototype.create)}}class Ho{constructor(e,t,s){this.service=e,this.serviceName=t,this.errors=s}create(e,...t){const s=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],o=i?su(i,s):"Error",a=`${this.serviceName}: ${o} (${r}).`;return new kt(r,a,s)}}function su(n,e){return n.replace(ru,(t,s)=>{const r=e[s];return r!=null?String(r):`<${s}?>`})}const ru=/\{\$([^}]+)}/g;/**
|
|
157
157
|
* @license
|
|
158
158
|
* Copyright 2017 Google LLC
|
|
159
159
|
*
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
184
184
|
* See the License for the specific language governing permissions and
|
|
185
185
|
* limitations under the License.
|
|
186
|
-
*/const
|
|
186
|
+
*/const Vo=function(n){let e={},t={},s={},r="";try{const i=n.split(".");e=gt(fs(i[0])||""),t=gt(fs(i[1])||""),r=i[2],s=t.d||{},delete t.d}catch{}return{header:e,claims:t,data:s,signature:r}},iu=function(n){const e=Vo(n),t=e.claims;return!!t&&typeof t=="object"&&t.hasOwnProperty("iat")},ou=function(n){const e=Vo(n).claims;return typeof e=="object"&&e.admin===!0};/**
|
|
187
187
|
* @license
|
|
188
188
|
* Copyright 2017 Google LLC
|
|
189
189
|
*
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
214
214
|
* See the License for the specific language governing permissions and
|
|
215
215
|
* limitations under the License.
|
|
216
|
-
*/function
|
|
216
|
+
*/function au(n){const e=[];for(const[t,s]of Object.entries(n))Array.isArray(s)?s.forEach(r=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(s));return e.length?"&"+e.join("&"):""}/**
|
|
217
217
|
* @license
|
|
218
218
|
* Copyright 2017 Google LLC
|
|
219
219
|
*
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
229
229
|
* See the License for the specific language governing permissions and
|
|
230
230
|
* limitations under the License.
|
|
231
|
-
*/class
|
|
231
|
+
*/class cu{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const s=this.W_;if(typeof e=="string")for(let u=0;u<16;u++)s[u]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let u=0;u<16;u++)s[u]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let u=16;u<80;u++){const d=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=(d<<1|d>>>31)&4294967295}let r=this.chain_[0],i=this.chain_[1],o=this.chain_[2],a=this.chain_[3],c=this.chain_[4],l,h;for(let u=0;u<80;u++){u<40?u<20?(l=a^i&(o^a),h=1518500249):(l=i^o^a,h=1859775393):u<60?(l=i&o|a&(i|o),h=2400959708):(l=i^o^a,h=3395469782);const d=(r<<5|r>>>27)+l+c+h+s[u]&4294967295;c=a,a=o,o=(i<<30|i>>>2)&4294967295,i=r,r=d}this.chain_[0]=this.chain_[0]+r&4294967295,this.chain_[1]=this.chain_[1]+i&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(e,t){if(e==null)return;t===void 0&&(t=e.length);const s=t-this.blockSize;let r=0;const i=this.buf_;let o=this.inbuf_;for(;r<t;){if(o===0)for(;r<=s;)this.compress_(e,r),r+=this.blockSize;if(typeof e=="string"){for(;r<t;)if(i[o]=e.charCodeAt(r),++o,++r,o===this.blockSize){this.compress_(i),o=0;break}}else for(;r<t;)if(i[o]=e[r],++o,++r,o===this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=t}digest(){const e=[];let t=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let r=this.blockSize-1;r>=56;r--)this.buf_[r]=t&255,t/=256;this.compress_(this.buf_);let s=0;for(let r=0;r<5;r++)for(let i=24;i>=0;i-=8)e[s]=this.chain_[r]>>i&255,++s;return e}}function $o(n,e){return`${n} failed: ${e} argument `}/**
|
|
232
232
|
* @license
|
|
233
233
|
* Copyright 2017 Google LLC
|
|
234
234
|
*
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
244
244
|
* See the License for the specific language governing permissions and
|
|
245
245
|
* limitations under the License.
|
|
246
|
-
*/const
|
|
246
|
+
*/const lu=function(n){const e=[];let t=0;for(let s=0;s<n.length;s++){let r=n.charCodeAt(s);if(r>=55296&&r<=56319){const i=r-55296;s++,m(s<n.length,"Surrogate pair missing trail surrogate.");const o=n.charCodeAt(s)-56320;r=65536+(i<<10)+o}r<128?e[t++]=r:r<2048?(e[t++]=r>>6|192,e[t++]=r&63|128):r<65536?(e[t++]=r>>12|224,e[t++]=r>>6&63|128,e[t++]=r&63|128):(e[t++]=r>>18|240,e[t++]=r>>12&63|128,e[t++]=r>>6&63|128,e[t++]=r&63|128)}return e},Nn=function(n){let e=0;for(let t=0;t<n.length;t++){const s=n.charCodeAt(t);s<128?e++:s<2048?e+=2:s>=55296&&s<=56319?(e+=4,t++):e+=3}return e};/**
|
|
247
247
|
* @license
|
|
248
248
|
* Copyright 2021 Google LLC
|
|
249
249
|
*
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
259
259
|
* See the License for the specific language governing permissions and
|
|
260
260
|
* limitations under the License.
|
|
261
|
-
*/function
|
|
261
|
+
*/function kn(n){return n&&n._delegate?n._delegate:n}class yt{constructor(e,t,s){this.name=e,this.instanceFactory=t,this.type=s,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}}/**
|
|
262
262
|
* @license
|
|
263
263
|
* Copyright 2019 Google LLC
|
|
264
264
|
*
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
289
289
|
* See the License for the specific language governing permissions and
|
|
290
290
|
* limitations under the License.
|
|
291
|
-
*/class
|
|
291
|
+
*/class hu{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 s=new Vs;if(this.instancesDeferred.set(t,s),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&s.resolve(r)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const s=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(s)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:s})}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(du(e))try{this.getOrInitializeService({instanceIdentifier:Re})}catch{}for(const[t,s]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:r});s.resolve(i)}catch{}}}}clearInstance(e=Re){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=Re){return this.instances.has(e)}getOptions(e=Re){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,s=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(s))throw Error(`${this.name}(${s}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:s,options:t});for(const[i,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(i);s===a&&o.resolve(r)}return r}onInit(e,t){var s;const r=this.normalizeInstanceIdentifier(t),i=(s=this.onInitCallbacks.get(r))!==null&&s!==void 0?s:new Set;i.add(e),this.onInitCallbacks.set(r,i);const o=this.instances.get(r);return o&&e(o,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const s=this.onInitCallbacks.get(t);if(s)for(const r of s)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let s=this.instances.get(e);if(!s&&this.component&&(s=this.component.instanceFactory(this.container,{instanceIdentifier:uu(e),options:t}),this.instances.set(e,s),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(s,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,s)}catch{}return s||null}normalizeInstanceIdentifier(e=Re){return this.component?this.component.multipleInstances?e:Re:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function uu(n){return n===Re?void 0:n}function du(n){return n.instantiationMode==="EAGER"}/**
|
|
292
292
|
* @license
|
|
293
293
|
* Copyright 2019 Google LLC
|
|
294
294
|
*
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
304
304
|
* See the License for the specific language governing permissions and
|
|
305
305
|
* limitations under the License.
|
|
306
|
-
*/class
|
|
306
|
+
*/class fu{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 hu(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
|
|
307
307
|
* @license
|
|
308
308
|
* Copyright 2017 Google LLC
|
|
309
309
|
*
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
319
319
|
* See the License for the specific language governing permissions and
|
|
320
320
|
* limitations under the License.
|
|
321
|
-
*/var
|
|
321
|
+
*/var O;(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"})(O||(O={}));const pu={debug:O.DEBUG,verbose:O.VERBOSE,info:O.INFO,warn:O.WARN,error:O.ERROR,silent:O.SILENT},_u=O.INFO,mu={[O.DEBUG]:"log",[O.VERBOSE]:"log",[O.INFO]:"info",[O.WARN]:"warn",[O.ERROR]:"error"},gu=(n,e,...t)=>{if(e<n.logLevel)return;const s=new Date().toISOString(),r=mu[e];if(r)console[r](`[${s}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class zo{constructor(e){this.name=e,this._logLevel=_u,this._logHandler=gu,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in O))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?pu[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,O.DEBUG,...e),this._logHandler(this,O.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,O.VERBOSE,...e),this._logHandler(this,O.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,O.INFO,...e),this._logHandler(this,O.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,O.WARN,...e),this._logHandler(this,O.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,O.ERROR,...e),this._logHandler(this,O.ERROR,...e)}}const yu=(n,e)=>e.some(t=>n instanceof t);let Hr,Vr;function Eu(){return Hr||(Hr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function wu(){return Vr||(Vr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const jo=new WeakMap,ps=new WeakMap,Ko=new WeakMap,$n=new WeakMap,$s=new WeakMap;function vu(n){const e=new Promise((t,s)=>{const r=()=>{n.removeEventListener("success",i),n.removeEventListener("error",o)},i=()=>{t(we(n.result)),r()},o=()=>{s(n.error),r()};n.addEventListener("success",i),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&jo.set(t,n)}).catch(()=>{}),$s.set(e,n),e}function bu(n){if(ps.has(n))return;const e=new Promise((t,s)=>{const r=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",o),n.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{s(n.error||new DOMException("AbortError","AbortError")),r()};n.addEventListener("complete",i),n.addEventListener("error",o),n.addEventListener("abort",o)});ps.set(n,e)}let _s={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return ps.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Ko.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return we(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 Cu(n){_s=n(_s)}function Su(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const s=n.call(zn(this),e,...t);return Ko.set(s,e.sort?e.sort():[e]),we(s)}:wu().includes(n)?function(...e){return n.apply(zn(this),e),we(jo.get(this))}:function(...e){return we(n.apply(zn(this),e))}}function Tu(n){return typeof n=="function"?Su(n):(n instanceof IDBTransaction&&bu(n),yu(n,Eu())?new Proxy(n,_s):n)}function we(n){if(n instanceof IDBRequest)return vu(n);if($n.has(n))return $n.get(n);const e=Tu(n);return e!==n&&($n.set(n,e),$s.set(e,n)),e}const zn=n=>$s.get(n);function Ru(n,e,{blocked:t,upgrade:s,blocking:r,terminated:i}={}){const o=indexedDB.open(n,e),a=we(o);return s&&o.addEventListener("upgradeneeded",c=>{s(we(o.result),c.oldVersion,c.newVersion,we(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),r&&c.addEventListener("versionchange",l=>r(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const Iu=["get","getKey","getAll","getAllKeys","count"],Nu=["put","add","delete","clear"],jn=new Map;function $r(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(jn.get(e))return jn.get(e);const t=e.replace(/FromIndex$/,""),s=e!==t,r=Nu.includes(t);if(!(t in(s?IDBIndex:IDBObjectStore).prototype)||!(r||Iu.includes(t)))return;const i=async function(o,...a){const c=this.transaction(o,r?"readwrite":"readonly");let l=c.store;return s&&(l=l.index(a.shift())),(await Promise.all([l[t](...a),r&&c.done]))[0]};return jn.set(e,i),i}Cu(n=>({...n,get:(e,t,s)=>$r(e,t)||n.get(e,t,s),has:(e,t)=>!!$r(e,t)||n.has(e,t)}));/**
|
|
322
322
|
* @license
|
|
323
323
|
* Copyright 2019 Google LLC
|
|
324
324
|
*
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
334
334
|
* See the License for the specific language governing permissions and
|
|
335
335
|
* limitations under the License.
|
|
336
|
-
*/class
|
|
336
|
+
*/class ku{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Au(t)){const s=t.getImmediate();return`${s.library}/${s.version}`}else return null}).filter(t=>t).join(" ")}}function Au(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const ms="@firebase/app",zr="0.11.5";/**
|
|
337
337
|
* @license
|
|
338
338
|
* Copyright 2019 Google LLC
|
|
339
339
|
*
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
349
349
|
* See the License for the specific language governing permissions and
|
|
350
350
|
* limitations under the License.
|
|
351
|
-
*/const pe=new
|
|
351
|
+
*/const pe=new zo("@firebase/app"),xu="@firebase/app-compat",Ou="@firebase/analytics-compat",Pu="@firebase/analytics",Du="@firebase/app-check-compat",Lu="@firebase/app-check",Fu="@firebase/auth",Mu="@firebase/auth-compat",Bu="@firebase/database",Uu="@firebase/data-connect",qu="@firebase/database-compat",Wu="@firebase/functions",Hu="@firebase/functions-compat",Vu="@firebase/installations",$u="@firebase/installations-compat",zu="@firebase/messaging",ju="@firebase/messaging-compat",Ku="@firebase/performance",Gu="@firebase/performance-compat",Yu="@firebase/remote-config",Qu="@firebase/remote-config-compat",Ju="@firebase/storage",Xu="@firebase/storage-compat",Zu="@firebase/firestore",ed="@firebase/vertexai",td="@firebase/firestore-compat",nd="firebase",sd="11.6.1";/**
|
|
352
352
|
* @license
|
|
353
353
|
* Copyright 2019 Google LLC
|
|
354
354
|
*
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
364
364
|
* See the License for the specific language governing permissions and
|
|
365
365
|
* limitations under the License.
|
|
366
|
-
*/const gs="[DEFAULT]",
|
|
366
|
+
*/const gs="[DEFAULT]",rd={[ms]:"fire-core",[xu]:"fire-core-compat",[Pu]:"fire-analytics",[Ou]:"fire-analytics-compat",[Lu]:"fire-app-check",[Du]:"fire-app-check-compat",[Fu]:"fire-auth",[Mu]:"fire-auth-compat",[Bu]:"fire-rtdb",[Uu]:"fire-data-connect",[qu]:"fire-rtdb-compat",[Wu]:"fire-fn",[Hu]:"fire-fn-compat",[Vu]:"fire-iid",[$u]:"fire-iid-compat",[zu]:"fire-fcm",[ju]:"fire-fcm-compat",[Ku]:"fire-perf",[Gu]:"fire-perf-compat",[Yu]:"fire-rc",[Qu]:"fire-rc-compat",[Ju]:"fire-gcs",[Xu]:"fire-gcs-compat",[Zu]:"fire-fst",[td]:"fire-fst-compat",[ed]:"fire-vertex","fire-js":"fire-js",[nd]:"fire-js-all"};/**
|
|
367
367
|
* @license
|
|
368
368
|
* Copyright 2019 Google LLC
|
|
369
369
|
*
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
379
379
|
* See the License for the specific language governing permissions and
|
|
380
380
|
* limitations under the License.
|
|
381
|
-
*/const sn=new Map,
|
|
381
|
+
*/const sn=new Map,id=new Map,ys=new Map;function jr(n,e){try{n.container.addComponent(e)}catch(t){pe.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function rn(n){const e=n.name;if(ys.has(e))return pe.debug(`There were multiple attempts to register component ${e}.`),!1;ys.set(e,n);for(const t of sn.values())jr(t,n);for(const t of id.values())jr(t,n);return!0}function od(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function ad(n){return n==null?!1:n.settings!==void 0}/**
|
|
382
382
|
* @license
|
|
383
383
|
* Copyright 2019 Google LLC
|
|
384
384
|
*
|
|
@@ -393,7 +393,7 @@
|
|
|
393
393
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
394
394
|
* See the License for the specific language governing permissions and
|
|
395
395
|
* limitations under the License.
|
|
396
|
-
*/const
|
|
396
|
+
*/const cd={"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.","invalid-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."},ve=new Ho("app","Firebase",cd);/**
|
|
397
397
|
* @license
|
|
398
398
|
* Copyright 2019 Google LLC
|
|
399
399
|
*
|
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
409
409
|
* See the License for the specific language governing permissions and
|
|
410
410
|
* limitations under the License.
|
|
411
|
-
*/class
|
|
411
|
+
*/class ld{constructor(e,t,s){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=s,this.container.addComponent(new yt("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 ve.create("app-deleted",{appName:this._name})}}/**
|
|
412
412
|
* @license
|
|
413
413
|
* Copyright 2019 Google LLC
|
|
414
414
|
*
|
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
424
424
|
* See the License for the specific language governing permissions and
|
|
425
425
|
* limitations under the License.
|
|
426
|
-
*/const
|
|
426
|
+
*/const hd=sd;function Go(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const s=Object.assign({name:gs,automaticDataCollectionEnabled:!1},e),r=s.name;if(typeof r!="string"||!r)throw ve.create("bad-app-name",{appName:String(r)});if(t||(t=qo()),!t)throw ve.create("no-options");const i=sn.get(r);if(i){if(nn(t,i.options)&&nn(s,i.config))return i;throw ve.create("duplicate-app",{appName:r})}const o=new fu(r);for(const c of ys.values())o.addComponent(c);const a=new ld(t,s,o);return sn.set(r,a),a}function ud(n=gs){const e=sn.get(n);if(!e&&n===gs&&qo())return Go();if(!e)throw ve.create("no-app",{appName:n});return e}function $e(n,e,t){var s;let r=(s=rd[n])!==null&&s!==void 0?s:n;t&&(r+=`-${t}`);const i=r.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const a=[`Unable to register library "${r}" with version "${e}":`];i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),pe.warn(a.join(" "));return}rn(new yt(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
|
|
427
427
|
* @license
|
|
428
428
|
* Copyright 2021 Google LLC
|
|
429
429
|
*
|
|
@@ -438,7 +438,7 @@
|
|
|
438
438
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
439
439
|
* See the License for the specific language governing permissions and
|
|
440
440
|
* limitations under the License.
|
|
441
|
-
*/const
|
|
441
|
+
*/const dd="firebase-heartbeat-database",fd=1,Et="firebase-heartbeat-store";let Kn=null;function Yo(){return Kn||(Kn=Ru(dd,fd,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(Et)}catch(t){console.warn(t)}}}}).catch(n=>{throw ve.create("idb-open",{originalErrorMessage:n.message})})),Kn}async function pd(n){try{const t=(await Yo()).transaction(Et),s=await t.objectStore(Et).get(Qo(n));return await t.done,s}catch(e){if(e instanceof kt)pe.warn(e.message);else{const t=ve.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});pe.warn(t.message)}}}async function Kr(n,e){try{const s=(await Yo()).transaction(Et,"readwrite");await s.objectStore(Et).put(e,Qo(n)),await s.done}catch(t){if(t instanceof kt)pe.warn(t.message);else{const s=ve.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});pe.warn(s.message)}}}function Qo(n){return`${n.name}!${n.options.appId}`}/**
|
|
442
442
|
* @license
|
|
443
443
|
* Copyright 2021 Google LLC
|
|
444
444
|
*
|
|
@@ -453,7 +453,7 @@
|
|
|
453
453
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
454
454
|
* See the License for the specific language governing permissions and
|
|
455
455
|
* limitations under the License.
|
|
456
|
-
*/const
|
|
456
|
+
*/const _d=1024,md=30;class gd{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Ed(t),this._heartbeatsCachePromise=this._storage.read().then(s=>(this._heartbeatsCache=s,s))}async triggerHeartbeat(){var e,t;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Gr();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:r}),this._heartbeatsCache.heartbeats.length>md){const o=wd(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(s){pe.warn(s)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=Gr(),{heartbeatsToSend:s,unsentEntries:r}=yd(this._heartbeatsCache.heartbeats),i=en(JSON.stringify({version:2,heartbeats:s}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return pe.warn(t),""}}}function Gr(){return new Date().toISOString().substring(0,10)}function yd(n,e=_d){const t=[];let s=n.slice();for(const r of n){const i=t.find(o=>o.agent===r.agent);if(i){if(i.dates.push(r.date),Yr(t)>e){i.dates.pop();break}}else if(t.push({agent:r.agent,dates:[r.date]}),Yr(t)>e){t.pop();break}s=s.slice(1)}return{heartbeatsToSend:t,unsentEntries:s}}class Ed{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return eu()?tu().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await pd(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return Kr(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return Kr(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function Yr(n){return en(JSON.stringify({version:2,heartbeats:n})).length}function wd(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let s=1;s<n.length;s++)n[s].date<t&&(t=n[s].date,e=s);return e}/**
|
|
457
457
|
* @license
|
|
458
458
|
* Copyright 2019 Google LLC
|
|
459
459
|
*
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
469
469
|
* See the License for the specific language governing permissions and
|
|
470
470
|
* limitations under the License.
|
|
471
|
-
*/function
|
|
471
|
+
*/function vd(n){rn(new yt("platform-logger",e=>new ku(e),"PRIVATE")),rn(new yt("heartbeat",e=>new gd(e),"PRIVATE")),$e(ms,zr,n),$e(ms,zr,"esm2017"),$e("fire-js","")}vd("");const Qr="@firebase/database",Jr="1.0.14";/**
|
|
472
472
|
* @license
|
|
473
473
|
* Copyright 2019 Google LLC
|
|
474
474
|
*
|
|
@@ -483,7 +483,7 @@
|
|
|
483
483
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
484
484
|
* See the License for the specific language governing permissions and
|
|
485
485
|
* limitations under the License.
|
|
486
|
-
*/let
|
|
486
|
+
*/let Jo="";function bd(n){Jo=n}/**
|
|
487
487
|
* @license
|
|
488
488
|
* Copyright 2017 Google LLC
|
|
489
489
|
*
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
499
499
|
* See the License for the specific language governing permissions and
|
|
500
500
|
* limitations under the License.
|
|
501
|
-
*/class
|
|
501
|
+
*/class Cd{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,t){t==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),$(t))}get(e){const t=this.domStorage_.getItem(this.prefixedName_(e));return t==null?null:gt(t)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}/**
|
|
502
502
|
* @license
|
|
503
503
|
* Copyright 2017 Google LLC
|
|
504
504
|
*
|
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
514
514
|
* See the License for the specific language governing permissions and
|
|
515
515
|
* limitations under the License.
|
|
516
|
-
*/class
|
|
516
|
+
*/class Sd{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,t){t==null?delete this.cache_[e]:this.cache_[e]=t}get(e){return me(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}/**
|
|
517
517
|
* @license
|
|
518
518
|
* Copyright 2017 Google LLC
|
|
519
519
|
*
|
|
@@ -528,7 +528,7 @@
|
|
|
528
528
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
529
529
|
* See the License for the specific language governing permissions and
|
|
530
530
|
* limitations under the License.
|
|
531
|
-
*/const
|
|
531
|
+
*/const Xo=function(n){try{if(typeof window<"u"&&typeof window[n]<"u"){const e=window[n];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new Cd(e)}}catch{}return new Sd},xe=Xo("localStorage"),Td=Xo("sessionStorage");/**
|
|
532
532
|
* @license
|
|
533
533
|
* Copyright 2017 Google LLC
|
|
534
534
|
*
|
|
@@ -543,7 +543,7 @@
|
|
|
543
543
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
544
544
|
* See the License for the specific language governing permissions and
|
|
545
545
|
* limitations under the License.
|
|
546
|
-
*/const ze=new
|
|
546
|
+
*/const ze=new zo("@firebase/database"),Rd=function(){let n=1;return function(){return n++}}(),Zo=function(n){const e=lu(n),t=new cu;t.update(e);const s=t.digest();return Hs.encodeByteArray(s)},At=function(...n){let e="";for(let t=0;t<n.length;t++){const s=n[t];Array.isArray(s)||s&&typeof s=="object"&&typeof s.length=="number"?e+=At.apply(null,s):typeof s=="object"?e+=$(s):e+=s,e+=" "}return e};let ut=null,Xr=!0;const Id=function(n,e){m(!0,"Can't turn on custom loggers persistently."),ze.logLevel=O.VERBOSE,ut=ze.log.bind(ze)},z=function(...n){if(Xr===!0&&(Xr=!1,ut===null&&Td.get("logging_enabled")===!0&&Id()),ut){const e=At.apply(null,n);ut(e)}},xt=function(n){return function(...e){z(n,...e)}},Es=function(...n){const e="FIREBASE INTERNAL ERROR: "+At(...n);ze.error(e)},_e=function(...n){const e=`FIREBASE FATAL ERROR: ${At(...n)}`;throw ze.error(e),new Error(e)},te=function(...n){const e="FIREBASE WARNING: "+At(...n);ze.warn(e)},Nd=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&te("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},ea=function(n){return typeof n=="number"&&(n!==n||n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY)},kd=function(n){if(document.readyState==="complete")n();else{let e=!1;const t=function(){if(!document.body){setTimeout(t,Math.floor(10));return}e||(e=!0,n())};document.addEventListener?(document.addEventListener("DOMContentLoaded",t,!1),window.addEventListener("load",t,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&t()}),window.attachEvent("onload",t))}},Ye="[MIN_NAME]",De="[MAX_NAME]",nt=function(n,e){if(n===e)return 0;if(n===Ye||e===De)return-1;if(e===Ye||n===De)return 1;{const t=Zr(n),s=Zr(e);return t!==null?s!==null?t-s===0?n.length-e.length:t-s:-1:s!==null?1:n<e?-1:1}},Ad=function(n,e){return n===e?0:n<e?-1:1},ot=function(n,e){if(e&&n in e)return e[n];throw new Error("Missing required key ("+n+") in object: "+$(e))},zs=function(n){if(typeof n!="object"||n===null)return $(n);const e=[];for(const s in n)e.push(s);e.sort();let t="{";for(let s=0;s<e.length;s++)s!==0&&(t+=","),t+=$(e[s]),t+=":",t+=zs(n[e[s]]);return t+="}",t},ta=function(n,e){const t=n.length;if(t<=e)return[n];const s=[];for(let r=0;r<t;r+=e)r+e>t?s.push(n.substring(r,t)):s.push(n.substring(r,r+e));return s};function Z(n,e){for(const t in n)n.hasOwnProperty(t)&&e(t,n[t])}const na=function(n){m(!ea(n),"Invalid JSON number");const e=11,t=52,s=(1<<e-1)-1;let r,i,o,a,c;n===0?(i=0,o=0,r=1/n===-1/0?1:0):(r=n<0,n=Math.abs(n),n>=Math.pow(2,1-s)?(a=Math.min(Math.floor(Math.log(n)/Math.LN2),s),i=a+s,o=Math.round(n*Math.pow(2,t-a)-Math.pow(2,t))):(i=0,o=Math.round(n/Math.pow(2,1-s-t))));const l=[];for(c=t;c;c-=1)l.push(o%2?1:0),o=Math.floor(o/2);for(c=e;c;c-=1)l.push(i%2?1:0),i=Math.floor(i/2);l.push(r?1:0),l.reverse();const h=l.join("");let u="";for(c=0;c<64;c+=8){let d=parseInt(h.substr(c,8),2).toString(16);d.length===1&&(d="0"+d),u=u+d}return u.toLowerCase()},xd=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},Od=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function Pd(n,e){let t="Unknown Error";n==="too_big"?t="The data requested exceeds the maximum size that can be accessed with a single request.":n==="permission_denied"?t="Client doesn't have permission to access the desired data.":n==="unavailable"&&(t="The service is unavailable");const s=new Error(n+" at "+e._path.toString()+": "+t);return s.code=n.toUpperCase(),s}const Dd=new RegExp("^-?(0*)\\d{1,10}$"),Ld=-2147483648,Fd=2147483647,Zr=function(n){if(Dd.test(n)){const e=Number(n);if(e>=Ld&&e<=Fd)return e}return null},Ot=function(n){try{n()}catch(e){setTimeout(()=>{const t=e.stack||"";throw te("Exception was thrown by user callback.",t),e},Math.floor(0))}},Md=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},dt=function(n,e){const t=setTimeout(n,e);return typeof t=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(t):typeof t=="object"&&t.unref&&t.unref(),t};/**
|
|
547
547
|
* @license
|
|
548
548
|
* Copyright 2021 Google LLC
|
|
549
549
|
*
|
|
@@ -558,7 +558,7 @@
|
|
|
558
558
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
559
559
|
* See the License for the specific language governing permissions and
|
|
560
560
|
* limitations under the License.
|
|
561
|
-
*/class
|
|
561
|
+
*/class Bd{constructor(e,t){this.appCheckProvider=t,this.appName=e.name,ad(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=t==null?void 0:t.getImmediate({optional:!0}),this.appCheck||t==null||t.get().then(s=>this.appCheck=s)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((t,s)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(t,s):t(null)},0)})}addTokenChangeListener(e){var t;(t=this.appCheckProvider)===null||t===void 0||t.get().then(s=>s.addTokenListener(e))}notifyForInvalidToken(){te(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}/**
|
|
562
562
|
* @license
|
|
563
563
|
* Copyright 2017 Google LLC
|
|
564
564
|
*
|
|
@@ -573,7 +573,7 @@
|
|
|
573
573
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
574
574
|
* See the License for the specific language governing permissions and
|
|
575
575
|
* limitations under the License.
|
|
576
|
-
*/class
|
|
576
|
+
*/class Ud{constructor(e,t,s){this.appName_=e,this.firebaseOptions_=t,this.authProvider_=s,this.auth_=null,this.auth_=s.getImmediate({optional:!0}),this.auth_||s.onInit(r=>this.auth_=r)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(t=>t&&t.code==="auth/token-not-initialized"?(z("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)):new Promise((t,s)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(t,s):t(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(t=>t.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(t=>t.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',te(e)}}class Yt{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}Yt.OWNER="owner";/**
|
|
577
577
|
* @license
|
|
578
578
|
* Copyright 2017 Google LLC
|
|
579
579
|
*
|
|
@@ -588,7 +588,7 @@
|
|
|
588
588
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
589
589
|
* See the License for the specific language governing permissions and
|
|
590
590
|
* limitations under the License.
|
|
591
|
-
*/const js="5",
|
|
591
|
+
*/const js="5",sa="v",ra="s",ia="r",oa="f",aa=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,ca="ls",la="p",ws="ac",ha="websocket",ua="long_polling";/**
|
|
592
592
|
* @license
|
|
593
593
|
* Copyright 2017 Google LLC
|
|
594
594
|
*
|
|
@@ -603,7 +603,7 @@
|
|
|
603
603
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
604
604
|
* See the License for the specific language governing permissions and
|
|
605
605
|
* limitations under the License.
|
|
606
|
-
*/class
|
|
606
|
+
*/class da{constructor(e,t,s,r,i=!1,o="",a=!1,c=!1,l=null){this.secure=t,this.namespace=s,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=c,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=xe.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&xe.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){const e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${t}`}}function qd(n){return n.host!==n.internalHost||n.isCustomHost()||n.includeNamespaceInQueryParams}function fa(n,e,t){m(typeof e=="string","typeof type must == string"),m(typeof t=="object","typeof params must == object");let s;if(e===ha)s=(n.secure?"wss://":"ws://")+n.internalHost+"/.ws?";else if(e===ua)s=(n.secure?"https://":"http://")+n.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);qd(n)&&(t.ns=n.namespace);const r=[];return Z(t,(i,o)=>{r.push(i+"="+o)}),s+r.join("&")}/**
|
|
607
607
|
* @license
|
|
608
608
|
* Copyright 2017 Google LLC
|
|
609
609
|
*
|
|
@@ -618,7 +618,7 @@
|
|
|
618
618
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
619
619
|
* See the License for the specific language governing permissions and
|
|
620
620
|
* limitations under the License.
|
|
621
|
-
*/class
|
|
621
|
+
*/class Wd{constructor(){this.counters_={}}incrementCounter(e,t=1){me(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}get(){return Hh(this.counters_)}}/**
|
|
622
622
|
* @license
|
|
623
623
|
* Copyright 2017 Google LLC
|
|
624
624
|
*
|
|
@@ -633,7 +633,7 @@
|
|
|
633
633
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
634
634
|
* See the License for the specific language governing permissions and
|
|
635
635
|
* limitations under the License.
|
|
636
|
-
*/const Gn={},Yn={};function Ks(n){const e=n.toString();return Gn[e]||(Gn[e]=new
|
|
636
|
+
*/const Gn={},Yn={};function Ks(n){const e=n.toString();return Gn[e]||(Gn[e]=new Wd),Gn[e]}function Hd(n,e){const t=n.toString();return Yn[t]||(Yn[t]=e()),Yn[t]}/**
|
|
637
637
|
* @license
|
|
638
638
|
* Copyright 2017 Google LLC
|
|
639
639
|
*
|
|
@@ -648,7 +648,7 @@
|
|
|
648
648
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
649
649
|
* See the License for the specific language governing permissions and
|
|
650
650
|
* limitations under the License.
|
|
651
|
-
*/class
|
|
651
|
+
*/class Vd{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,t){for(this.pendingResponses[e]=t;this.pendingResponses[this.currentResponseNum];){const s=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let r=0;r<s.length;++r)s[r]&&Ot(()=>{this.onMessage_(s[r])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/**
|
|
652
652
|
* @license
|
|
653
653
|
* Copyright 2017 Google LLC
|
|
654
654
|
*
|
|
@@ -663,7 +663,7 @@
|
|
|
663
663
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
664
664
|
* See the License for the specific language governing permissions and
|
|
665
665
|
* limitations under the License.
|
|
666
|
-
*/const ei="start"
|
|
666
|
+
*/const ei="start",$d="close",zd="pLPCommand",jd="pRTLPCB",pa="id",_a="pw",ma="ser",Kd="cb",Gd="seg",Yd="ts",Qd="d",Jd="dframe",ga=1870,ya=30,Xd=ga-ya,Zd=25e3,ef=3e4;class We{constructor(e,t,s,r,i,o,a){this.connId=e,this.repoInfo=t,this.applicationId=s,this.appCheckToken=r,this.authToken=i,this.transportSessionId=o,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=xt(e),this.stats_=Ks(t),this.urlFn=c=>(this.appCheckToken&&(c[ws]=this.appCheckToken),fa(t,ua,c))}open(e,t){this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new Vd(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(ef)),kd(()=>{if(this.isClosed_)return;this.scriptTagHolder=new Gs((...i)=>{const[o,a,c,l,h]=i;if(this.incrementIncomingBytes_(i),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,o===ei)this.id=a,this.password=c;else if(o===$d)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+o)},(...i)=>{const[o,a]=i;this.incrementIncomingBytes_(i),this.myPacketOrderer.handleResponse(o,a)},()=>{this.onClosed_()},this.urlFn);const s={};s[ei]="t",s[ma]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(s[Kd]=this.scriptTagHolder.uniqueCallbackIdentifier),s[sa]=js,this.transportSessionId&&(s[ra]=this.transportSessionId),this.lastSessionId&&(s[ca]=this.lastSessionId),this.applicationId&&(s[la]=this.applicationId),this.appCheckToken&&(s[ws]=this.appCheckToken),typeof location<"u"&&location.hostname&&aa.test(location.hostname)&&(s[ia]=oa);const r=this.urlFn(s);this.log_("Connecting via long-poll to "+r),this.scriptTagHolder.addTag(r,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){We.forceAllow_=!0}static forceDisallow(){We.forceDisallow_=!0}static isAvailable(){return We.forceAllow_?!0:!We.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!xd()&&!Od()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){const t=$(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const s=Mo(t),r=ta(s,Xd);for(let i=0;i<r.length;i++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[i]),this.curSegmentNum++}addDisconnectPingFrame(e,t){this.myDisconnFrame=document.createElement("iframe");const s={};s[Jd]="t",s[pa]=e,s[_a]=t,this.myDisconnFrame.src=this.urlFn(s),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){const t=$(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)}}class Gs{constructor(e,t,s,r){this.onDisconnect=s,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=Rd(),window[zd+this.uniqueCallbackIdentifier]=e,window[jd+this.uniqueCallbackIdentifier]=t,this.myIFrame=Gs.createIFrame_();let i="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(i='<script>document.domain="'+document.domain+'";<\/script>');const o="<html><body>"+i+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(a){z("frame writing exception"),a.stack&&z(a.stack),z(a)}}}static createIFrame_(){const e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||z("No IE domain setting required")}catch{const s=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+s+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const e={};e[pa]=this.myID,e[_a]=this.myPW,e[ma]=this.currentSerial;let t=this.urlFn(e),s="",r=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+ya+s.length<=ga;){const o=this.pendingSegs.shift();s=s+"&"+Gd+r+"="+o.seg+"&"+Yd+r+"="+o.ts+"&"+Qd+r+"="+o.d,r++}return t=t+s,this.addLongPollTag_(t,this.currentSerial),!0}else return!1}enqueueSegment(e,t,s){this.pendingSegs.push({seg:e,ts:t,d:s}),this.alive&&this.newRequest_()}addLongPollTag_(e,t){this.outstandingRequests.add(t);const s=()=>{this.outstandingRequests.delete(t),this.newRequest_()},r=setTimeout(s,Math.floor(Zd)),i=()=>{clearTimeout(r),s()};this.addTag(e,i)}addTag(e,t){setTimeout(()=>{try{if(!this.sendNewPolls)return;const s=this.myIFrame.doc.createElement("script");s.type="text/javascript",s.async=!0,s.src=e,s.onload=s.onreadystatechange=function(){const r=s.readyState;(!r||r==="loaded"||r==="complete")&&(s.onload=s.onreadystatechange=null,s.parentNode&&s.parentNode.removeChild(s),t())},s.onerror=()=>{z("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(s)}catch{}},Math.floor(1))}}/**
|
|
667
667
|
* @license
|
|
668
668
|
* Copyright 2017 Google LLC
|
|
669
669
|
*
|
|
@@ -678,7 +678,7 @@
|
|
|
678
678
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
679
679
|
* See the License for the specific language governing permissions and
|
|
680
680
|
* limitations under the License.
|
|
681
|
-
*/const
|
|
681
|
+
*/const tf=16384,nf=45e3;let on=null;typeof MozWebSocket<"u"?on=MozWebSocket:typeof WebSocket<"u"&&(on=WebSocket);class ie{constructor(e,t,s,r,i,o,a){this.connId=e,this.applicationId=s,this.appCheckToken=r,this.authToken=i,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=xt(this.connId),this.stats_=Ks(t),this.connURL=ie.connectionURL_(t,o,a,r,s),this.nodeAdmin=t.nodeAdmin}static connectionURL_(e,t,s,r,i){const o={};return o[sa]=js,typeof location<"u"&&location.hostname&&aa.test(location.hostname)&&(o[ia]=oa),t&&(o[ra]=t),s&&(o[ca]=s),r&&(o[ws]=r),i&&(o[la]=i),fa(e,ha,o)}open(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,xe.set("previous_websocket_failure",!0);try{let s;Zh(),this.mySock=new on(this.connURL,[],s)}catch(s){this.log_("Error instantiating WebSocket.");const r=s.message||s.data;r&&this.log_(r),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=s=>{this.handleIncomingFrame(s)},this.mySock.onerror=s=>{this.log_("WebSocket error. Closing connection.");const r=s.message||s.data;r&&this.log_(r),this.onClosed_()}}start(){}static forceDisallow(){ie.forceDisallow_=!0}static isAvailable(){let e=!1;if(typeof navigator<"u"&&navigator.userAgent){const t=/Android ([0-9]{0,}\.[0-9]{0,})/,s=navigator.userAgent.match(t);s&&s.length>1&&parseFloat(s[1])<4.4&&(e=!0)}return!e&&on!==null&&!ie.forceDisallow_}static previouslyFailed(){return xe.isInMemoryStorage||xe.get("previous_websocket_failure")===!0}markConnectionHealthy(){xe.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){const t=this.frames.join("");this.frames=null;const s=gt(t);this.onMessage(s)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(m(this.frames===null,"We already have a frame buffer"),e.length<=6){const t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(this.mySock===null)return;const t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(t);else{const s=this.extractFrameCount_(t);s!==null&&this.appendFrame_(s)}}send(e){this.resetKeepAlive();const t=$(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const s=ta(t,tf);s.length>1&&this.sendString_(String(s.length));for(let r=0;r<s.length;r++)this.sendString_(s[r])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(nf))}sendString_(e){try{this.mySock.send(e)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}ie.responsesRequiredToBeHealthy=2;ie.healthyTimeout=3e4;/**
|
|
682
682
|
* @license
|
|
683
683
|
* Copyright 2017 Google LLC
|
|
684
684
|
*
|
|
@@ -693,7 +693,7 @@
|
|
|
693
693
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
694
694
|
* See the License for the specific language governing permissions and
|
|
695
695
|
* limitations under the License.
|
|
696
|
-
*/class wt{static get ALL_TRANSPORTS(){return[We,ie]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(e){this.initTransports_(e)}initTransports_(e){const t=ie&&ie.isAvailable();let s=t&&!ie.previouslyFailed();if(e.webSocketOnly&&(t||
|
|
696
|
+
*/class wt{static get ALL_TRANSPORTS(){return[We,ie]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(e){this.initTransports_(e)}initTransports_(e){const t=ie&&ie.isAvailable();let s=t&&!ie.previouslyFailed();if(e.webSocketOnly&&(t||te("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),s=!0),s)this.transports_=[ie];else{const r=this.transports_=[];for(const i of wt.ALL_TRANSPORTS)i&&i.isAvailable()&&r.push(i);wt.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}wt.globalTransportInitialized_=!1;/**
|
|
697
697
|
* @license
|
|
698
698
|
* Copyright 2017 Google LLC
|
|
699
699
|
*
|
|
@@ -708,7 +708,7 @@
|
|
|
708
708
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
709
709
|
* See the License for the specific language governing permissions and
|
|
710
710
|
* limitations under the License.
|
|
711
|
-
*/const
|
|
711
|
+
*/const sf=6e4,rf=5e3,of=10*1024,af=100*1024,Qn="t",ti="d",cf="s",ni="r",lf="e",si="o",ri="a",ii="n",oi="p",hf="h";class uf{constructor(e,t,s,r,i,o,a,c,l,h){this.id=e,this.repoInfo_=t,this.applicationId_=s,this.appCheckToken_=r,this.authToken_=i,this.onMessage_=o,this.onReady_=a,this.onDisconnect_=c,this.onKill_=l,this.lastSessionId=h,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=xt("c:"+this.id+":"),this.transportManager_=new wt(t),this.log_("Connection created"),this.start_()}start_(){const e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.conn_),s=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(t,s)},Math.floor(0));const r=e.healthyTimeout||0;r>0&&(this.healthyTimeout_=dt(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>af?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>of?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(r)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return t=>{e===this.conn_?this.onConnectionLost_(t):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return t=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(t):e===this.secondaryConn_?this.onSecondaryMessageReceived_(t):this.log_("message on old connection"))}}sendRequest(e){const t={t:"d",d:e};this.sendData_(t)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(Qn in e){const t=e[Qn];t===ri?this.upgradeIfSecondaryHealthy_():t===ni?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):t===si&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){const t=ot("t",e),s=ot("d",e);if(t==="c")this.onSecondaryControl_(s);else if(t==="d")this.pendingDataMessages.push(s);else throw new Error("Unknown protocol layer: "+t)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:oi,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:ri,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:ii,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){const t=ot("t",e),s=ot("d",e);t==="c"?this.onControl_(s):t==="d"&&this.onDataMessage_(s)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){const t=ot(Qn,e);if(ti in e){const s=e[ti];if(t===hf){const r=Object.assign({},s);this.repoInfo_.isUsingEmulator&&(r.h=this.repoInfo_.host),this.onHandshake_(r)}else if(t===ii){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else t===cf?this.onConnectionShutdown_(s):t===ni?this.onReset_(s):t===lf?Es("Server Error: "+s):t===si?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):Es("Unknown control packet command: "+t)}}onHandshake_(e){const t=e.ts,s=e.v,r=e.h;this.sessionId=e.s,this.repoInfo_.host=r,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),js!==s&&te("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.secondaryConn_),s=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,s),dt(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(sf))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):dt(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(rf))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:oi,d:{}}}))}onSecondaryConnectionLost_(){const e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(xe.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/**
|
|
712
712
|
* @license
|
|
713
713
|
* Copyright 2017 Google LLC
|
|
714
714
|
*
|
|
@@ -723,7 +723,7 @@
|
|
|
723
723
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
724
724
|
* See the License for the specific language governing permissions and
|
|
725
725
|
* limitations under the License.
|
|
726
|
-
*/class
|
|
726
|
+
*/class Ea{put(e,t,s,r){}merge(e,t,s,r){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,t,s){}onDisconnectMerge(e,t,s){}onDisconnectCancel(e,t){}reportStats(e){}}/**
|
|
727
727
|
* @license
|
|
728
728
|
* Copyright 2017 Google LLC
|
|
729
729
|
*
|
|
@@ -738,7 +738,7 @@
|
|
|
738
738
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
739
739
|
* See the License for the specific language governing permissions and
|
|
740
740
|
* limitations under the License.
|
|
741
|
-
*/class
|
|
741
|
+
*/class wa{constructor(e){this.allowedEvents_=e,this.listeners_={},m(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...t){if(Array.isArray(this.listeners_[e])){const s=[...this.listeners_[e]];for(let r=0;r<s.length;r++)s[r].callback.apply(s[r].context,t)}}on(e,t,s){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:s});const r=this.getInitialEvent(e);r&&t.apply(s,r)}off(e,t,s){this.validateEventType_(e);const r=this.listeners_[e]||[];for(let i=0;i<r.length;i++)if(r[i].callback===t&&(!s||s===r[i].context)){r.splice(i,1);return}}validateEventType_(e){m(this.allowedEvents_.find(t=>t===e),"Unknown event: "+e)}}/**
|
|
742
742
|
* @license
|
|
743
743
|
* Copyright 2017 Google LLC
|
|
744
744
|
*
|
|
@@ -753,7 +753,7 @@
|
|
|
753
753
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
754
754
|
* See the License for the specific language governing permissions and
|
|
755
755
|
* limitations under the License.
|
|
756
|
-
*/class an extends
|
|
756
|
+
*/class an extends wa{static getInstance(){return new an}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!Wo()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return m(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}}/**
|
|
757
757
|
* @license
|
|
758
758
|
* Copyright 2017 Google LLC
|
|
759
759
|
*
|
|
@@ -768,7 +768,7 @@
|
|
|
768
768
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
769
769
|
* See the License for the specific language governing permissions and
|
|
770
770
|
* limitations under the License.
|
|
771
|
-
*/const ai=32,ci=768;class
|
|
771
|
+
*/const ai=32,ci=768;class x{constructor(e,t){if(t===void 0){this.pieces_=e.split("/");let s=0;for(let r=0;r<this.pieces_.length;r++)this.pieces_[r].length>0&&(this.pieces_[s]=this.pieces_[r],s++);this.pieces_.length=s,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=t}toString(){let e="";for(let t=this.pieceNum_;t<this.pieces_.length;t++)this.pieces_[t]!==""&&(e+="/"+this.pieces_[t]);return e||"/"}}function I(){return new x("")}function b(n){return n.pieceNum_>=n.pieces_.length?null:n.pieces_[n.pieceNum_]}function Ce(n){return n.pieces_.length-n.pieceNum_}function P(n){let e=n.pieceNum_;return e<n.pieces_.length&&e++,new x(n.pieces_,e)}function va(n){return n.pieceNum_<n.pieces_.length?n.pieces_[n.pieces_.length-1]:null}function df(n){let e="";for(let t=n.pieceNum_;t<n.pieces_.length;t++)n.pieces_[t]!==""&&(e+="/"+encodeURIComponent(String(n.pieces_[t])));return e||"/"}function ba(n,e=0){return n.pieces_.slice(n.pieceNum_+e)}function Ca(n){if(n.pieceNum_>=n.pieces_.length)return null;const e=[];for(let t=n.pieceNum_;t<n.pieces_.length-1;t++)e.push(n.pieces_[t]);return new x(e,0)}function W(n,e){const t=[];for(let s=n.pieceNum_;s<n.pieces_.length;s++)t.push(n.pieces_[s]);if(e instanceof x)for(let s=e.pieceNum_;s<e.pieces_.length;s++)t.push(e.pieces_[s]);else{const s=e.split("/");for(let r=0;r<s.length;r++)s[r].length>0&&t.push(s[r])}return new x(t,0)}function C(n){return n.pieceNum_>=n.pieces_.length}function Q(n,e){const t=b(n),s=b(e);if(t===null)return e;if(t===s)return Q(P(n),P(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+n+")")}function Ys(n,e){if(Ce(n)!==Ce(e))return!1;for(let t=n.pieceNum_,s=e.pieceNum_;t<=n.pieces_.length;t++,s++)if(n.pieces_[t]!==e.pieces_[s])return!1;return!0}function oe(n,e){let t=n.pieceNum_,s=e.pieceNum_;if(Ce(n)>Ce(e))return!1;for(;t<n.pieces_.length;){if(n.pieces_[t]!==e.pieces_[s])return!1;++t,++s}return!0}class ff{constructor(e,t){this.errorPrefix_=t,this.parts_=ba(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let s=0;s<this.parts_.length;s++)this.byteLength_+=Nn(this.parts_[s]);Sa(this)}}function pf(n,e){n.parts_.length>0&&(n.byteLength_+=1),n.parts_.push(e),n.byteLength_+=Nn(e),Sa(n)}function _f(n){const e=n.parts_.pop();n.byteLength_-=Nn(e),n.parts_.length>0&&(n.byteLength_-=1)}function Sa(n){if(n.byteLength_>ci)throw new Error(n.errorPrefix_+"has a key path longer than "+ci+" bytes ("+n.byteLength_+").");if(n.parts_.length>ai)throw new Error(n.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+ai+") or object contains a cycle "+Ie(n))}function Ie(n){return n.parts_.length===0?"":"in property '"+n.parts_.join(".")+"'"}/**
|
|
772
772
|
* @license
|
|
773
773
|
* Copyright 2017 Google LLC
|
|
774
774
|
*
|
|
@@ -783,7 +783,7 @@
|
|
|
783
783
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
784
784
|
* See the License for the specific language governing permissions and
|
|
785
785
|
* limitations under the License.
|
|
786
|
-
*/class Qs extends
|
|
786
|
+
*/class Qs extends wa{static getInstance(){return new Qs}constructor(){super(["visible"]);let e,t;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(t="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(t="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(t="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(t="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,t&&document.addEventListener(t,()=>{const s=!document[e];s!==this.visible_&&(this.visible_=s,this.trigger("visible",s))},!1)}getInitialEvent(e){return m(e==="visible","Unknown event type: "+e),[this.visible_]}}/**
|
|
787
787
|
* @license
|
|
788
788
|
* Copyright 2017 Google LLC
|
|
789
789
|
*
|
|
@@ -798,10 +798,10 @@
|
|
|
798
798
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
799
799
|
* See the License for the specific language governing permissions and
|
|
800
800
|
* limitations under the License.
|
|
801
|
-
*/const at=1e3,
|
|
802
|
-
Are you using the latest client?`)}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){m(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=at,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=at,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>
|
|
801
|
+
*/const at=1e3,mf=60*5*1e3,li=30*1e3,gf=1.3,yf=3e4,Ef="server_kill",hi=3;class fe extends Ea{constructor(e,t,s,r,i,o,a,c){if(super(),this.repoInfo_=e,this.applicationId_=t,this.onDataUpdate_=s,this.onConnectStatus_=r,this.onServerInfoUpdate_=i,this.authTokenProvider_=o,this.appCheckTokenProvider_=a,this.authOverride_=c,this.id=fe.nextPersistentConnectionId_++,this.log_=xt("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=at,this.maxReconnectDelay_=mf,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,c)throw new Error("Auth override specified in options, but not supported on non Node.js platforms");Qs.getInstance().on("visible",this.onVisible_,this),e.host.indexOf("fblocal")===-1&&an.getInstance().on("online",this.onOnline_,this)}sendRequest(e,t,s){const r=++this.requestNumber_,i={r,a:e,b:t};this.log_($(i)),m(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),s&&(this.requestCBHash_[r]=s)}get(e){this.initConnection_();const t=new Vs,r={action:"g",request:{p:e._path.toString(),q:e._queryObject},onComplete:o=>{const a=o.d;o.s==="ok"?t.resolve(a):t.reject(a)}};this.outstandingGets_.push(r),this.outstandingGetCount_++;const i=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(i),t.promise}listen(e,t,s,r){this.initConnection_();const i=e._queryIdentifier,o=e._path.toString();this.log_("Listen called for "+o+" "+i),this.listens.has(o)||this.listens.set(o,new Map),m(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),m(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");const a={onComplete:r,hashFn:t,query:e,tag:s};this.listens.get(o).set(i,a),this.connected_&&this.sendListen_(a)}sendGet_(e){const t=this.outstandingGets_[e];this.sendRequest("g",t.request,s=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(s)})}sendListen_(e){const t=e.query,s=t._path.toString(),r=t._queryIdentifier;this.log_("Listen on "+s+" for "+r);const i={p:s},o="q";e.tag&&(i.q=t._queryObject,i.t=e.tag),i.h=e.hashFn(),this.sendRequest(o,i,a=>{const c=a.d,l=a.s;fe.warnOnListenWarnings_(c,t),(this.listens.get(s)&&this.listens.get(s).get(r))===e&&(this.log_("listen response",a),l!=="ok"&&this.removeListen_(s,r),e.onComplete&&e.onComplete(l,c))})}static warnOnListenWarnings_(e,t){if(e&&typeof e=="object"&&me(e,"w")){const s=Ge(e,"w");if(Array.isArray(s)&&~s.indexOf("no_index")){const r='".indexOn": "'+t._queryParams.getIndex().toString()+'"',i=t._path.toString();te(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${r} at ${i} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&e.length===40||ou(e))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=li)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const e=this.authToken_,t=iu(e)?"auth":"gauth",s={cred:e};this.authOverride_===null?s.noauth=!0:typeof this.authOverride_=="object"&&(s.authvar=this.authOverride_),this.sendRequest(t,s,r=>{const i=r.s,o=r.d||"error";this.authToken_===e&&(i==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(i,o))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{const t=e.s,s=e.d||"error";t==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,s)})}unlisten(e,t){const s=e._path.toString(),r=e._queryIdentifier;this.log_("Unlisten called for "+s+" "+r),m(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(s,r)&&this.connected_&&this.sendUnlisten_(s,r,e._queryObject,t)}sendUnlisten_(e,t,s,r){this.log_("Unlisten on "+e+" for "+t);const i={p:e},o="n";r&&(i.q=s,i.t=r),this.sendRequest(o,i)}onDisconnectPut(e,t,s){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,t,s):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:s})}onDisconnectMerge(e,t,s){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,t,s):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:s})}onDisconnectCancel(e,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(e,t,s,r){const i={p:t,d:s};this.log_("onDisconnect "+e,i),this.sendRequest(e,i,o=>{r&&setTimeout(()=>{r(o.s,o.d)},Math.floor(0))})}put(e,t,s,r){this.putInternal("p",e,t,s,r)}merge(e,t,s,r){this.putInternal("m",e,t,s,r)}putInternal(e,t,s,r,i){this.initConnection_();const o={p:t,d:s};i!==void 0&&(o.h=i),this.outstandingPuts_.push({action:e,request:o,onComplete:r}),this.outstandingPutCount_++;const a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+t)}sendPut_(e){const t=this.outstandingPuts_[e].action,s=this.outstandingPuts_[e].request,r=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(t,s,i=>{this.log_(t+" response",i),delete this.outstandingPuts_[e],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),r&&r(i.s,i.d)})}reportStats(e){if(this.connected_){const t={c:e};this.log_("reportStats",t),this.sendRequest("s",t,s=>{if(s.s!=="ok"){const i=s.d;this.log_("reportStats","Error sending stats: "+i)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+$(e));const t=e.r,s=this.requestCBHash_[t];s&&(delete this.requestCBHash_[t],s(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}}onDataPush_(e,t){this.log_("handleServerMessage",e,t),e==="d"?this.onDataUpdate_(t.p,t.d,!1,t.t):e==="m"?this.onDataUpdate_(t.p,t.d,!0,t.t):e==="c"?this.onListenRevoked_(t.p,t.q):e==="ac"?this.onAuthRevoked_(t.s,t.d):e==="apc"?this.onAppCheckRevoked_(t.s,t.d):e==="sd"?this.onSecurityDebugPacket_(t):Es("Unrecognized action received from server: "+$(e)+`
|
|
802
|
+
Are you using the latest client?`)}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){m(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=at,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=at,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>yf&&(this.reconnectDelay_=at),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const e=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_);let t=Math.max(0,this.reconnectDelay_-e);t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*gf)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const e=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),s=this.onRealtimeDisconnect_.bind(this),r=this.id+":"+fe.nextConnectionId_++,i=this.lastSessionId;let o=!1,a=null;const c=function(){a?a.close():(o=!0,s())},l=function(u){m(a,"sendRequest call when we're not connected not allowed."),a.sendRequest(u)};this.realtime_={close:c,sendRequest:l};const h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[u,d]=await Promise.all([this.authTokenProvider_.getToken(h),this.appCheckTokenProvider_.getToken(h)]);o?z("getToken() completed but was canceled"):(z("getToken() completed. Creating connection."),this.authToken_=u&&u.accessToken,this.appCheckToken_=d&&d.token,a=new uf(r,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,t,s,_=>{te(_+" ("+this.repoInfo_.toString()+")"),this.interrupt(Ef)},i))}catch(u){this.log_("Failed to get token: "+u),o||(this.repoInfo_.nodeAdmin&&te(u),c())}}}interrupt(e){z("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){z("Resuming connection for reason: "+e),delete this.interruptReasons_[e],qr(this.interruptReasons_)&&(this.reconnectDelay_=at,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){const t=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){const t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(e,t){let s;t?s=t.map(i=>zs(i)).join("$"):s="default";const r=this.removeListen_(e,s);r&&r.onComplete&&r.onComplete("permission_denied")}removeListen_(e,t){const s=new x(e).toString();let r;if(this.listens.has(s)){const i=this.listens.get(s);r=i.get(t),i.delete(t),i.size===0&&this.listens.delete(s)}else r=void 0;return r}onAuthRevoked_(e,t){z("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(e==="invalid_token"||e==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=hi&&(this.reconnectDelay_=li,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,t){z("App check token revoked: "+e+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(e==="invalid_token"||e==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=hi&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace(`
|
|
803
803
|
`,`
|
|
804
|
-
FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of this.listens.values())for(const t of e.values())this.sendListen_(t);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){const e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){const e={};let t="js";e["sdk."+t+"."+
|
|
804
|
+
FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of this.listens.values())for(const t of e.values())this.sendListen_(t);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){const e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){const e={};let t="js";e["sdk."+t+"."+Jo.replace(/\./g,"-")]=1,Wo()?e["framework.cordova"]=1:Xh()&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){const e=an.getInstance().currentlyOnline();return qr(this.interruptReasons_)&&e}}fe.nextPersistentConnectionId_=0;fe.nextConnectionId_=0;/**
|
|
805
805
|
* @license
|
|
806
806
|
* Copyright 2017 Google LLC
|
|
807
807
|
*
|
|
@@ -831,7 +831,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
831
831
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
832
832
|
* See the License for the specific language governing permissions and
|
|
833
833
|
* limitations under the License.
|
|
834
|
-
*/class
|
|
834
|
+
*/class An{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,t){const s=new v(Ye,e),r=new v(Ye,t);return this.compare(s,r)!==0}minPost(){return v.MIN}}/**
|
|
835
835
|
* @license
|
|
836
836
|
* Copyright 2017 Google LLC
|
|
837
837
|
*
|
|
@@ -846,7 +846,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
846
846
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
847
847
|
* See the License for the specific language governing permissions and
|
|
848
848
|
* limitations under the License.
|
|
849
|
-
*/let Ut;class
|
|
849
|
+
*/let Ut;class Ta extends An{static get __EMPTY_NODE(){return Ut}static set __EMPTY_NODE(e){Ut=e}compare(e,t){return nt(e.name,t.name)}isDefinedOn(e){throw tt("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,t){return!1}minPost(){return v.MIN}maxPost(){return new v(De,Ut)}makePost(e,t){return m(typeof e=="string","KeyIndex indexValue must always be a string."),new v(e,Ut)}toString(){return".key"}}const je=new Ta;/**
|
|
850
850
|
* @license
|
|
851
851
|
* Copyright 2017 Google LLC
|
|
852
852
|
*
|
|
@@ -861,7 +861,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
861
861
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
862
862
|
* See the License for the specific language governing permissions and
|
|
863
863
|
* limitations under the License.
|
|
864
|
-
*/class qt{constructor(e,t,s,r,i=null){this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=t?s(e.key,t):1,r&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),t;if(this.resultGenerator_?t=this.resultGenerator_(e.key,e.value):t={key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return t}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;const e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class V{constructor(e,t,s,r,i){this.key=e,this.value=t,this.color=s??V.RED,this.left=r??
|
|
864
|
+
*/class qt{constructor(e,t,s,r,i=null){this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=t?s(e.key,t):1,r&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),t;if(this.resultGenerator_?t=this.resultGenerator_(e.key,e.value):t={key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return t}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;const e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class V{constructor(e,t,s,r,i){this.key=e,this.value=t,this.color=s??V.RED,this.left=r??J.EMPTY_NODE,this.right=i??J.EMPTY_NODE}copy(e,t,s,r,i){return new V(e??this.key,t??this.value,s??this.color,r??this.left,i??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||!!e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,s){let r=this;const i=s(e,r.key);return i<0?r=r.copy(null,null,null,r.left.insert(e,t,s),null):i===0?r=r.copy(null,t,null,null,null):r=r.copy(null,null,null,null,r.right.insert(e,t,s)),r.fixUp_()}removeMin_(){if(this.left.isEmpty())return J.EMPTY_NODE;let e=this;return!e.left.isRed_()&&!e.left.left.isRed_()&&(e=e.moveRedLeft_()),e=e.copy(null,null,null,e.left.removeMin_(),null),e.fixUp_()}remove(e,t){let s,r;if(s=this,t(e,s.key)<0)!s.left.isEmpty()&&!s.left.isRed_()&&!s.left.left.isRed_()&&(s=s.moveRedLeft_()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed_()&&(s=s.rotateRight_()),!s.right.isEmpty()&&!s.right.isRed_()&&!s.right.left.isRed_()&&(s=s.moveRedRight_()),t(e,s.key)===0){if(s.right.isEmpty())return J.EMPTY_NODE;r=s.right.min_(),s=s.copy(r.key,r.value,null,null,s.right.removeMin_())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.fixUp_()}isRed_(){return this.color}fixUp_(){let e=this;return e.right.isRed_()&&!e.left.isRed_()&&(e=e.rotateLeft_()),e.left.isRed_()&&e.left.left.isRed_()&&(e=e.rotateRight_()),e.left.isRed_()&&e.right.isRed_()&&(e=e.colorFlip_()),e}moveRedLeft_(){let e=this.colorFlip_();return e.right.left.isRed_()&&(e=e.copy(null,null,null,null,e.right.rotateRight_()),e=e.rotateLeft_(),e=e.colorFlip_()),e}moveRedRight_(){let e=this.colorFlip_();return e.left.left.isRed_()&&(e=e.rotateRight_(),e=e.colorFlip_()),e}rotateLeft_(){const e=this.copy(null,null,V.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){const e=this.copy(null,null,V.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip_(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth_(){const e=this.check_();return Math.pow(2,e)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const e=this.left.check_();if(e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}V.RED=!0;V.BLACK=!1;class wf{copy(e,t,s,r,i){return this}insert(e,t,s){return new V(e,t,null)}remove(e,t){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class J{constructor(e,t=J.EMPTY_NODE){this.comparator_=e,this.root_=t}insert(e,t){return new J(this.comparator_,this.root_.insert(e,t,this.comparator_).copy(null,null,V.BLACK,null,null))}remove(e){return new J(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,V.BLACK,null,null))}get(e){let t,s=this.root_;for(;!s.isEmpty();){if(t=this.comparator_(e,s.key),t===0)return s.value;t<0?s=s.left:t>0&&(s=s.right)}return null}getPredecessorKey(e){let t,s=this.root_,r=null;for(;!s.isEmpty();)if(t=this.comparator_(e,s.key),t===0){if(s.left.isEmpty())return r?r.key:null;for(s=s.left;!s.right.isEmpty();)s=s.right;return s.key}else t<0?s=s.left:t>0&&(r=s,s=s.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new qt(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,t){return new qt(this.root_,e,this.comparator_,!1,t)}getReverseIteratorFrom(e,t){return new qt(this.root_,e,this.comparator_,!0,t)}getReverseIterator(e){return new qt(this.root_,null,this.comparator_,!0,e)}}J.EMPTY_NODE=new wf;/**
|
|
865
865
|
* @license
|
|
866
866
|
* Copyright 2017 Google LLC
|
|
867
867
|
*
|
|
@@ -876,7 +876,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
876
876
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
877
877
|
* See the License for the specific language governing permissions and
|
|
878
878
|
* limitations under the License.
|
|
879
|
-
*/function
|
|
879
|
+
*/function vf(n,e){return nt(n.name,e.name)}function Js(n,e){return nt(n,e)}/**
|
|
880
880
|
* @license
|
|
881
881
|
* Copyright 2017 Google LLC
|
|
882
882
|
*
|
|
@@ -891,7 +891,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
891
891
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
892
892
|
* See the License for the specific language governing permissions and
|
|
893
893
|
* limitations under the License.
|
|
894
|
-
*/let vs;function
|
|
894
|
+
*/let vs;function bf(n){vs=n}const Ra=function(n){return typeof n=="number"?"number:"+na(n):"string:"+n},Ia=function(n){if(n.isLeafNode()){const e=n.val();m(typeof e=="string"||typeof e=="number"||typeof e=="object"&&me(e,".sv"),"Priority must be a string or number.")}else m(n===vs||n.isEmpty(),"priority of unexpected type.");m(n===vs||n.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/**
|
|
895
895
|
* @license
|
|
896
896
|
* Copyright 2017 Google LLC
|
|
897
897
|
*
|
|
@@ -906,7 +906,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
906
906
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
907
907
|
* See the License for the specific language governing permissions and
|
|
908
908
|
* limitations under the License.
|
|
909
|
-
*/let ui;class H{static set __childrenNodeConstructor(e){ui=e}static get __childrenNodeConstructor(){return ui}constructor(e,t=H.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=t,this.lazyHash_=null,m(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),
|
|
909
|
+
*/let ui;class H{static set __childrenNodeConstructor(e){ui=e}static get __childrenNodeConstructor(){return ui}constructor(e,t=H.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=t,this.lazyHash_=null,m(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),Ia(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(e){return new H(this.value_,e)}getImmediateChild(e){return e===".priority"?this.priorityNode_:H.__childrenNodeConstructor.EMPTY_NODE}getChild(e){return C(e)?this:b(e)===".priority"?this.priorityNode_:H.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,t){return null}updateImmediateChild(e,t){return e===".priority"?this.updatePriority(t):t.isEmpty()&&e!==".priority"?this:H.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,t).updatePriority(this.priorityNode_)}updateChild(e,t){const s=b(e);return s===null?t:t.isEmpty()&&s!==".priority"?this:(m(s!==".priority"||Ce(e)===1,".priority must be the last token in a path"),this.updateImmediateChild(s,H.__childrenNodeConstructor.EMPTY_NODE.updateChild(P(e),t)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,t){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+Ra(this.priorityNode_.val())+":");const t=typeof this.value_;e+=t+":",t==="number"?e+=na(this.value_):e+=this.value_,this.lazyHash_=Zo(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(e){return e===H.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof H.__childrenNodeConstructor?-1:(m(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))}compareToLeafNode_(e){const t=typeof e.value_,s=typeof this.value_,r=H.VALUE_TYPE_ORDER.indexOf(t),i=H.VALUE_TYPE_ORDER.indexOf(s);return m(r>=0,"Unknown leaf type: "+t),m(i>=0,"Unknown leaf type: "+s),r===i?s==="object"?0:this.value_<e.value_?-1:this.value_===e.value_?0:1:i-r}withIndex(){return this}isIndexed(){return!0}equals(e){if(e===this)return!0;if(e.isLeafNode()){const t=e;return this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_)}else return!1}}H.VALUE_TYPE_ORDER=["object","boolean","number","string"];/**
|
|
910
910
|
* @license
|
|
911
911
|
* Copyright 2017 Google LLC
|
|
912
912
|
*
|
|
@@ -921,7 +921,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
921
921
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
922
922
|
* See the License for the specific language governing permissions and
|
|
923
923
|
* limitations under the License.
|
|
924
|
-
*/let
|
|
924
|
+
*/let Na,ka;function Cf(n){Na=n}function Sf(n){ka=n}class Tf extends An{compare(e,t){const s=e.node.getPriority(),r=t.node.getPriority(),i=s.compareTo(r);return i===0?nt(e.name,t.name):i}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,t){return!e.getPriority().equals(t.getPriority())}minPost(){return v.MIN}maxPost(){return new v(De,new H("[PRIORITY-POST]",ka))}makePost(e,t){const s=Na(e);return new v(t,new H("[PRIORITY-POST]",s))}toString(){return".priority"}}const U=new Tf;/**
|
|
925
925
|
* @license
|
|
926
926
|
* Copyright 2017 Google LLC
|
|
927
927
|
*
|
|
@@ -936,7 +936,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
936
936
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
937
937
|
* See the License for the specific language governing permissions and
|
|
938
938
|
* limitations under the License.
|
|
939
|
-
*/const
|
|
939
|
+
*/const Rf=Math.log(2);class If{constructor(e){const t=i=>parseInt(Math.log(i)/Rf,10),s=i=>parseInt(Array(i+1).join("1"),2);this.count=t(e+1),this.current_=this.count-1;const r=s(this.count);this.bits_=e+1&r}nextBitIsOne(){const e=!(this.bits_&1<<this.current_);return this.current_--,e}}const cn=function(n,e,t,s){n.sort(e);const r=function(c,l){const h=l-c;let u,d;if(h===0)return null;if(h===1)return u=n[c],d=t?t(u):u,new V(d,u.node,V.BLACK,null,null);{const _=parseInt(h/2,10)+c,p=r(c,_),y=r(_+1,l);return u=n[_],d=t?t(u):u,new V(d,u.node,V.BLACK,p,y)}},i=function(c){let l=null,h=null,u=n.length;const d=function(p,y){const g=u-p,k=u;u-=p;const L=r(g+1,k),M=n[g],se=t?t(M):M;_(new V(se,M.node,y,null,L))},_=function(p){l?(l.left=p,l=p):(h=p,l=p)};for(let p=0;p<c.count;++p){const y=c.nextBitIsOne(),g=Math.pow(2,c.count-(p+1));y?d(g,V.BLACK):(d(g,V.BLACK),d(g,V.RED))}return h},o=new If(n.length),a=i(o);return new J(s||e,a)};/**
|
|
940
940
|
* @license
|
|
941
941
|
* Copyright 2017 Google LLC
|
|
942
942
|
*
|
|
@@ -951,7 +951,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
951
951
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
952
952
|
* See the License for the specific language governing permissions and
|
|
953
953
|
* limitations under the License.
|
|
954
|
-
*/let Jn;const qe={};class de{static get Default(){return m(qe&&
|
|
954
|
+
*/let Jn;const qe={};class de{static get Default(){return m(qe&&U,"ChildrenNode.ts has not been loaded"),Jn=Jn||new de({".priority":qe},{".priority":U}),Jn}constructor(e,t){this.indexes_=e,this.indexSet_=t}get(e){const t=Ge(this.indexes_,e);if(!t)throw new Error("No index defined for "+e);return t instanceof J?t:null}hasIndex(e){return me(this.indexSet_,e.toString())}addIndex(e,t){m(e!==je,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const s=[];let r=!1;const i=t.getIterator(v.Wrap);let o=i.getNext();for(;o;)r=r||e.isDefinedOn(o.node),s.push(o),o=i.getNext();let a;r?a=cn(s,e.getCompare()):a=qe;const c=e.toString(),l=Object.assign({},this.indexSet_);l[c]=e;const h=Object.assign({},this.indexes_);return h[c]=a,new de(h,l)}addToIndexes(e,t){const s=tn(this.indexes_,(r,i)=>{const o=Ge(this.indexSet_,i);if(m(o,"Missing index implementation for "+i),r===qe)if(o.isDefinedOn(e.node)){const a=[],c=t.getIterator(v.Wrap);let l=c.getNext();for(;l;)l.name!==e.name&&a.push(l),l=c.getNext();return a.push(e),cn(a,o.getCompare())}else return qe;else{const a=t.get(e.name);let c=r;return a&&(c=c.remove(new v(e.name,a))),c.insert(e,e.node)}});return new de(s,this.indexSet_)}removeFromIndexes(e,t){const s=tn(this.indexes_,r=>{if(r===qe)return r;{const i=t.get(e.name);return i?r.remove(new v(e.name,i)):r}});return new de(s,this.indexSet_)}}/**
|
|
955
955
|
* @license
|
|
956
956
|
* Copyright 2017 Google LLC
|
|
957
957
|
*
|
|
@@ -966,7 +966,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
966
966
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
967
967
|
* See the License for the specific language governing permissions and
|
|
968
968
|
* limitations under the License.
|
|
969
|
-
*/let ct;class E{static get EMPTY_NODE(){return ct||(ct=new E(new
|
|
969
|
+
*/let ct;class E{static get EMPTY_NODE(){return ct||(ct=new E(new J(Js),null,de.Default))}constructor(e,t,s){this.children_=e,this.priorityNode_=t,this.indexMap_=s,this.lazyHash_=null,this.priorityNode_&&Ia(this.priorityNode_),this.children_.isEmpty()&&m(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||ct}updatePriority(e){return this.children_.isEmpty()?this:new E(this.children_,e,this.indexMap_)}getImmediateChild(e){if(e===".priority")return this.getPriority();{const t=this.children_.get(e);return t===null?ct:t}}getChild(e){const t=b(e);return t===null?this:this.getImmediateChild(t).getChild(P(e))}hasChild(e){return this.children_.get(e)!==null}updateImmediateChild(e,t){if(m(t,"We should always be passing snapshot nodes"),e===".priority")return this.updatePriority(t);{const s=new v(e,t);let r,i;t.isEmpty()?(r=this.children_.remove(e),i=this.indexMap_.removeFromIndexes(s,this.children_)):(r=this.children_.insert(e,t),i=this.indexMap_.addToIndexes(s,this.children_));const o=r.isEmpty()?ct:this.priorityNode_;return new E(r,o,i)}}updateChild(e,t){const s=b(e);if(s===null)return t;{m(b(e)!==".priority"||Ce(e)===1,".priority must be the last token in a path");const r=this.getImmediateChild(s).updateChild(P(e),t);return this.updateImmediateChild(s,r)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;const t={};let s=0,r=0,i=!0;if(this.forEachChild(U,(o,a)=>{t[o]=a.val(e),s++,i&&E.INTEGER_REGEXP_.test(o)?r=Math.max(r,Number(o)):i=!1}),!e&&i&&r<2*s){const o=[];for(const a in t)o[a]=t[a];return o}else return e&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t}hash(){if(this.lazyHash_===null){let e="";this.getPriority().isEmpty()||(e+="priority:"+Ra(this.getPriority().val())+":"),this.forEachChild(U,(t,s)=>{const r=s.hash();r!==""&&(e+=":"+t+":"+r)}),this.lazyHash_=e===""?"":Zo(e)}return this.lazyHash_}getPredecessorChildName(e,t,s){const r=this.resolveIndex_(s);if(r){const i=r.getPredecessorKey(new v(e,t));return i?i.name:null}else return this.children_.getPredecessorKey(e)}getFirstChildName(e){const t=this.resolveIndex_(e);if(t){const s=t.minKey();return s&&s.name}else return this.children_.minKey()}getFirstChild(e){const t=this.getFirstChildName(e);return t?new v(t,this.children_.get(t)):null}getLastChildName(e){const t=this.resolveIndex_(e);if(t){const s=t.maxKey();return s&&s.name}else return this.children_.maxKey()}getLastChild(e){const t=this.getLastChildName(e);return t?new v(t,this.children_.get(t)):null}forEachChild(e,t){const s=this.resolveIndex_(e);return s?s.inorderTraversal(r=>t(r.name,r.node)):this.children_.inorderTraversal(t)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,t){const s=this.resolveIndex_(t);if(s)return s.getIteratorFrom(e,r=>r);{const r=this.children_.getIteratorFrom(e.name,v.Wrap);let i=r.peek();for(;i!=null&&t.compare(i,e)<0;)r.getNext(),i=r.peek();return r}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,t){const s=this.resolveIndex_(t);if(s)return s.getReverseIteratorFrom(e,r=>r);{const r=this.children_.getReverseIteratorFrom(e.name,v.Wrap);let i=r.peek();for(;i!=null&&t.compare(i,e)>0;)r.getNext(),i=r.peek();return r}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Pt?-1:0}withIndex(e){if(e===je||this.indexMap_.hasIndex(e))return this;{const t=this.indexMap_.addIndex(e,this.children_);return new E(this.children_,this.priorityNode_,t)}}isIndexed(e){return e===je||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode())return!1;{const t=e;if(this.getPriority().equals(t.getPriority()))if(this.children_.count()===t.children_.count()){const s=this.getIterator(U),r=t.getIterator(U);let i=s.getNext(),o=r.getNext();for(;i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=s.getNext(),o=r.getNext()}return i===null&&o===null}else return!1;else return!1}}resolveIndex_(e){return e===je?null:this.indexMap_.get(e.toString())}}E.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class Nf extends E{constructor(){super(new J(Js),E.EMPTY_NODE,de.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return E.EMPTY_NODE}isEmpty(){return!1}}const Pt=new Nf;Object.defineProperties(v,{MIN:{value:new v(Ye,E.EMPTY_NODE)},MAX:{value:new v(De,Pt)}});Ta.__EMPTY_NODE=E.EMPTY_NODE;H.__childrenNodeConstructor=E;bf(Pt);Sf(Pt);/**
|
|
970
970
|
* @license
|
|
971
971
|
* Copyright 2017 Google LLC
|
|
972
972
|
*
|
|
@@ -981,7 +981,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
981
981
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
982
982
|
* See the License for the specific language governing permissions and
|
|
983
983
|
* limitations under the License.
|
|
984
|
-
*/const
|
|
984
|
+
*/const kf=!0;function j(n,e=null){if(n===null)return E.EMPTY_NODE;if(typeof n=="object"&&".priority"in n&&(e=n[".priority"]),m(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof n=="object"&&".value"in n&&n[".value"]!==null&&(n=n[".value"]),typeof n!="object"||".sv"in n){const t=n;return new H(t,j(e))}if(!(n instanceof Array)&&kf){const t=[];let s=!1;if(Z(n,(o,a)=>{if(o.substring(0,1)!=="."){const c=j(a);c.isEmpty()||(s=s||!c.getPriority().isEmpty(),t.push(new v(o,c)))}}),t.length===0)return E.EMPTY_NODE;const i=cn(t,vf,o=>o.name,Js);if(s){const o=cn(t,U.getCompare());return new E(i,j(e),new de({".priority":o},{".priority":U}))}else return new E(i,j(e),de.Default)}else{let t=E.EMPTY_NODE;return Z(n,(s,r)=>{if(me(n,s)&&s.substring(0,1)!=="."){const i=j(r);(i.isLeafNode()||!i.isEmpty())&&(t=t.updateImmediateChild(s,i))}}),t.updatePriority(j(e))}}Cf(j);/**
|
|
985
985
|
* @license
|
|
986
986
|
* Copyright 2017 Google LLC
|
|
987
987
|
*
|
|
@@ -996,7 +996,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
996
996
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
997
997
|
* See the License for the specific language governing permissions and
|
|
998
998
|
* limitations under the License.
|
|
999
|
-
*/class
|
|
999
|
+
*/class Af extends An{constructor(e){super(),this.indexPath_=e,m(!C(e)&&b(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,t){const s=this.extractChild(e.node),r=this.extractChild(t.node),i=s.compareTo(r);return i===0?nt(e.name,t.name):i}makePost(e,t){const s=j(e),r=E.EMPTY_NODE.updateChild(this.indexPath_,s);return new v(t,r)}maxPost(){const e=E.EMPTY_NODE.updateChild(this.indexPath_,Pt);return new v(De,e)}toString(){return ba(this.indexPath_,0).join("/")}}/**
|
|
1000
1000
|
* @license
|
|
1001
1001
|
* Copyright 2017 Google LLC
|
|
1002
1002
|
*
|
|
@@ -1011,7 +1011,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1011
1011
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1012
1012
|
* See the License for the specific language governing permissions and
|
|
1013
1013
|
* limitations under the License.
|
|
1014
|
-
*/class
|
|
1014
|
+
*/class xf extends An{compare(e,t){const s=e.node.compareTo(t.node);return s===0?nt(e.name,t.name):s}isDefinedOn(e){return!0}indexedValueChanged(e,t){return!e.equals(t)}minPost(){return v.MIN}maxPost(){return v.MAX}makePost(e,t){const s=j(e);return new v(t,s)}toString(){return".value"}}const Of=new xf;/**
|
|
1015
1015
|
* @license
|
|
1016
1016
|
* Copyright 2017 Google LLC
|
|
1017
1017
|
*
|
|
@@ -1026,7 +1026,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1026
1026
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1027
1027
|
* See the License for the specific language governing permissions and
|
|
1028
1028
|
* limitations under the License.
|
|
1029
|
-
*/function
|
|
1029
|
+
*/function Aa(n){return{type:"value",snapshotNode:n}}function Qe(n,e){return{type:"child_added",snapshotNode:e,childName:n}}function vt(n,e){return{type:"child_removed",snapshotNode:e,childName:n}}function bt(n,e,t){return{type:"child_changed",snapshotNode:e,childName:n,oldSnap:t}}function Pf(n,e){return{type:"child_moved",snapshotNode:e,childName:n}}/**
|
|
1030
1030
|
* @license
|
|
1031
1031
|
* Copyright 2017 Google LLC
|
|
1032
1032
|
*
|
|
@@ -1041,7 +1041,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1041
1041
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1042
1042
|
* See the License for the specific language governing permissions and
|
|
1043
1043
|
* limitations under the License.
|
|
1044
|
-
*/class Xs{constructor(e){this.index_=e}updateChild(e,t,s,r,i,o){m(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");const a=e.getImmediateChild(t);return a.getChild(r).equals(s.getChild(r))&&a.isEmpty()===s.isEmpty()||(o!=null&&(s.isEmpty()?e.hasChild(t)?o.trackChildChange(vt(t,a)):m(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(Qe(t,s)):o.trackChildChange(bt(t,s,a))),e.isLeafNode()&&s.isEmpty())?e:e.updateImmediateChild(t,s).withIndex(this.index_)}updateFullNode(e,t,s){return s!=null&&(e.isLeafNode()||e.forEachChild(
|
|
1044
|
+
*/class Xs{constructor(e){this.index_=e}updateChild(e,t,s,r,i,o){m(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");const a=e.getImmediateChild(t);return a.getChild(r).equals(s.getChild(r))&&a.isEmpty()===s.isEmpty()||(o!=null&&(s.isEmpty()?e.hasChild(t)?o.trackChildChange(vt(t,a)):m(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(Qe(t,s)):o.trackChildChange(bt(t,s,a))),e.isLeafNode()&&s.isEmpty())?e:e.updateImmediateChild(t,s).withIndex(this.index_)}updateFullNode(e,t,s){return s!=null&&(e.isLeafNode()||e.forEachChild(U,(r,i)=>{t.hasChild(r)||s.trackChildChange(vt(r,i))}),t.isLeafNode()||t.forEachChild(U,(r,i)=>{if(e.hasChild(r)){const o=e.getImmediateChild(r);o.equals(i)||s.trackChildChange(bt(r,i,o))}else s.trackChildChange(Qe(r,i))})),t.withIndex(this.index_)}updatePriority(e,t){return e.isEmpty()?E.EMPTY_NODE:e.updatePriority(t)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}/**
|
|
1045
1045
|
* @license
|
|
1046
1046
|
* Copyright 2017 Google LLC
|
|
1047
1047
|
*
|
|
@@ -1056,7 +1056,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1056
1056
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1057
1057
|
* See the License for the specific language governing permissions and
|
|
1058
1058
|
* limitations under the License.
|
|
1059
|
-
*/class Ct{constructor(e){this.indexedFilter_=new Xs(e.getIndex()),this.index_=e.getIndex(),this.startPost_=Ct.getStartPost_(e),this.endPost_=Ct.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){const t=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,s=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return t&&s}updateChild(e,t,s,r,i,o){return this.matches(new v(t,s))||(s=E.EMPTY_NODE),this.indexedFilter_.updateChild(e,t,s,r,i,o)}updateFullNode(e,t,s){t.isLeafNode()&&(t=E.EMPTY_NODE);let r=t.withIndex(this.index_);r=r.updatePriority(E.EMPTY_NODE);const i=this;return t.forEachChild(
|
|
1059
|
+
*/class Ct{constructor(e){this.indexedFilter_=new Xs(e.getIndex()),this.index_=e.getIndex(),this.startPost_=Ct.getStartPost_(e),this.endPost_=Ct.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){const t=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,s=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return t&&s}updateChild(e,t,s,r,i,o){return this.matches(new v(t,s))||(s=E.EMPTY_NODE),this.indexedFilter_.updateChild(e,t,s,r,i,o)}updateFullNode(e,t,s){t.isLeafNode()&&(t=E.EMPTY_NODE);let r=t.withIndex(this.index_);r=r.updatePriority(E.EMPTY_NODE);const i=this;return t.forEachChild(U,(o,a)=>{i.matches(new v(o,a))||(r=r.updateImmediateChild(o,E.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,r,s)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){const t=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),t)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){const t=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),t)}else return e.getIndex().maxPost()}}/**
|
|
1060
1060
|
* @license
|
|
1061
1061
|
* Copyright 2017 Google LLC
|
|
1062
1062
|
*
|
|
@@ -1071,7 +1071,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1071
1071
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1072
1072
|
* See the License for the specific language governing permissions and
|
|
1073
1073
|
* limitations under the License.
|
|
1074
|
-
*/class
|
|
1074
|
+
*/class Df{constructor(e){this.withinDirectionalStart=t=>this.reverse_?this.withinEndPost(t):this.withinStartPost(t),this.withinDirectionalEnd=t=>this.reverse_?this.withinStartPost(t):this.withinEndPost(t),this.withinStartPost=t=>{const s=this.index_.compare(this.rangedFilter_.getStartPost(),t);return this.startIsInclusive_?s<=0:s<0},this.withinEndPost=t=>{const s=this.index_.compare(t,this.rangedFilter_.getEndPost());return this.endIsInclusive_?s<=0:s<0},this.rangedFilter_=new Ct(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,t,s,r,i,o){return this.rangedFilter_.matches(new v(t,s))||(s=E.EMPTY_NODE),e.getImmediateChild(t).equals(s)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,t,s,r,i,o):this.fullLimitUpdateChild_(e,t,s,i,o)}updateFullNode(e,t,s){let r;if(t.isLeafNode()||t.isEmpty())r=E.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<t.numChildren()&&t.isIndexed(this.index_)){r=E.EMPTY_NODE.withIndex(this.index_);let i;this.reverse_?i=t.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):i=t.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let o=0;for(;i.hasNext()&&o<this.limit_;){const a=i.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))r=r.updateImmediateChild(a.name,a.node),o++;else break;else continue}}else{r=t.withIndex(this.index_),r=r.updatePriority(E.EMPTY_NODE);let i;this.reverse_?i=r.getReverseIterator(this.index_):i=r.getIterator(this.index_);let o=0;for(;i.hasNext();){const a=i.getNext();o<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?o++:r=r.updateImmediateChild(a.name,E.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,r,s)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,t,s,r,i){let o;if(this.reverse_){const u=this.index_.getCompare();o=(d,_)=>u(_,d)}else o=this.index_.getCompare();const a=e;m(a.numChildren()===this.limit_,"");const c=new v(t,s),l=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),h=this.rangedFilter_.matches(c);if(a.hasChild(t)){const u=a.getImmediateChild(t);let d=r.getChildAfterChild(this.index_,l,this.reverse_);for(;d!=null&&(d.name===t||a.hasChild(d.name));)d=r.getChildAfterChild(this.index_,d,this.reverse_);const _=d==null?1:o(d,c);if(h&&!s.isEmpty()&&_>=0)return i!=null&&i.trackChildChange(bt(t,s,u)),a.updateImmediateChild(t,s);{i!=null&&i.trackChildChange(vt(t,u));const y=a.updateImmediateChild(t,E.EMPTY_NODE);return d!=null&&this.rangedFilter_.matches(d)?(i!=null&&i.trackChildChange(Qe(d.name,d.node)),y.updateImmediateChild(d.name,d.node)):y}}else return s.isEmpty()?e:h&&o(l,c)>=0?(i!=null&&(i.trackChildChange(vt(l.name,l.node)),i.trackChildChange(Qe(t,s))),a.updateImmediateChild(t,s).updateImmediateChild(l.name,E.EMPTY_NODE)):e}}/**
|
|
1075
1075
|
* @license
|
|
1076
1076
|
* Copyright 2017 Google LLC
|
|
1077
1077
|
*
|
|
@@ -1086,7 +1086,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1086
1086
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1087
1087
|
* See the License for the specific language governing permissions and
|
|
1088
1088
|
* limitations under the License.
|
|
1089
|
-
*/class Zs{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=
|
|
1089
|
+
*/class Zs{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=U}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return m(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return m(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Ye}hasEnd(){return this.endSet_}getIndexEndValue(){return m(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return m(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:De}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return m(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===U}copy(){const e=new Zs;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function Lf(n){return n.loadsAllData()?new Xs(n.getIndex()):n.hasLimit()?new Df(n):new Ct(n)}function di(n){const e={};if(n.isDefault())return e;let t;if(n.index_===U?t="$priority":n.index_===Of?t="$value":n.index_===je?t="$key":(m(n.index_ instanceof Af,"Unrecognized index type!"),t=n.index_.toString()),e.orderBy=$(t),n.startSet_){const s=n.startAfterSet_?"startAfter":"startAt";e[s]=$(n.indexStartValue_),n.startNameSet_&&(e[s]+=","+$(n.indexStartName_))}if(n.endSet_){const s=n.endBeforeSet_?"endBefore":"endAt";e[s]=$(n.indexEndValue_),n.endNameSet_&&(e[s]+=","+$(n.indexEndName_))}return n.limitSet_&&(n.isViewFromLeft()?e.limitToFirst=n.limit_:e.limitToLast=n.limit_),e}function fi(n){const e={};if(n.startSet_&&(e.sp=n.indexStartValue_,n.startNameSet_&&(e.sn=n.indexStartName_),e.sin=!n.startAfterSet_),n.endSet_&&(e.ep=n.indexEndValue_,n.endNameSet_&&(e.en=n.indexEndName_),e.ein=!n.endBeforeSet_),n.limitSet_){e.l=n.limit_;let t=n.viewFrom_;t===""&&(n.isViewFromLeft()?t="l":t="r"),e.vf=t}return n.index_!==U&&(e.i=n.index_.toString()),e}/**
|
|
1090
1090
|
* @license
|
|
1091
1091
|
* Copyright 2017 Google LLC
|
|
1092
1092
|
*
|
|
@@ -1101,7 +1101,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1101
1101
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1102
1102
|
* See the License for the specific language governing permissions and
|
|
1103
1103
|
* limitations under the License.
|
|
1104
|
-
*/class ln extends
|
|
1104
|
+
*/class ln extends Ea{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,t){return t!==void 0?"tag$"+t:(m(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,t,s,r){super(),this.repoInfo_=e,this.onDataUpdate_=t,this.authTokenProvider_=s,this.appCheckTokenProvider_=r,this.log_=xt("p:rest:"),this.listens_={}}listen(e,t,s,r){const i=e._path.toString();this.log_("Listen called for "+i+" "+e._queryIdentifier);const o=ln.getListenId_(e,s),a={};this.listens_[o]=a;const c=di(e._queryParams);this.restRequest_(i+".json",c,(l,h)=>{let u=h;if(l===404&&(u=null,l=null),l===null&&this.onDataUpdate_(i,u,!1,s),Ge(this.listens_,o)===a){let d;l?l===401?d="permission_denied":d="rest_error:"+l:d="ok",r(d,null)}})}unlisten(e,t){const s=ln.getListenId_(e,t);delete this.listens_[s]}get(e){const t=di(e._queryParams),s=e._path.toString(),r=new Vs;return this.restRequest_(s+".json",t,(i,o)=>{let a=o;i===404&&(a=null,i=null),i===null?(this.onDataUpdate_(s,a,!1,null),r.resolve(a)):r.reject(new Error(a))}),r.promise}refreshAuthToken(e){}restRequest_(e,t={},s){return t.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([r,i])=>{r&&r.accessToken&&(t.auth=r.accessToken),i&&i.token&&(t.ac=i.token);const o=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+au(t);this.log_("Sending REST request for "+o);const a=new XMLHttpRequest;a.onreadystatechange=()=>{if(s&&a.readyState===4){this.log_("REST Response for "+o+" received. status:",a.status,"response:",a.responseText);let c=null;if(a.status>=200&&a.status<300){try{c=gt(a.responseText)}catch{te("Failed to parse JSON response for "+o+": "+a.responseText)}s(null,c)}else a.status!==401&&a.status!==404&&te("Got unsuccessful REST response for "+o+" Status: "+a.status),s(a.status);s=null}},a.open("GET",o,!0),a.send()})}}/**
|
|
1105
1105
|
* @license
|
|
1106
1106
|
* Copyright 2017 Google LLC
|
|
1107
1107
|
*
|
|
@@ -1116,7 +1116,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1116
1116
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1117
1117
|
* See the License for the specific language governing permissions and
|
|
1118
1118
|
* limitations under the License.
|
|
1119
|
-
*/class
|
|
1119
|
+
*/class Ff{constructor(){this.rootNode_=E.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}}/**
|
|
1120
1120
|
* @license
|
|
1121
1121
|
* Copyright 2017 Google LLC
|
|
1122
1122
|
*
|
|
@@ -1131,7 +1131,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1131
1131
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1132
1132
|
* See the License for the specific language governing permissions and
|
|
1133
1133
|
* limitations under the License.
|
|
1134
|
-
*/function hn(){return{value:null,children:new Map}}function
|
|
1134
|
+
*/function hn(){return{value:null,children:new Map}}function xa(n,e,t){if(C(e))n.value=t,n.children.clear();else if(n.value!==null)n.value=n.value.updateChild(e,t);else{const s=b(e);n.children.has(s)||n.children.set(s,hn());const r=n.children.get(s);e=P(e),xa(r,e,t)}}function bs(n,e,t){n.value!==null?t(e,n.value):Mf(n,(s,r)=>{const i=new x(e.toString()+"/"+s);bs(r,i,t)})}function Mf(n,e){n.children.forEach((t,s)=>{e(s,t)})}/**
|
|
1135
1135
|
* @license
|
|
1136
1136
|
* Copyright 2017 Google LLC
|
|
1137
1137
|
*
|
|
@@ -1146,7 +1146,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1146
1146
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1147
1147
|
* See the License for the specific language governing permissions and
|
|
1148
1148
|
* limitations under the License.
|
|
1149
|
-
*/class
|
|
1149
|
+
*/class Bf{constructor(e){this.collection_=e,this.last_=null}get(){const e=this.collection_.get(),t=Object.assign({},e);return this.last_&&Z(this.last_,(s,r)=>{t[s]=t[s]-r}),this.last_=e,t}}/**
|
|
1150
1150
|
* @license
|
|
1151
1151
|
* Copyright 2017 Google LLC
|
|
1152
1152
|
*
|
|
@@ -1161,7 +1161,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1161
1161
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1162
1162
|
* See the License for the specific language governing permissions and
|
|
1163
1163
|
* limitations under the License.
|
|
1164
|
-
*/const pi=10*1e3,
|
|
1164
|
+
*/const pi=10*1e3,Uf=30*1e3,qf=5*60*1e3;class Wf{constructor(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new Bf(e);const s=pi+(Uf-pi)*Math.random();dt(this.reportStats_.bind(this),Math.floor(s))}reportStats_(){const e=this.statsListener_.get(),t={};let s=!1;Z(e,(r,i)=>{i>0&&me(this.statsToReport_,r)&&(t[r]=i,s=!0)}),s&&this.server_.reportStats(t),dt(this.reportStats_.bind(this),Math.floor(Math.random()*2*qf))}}/**
|
|
1165
1165
|
* @license
|
|
1166
1166
|
* Copyright 2017 Google LLC
|
|
1167
1167
|
*
|
|
@@ -1176,7 +1176,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1176
1176
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1177
1177
|
* See the License for the specific language governing permissions and
|
|
1178
1178
|
* limitations under the License.
|
|
1179
|
-
*/var ae;(function(n){n[n.OVERWRITE=0]="OVERWRITE",n[n.MERGE=1]="MERGE",n[n.ACK_USER_WRITE=2]="ACK_USER_WRITE",n[n.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(ae||(ae={}));function
|
|
1179
|
+
*/var ae;(function(n){n[n.OVERWRITE=0]="OVERWRITE",n[n.MERGE=1]="MERGE",n[n.ACK_USER_WRITE=2]="ACK_USER_WRITE",n[n.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(ae||(ae={}));function Oa(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function er(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function tr(n){return{fromUser:!1,fromServer:!0,queryId:n,tagged:!0}}/**
|
|
1180
1180
|
* @license
|
|
1181
1181
|
* Copyright 2017 Google LLC
|
|
1182
1182
|
*
|
|
@@ -1191,7 +1191,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1191
1191
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1192
1192
|
* See the License for the specific language governing permissions and
|
|
1193
1193
|
* limitations under the License.
|
|
1194
|
-
*/class un{constructor(e,t,s){this.path=e,this.affectedTree=t,this.revert=s,this.type=ae.ACK_USER_WRITE,this.source=
|
|
1194
|
+
*/class un{constructor(e,t,s){this.path=e,this.affectedTree=t,this.revert=s,this.type=ae.ACK_USER_WRITE,this.source=Oa()}operationForChild(e){if(C(this.path)){if(this.affectedTree.value!=null)return m(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const t=this.affectedTree.subtree(new x(e));return new un(I(),t,this.revert)}}else return m(b(this.path)===e,"operationForChild called for unrelated child."),new un(P(this.path),this.affectedTree,this.revert)}}/**
|
|
1195
1195
|
* @license
|
|
1196
1196
|
* Copyright 2017 Google LLC
|
|
1197
1197
|
*
|
|
@@ -1206,7 +1206,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1206
1206
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1207
1207
|
* See the License for the specific language governing permissions and
|
|
1208
1208
|
* limitations under the License.
|
|
1209
|
-
*/class St{constructor(e,t){this.source=e,this.path=t,this.type=ae.LISTEN_COMPLETE}operationForChild(e){return C(this.path)?new St(this.source,
|
|
1209
|
+
*/class St{constructor(e,t){this.source=e,this.path=t,this.type=ae.LISTEN_COMPLETE}operationForChild(e){return C(this.path)?new St(this.source,I()):new St(this.source,P(this.path))}}/**
|
|
1210
1210
|
* @license
|
|
1211
1211
|
* Copyright 2017 Google LLC
|
|
1212
1212
|
*
|
|
@@ -1221,7 +1221,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1221
1221
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1222
1222
|
* See the License for the specific language governing permissions and
|
|
1223
1223
|
* limitations under the License.
|
|
1224
|
-
*/class Le{constructor(e,t,s){this.source=e,this.path=t,this.snap=s,this.type=ae.OVERWRITE}operationForChild(e){return C(this.path)?new Le(this.source,
|
|
1224
|
+
*/class Le{constructor(e,t,s){this.source=e,this.path=t,this.snap=s,this.type=ae.OVERWRITE}operationForChild(e){return C(this.path)?new Le(this.source,I(),this.snap.getImmediateChild(e)):new Le(this.source,P(this.path),this.snap)}}/**
|
|
1225
1225
|
* @license
|
|
1226
1226
|
* Copyright 2017 Google LLC
|
|
1227
1227
|
*
|
|
@@ -1236,7 +1236,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1236
1236
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1237
1237
|
* See the License for the specific language governing permissions and
|
|
1238
1238
|
* limitations under the License.
|
|
1239
|
-
*/class Tt{constructor(e,t,s){this.source=e,this.path=t,this.children=s,this.type=ae.MERGE}operationForChild(e){if(C(this.path)){const t=this.children.subtree(new
|
|
1239
|
+
*/class Tt{constructor(e,t,s){this.source=e,this.path=t,this.children=s,this.type=ae.MERGE}operationForChild(e){if(C(this.path)){const t=this.children.subtree(new x(e));return t.isEmpty()?null:t.value?new Le(this.source,I(),t.value):new Tt(this.source,I(),t)}else return m(b(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new Tt(this.source,P(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}/**
|
|
1240
1240
|
* @license
|
|
1241
1241
|
* Copyright 2017 Google LLC
|
|
1242
1242
|
*
|
|
@@ -1266,7 +1266,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1266
1266
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1267
1267
|
* See the License for the specific language governing permissions and
|
|
1268
1268
|
* limitations under the License.
|
|
1269
|
-
*/class
|
|
1269
|
+
*/class Hf{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function Vf(n,e,t,s){const r=[],i=[];return e.forEach(o=>{o.type==="child_changed"&&n.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&i.push(Pf(o.childName,o.snapshotNode))}),lt(n,r,"child_removed",e,s,t),lt(n,r,"child_added",e,s,t),lt(n,r,"child_moved",i,s,t),lt(n,r,"child_changed",e,s,t),lt(n,r,"value",e,s,t),r}function lt(n,e,t,s,r,i){const o=s.filter(a=>a.type===t);o.sort((a,c)=>zf(n,a,c)),o.forEach(a=>{const c=$f(n,a,i);r.forEach(l=>{l.respondsTo(a.type)&&e.push(l.createEvent(c,n.query_))})})}function $f(n,e,t){return e.type==="value"||e.type==="child_removed"||(e.prevName=t.getPredecessorChildName(e.childName,e.snapshotNode,n.index_)),e}function zf(n,e,t){if(e.childName==null||t.childName==null)throw tt("Should only compare child_ events.");const s=new v(e.childName,e.snapshotNode),r=new v(t.childName,t.snapshotNode);return n.index_.compare(s,r)}/**
|
|
1270
1270
|
* @license
|
|
1271
1271
|
* Copyright 2017 Google LLC
|
|
1272
1272
|
*
|
|
@@ -1281,7 +1281,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1281
1281
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1282
1282
|
* See the License for the specific language governing permissions and
|
|
1283
1283
|
* limitations under the License.
|
|
1284
|
-
*/function
|
|
1284
|
+
*/function xn(n,e){return{eventCache:n,serverCache:e}}function ft(n,e,t,s){return xn(new Fe(e,t,s),n.serverCache)}function Pa(n,e,t,s){return xn(n.eventCache,new Fe(e,t,s))}function Cs(n){return n.eventCache.isFullyInitialized()?n.eventCache.getNode():null}function Me(n){return n.serverCache.isFullyInitialized()?n.serverCache.getNode():null}/**
|
|
1285
1285
|
* @license
|
|
1286
1286
|
* Copyright 2017 Google LLC
|
|
1287
1287
|
*
|
|
@@ -1296,7 +1296,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1296
1296
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1297
1297
|
* See the License for the specific language governing permissions and
|
|
1298
1298
|
* limitations under the License.
|
|
1299
|
-
*/let Xn;const
|
|
1299
|
+
*/let Xn;const jf=()=>(Xn||(Xn=new J(Ad)),Xn);class D{static fromObject(e){let t=new D(null);return Z(e,(s,r)=>{t=t.set(new x(s),r)}),t}constructor(e,t=jf()){this.value=e,this.children=t}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,t){if(this.value!=null&&t(this.value))return{path:I(),value:this.value};if(C(e))return null;{const s=b(e),r=this.children.get(s);if(r!==null){const i=r.findRootMostMatchingPathAndValue(P(e),t);return i!=null?{path:W(new x(s),i.path),value:i.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(C(e))return this;{const t=b(e),s=this.children.get(t);return s!==null?s.subtree(P(e)):new D(null)}}set(e,t){if(C(e))return new D(t,this.children);{const s=b(e),i=(this.children.get(s)||new D(null)).set(P(e),t),o=this.children.insert(s,i);return new D(this.value,o)}}remove(e){if(C(e))return this.children.isEmpty()?new D(null):new D(null,this.children);{const t=b(e),s=this.children.get(t);if(s){const r=s.remove(P(e));let i;return r.isEmpty()?i=this.children.remove(t):i=this.children.insert(t,r),this.value===null&&i.isEmpty()?new D(null):new D(this.value,i)}else return this}}get(e){if(C(e))return this.value;{const t=b(e),s=this.children.get(t);return s?s.get(P(e)):null}}setTree(e,t){if(C(e))return t;{const s=b(e),i=(this.children.get(s)||new D(null)).setTree(P(e),t);let o;return i.isEmpty()?o=this.children.remove(s):o=this.children.insert(s,i),new D(this.value,o)}}fold(e){return this.fold_(I(),e)}fold_(e,t){const s={};return this.children.inorderTraversal((r,i)=>{s[r]=i.fold_(W(e,r),t)}),t(e,this.value,s)}findOnPath(e,t){return this.findOnPath_(e,I(),t)}findOnPath_(e,t,s){const r=this.value?s(t,this.value):!1;if(r)return r;if(C(e))return null;{const i=b(e),o=this.children.get(i);return o?o.findOnPath_(P(e),W(t,i),s):null}}foreachOnPath(e,t){return this.foreachOnPath_(e,I(),t)}foreachOnPath_(e,t,s){if(C(e))return this;{this.value&&s(t,this.value);const r=b(e),i=this.children.get(r);return i?i.foreachOnPath_(P(e),W(t,r),s):new D(null)}}foreach(e){this.foreach_(I(),e)}foreach_(e,t){this.children.inorderTraversal((s,r)=>{r.foreach_(W(e,s),t)}),this.value&&t(e,this.value)}foreachChild(e){this.children.inorderTraversal((t,s)=>{s.value&&e(t,s.value)})}}/**
|
|
1300
1300
|
* @license
|
|
1301
1301
|
* Copyright 2017 Google LLC
|
|
1302
1302
|
*
|
|
@@ -1311,7 +1311,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1311
1311
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1312
1312
|
* See the License for the specific language governing permissions and
|
|
1313
1313
|
* limitations under the License.
|
|
1314
|
-
*/class ce{constructor(e){this.writeTree_=e}static empty(){return new ce(new D(null))}}function pt(n,e,t){if(C(e))return new ce(new D(t));{const s=n.writeTree_.findRootMostValueAndPath(e);if(s!=null){const r=s.path;let i=s.value;const o=
|
|
1314
|
+
*/class ce{constructor(e){this.writeTree_=e}static empty(){return new ce(new D(null))}}function pt(n,e,t){if(C(e))return new ce(new D(t));{const s=n.writeTree_.findRootMostValueAndPath(e);if(s!=null){const r=s.path;let i=s.value;const o=Q(r,e);return i=i.updateChild(o,t),new ce(n.writeTree_.set(r,i))}else{const r=new D(t),i=n.writeTree_.setTree(e,r);return new ce(i)}}}function _i(n,e,t){let s=n;return Z(t,(r,i)=>{s=pt(s,W(e,r),i)}),s}function mi(n,e){if(C(e))return ce.empty();{const t=n.writeTree_.setTree(e,new D(null));return new ce(t)}}function Ss(n,e){return Be(n,e)!=null}function Be(n,e){const t=n.writeTree_.findRootMostValueAndPath(e);return t!=null?n.writeTree_.get(t.path).getChild(Q(t.path,e)):null}function gi(n){const e=[],t=n.writeTree_.value;return t!=null?t.isLeafNode()||t.forEachChild(U,(s,r)=>{e.push(new v(s,r))}):n.writeTree_.children.inorderTraversal((s,r)=>{r.value!=null&&e.push(new v(s,r.value))}),e}function be(n,e){if(C(e))return n;{const t=Be(n,e);return t!=null?new ce(new D(t)):new ce(n.writeTree_.subtree(e))}}function Ts(n){return n.writeTree_.isEmpty()}function Je(n,e){return Da(I(),n.writeTree_,e)}function Da(n,e,t){if(e.value!=null)return t.updateChild(n,e.value);{let s=null;return e.children.inorderTraversal((r,i)=>{r===".priority"?(m(i.value!==null,"Priority writes must always be leaf nodes"),s=i.value):t=Da(W(n,r),i,t)}),!t.getChild(n).isEmpty()&&s!==null&&(t=t.updateChild(W(n,".priority"),s)),t}}/**
|
|
1315
1315
|
* @license
|
|
1316
1316
|
* Copyright 2017 Google LLC
|
|
1317
1317
|
*
|
|
@@ -1326,7 +1326,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1326
1326
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1327
1327
|
* See the License for the specific language governing permissions and
|
|
1328
1328
|
* limitations under the License.
|
|
1329
|
-
*/function nr(n,e){return
|
|
1329
|
+
*/function nr(n,e){return Ba(e,n)}function Kf(n,e,t,s,r){m(s>n.lastWriteId,"Stacking an older write on top of newer ones"),r===void 0&&(r=!0),n.allWrites.push({path:e,snap:t,writeId:s,visible:r}),r&&(n.visibleWrites=pt(n.visibleWrites,e,t)),n.lastWriteId=s}function Gf(n,e){for(let t=0;t<n.allWrites.length;t++){const s=n.allWrites[t];if(s.writeId===e)return s}return null}function Yf(n,e){const t=n.allWrites.findIndex(a=>a.writeId===e);m(t>=0,"removeWrite called with nonexistent writeId.");const s=n.allWrites[t];n.allWrites.splice(t,1);let r=s.visible,i=!1,o=n.allWrites.length-1;for(;r&&o>=0;){const a=n.allWrites[o];a.visible&&(o>=t&&Qf(a,s.path)?r=!1:oe(s.path,a.path)&&(i=!0)),o--}if(r){if(i)return Jf(n),!0;if(s.snap)n.visibleWrites=mi(n.visibleWrites,s.path);else{const a=s.children;Z(a,c=>{n.visibleWrites=mi(n.visibleWrites,W(s.path,c))})}return!0}else return!1}function Qf(n,e){if(n.snap)return oe(n.path,e);for(const t in n.children)if(n.children.hasOwnProperty(t)&&oe(W(n.path,t),e))return!0;return!1}function Jf(n){n.visibleWrites=La(n.allWrites,Xf,I()),n.allWrites.length>0?n.lastWriteId=n.allWrites[n.allWrites.length-1].writeId:n.lastWriteId=-1}function Xf(n){return n.visible}function La(n,e,t){let s=ce.empty();for(let r=0;r<n.length;++r){const i=n[r];if(e(i)){const o=i.path;let a;if(i.snap)oe(t,o)?(a=Q(t,o),s=pt(s,a,i.snap)):oe(o,t)&&(a=Q(o,t),s=pt(s,I(),i.snap.getChild(a)));else if(i.children){if(oe(t,o))a=Q(t,o),s=_i(s,a,i.children);else if(oe(o,t))if(a=Q(o,t),C(a))s=_i(s,I(),i.children);else{const c=Ge(i.children,b(a));if(c){const l=c.getChild(P(a));s=pt(s,I(),l)}}}else throw tt("WriteRecord should have .snap or .children")}}return s}function Fa(n,e,t,s,r){if(!s&&!r){const i=Be(n.visibleWrites,e);if(i!=null)return i;{const o=be(n.visibleWrites,e);if(Ts(o))return t;if(t==null&&!Ss(o,I()))return null;{const a=t||E.EMPTY_NODE;return Je(o,a)}}}else{const i=be(n.visibleWrites,e);if(!r&&Ts(i))return t;if(!r&&t==null&&!Ss(i,I()))return null;{const o=function(l){return(l.visible||r)&&(!s||!~s.indexOf(l.writeId))&&(oe(l.path,e)||oe(e,l.path))},a=La(n.allWrites,o,e),c=t||E.EMPTY_NODE;return Je(a,c)}}}function Zf(n,e,t){let s=E.EMPTY_NODE;const r=Be(n.visibleWrites,e);if(r)return r.isLeafNode()||r.forEachChild(U,(i,o)=>{s=s.updateImmediateChild(i,o)}),s;if(t){const i=be(n.visibleWrites,e);return t.forEachChild(U,(o,a)=>{const c=Je(be(i,new x(o)),a);s=s.updateImmediateChild(o,c)}),gi(i).forEach(o=>{s=s.updateImmediateChild(o.name,o.node)}),s}else{const i=be(n.visibleWrites,e);return gi(i).forEach(o=>{s=s.updateImmediateChild(o.name,o.node)}),s}}function ep(n,e,t,s,r){m(s||r,"Either existingEventSnap or existingServerSnap must exist");const i=W(e,t);if(Ss(n.visibleWrites,i))return null;{const o=be(n.visibleWrites,i);return Ts(o)?r.getChild(t):Je(o,r.getChild(t))}}function tp(n,e,t,s){const r=W(e,t),i=Be(n.visibleWrites,r);if(i!=null)return i;if(s.isCompleteForChild(t)){const o=be(n.visibleWrites,r);return Je(o,s.getNode().getImmediateChild(t))}else return null}function np(n,e){return Be(n.visibleWrites,e)}function sp(n,e,t,s,r,i,o){let a;const c=be(n.visibleWrites,e),l=Be(c,I());if(l!=null)a=l;else if(t!=null)a=Je(c,t);else return[];if(a=a.withIndex(o),!a.isEmpty()&&!a.isLeafNode()){const h=[],u=o.getCompare(),d=i?a.getReverseIteratorFrom(s,o):a.getIteratorFrom(s,o);let _=d.getNext();for(;_&&h.length<r;)u(_,s)!==0&&h.push(_),_=d.getNext();return h}else return[]}function rp(){return{visibleWrites:ce.empty(),allWrites:[],lastWriteId:-1}}function dn(n,e,t,s){return Fa(n.writeTree,n.treePath,e,t,s)}function sr(n,e){return Zf(n.writeTree,n.treePath,e)}function yi(n,e,t,s){return ep(n.writeTree,n.treePath,e,t,s)}function fn(n,e){return np(n.writeTree,W(n.treePath,e))}function ip(n,e,t,s,r,i){return sp(n.writeTree,n.treePath,e,t,s,r,i)}function rr(n,e,t){return tp(n.writeTree,n.treePath,e,t)}function Ma(n,e){return Ba(W(n.treePath,e),n.writeTree)}function Ba(n,e){return{treePath:n,writeTree:e}}/**
|
|
1330
1330
|
* @license
|
|
1331
1331
|
* Copyright 2017 Google LLC
|
|
1332
1332
|
*
|
|
@@ -1341,7 +1341,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1341
1341
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1342
1342
|
* See the License for the specific language governing permissions and
|
|
1343
1343
|
* limitations under the License.
|
|
1344
|
-
*/class
|
|
1344
|
+
*/class op{constructor(){this.changeMap=new Map}trackChildChange(e){const t=e.type,s=e.childName;m(t==="child_added"||t==="child_changed"||t==="child_removed","Only child changes supported for tracking"),m(s!==".priority","Only non-priority child changes can be tracked.");const r=this.changeMap.get(s);if(r){const i=r.type;if(t==="child_added"&&i==="child_removed")this.changeMap.set(s,bt(s,e.snapshotNode,r.snapshotNode));else if(t==="child_removed"&&i==="child_added")this.changeMap.delete(s);else if(t==="child_removed"&&i==="child_changed")this.changeMap.set(s,vt(s,r.oldSnap));else if(t==="child_changed"&&i==="child_added")this.changeMap.set(s,Qe(s,e.snapshotNode));else if(t==="child_changed"&&i==="child_changed")this.changeMap.set(s,bt(s,e.snapshotNode,r.oldSnap));else throw tt("Illegal combination of changes: "+e+" occurred after "+r)}else this.changeMap.set(s,e)}getChanges(){return Array.from(this.changeMap.values())}}/**
|
|
1345
1345
|
* @license
|
|
1346
1346
|
* Copyright 2017 Google LLC
|
|
1347
1347
|
*
|
|
@@ -1356,7 +1356,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1356
1356
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1357
1357
|
* See the License for the specific language governing permissions and
|
|
1358
1358
|
* limitations under the License.
|
|
1359
|
-
*/class
|
|
1359
|
+
*/class ap{getCompleteChild(e){return null}getChildAfterChild(e,t,s){return null}}const Ua=new ap;class ir{constructor(e,t,s=null){this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=s}getCompleteChild(e){const t=this.viewCache_.eventCache;if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);{const s=this.optCompleteServerCache_!=null?new Fe(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return rr(this.writes_,e,s)}}getChildAfterChild(e,t,s){const r=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:Me(this.viewCache_),i=ip(this.writes_,r,t,1,s,e);return i.length===0?null:i[0]}}/**
|
|
1360
1360
|
* @license
|
|
1361
1361
|
* Copyright 2017 Google LLC
|
|
1362
1362
|
*
|
|
@@ -1371,7 +1371,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1371
1371
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1372
1372
|
* See the License for the specific language governing permissions and
|
|
1373
1373
|
* limitations under the License.
|
|
1374
|
-
*/function
|
|
1374
|
+
*/function cp(n){return{filter:n}}function lp(n,e){m(e.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),m(e.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed")}function hp(n,e,t,s,r){const i=new op;let o,a;if(t.type===ae.OVERWRITE){const l=t;l.source.fromUser?o=Rs(n,e,l.path,l.snap,s,r,i):(m(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!C(l.path),o=pn(n,e,l.path,l.snap,s,r,a,i))}else if(t.type===ae.MERGE){const l=t;l.source.fromUser?o=dp(n,e,l.path,l.children,s,r,i):(m(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),o=Is(n,e,l.path,l.children,s,r,a,i))}else if(t.type===ae.ACK_USER_WRITE){const l=t;l.revert?o=_p(n,e,l.path,s,r,i):o=fp(n,e,l.path,l.affectedTree,s,r,i)}else if(t.type===ae.LISTEN_COMPLETE)o=pp(n,e,t.path,s,i);else throw tt("Unknown operation type: "+t.type);const c=i.getChanges();return up(e,o,c),{viewCache:o,changes:c}}function up(n,e,t){const s=e.eventCache;if(s.isFullyInitialized()){const r=s.getNode().isLeafNode()||s.getNode().isEmpty(),i=Cs(n);(t.length>0||!n.eventCache.isFullyInitialized()||r&&!s.getNode().equals(i)||!s.getNode().getPriority().equals(i.getPriority()))&&t.push(Aa(Cs(e)))}}function qa(n,e,t,s,r,i){const o=e.eventCache;if(fn(s,t)!=null)return e;{let a,c;if(C(t))if(m(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const l=Me(e),h=l instanceof E?l:E.EMPTY_NODE,u=sr(s,h);a=n.filter.updateFullNode(e.eventCache.getNode(),u,i)}else{const l=dn(s,Me(e));a=n.filter.updateFullNode(e.eventCache.getNode(),l,i)}else{const l=b(t);if(l===".priority"){m(Ce(t)===1,"Can't have a priority with additional path components");const h=o.getNode();c=e.serverCache.getNode();const u=yi(s,t,h,c);u!=null?a=n.filter.updatePriority(h,u):a=o.getNode()}else{const h=P(t);let u;if(o.isCompleteForChild(l)){c=e.serverCache.getNode();const d=yi(s,t,o.getNode(),c);d!=null?u=o.getNode().getImmediateChild(l).updateChild(h,d):u=o.getNode().getImmediateChild(l)}else u=rr(s,l,e.serverCache);u!=null?a=n.filter.updateChild(o.getNode(),l,u,h,r,i):a=o.getNode()}}return ft(e,a,o.isFullyInitialized()||C(t),n.filter.filtersNodes())}}function pn(n,e,t,s,r,i,o,a){const c=e.serverCache;let l;const h=o?n.filter:n.filter.getIndexedFilter();if(C(t))l=h.updateFullNode(c.getNode(),s,null);else if(h.filtersNodes()&&!c.isFiltered()){const _=c.getNode().updateChild(t,s);l=h.updateFullNode(c.getNode(),_,null)}else{const _=b(t);if(!c.isCompleteForPath(t)&&Ce(t)>1)return e;const p=P(t),g=c.getNode().getImmediateChild(_).updateChild(p,s);_===".priority"?l=h.updatePriority(c.getNode(),g):l=h.updateChild(c.getNode(),_,g,p,Ua,null)}const u=Pa(e,l,c.isFullyInitialized()||C(t),h.filtersNodes()),d=new ir(r,u,i);return qa(n,u,t,r,d,a)}function Rs(n,e,t,s,r,i,o){const a=e.eventCache;let c,l;const h=new ir(r,e,i);if(C(t))l=n.filter.updateFullNode(e.eventCache.getNode(),s,o),c=ft(e,l,!0,n.filter.filtersNodes());else{const u=b(t);if(u===".priority")l=n.filter.updatePriority(e.eventCache.getNode(),s),c=ft(e,l,a.isFullyInitialized(),a.isFiltered());else{const d=P(t),_=a.getNode().getImmediateChild(u);let p;if(C(d))p=s;else{const y=h.getCompleteChild(u);y!=null?va(d)===".priority"&&y.getChild(Ca(d)).isEmpty()?p=y:p=y.updateChild(d,s):p=E.EMPTY_NODE}if(_.equals(p))c=e;else{const y=n.filter.updateChild(a.getNode(),u,p,d,h,o);c=ft(e,y,a.isFullyInitialized(),n.filter.filtersNodes())}}}return c}function Ei(n,e){return n.eventCache.isCompleteForChild(e)}function dp(n,e,t,s,r,i,o){let a=e;return s.foreach((c,l)=>{const h=W(t,c);Ei(e,b(h))&&(a=Rs(n,a,h,l,r,i,o))}),s.foreach((c,l)=>{const h=W(t,c);Ei(e,b(h))||(a=Rs(n,a,h,l,r,i,o))}),a}function wi(n,e,t){return t.foreach((s,r)=>{e=e.updateChild(s,r)}),e}function Is(n,e,t,s,r,i,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let c=e,l;C(t)?l=s:l=new D(null).setTree(t,s);const h=e.serverCache.getNode();return l.children.inorderTraversal((u,d)=>{if(h.hasChild(u)){const _=e.serverCache.getNode().getImmediateChild(u),p=wi(n,_,d);c=pn(n,c,new x(u),p,r,i,o,a)}}),l.children.inorderTraversal((u,d)=>{const _=!e.serverCache.isCompleteForChild(u)&&d.value===null;if(!h.hasChild(u)&&!_){const p=e.serverCache.getNode().getImmediateChild(u),y=wi(n,p,d);c=pn(n,c,new x(u),y,r,i,o,a)}}),c}function fp(n,e,t,s,r,i,o){if(fn(r,t)!=null)return e;const a=e.serverCache.isFiltered(),c=e.serverCache;if(s.value!=null){if(C(t)&&c.isFullyInitialized()||c.isCompleteForPath(t))return pn(n,e,t,c.getNode().getChild(t),r,i,a,o);if(C(t)){let l=new D(null);return c.getNode().forEachChild(je,(h,u)=>{l=l.set(new x(h),u)}),Is(n,e,t,l,r,i,a,o)}else return e}else{let l=new D(null);return s.foreach((h,u)=>{const d=W(t,h);c.isCompleteForPath(d)&&(l=l.set(h,c.getNode().getChild(d)))}),Is(n,e,t,l,r,i,a,o)}}function pp(n,e,t,s,r){const i=e.serverCache,o=Pa(e,i.getNode(),i.isFullyInitialized()||C(t),i.isFiltered());return qa(n,o,t,s,Ua,r)}function _p(n,e,t,s,r,i){let o;if(fn(s,t)!=null)return e;{const a=new ir(s,e,r),c=e.eventCache.getNode();let l;if(C(t)||b(t)===".priority"){let h;if(e.serverCache.isFullyInitialized())h=dn(s,Me(e));else{const u=e.serverCache.getNode();m(u instanceof E,"serverChildren would be complete if leaf node"),h=sr(s,u)}h=h,l=n.filter.updateFullNode(c,h,i)}else{const h=b(t);let u=rr(s,h,e.serverCache);u==null&&e.serverCache.isCompleteForChild(h)&&(u=c.getImmediateChild(h)),u!=null?l=n.filter.updateChild(c,h,u,P(t),a,i):e.eventCache.getNode().hasChild(h)?l=n.filter.updateChild(c,h,E.EMPTY_NODE,P(t),a,i):l=c,l.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=dn(s,Me(e)),o.isLeafNode()&&(l=n.filter.updateFullNode(l,o,i)))}return o=e.serverCache.isFullyInitialized()||fn(s,I())!=null,ft(e,l,o,n.filter.filtersNodes())}}/**
|
|
1375
1375
|
* @license
|
|
1376
1376
|
* Copyright 2017 Google LLC
|
|
1377
1377
|
*
|
|
@@ -1386,7 +1386,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1386
1386
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1387
1387
|
* See the License for the specific language governing permissions and
|
|
1388
1388
|
* limitations under the License.
|
|
1389
|
-
*/class
|
|
1389
|
+
*/class mp{constructor(e,t){this.query_=e,this.eventRegistrations_=[];const s=this.query_._queryParams,r=new Xs(s.getIndex()),i=Lf(s);this.processor_=cp(i);const o=t.serverCache,a=t.eventCache,c=r.updateFullNode(E.EMPTY_NODE,o.getNode(),null),l=i.updateFullNode(E.EMPTY_NODE,a.getNode(),null),h=new Fe(c,o.isFullyInitialized(),r.filtersNodes()),u=new Fe(l,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=xn(u,h),this.eventGenerator_=new Hf(this.query_)}get query(){return this.query_}}function gp(n){return n.viewCache_.serverCache.getNode()}function yp(n,e){const t=Me(n.viewCache_);return t&&(n.query._queryParams.loadsAllData()||!C(e)&&!t.getImmediateChild(b(e)).isEmpty())?t.getChild(e):null}function vi(n){return n.eventRegistrations_.length===0}function Ep(n,e){n.eventRegistrations_.push(e)}function bi(n,e,t){const s=[];if(t){m(e==null,"A cancel should cancel all event registrations.");const r=n.query._path;n.eventRegistrations_.forEach(i=>{const o=i.createCancelEvent(t,r);o&&s.push(o)})}if(e){let r=[];for(let i=0;i<n.eventRegistrations_.length;++i){const o=n.eventRegistrations_[i];if(!o.matches(e))r.push(o);else if(e.hasAnyCallback()){r=r.concat(n.eventRegistrations_.slice(i+1));break}}n.eventRegistrations_=r}else n.eventRegistrations_=[];return s}function Ci(n,e,t,s){e.type===ae.MERGE&&e.source.queryId!==null&&(m(Me(n.viewCache_),"We should always have a full cache before handling merges"),m(Cs(n.viewCache_),"Missing event cache, even though we have a server cache"));const r=n.viewCache_,i=hp(n.processor_,r,e,t,s);return lp(n.processor_,i.viewCache),m(i.viewCache.serverCache.isFullyInitialized()||!r.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),n.viewCache_=i.viewCache,Wa(n,i.changes,i.viewCache.eventCache.getNode(),null)}function wp(n,e){const t=n.viewCache_.eventCache,s=[];return t.getNode().isLeafNode()||t.getNode().forEachChild(U,(i,o)=>{s.push(Qe(i,o))}),t.isFullyInitialized()&&s.push(Aa(t.getNode())),Wa(n,s,t.getNode(),e)}function Wa(n,e,t,s){const r=s?[s]:n.eventRegistrations_;return Vf(n.eventGenerator_,e,t,r)}/**
|
|
1390
1390
|
* @license
|
|
1391
1391
|
* Copyright 2017 Google LLC
|
|
1392
1392
|
*
|
|
@@ -1401,7 +1401,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1401
1401
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1402
1402
|
* See the License for the specific language governing permissions and
|
|
1403
1403
|
* limitations under the License.
|
|
1404
|
-
*/let _n;class
|
|
1404
|
+
*/let _n;class vp{constructor(){this.views=new Map}}function bp(n){m(!_n,"__referenceConstructor has already been defined"),_n=n}function Cp(){return m(_n,"Reference.ts has not been loaded"),_n}function Sp(n){return n.views.size===0}function or(n,e,t,s){const r=e.source.queryId;if(r!==null){const i=n.views.get(r);return m(i!=null,"SyncTree gave us an op for an invalid query."),Ci(i,e,t,s)}else{let i=[];for(const o of n.views.values())i=i.concat(Ci(o,e,t,s));return i}}function Tp(n,e,t,s,r){const i=e._queryIdentifier,o=n.views.get(i);if(!o){let a=dn(t,r?s:null),c=!1;a?c=!0:s instanceof E?(a=sr(t,s),c=!1):(a=E.EMPTY_NODE,c=!1);const l=xn(new Fe(a,c,!1),new Fe(s,r,!1));return new mp(e,l)}return o}function Rp(n,e,t,s,r,i){const o=Tp(n,e,s,r,i);return n.views.has(e._queryIdentifier)||n.views.set(e._queryIdentifier,o),Ep(o,t),wp(o,t)}function Ip(n,e,t,s){const r=e._queryIdentifier,i=[];let o=[];const a=Se(n);if(r==="default")for(const[c,l]of n.views.entries())o=o.concat(bi(l,t,s)),vi(l)&&(n.views.delete(c),l.query._queryParams.loadsAllData()||i.push(l.query));else{const c=n.views.get(r);c&&(o=o.concat(bi(c,t,s)),vi(c)&&(n.views.delete(r),c.query._queryParams.loadsAllData()||i.push(c.query)))}return a&&!Se(n)&&i.push(new(Cp())(e._repo,e._path)),{removed:i,events:o}}function Ha(n){const e=[];for(const t of n.views.values())t.query._queryParams.loadsAllData()||e.push(t);return e}function Ke(n,e){let t=null;for(const s of n.views.values())t=t||yp(s,e);return t}function Va(n,e){if(e._queryParams.loadsAllData())return On(n);{const s=e._queryIdentifier;return n.views.get(s)}}function $a(n,e){return Va(n,e)!=null}function Se(n){return On(n)!=null}function On(n){for(const e of n.views.values())if(e.query._queryParams.loadsAllData())return e;return null}/**
|
|
1405
1405
|
* @license
|
|
1406
1406
|
* Copyright 2017 Google LLC
|
|
1407
1407
|
*
|
|
@@ -1416,7 +1416,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1416
1416
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1417
1417
|
* See the License for the specific language governing permissions and
|
|
1418
1418
|
* limitations under the License.
|
|
1419
|
-
*/let mn;function
|
|
1419
|
+
*/let mn;function Np(n){m(!mn,"__referenceConstructor has already been defined"),mn=n}function kp(){return m(mn,"Reference.ts has not been loaded"),mn}let Ap=1;class Si{constructor(e){this.listenProvider_=e,this.syncPointTree_=new D(null),this.pendingWriteTree_=rp(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function xp(n,e,t,s,r){return Kf(n.pendingWriteTree_,e,t,s,r),r?Dt(n,new Le(Oa(),e,t)):[]}function He(n,e,t=!1){const s=Gf(n.pendingWriteTree_,e);if(Yf(n.pendingWriteTree_,e)){let i=new D(null);return s.snap!=null?i=i.set(I(),!0):Z(s.children,o=>{i=i.set(new x(o),!0)}),Dt(n,new un(s.path,i,t))}else return[]}function Pn(n,e,t){return Dt(n,new Le(er(),e,t))}function Op(n,e,t){const s=D.fromObject(t);return Dt(n,new Tt(er(),e,s))}function Pp(n,e){return Dt(n,new St(er(),e))}function Dp(n,e,t){const s=ar(n,t);if(s){const r=cr(s),i=r.path,o=r.queryId,a=Q(i,e),c=new St(tr(o),a);return lr(n,i,c)}else return[]}function Ns(n,e,t,s,r=!1){const i=e._path,o=n.syncPointTree_.get(i);let a=[];if(o&&(e._queryIdentifier==="default"||$a(o,e))){const c=Ip(o,e,t,s);Sp(o)&&(n.syncPointTree_=n.syncPointTree_.remove(i));const l=c.removed;if(a=c.events,!r){const h=l.findIndex(d=>d._queryParams.loadsAllData())!==-1,u=n.syncPointTree_.findOnPath(i,(d,_)=>Se(_));if(h&&!u){const d=n.syncPointTree_.subtree(i);if(!d.isEmpty()){const _=Mp(d);for(let p=0;p<_.length;++p){const y=_[p],g=y.query,k=Ga(n,y);n.listenProvider_.startListening(_t(g),gn(n,g),k.hashFn,k.onComplete)}}}!u&&l.length>0&&!s&&(h?n.listenProvider_.stopListening(_t(e),null):l.forEach(d=>{const _=n.queryToTagMap.get(Dn(d));n.listenProvider_.stopListening(_t(d),_)}))}Bp(n,l)}return a}function Lp(n,e,t,s){const r=ar(n,s);if(r!=null){const i=cr(r),o=i.path,a=i.queryId,c=Q(o,e),l=new Le(tr(a),c,t);return lr(n,o,l)}else return[]}function Fp(n,e,t,s){const r=ar(n,s);if(r){const i=cr(r),o=i.path,a=i.queryId,c=Q(o,e),l=D.fromObject(t),h=new Tt(tr(a),c,l);return lr(n,o,h)}else return[]}function Ti(n,e,t,s=!1){const r=e._path;let i=null,o=!1;n.syncPointTree_.foreachOnPath(r,(d,_)=>{const p=Q(d,r);i=i||Ke(_,p),o=o||Se(_)});let a=n.syncPointTree_.get(r);a?(o=o||Se(a),i=i||Ke(a,I())):(a=new vp,n.syncPointTree_=n.syncPointTree_.set(r,a));let c;i!=null?c=!0:(c=!1,i=E.EMPTY_NODE,n.syncPointTree_.subtree(r).foreachChild((_,p)=>{const y=Ke(p,I());y&&(i=i.updateImmediateChild(_,y))}));const l=$a(a,e);if(!l&&!e._queryParams.loadsAllData()){const d=Dn(e);m(!n.queryToTagMap.has(d),"View does not exist, but we have a tag");const _=Up();n.queryToTagMap.set(d,_),n.tagToQueryMap.set(_,d)}const h=nr(n.pendingWriteTree_,r);let u=Rp(a,e,t,h,i,c);if(!l&&!o&&!s){const d=Va(a,e);u=u.concat(qp(n,e,d))}return u}function za(n,e,t){const r=n.pendingWriteTree_,i=n.syncPointTree_.findOnPath(e,(o,a)=>{const c=Q(o,e),l=Ke(a,c);if(l)return l});return Fa(r,e,i,t,!0)}function Dt(n,e){return ja(e,n.syncPointTree_,null,nr(n.pendingWriteTree_,I()))}function ja(n,e,t,s){if(C(n.path))return Ka(n,e,t,s);{const r=e.get(I());t==null&&r!=null&&(t=Ke(r,I()));let i=[];const o=b(n.path),a=n.operationForChild(o),c=e.children.get(o);if(c&&a){const l=t?t.getImmediateChild(o):null,h=Ma(s,o);i=i.concat(ja(a,c,l,h))}return r&&(i=i.concat(or(r,n,s,t))),i}}function Ka(n,e,t,s){const r=e.get(I());t==null&&r!=null&&(t=Ke(r,I()));let i=[];return e.children.inorderTraversal((o,a)=>{const c=t?t.getImmediateChild(o):null,l=Ma(s,o),h=n.operationForChild(o);h&&(i=i.concat(Ka(h,a,c,l)))}),r&&(i=i.concat(or(r,n,s,t))),i}function Ga(n,e){const t=e.query,s=gn(n,t);return{hashFn:()=>(gp(e)||E.EMPTY_NODE).hash(),onComplete:r=>{if(r==="ok")return s?Dp(n,t._path,s):Pp(n,t._path);{const i=Pd(r,t);return Ns(n,t,null,i)}}}}function gn(n,e){const t=Dn(e);return n.queryToTagMap.get(t)}function Dn(n){return n._path.toString()+"$"+n._queryIdentifier}function ar(n,e){return n.tagToQueryMap.get(e)}function cr(n){const e=n.indexOf("$");return m(e!==-1&&e<n.length-1,"Bad queryKey."),{queryId:n.substr(e+1),path:new x(n.substr(0,e))}}function lr(n,e,t){const s=n.syncPointTree_.get(e);m(s,"Missing sync point for query tag that we're tracking");const r=nr(n.pendingWriteTree_,e);return or(s,t,r,null)}function Mp(n){return n.fold((e,t,s)=>{if(t&&Se(t))return[On(t)];{let r=[];return t&&(r=Ha(t)),Z(s,(i,o)=>{r=r.concat(o)}),r}})}function _t(n){return n._queryParams.loadsAllData()&&!n._queryParams.isDefault()?new(kp())(n._repo,n._path):n}function Bp(n,e){for(let t=0;t<e.length;++t){const s=e[t];if(!s._queryParams.loadsAllData()){const r=Dn(s),i=n.queryToTagMap.get(r);n.queryToTagMap.delete(r),n.tagToQueryMap.delete(i)}}}function Up(){return Ap++}function qp(n,e,t){const s=e._path,r=gn(n,e),i=Ga(n,t),o=n.listenProvider_.startListening(_t(e),r,i.hashFn,i.onComplete),a=n.syncPointTree_.subtree(s);if(r)m(!Se(a.value),"If we're adding a query, it shouldn't be shadowed");else{const c=a.fold((l,h,u)=>{if(!C(l)&&h&&Se(h))return[On(h).query];{let d=[];return h&&(d=d.concat(Ha(h).map(_=>_.query))),Z(u,(_,p)=>{d=d.concat(p)}),d}});for(let l=0;l<c.length;++l){const h=c[l];n.listenProvider_.stopListening(_t(h),gn(n,h))}}return o}/**
|
|
1420
1420
|
* @license
|
|
1421
1421
|
* Copyright 2017 Google LLC
|
|
1422
1422
|
*
|
|
@@ -1431,7 +1431,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1431
1431
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1432
1432
|
* See the License for the specific language governing permissions and
|
|
1433
1433
|
* limitations under the License.
|
|
1434
|
-
*/class hr{constructor(e){this.node_=e}getImmediateChild(e){const t=this.node_.getImmediateChild(e);return new hr(t)}node(){return this.node_}}class ur{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){const t=W(this.path_,e);return new ur(this.syncTree_,t)}node(){return
|
|
1434
|
+
*/class hr{constructor(e){this.node_=e}getImmediateChild(e){const t=this.node_.getImmediateChild(e);return new hr(t)}node(){return this.node_}}class ur{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){const t=W(this.path_,e);return new ur(this.syncTree_,t)}node(){return za(this.syncTree_,this.path_)}}const Wp=function(n){return n=n||{},n.timestamp=n.timestamp||new Date().getTime(),n},Ri=function(n,e,t){if(!n||typeof n!="object")return n;if(m(".sv"in n,"Unexpected leaf node or priority contents"),typeof n[".sv"]=="string")return Hp(n[".sv"],e,t);if(typeof n[".sv"]=="object")return Vp(n[".sv"],e);m(!1,"Unexpected server value: "+JSON.stringify(n,null,2))},Hp=function(n,e,t){switch(n){case"timestamp":return t.timestamp;default:m(!1,"Unexpected server value: "+n)}},Vp=function(n,e,t){n.hasOwnProperty("increment")||m(!1,"Unexpected server value: "+JSON.stringify(n,null,2));const s=n.increment;typeof s!="number"&&m(!1,"Unexpected increment value: "+s);const r=e.node();if(m(r!==null&&typeof r<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!r.isLeafNode())return s;const o=r.getValue();return typeof o!="number"?s:o+s},$p=function(n,e,t,s){return dr(e,new ur(t,n),s)},zp=function(n,e,t){return dr(n,new hr(e),t)};function dr(n,e,t){const s=n.getPriority().val(),r=Ri(s,e.getImmediateChild(".priority"),t);let i;if(n.isLeafNode()){const o=n,a=Ri(o.getValue(),e,t);return a!==o.getValue()||r!==o.getPriority().val()?new H(a,j(r)):n}else{const o=n;return i=o,r!==o.getPriority().val()&&(i=i.updatePriority(new H(r))),o.forEachChild(U,(a,c)=>{const l=dr(c,e.getImmediateChild(a),t);l!==c&&(i=i.updateImmediateChild(a,l))}),i}}/**
|
|
1435
1435
|
* @license
|
|
1436
1436
|
* Copyright 2017 Google LLC
|
|
1437
1437
|
*
|
|
@@ -1446,7 +1446,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1446
1446
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1447
1447
|
* See the License for the specific language governing permissions and
|
|
1448
1448
|
* limitations under the License.
|
|
1449
|
-
*/class fr{constructor(e="",t=null,s={children:{},childCount:0}){this.name=e,this.parent=t,this.node=s}}function pr(n,e){let t=e instanceof
|
|
1449
|
+
*/class fr{constructor(e="",t=null,s={children:{},childCount:0}){this.name=e,this.parent=t,this.node=s}}function pr(n,e){let t=e instanceof x?e:new x(e),s=n,r=b(t);for(;r!==null;){const i=Ge(s.node.children,r)||{children:{},childCount:0};s=new fr(r,s,i),t=P(t),r=b(t)}return s}function st(n){return n.node.value}function Ya(n,e){n.node.value=e,ks(n)}function Qa(n){return n.node.childCount>0}function jp(n){return st(n)===void 0&&!Qa(n)}function Ln(n,e){Z(n.node.children,(t,s)=>{e(new fr(t,n,s))})}function Ja(n,e,t,s){t&&e(n),Ln(n,r=>{Ja(r,e,!0)})}function Kp(n,e,t){let s=n.parent;for(;s!==null;){if(e(s))return!0;s=s.parent}return!1}function Lt(n){return new x(n.parent===null?n.name:Lt(n.parent)+"/"+n.name)}function ks(n){n.parent!==null&&Gp(n.parent,n.name,n)}function Gp(n,e,t){const s=jp(t),r=me(n.node.children,e);s&&r?(delete n.node.children[e],n.node.childCount--,ks(n)):!s&&!r&&(n.node.children[e]=t.node,n.node.childCount++,ks(n))}/**
|
|
1450
1450
|
* @license
|
|
1451
1451
|
* Copyright 2017 Google LLC
|
|
1452
1452
|
*
|
|
@@ -1461,7 +1461,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1461
1461
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1462
1462
|
* See the License for the specific language governing permissions and
|
|
1463
1463
|
* limitations under the License.
|
|
1464
|
-
*/const
|
|
1464
|
+
*/const Yp=/[\[\].#$\/\u0000-\u001F\u007F]/,Qp=/[\[\].#$\u0000-\u001F\u007F]/,Zn=10*1024*1024,Xa=function(n){return typeof n=="string"&&n.length!==0&&!Yp.test(n)},Za=function(n){return typeof n=="string"&&n.length!==0&&!Qp.test(n)},Jp=function(n){return n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Za(n)},ec=function(n,e,t){const s=t instanceof x?new ff(t,n):t;if(e===void 0)throw new Error(n+"contains undefined "+Ie(s));if(typeof e=="function")throw new Error(n+"contains a function "+Ie(s)+" with contents = "+e.toString());if(ea(e))throw new Error(n+"contains "+e.toString()+" "+Ie(s));if(typeof e=="string"&&e.length>Zn/3&&Nn(e)>Zn)throw new Error(n+"contains a string greater than "+Zn+" utf8 bytes "+Ie(s)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let r=!1,i=!1;if(Z(e,(o,a)=>{if(o===".value")r=!0;else if(o!==".priority"&&o!==".sv"&&(i=!0,!Xa(o)))throw new Error(n+" contains an invalid key ("+o+") "+Ie(s)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);pf(s,o),ec(n,a,s),_f(s)}),r&&i)throw new Error(n+' contains ".value" child '+Ie(s)+" in addition to actual children.")}},tc=function(n,e,t,s){if(!Za(t))throw new Error($o(n,e)+'was an invalid path = "'+t+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},Xp=function(n,e,t,s){t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),tc(n,e,t)},Zp=function(n,e){const t=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!Xa(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||t.length!==0&&!Jp(t))throw new Error($o(n,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/**
|
|
1465
1465
|
* @license
|
|
1466
1466
|
* Copyright 2017 Google LLC
|
|
1467
1467
|
*
|
|
@@ -1476,7 +1476,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1476
1476
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1477
1477
|
* See the License for the specific language governing permissions and
|
|
1478
1478
|
* limitations under the License.
|
|
1479
|
-
*/class
|
|
1479
|
+
*/class e_{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function nc(n,e){let t=null;for(let s=0;s<e.length;s++){const r=e[s],i=r.getPath();t!==null&&!Ys(i,t.path)&&(n.eventLists_.push(t),t=null),t===null&&(t={events:[],path:i}),t.events.push(r)}t&&n.eventLists_.push(t)}function sc(n,e,t){nc(n,t),rc(n,s=>Ys(s,e))}function Ue(n,e,t){nc(n,t),rc(n,s=>oe(s,e)||oe(e,s))}function rc(n,e){n.recursionDepth_++;let t=!0;for(let s=0;s<n.eventLists_.length;s++){const r=n.eventLists_[s];if(r){const i=r.path;e(i)?(t_(n.eventLists_[s]),n.eventLists_[s]=null):t=!1}}t&&(n.eventLists_=[]),n.recursionDepth_--}function t_(n){for(let e=0;e<n.events.length;e++){const t=n.events[e];if(t!==null){n.events[e]=null;const s=t.getEventRunner();ut&&z("event: "+t.toString()),Ot(s)}}}/**
|
|
1480
1480
|
* @license
|
|
1481
1481
|
* Copyright 2017 Google LLC
|
|
1482
1482
|
*
|
|
@@ -1491,7 +1491,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1491
1491
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1492
1492
|
* See the License for the specific language governing permissions and
|
|
1493
1493
|
* limitations under the License.
|
|
1494
|
-
*/const
|
|
1494
|
+
*/const n_="repo_interrupt",s_=25;class r_{constructor(e,t,s,r){this.repoInfo_=e,this.forceRestClient_=t,this.authTokenProvider_=s,this.appCheckProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new e_,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=hn(),this.transactionQueueTree_=new fr,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function i_(n,e,t){if(n.stats_=Ks(n.repoInfo_),n.forceRestClient_||Md())n.server_=new ln(n.repoInfo_,(s,r,i,o)=>{Ii(n,s,r,i,o)},n.authTokenProvider_,n.appCheckProvider_),setTimeout(()=>Ni(n,!0),0);else{if(typeof t<"u"&&t!==null){if(typeof t!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{$(t)}catch(s){throw new Error("Invalid authOverride provided: "+s)}}n.persistentConnection_=new fe(n.repoInfo_,e,(s,r,i,o)=>{Ii(n,s,r,i,o)},s=>{Ni(n,s)},s=>{a_(n,s)},n.authTokenProvider_,n.appCheckProvider_,t),n.server_=n.persistentConnection_}n.authTokenProvider_.addTokenChangeListener(s=>{n.server_.refreshAuthToken(s)}),n.appCheckProvider_.addTokenChangeListener(s=>{n.server_.refreshAppCheckToken(s.token)}),n.statsReporter_=Hd(n.repoInfo_,()=>new Wf(n.stats_,n.server_)),n.infoData_=new Ff,n.infoSyncTree_=new Si({startListening:(s,r,i,o)=>{let a=[];const c=n.infoData_.getNode(s._path);return c.isEmpty()||(a=Pn(n.infoSyncTree_,s._path,c),setTimeout(()=>{o("ok")},0)),a},stopListening:()=>{}}),_r(n,"connected",!1),n.serverSyncTree_=new Si({startListening:(s,r,i,o)=>(n.server_.listen(s,i,r,(a,c)=>{const l=o(a,c);Ue(n.eventQueue_,s._path,l)}),[]),stopListening:(s,r)=>{n.server_.unlisten(s,r)}})}function o_(n){const t=n.infoData_.getNode(new x(".info/serverTimeOffset")).val()||0;return new Date().getTime()+t}function ic(n){return Wp({timestamp:o_(n)})}function Ii(n,e,t,s,r){n.dataUpdateCount++;const i=new x(e);t=n.interceptServerDataCallback_?n.interceptServerDataCallback_(e,t):t;let o=[];if(r)if(s){const c=tn(t,l=>j(l));o=Fp(n.serverSyncTree_,i,c,r)}else{const c=j(t);o=Lp(n.serverSyncTree_,i,c,r)}else if(s){const c=tn(t,l=>j(l));o=Op(n.serverSyncTree_,i,c)}else{const c=j(t);o=Pn(n.serverSyncTree_,i,c)}let a=i;o.length>0&&(a=gr(n,i)),Ue(n.eventQueue_,a,o)}function Ni(n,e){_r(n,"connected",e),e===!1&&l_(n)}function a_(n,e){Z(e,(t,s)=>{_r(n,t,s)})}function _r(n,e,t){const s=new x("/.info/"+e),r=j(t);n.infoData_.updateSnapshot(s,r);const i=Pn(n.infoSyncTree_,s,r);Ue(n.eventQueue_,s,i)}function c_(n){return n.nextWriteId_++}function l_(n){oc(n,"onDisconnectEvents");const e=ic(n),t=hn();bs(n.onDisconnect_,I(),(r,i)=>{const o=$p(r,i,n.serverSyncTree_,e);xa(t,r,o)});let s=[];bs(t,I(),(r,i)=>{s=s.concat(Pn(n.serverSyncTree_,r,i));const o=__(n,r);gr(n,o)}),n.onDisconnect_=hn(),Ue(n.eventQueue_,I(),s)}function h_(n,e,t){let s;b(e._path)===".info"?s=Ti(n.infoSyncTree_,e,t):s=Ti(n.serverSyncTree_,e,t),sc(n.eventQueue_,e._path,s)}function u_(n,e,t){let s;b(e._path)===".info"?s=Ns(n.infoSyncTree_,e,t):s=Ns(n.serverSyncTree_,e,t),sc(n.eventQueue_,e._path,s)}function d_(n){n.persistentConnection_&&n.persistentConnection_.interrupt(n_)}function oc(n,...e){let t="";n.persistentConnection_&&(t=n.persistentConnection_.id+":"),z(t,...e)}function ac(n,e,t){return za(n.serverSyncTree_,e,t)||E.EMPTY_NODE}function mr(n,e=n.transactionQueueTree_){if(e||Fn(n,e),st(e)){const t=lc(n,e);m(t.length>0,"Sending zero length transaction queue"),t.every(r=>r.status===0)&&f_(n,Lt(e),t)}else Qa(e)&&Ln(e,t=>{mr(n,t)})}function f_(n,e,t){const s=t.map(l=>l.currentWriteId),r=ac(n,e,s);let i=r;const o=r.hash();for(let l=0;l<t.length;l++){const h=t[l];m(h.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),h.status=1,h.retryCount++;const u=Q(e,h.path);i=i.updateChild(u,h.currentOutputSnapshotRaw)}const a=i.val(!0),c=e;n.server_.put(c.toString(),a,l=>{oc(n,"transaction put response",{path:c.toString(),status:l});let h=[];if(l==="ok"){const u=[];for(let d=0;d<t.length;d++)t[d].status=2,h=h.concat(He(n.serverSyncTree_,t[d].currentWriteId)),t[d].onComplete&&u.push(()=>t[d].onComplete(null,!0,t[d].currentOutputSnapshotResolved)),t[d].unwatcher();Fn(n,pr(n.transactionQueueTree_,e)),mr(n,n.transactionQueueTree_),Ue(n.eventQueue_,e,h);for(let d=0;d<u.length;d++)Ot(u[d])}else{if(l==="datastale")for(let u=0;u<t.length;u++)t[u].status===3?t[u].status=4:t[u].status=0;else{te("transaction at "+c.toString()+" failed: "+l);for(let u=0;u<t.length;u++)t[u].status=4,t[u].abortReason=l}gr(n,e)}},o)}function gr(n,e){const t=cc(n,e),s=Lt(t),r=lc(n,t);return p_(n,r,s),s}function p_(n,e,t){if(e.length===0)return;const s=[];let r=[];const o=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){const c=e[a],l=Q(t,c.path);let h=!1,u;if(m(l!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===4)h=!0,u=c.abortReason,r=r.concat(He(n.serverSyncTree_,c.currentWriteId,!0));else if(c.status===0)if(c.retryCount>=s_)h=!0,u="maxretry",r=r.concat(He(n.serverSyncTree_,c.currentWriteId,!0));else{const d=ac(n,c.path,o);c.currentInputSnapshot=d;const _=e[a].update(d.val());if(_!==void 0){ec("transaction failed: Data returned ",_,c.path);let p=j(_);typeof _=="object"&&_!=null&&me(_,".priority")||(p=p.updatePriority(d.getPriority()));const g=c.currentWriteId,k=ic(n),L=zp(p,d,k);c.currentOutputSnapshotRaw=p,c.currentOutputSnapshotResolved=L,c.currentWriteId=c_(n),o.splice(o.indexOf(g),1),r=r.concat(xp(n.serverSyncTree_,c.path,L,c.currentWriteId,c.applyLocally)),r=r.concat(He(n.serverSyncTree_,g,!0))}else h=!0,u="nodata",r=r.concat(He(n.serverSyncTree_,c.currentWriteId,!0))}Ue(n.eventQueue_,t,r),r=[],h&&(e[a].status=2,function(d){setTimeout(d,Math.floor(0))}(e[a].unwatcher),e[a].onComplete&&(u==="nodata"?s.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):s.push(()=>e[a].onComplete(new Error(u),!1,null))))}Fn(n,n.transactionQueueTree_);for(let a=0;a<s.length;a++)Ot(s[a]);mr(n,n.transactionQueueTree_)}function cc(n,e){let t,s=n.transactionQueueTree_;for(t=b(e);t!==null&&st(s)===void 0;)s=pr(s,t),e=P(e),t=b(e);return s}function lc(n,e){const t=[];return hc(n,e,t),t.sort((s,r)=>s.order-r.order),t}function hc(n,e,t){const s=st(e);if(s)for(let r=0;r<s.length;r++)t.push(s[r]);Ln(e,r=>{hc(n,r,t)})}function Fn(n,e){const t=st(e);if(t){let s=0;for(let r=0;r<t.length;r++)t[r].status!==2&&(t[s]=t[r],s++);t.length=s,Ya(e,t.length>0?t:void 0)}Ln(e,s=>{Fn(n,s)})}function __(n,e){const t=Lt(cc(n,e)),s=pr(n.transactionQueueTree_,e);return Kp(s,r=>{es(n,r)}),es(n,s),Ja(s,r=>{es(n,r)}),t}function es(n,e){const t=st(e);if(t){const s=[];let r=[],i=-1;for(let o=0;o<t.length;o++)t[o].status===3||(t[o].status===1?(m(i===o-1,"All SENT items should be at beginning of queue."),i=o,t[o].status=3,t[o].abortReason="set"):(m(t[o].status===0,"Unexpected transaction status in abort"),t[o].unwatcher(),r=r.concat(He(n.serverSyncTree_,t[o].currentWriteId,!0)),t[o].onComplete&&s.push(t[o].onComplete.bind(null,new Error("set"),!1,null))));i===-1?Ya(e,void 0):t.length=i+1,Ue(n.eventQueue_,Lt(e),r);for(let o=0;o<s.length;o++)Ot(s[o])}}/**
|
|
1495
1495
|
* @license
|
|
1496
1496
|
* Copyright 2017 Google LLC
|
|
1497
1497
|
*
|
|
@@ -1506,7 +1506,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1506
1506
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1507
1507
|
* See the License for the specific language governing permissions and
|
|
1508
1508
|
* limitations under the License.
|
|
1509
|
-
*/function
|
|
1509
|
+
*/function m_(n){let e="";const t=n.split("/");for(let s=0;s<t.length;s++)if(t[s].length>0){let r=t[s];try{r=decodeURIComponent(r.replace(/\+/g," "))}catch{}e+="/"+r}return e}function g_(n){const e={};n.charAt(0)==="?"&&(n=n.substring(1));for(const t of n.split("&")){if(t.length===0)continue;const s=t.split("=");s.length===2?e[decodeURIComponent(s[0])]=decodeURIComponent(s[1]):te(`Invalid query segment '${t}' in query '${n}'`)}return e}const ki=function(n,e){const t=y_(n),s=t.namespace;t.domain==="firebase.com"&&_e(t.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!s||s==="undefined")&&t.domain!=="localhost"&&_e("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),t.secure||Nd();const r=t.scheme==="ws"||t.scheme==="wss";return{repoInfo:new da(t.host,t.secure,s,r,e,"",s!==t.subdomain),path:new x(t.pathString)}},y_=function(n){let e="",t="",s="",r="",i="",o=!0,a="https",c=443;if(typeof n=="string"){let l=n.indexOf("//");l>=0&&(a=n.substring(0,l-1),n=n.substring(l+2));let h=n.indexOf("/");h===-1&&(h=n.length);let u=n.indexOf("?");u===-1&&(u=n.length),e=n.substring(0,Math.min(h,u)),h<u&&(r=m_(n.substring(h,u)));const d=g_(n.substring(Math.min(n.length,u)));l=e.indexOf(":"),l>=0?(o=a==="https"||a==="wss",c=parseInt(e.substring(l+1),10)):l=e.length;const _=e.slice(0,l);if(_.toLowerCase()==="localhost")t="localhost";else if(_.split(".").length<=2)t=_;else{const p=e.indexOf(".");s=e.substring(0,p).toLowerCase(),t=e.substring(p+1),i=s}"ns"in d&&(i=d.ns)}return{host:e,port:c,domain:t,subdomain:s,secure:o,scheme:a,pathString:r,namespace:i}};/**
|
|
1510
1510
|
* @license
|
|
1511
1511
|
* Copyright 2017 Google LLC
|
|
1512
1512
|
*
|
|
@@ -1521,7 +1521,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1521
1521
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1522
1522
|
* See the License for the specific language governing permissions and
|
|
1523
1523
|
* limitations under the License.
|
|
1524
|
-
*/class
|
|
1524
|
+
*/class uc{constructor(e,t,s,r){this.eventType=e,this.eventRegistration=t,this.snapshot=s,this.prevName=r}getPath(){const e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+$(this.snapshot.exportVal())}}class dc{constructor(e,t,s){this.eventRegistration=e,this.error=t,this.path=s}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/**
|
|
1525
1525
|
* @license
|
|
1526
1526
|
* Copyright 2017 Google LLC
|
|
1527
1527
|
*
|
|
@@ -1536,7 +1536,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1536
1536
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1537
1537
|
* See the License for the specific language governing permissions and
|
|
1538
1538
|
* limitations under the License.
|
|
1539
|
-
*/class
|
|
1539
|
+
*/class E_{constructor(e,t){this.snapshotCallback=e,this.cancelCallback=t}onValue(e,t){this.snapshotCallback.call(null,e,t)}onCancel(e){return m(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}/**
|
|
1540
1540
|
* @license
|
|
1541
1541
|
* Copyright 2020 Google LLC
|
|
1542
1542
|
*
|
|
@@ -1551,7 +1551,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1551
1551
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1552
1552
|
* See the License for the specific language governing permissions and
|
|
1553
1553
|
* limitations under the License.
|
|
1554
|
-
*/class yr{constructor(e,t,s,r){this._repo=e,this._path=t,this._queryParams=s,this._orderByCalled=r}get key(){return C(this._path)?null:
|
|
1554
|
+
*/class yr{constructor(e,t,s,r){this._repo=e,this._path=t,this._queryParams=s,this._orderByCalled=r}get key(){return C(this._path)?null:va(this._path)}get ref(){return new ge(this._repo,this._path)}get _queryIdentifier(){const e=fi(this._queryParams),t=zs(e);return t==="{}"?"default":t}get _queryObject(){return fi(this._queryParams)}isEqual(e){if(e=kn(e),!(e instanceof yr))return!1;const t=this._repo===e._repo,s=Ys(this._path,e._path),r=this._queryIdentifier===e._queryIdentifier;return t&&s&&r}toJSON(){return this.toString()}toString(){return this._repo.toString()+df(this._path)}}class ge extends yr{constructor(e,t){super(e,t,new Zs,!1)}get parent(){const e=Ca(this._path);return e===null?null:new ge(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}}class Rt{constructor(e,t,s){this._node=e,this.ref=t,this._index=s}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){const t=new x(e),s=yn(this.ref,e);return new Rt(this._node.getChild(t),s,U)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(s,r)=>e(new Rt(r,yn(this.ref,s),U)))}hasChild(e){const t=new x(e);return!this._node.getChild(t).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function Qt(n,e){return n=kn(n),n._checkNotDeleted("ref"),e!==void 0?yn(n._root,e):n._root}function yn(n,e){return n=kn(n),b(n._path)===null?Xp("child","path",e):tc("child","path",e),new ge(n._repo,W(n._path,e))}class Er{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,t){const s=t._queryParams.getIndex();return new uc("value",this,new Rt(e.snapshotNode,new ge(t._repo,t._path),s))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,t){return this.callbackContext.hasCancelCallback?new dc(this,e,t):null}matches(e){return e instanceof Er?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}class wr{constructor(e,t){this.eventType=e,this.callbackContext=t}respondsTo(e){let t=e==="children_added"?"child_added":e;return t=t==="children_removed"?"child_removed":t,this.eventType===t}createCancelEvent(e,t){return this.callbackContext.hasCancelCallback?new dc(this,e,t):null}createEvent(e,t){m(e.childName!=null,"Child events should have a childName.");const s=yn(new ge(t._repo,t._path),e.childName),r=t._queryParams.getIndex();return new uc(e.type,this,new Rt(e.snapshotNode,s,r),e.prevName)}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,e.prevName)}matches(e){return e instanceof wr?this.eventType===e.eventType&&(!this.callbackContext||!e.callbackContext||this.callbackContext.matches(e.callbackContext)):!1}hasAnyCallback(){return!!this.callbackContext}}function fc(n,e,t,s,r){const i=new E_(t,void 0),o=e==="value"?new Er(i):new wr(e,i);return h_(n._repo,n,o),()=>u_(n._repo,n,o)}function As(n,e,t,s){return fc(n,"value",e)}function w_(n,e,t,s){return fc(n,"child_added",e)}bp(ge);Np(ge);/**
|
|
1555
1555
|
* @license
|
|
1556
1556
|
* Copyright 2020 Google LLC
|
|
1557
1557
|
*
|
|
@@ -1566,7 +1566,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1566
1566
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1567
1567
|
* See the License for the specific language governing permissions and
|
|
1568
1568
|
* limitations under the License.
|
|
1569
|
-
*/const
|
|
1569
|
+
*/const v_="FIREBASE_DATABASE_EMULATOR_HOST",xs={};let b_=!1;function C_(n,e,t,s){n.repoInfo_=new da(e,!1,n.repoInfo_.namespace,n.repoInfo_.webSocketOnly,n.repoInfo_.nodeAdmin,n.repoInfo_.persistenceKey,n.repoInfo_.includeNamespaceInQueryParams,!0,t),s&&(n.authTokenProvider_=s)}function S_(n,e,t,s,r){let i=s||n.options.databaseURL;i===void 0&&(n.options.projectId||_e("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),z("Using default host for project ",n.options.projectId),i=`${n.options.projectId}-default-rtdb.firebaseio.com`);let o=ki(i,r),a=o.repoInfo,c;typeof process<"u"&&process.env&&(c=process.env[v_]),c?(i=`http://${c}?ns=${a.namespace}`,o=ki(i,r),a=o.repoInfo):o.repoInfo.secure;const l=new Ud(n.name,n.options,e);Zp("Invalid Firebase Database URL",o),C(o.path)||_e("Database URL must point to the root of a Firebase Database (not including a child path).");const h=R_(a,n,l,new Bd(n,t));return new I_(h,n)}function T_(n,e){const t=xs[e];(!t||t[n.key]!==n)&&_e(`Database ${e}(${n.repoInfo_}) has already been deleted.`),d_(n),delete t[n.key]}function R_(n,e,t,s){let r=xs[e.name];r||(r={},xs[e.name]=r);let i=r[n.toURLString()];return i&&_e("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new r_(n,b_,t,s),r[n.toURLString()]=i,i}class I_{constructor(e,t){this._repoInternal=e,this.app=t,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(i_(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new ge(this._repo,I())),this._rootInternal}_delete(){return this._rootInternal!==null&&(T_(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&_e("Cannot call "+e+" on a deleted database.")}}function Jt(n=ud(),e){const t=od(n,"database").getImmediate({identifier:e});if(!t._instanceStarted){const s=Yh("database");s&&N_(t,...s)}return t}function N_(n,e,t,s={}){n=kn(n),n._checkNotDeleted("useEmulator");const r=`${e}:${t}`,i=n._repoInternal;if(n._instanceStarted){if(r===n._repoInternal.repoInfo_.host&&nn(s,i.repoInfo_.emulatorOptions))return;_e("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let o;if(i.repoInfo_.nodeAdmin)s.mockUserToken&&_e('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),o=new Yt(Yt.OWNER);else if(s.mockUserToken){const a=typeof s.mockUserToken=="string"?s.mockUserToken:Qh(s.mockUserToken,n.app.options.projectId);o=new Yt(a)}C_(i,r,s,o)}/**
|
|
1570
1570
|
* @license
|
|
1571
1571
|
* Copyright 2021 Google LLC
|
|
1572
1572
|
*
|
|
@@ -1581,7 +1581,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1581
1581
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1582
1582
|
* See the License for the specific language governing permissions and
|
|
1583
1583
|
* limitations under the License.
|
|
1584
|
-
*/function
|
|
1584
|
+
*/function k_(n){bd(hd),rn(new yt("database",(e,{instanceIdentifier:t})=>{const s=e.getProvider("app").getImmediate(),r=e.getProvider("auth-internal"),i=e.getProvider("app-check-internal");return S_(s,r,i,t)},"PUBLIC").setMultipleInstances(!0)),$e(Qr,Jr,n),$e(Qr,Jr,"esm2017")}fe.prototype.simpleListen=function(n,e){this.sendRequest("q",{p:n},e)};fe.prototype.echo=function(n,e){this.sendRequest("echo",{d:n},e)};k_();const Mn=n=>n==="server"?"https://backend.nervoscan.com":"https://backendv2-dev.nervoscan.com",Ne=class Ne{constructor(){A(this,"socket");A(this,"backendUrl",Mn("server"));A(this,"videoStream");A(this,"videoElement");A(this,"isConnected",!1);A(this,"isStreaming",!1);A(this,"jobId");A(this,"onDisconnection");A(this,"playHandler",()=>{if(!this.videoElement)return;const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight,this.captureAndSendFrame(e,this.videoElement)});A(this,"stopStreaming",()=>{this.isStreaming=!1,this.removePlayEventListener()})}static getInstance(){return Ne.instance||(Ne.instance=new Ne),Ne.instance}setupWebSocketConnection(){this.socket||(this.socket=Gt(this.backendUrl,{transports:["websocket","polling"]}),this.socket.on("connect",()=>{this.isConnected=!0}),this.socket.on("connect_error",e=>this.handleSocketError(e)),this.socket.on("disconnect",e=>this.handleSocketDisconnection(e)))}handleSocketError(e){console.error("Connection error:",e)}handleSocketDisconnection(e){console.warn("Disconnected from WebSocket server:",e)}initializeStreaming(e,t){this.setupWebSocketConnection(),this.videoStream=e,this.videoElement=t,this.videoElement.srcObject=e}startStreaming(e){var t;this.jobId=e,(t=this.socket)==null||t.emit("register",e),this.sendInitialRequest(e),this.isStreaming=!0,this.startVideoStream(),this.addDisconnectionListener()}async sendInitialRequest(e){await N.post(`${this.backendUrl}/react`,{username:e,uuid:e,device_id:"1234567",face_detector:"BlazefaceFacemesh",motion_tracking:!0,skin_segmentor:"HSVandYCrCbSkinSegmentation",extreme_pixel_removal:!1,gamma_value:1,eularian_color_magnification:!1},{headers:{"Content-Type":"application/json"}})}startVideoStream(){this.videoElement?(this.videoElement.addEventListener("play",this.playHandler),!this.videoElement.paused&&!this.videoElement.ended&&this.playHandler(),this.videoElement.play().then(()=>{}).catch(e=>console.error("Error starting video stream:",e))):console.error("Video stream not found when trying to start streaming")}captureAndSendFrame(e,t){const s=e.getContext("2d");if(!s)return;const r=()=>{this.isStreaming&&(!t.paused&&!t.ended&&(s.drawImage(t,0,0,640,480),this.sendFrameToBackend(e)),setTimeout(r,33))};r()}sendFrameToBackend(e){e.toBlob(t=>{if(!t)return;const s=new FileReader;s.onloadend=()=>{var r;if(this.isConnected&&this.isStreaming){const i=s.result;(r=this.socket)==null||r.emit("frame",i)}},s.readAsArrayBuffer(t)},"image/jpeg",.7)}removePlayEventListener(){this.videoElement&&this.videoElement.removeEventListener("play",this.playHandler)}setOnDisconnection(e){this.onDisconnection=e}addDisconnectionListener(){const e=Jt(),t=Qt(e,`${this.jobId}/disconnect`),s=As(t,r=>{r.val()!=null&&(this.stopStreaming(),this.onDisconnection&&this.onDisconnection(),s())})}};A(Ne,"instance");let En=Ne;class pc{constructor(e,t){A(this,"backendUrl",Mn("server"));A(this,"username");A(this,"password");A(this,"streamingManager",En.getInstance());this.username=e,this.password=t}}class A_ extends pc{constructor(t,s){super(t,s);A(this,"streamingManager",En.getInstance());this.backendUrl=Mn("server")}async getToken(){try{return(await N.post(this.backendUrl.concat("/clientlogin"),{username:this.username,password:this.password})).data.access_token}catch(t){R.handleErrorResponse(t)}}async getAPIKey(t){t||R.throwKnownError(T.InvalidAccessTokenError);try{return(await N.post(this.backendUrl.concat("/clientgeturl"),{host_name:"www.nervoscan.com"},{headers:{Authorization:`Bearer ${t}`}})).data.url.split("?api_key=")[1]}catch(s){R.handleErrorResponse(s)}}async uploadVideoToServer(t,s,r){(!s||!r)&&R.throwKnownError(T.InvalidAccessTokenError);const i=new FormData;i.append("file",t,"recording.webm"),i.append("data",JSON.stringify({uuid:r,meta_data:{}}));const a=await(await fetch(this.backendUrl.concat("/submitscan"),{method:"POST",headers:{Authorization:`Bearer ${s}`},body:i})).json();return a.success===!1&&R.handleErrorResponse(a),a}async getResults(t,s){var r;s||R.throwKnownError(T.InvalidAccessTokenError);try{const i=await N.post(this.backendUrl.concat("/getcustomerinfo"),{mode:"selection",api_keys:[t]},{headers:{Authorization:`Bearer ${s}`}});return((r=i.data)==null?void 0:r.success)===!1&&R.throwKnownError(T.NoScanDataError),i.data}catch(i){console.error("Error getting results:",i),R.handleErrorResponse(i)}}async checkResults(t,s){try{s||R.throwKnownError(T.InvalidAccessTokenError);const o=(await N.post(this.backendUrl.concat("/check"),{api_key:t},{headers:{Authorization:`Bearer ${s}`}})).data.job_status;return o==="Completed"||o==="Failed"?o:"Pending"}catch(r){R.handleErrorResponse(r)}}}class x_ extends pc{constructor(e,t){super(e,t),this.backendUrl=Mn("serverless")}async getToken(){try{const e=await N.post(this.backendUrl.concat("/user/login"),{username:this.username,password:this.password});if(e.data.success===!1)R.throwKnownError(T.InvalidUsernameError);else return JSON.parse(e.data.body).idToken}catch(e){console.error("error printed in serverless repository",e),R.handleErrorResponse(e)}}async getAPIKey(e){e||R.throwKnownError(T.InvalidAccessTokenError);try{return(await N.post(this.backendUrl.concat("/get-redirection-url"),{host_name:"www.nervoscan.com",username:this.username},{headers:{Authorization:`Bearer ${e}`}})).data.url.split("?api_key=")[1]}catch(t){R.handleErrorResponse(t)}}async uploadVideoToServer(e,t,s){(!t||!s)&&R.throwKnownError(T.InvalidAccessTokenError);try{const r=await this.generatePreSignedUrl(s);return r||R.throwKnownError(T.InvalidAccessTokenError),await this.uploadVideoToS3(e,r)}catch(r){throw console.error("Error uploading video:",r),r.response?(console.error("Error response:",r.response.data),console.error("Error status:",r.response.status),console.error("Error headers:",r.response.headers)):r.request?console.error("Error request:",r.request):console.error("Error message:",r.message),r}}getResults(e,t){return console.log("not implemented"),Promise.resolve(void 0)}async checkResults(e,t){try{t||R.throwKnownError(T.InvalidAccessTokenError);const i=(await N.post(this.backendUrl.concat("/check"),{api_key:e},{headers:{Authorization:`Bearer ${t}`}})).data.job_status;return i==="Completed"||i==="Failed"?i:"Pending"}catch(s){R.handleErrorResponse(s)}}async generatePreSignedUrl(e){try{return(await N.get(this.backendUrl.concat("/generate-presigned-url?job_id="+e))).data.upload_url}catch(t){R.handleErrorResponse(t)}}async uploadVideoToS3(e,t){try{return(await N.put(t,e,{headers:{"Content-Type":"video/mp4"}})).data}catch(s){R.handleErrorResponse(s)}}}var O_="firebase",P_="11.6.1";/**
|
|
1585
1585
|
* @license
|
|
1586
1586
|
* Copyright 2020 Google LLC
|
|
1587
1587
|
*
|
|
@@ -1596,4 +1596,4 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
|
|
|
1596
1596
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1597
1597
|
* See the License for the specific language governing permissions and
|
|
1598
1598
|
* limitations under the License.
|
|
1599
|
-
*/$e(
|
|
1599
|
+
*/$e(O_,P_,"app");const ke=class ke{constructor(){A(this,"initialized",!1);A(this,"accessToken");A(this,"backendRepository");A(this,"onWindowResults");A(this,"onFinalResults");A(this,"onError");A(this,"firebaseHandlers",[]);Go({apiKey:"AIzaSyAoOpQqLrc6wQLJI5KRE2Vt7QV1cplsZv8",authDomain:"nervowebreact.firebaseapp.com",databaseURL:"https://nervowebreact-default-rtdb.asia-southeast1.firebasedatabase.app",projectId:"nervowebreact",storageBucket:"nervowebreact.firebasestorage.app",messagingSenderId:"1025695568936",appId:"1:1025695568936:web:36f269a1eb74e1fdda511d",measurementId:"G-L3105FG92S"})}static getInstance(){return ke.instance||(ke.instance=new ke),ke.instance}initialize(e,t,s="server"){this.initialized=!0,s==="server"?this.backendRepository=new A_(e,t):s==="serverless"?this.backendRepository=new x_(e,t):R.throwKnownError(T.InvalidServerTypeError)}async uploadVideo(e){var r,i,o;this.initialized||R.throwKnownError(T.NotInitializedError),e instanceof Blob||R.throwKnownError(T.VideoTypeError),(e===null||e.size===0)&&R.throwKnownError(T.EmptyVideoError);const t=await((r=this.backendRepository)==null?void 0:r.getToken()),s=await((i=this.backendRepository)==null?void 0:i.getAPIKey(t));return(o=this.backendRepository)==null||o.uploadVideoToServer(e,t,s),s&&this.addfirebaseListeners(s),s}async checkResults(e){var t,s;console.warn("Warning: checkResults() is deprecated and will be removed in a future version. Use setOnWindowResults() and setOnFinalResults() instead!"),this.initialized||R.throwKnownError(T.NotInitializedError);try{return this.accessToken||(this.accessToken=await((t=this.backendRepository)==null?void 0:t.getToken())),await((s=this.backendRepository)==null?void 0:s.checkResults(e,this.accessToken))}catch(r){R.handleErrorResponse(r)}}async getResults(e){var s,r;return console.warn("Warning: getResults() is deprecated and will be removed in a future version. Use setOnWindowResults() and setOnFinalResults() instead!"),this.initialized||R.throwKnownError(T.NotInitializedError),this.accessToken||(this.accessToken=await((s=this.backendRepository)==null?void 0:s.getToken())),await((r=this.backendRepository)==null?void 0:r.getResults(e,this.accessToken))}setOnWindowResults(e){this.onWindowResults=e}setOnFinalResults(e){this.onFinalResults=e}setOnError(e){this.onError=e}setOnDisconnection(e){var t;(t=this.backendRepository)==null||t.streamingManager.setOnDisconnection(e)}initializeStreaming(e,t){var s;(s=this.backendRepository)==null||s.streamingManager.initializeStreaming(e,t)}async startStreaming(){var s,r,i;this.initialized||R.throwKnownError(T.NotInitializedError);const e=await((s=this.backendRepository)==null?void 0:s.getToken()),t=await((r=this.backendRepository)==null?void 0:r.getAPIKey(e));if(t)return(i=this.backendRepository)==null||i.streamingManager.startStreaming(t),this.addfirebaseListeners(t),t;R.throwKnownError(T.InvalidAccessTokenError)}stopStreaming(){var e;(e=this.backendRepository)==null||e.streamingManager.stopStreaming()}async addfirebaseListeners(e){this.addWindowListener(e),this.addFinalListener(e),this.addErrorListener(e)}addWindowListener(e){const t=Jt(),s=Qt(t,`${e}`),r=w_(s,i=>{i.val()!==null&&i.key&&/^\d+$/.test(i.key)&&this.onWindowResults&&this.onWindowResults(i.val())});this.firebaseHandlers.push(r)}removefirebaseListeners(){this.firebaseHandlers.forEach(e=>{e()}),this.firebaseHandlers=[]}addFinalListener(e){const t=Jt(),s=Qt(t,`/${e}/averaged_results/`),r=As(s,i=>{i.val()!==null&&(this.onFinalResults&&this.onFinalResults(i.val()),this.removefirebaseListeners())});this.firebaseHandlers.push(r)}addErrorListener(e){const t=Jt(),s=Qt(t,`/${e}/error/`),r=As(s,i=>{if(i.val()===null)return;const o=R.handleScanError(i.val());this.onError?this.onError(o):R.throwKnownError(T.ErrorCallbackNotSetError),this.removefirebaseListeners()});this.firebaseHandlers.push(r)}};A(ke,"instance");let Os=ke;exports.Client=Os;exports.EmptyVideoError=xi;exports.ErrorCallbackNotSetError=Ki;exports.Errors=B;exports.FPSCalculationError=Wi;exports.FaceLookingLeftError=zi;exports.FaceLookingRightError=ji;exports.FaceNotCenteredError=Hi;exports.FaceTooCloseError=$i;exports.FaceTooFarError=Vi;exports.InvalidAccessTokenError=Fi;exports.InvalidContentTypeError=Yi;exports.InvalidPasswordError=Di;exports.InvalidServerTypeError=Bi;exports.InvalidUsernameError=Pi;exports.LowFPSError=qi;exports.NervoscanError=F;exports.NoScanDataError=Mi;exports.NoScansAvailableError=Li;exports.NotImplementedError=Ui;exports.NotInitializedError=Ai;exports.SkinExtractionError=Gi;exports.UnhandledError=Qi;exports.UnhandledScanError=Ps;exports.VideoTypeError=Oi;
|