@qratilabs/qrati-connect 1.0.0-beta.1

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/index.js ADDED
@@ -0,0 +1,1446 @@
1
+ import*as e from"react";import t,{useState as r,useRef as n,useEffect as s,createContext as i}from"react";var o=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},a="undefined"==typeof window||"Deno"in globalThis;function c(){}function u(e){return"number"==typeof e&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function l(e,t){return"function"==typeof e?e(t):e}function d(e,t){return"function"==typeof e?e(t):e}function p(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o)if(n){if(t.queryHash!==m(o,t.options))return!1}else if(!y(t.queryKey,o))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&((!s||s===t.state.fetchStatus)&&!(i&&!i(t)))}function f(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(g(t.options.mutationKey)!==g(i))return!1}else if(!y(t.options.mutationKey,i))return!1}return(!n||t.state.status===n)&&!(s&&!s(t))}function m(e,t){return(t?.queryKeyHashFn||g)(e)}function g(e){return JSON.stringify(e,((e,t)=>_(t)?Object.keys(t).sort().reduce(((e,r)=>(e[r]=t[r],e)),{}):t))}function y(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&!Object.keys(t).some((r=>!y(e[r],t[r]))))}function v(e,t){if(e===t)return e;const r=w(e)&&w(t);if(r||_(e)&&_(t)){const n=r?e:Object.keys(e),s=n.length,i=r?t:Object.keys(t),o=i.length,a=r?[]:{};let c=0;for(let s=0;s<o;s++){const o=r?s:i[s];(!r&&n.includes(o)||r)&&void 0===e[o]&&void 0===t[o]?(a[o]=void 0,c++):(a[o]=v(e[o],t[o]),a[o]===e[o]&&void 0!==e[o]&&c++)}return s===o&&c===s?e:a}return t}function b(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function _(e){if(!I(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!I(r)&&(!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype)}function I(e){return"[object Object]"===Object.prototype.toString.call(e)}function E(e,t,r){if("function"==typeof r.structuralSharing)return r.structuralSharing(e,t);if(!1!==r.structuralSharing){if("production"!==process.env.NODE_ENV)try{return v(e,t)}catch(e){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${e}`)}return v(e,t)}return t}function T(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function S(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var C=Symbol();function R(e,t){return"production"!==process.env.NODE_ENV&&e.queryFn===C&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==C?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}var k=new class extends o{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!a&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e((e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()}))}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach((t=>{t(e)}))}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}},O=new class extends o{#n=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!a&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#n!==e&&(this.#n=e,this.listeners.forEach((t=>{t(e)})))}isOnline(){return this.#n}};function P(){let e,t;const r=new Promise(((r,n)=>{e=r,t=n}));function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch((()=>{})),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function A(e){return Math.min(1e3*2**e,3e4)}function D(e){return"online"!==(e??"online")||O.isOnline()}var N=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function L(e){return e instanceof N}function M(e){let t,r=!1,n=0,s=!1;const i=P(),o=()=>k.isFocused()&&("always"===e.networkMode||O.isOnline())&&e.canRun(),c=()=>D(e.networkMode)&&e.canRun(),u=r=>{s||(s=!0,e.onSuccess?.(r),t?.(),i.resolve(r))},h=r=>{s||(s=!0,e.onError?.(r),t?.(),i.reject(r))},l=()=>new Promise((r=>{t=e=>{(s||o())&&r(e)},e.onPause?.()})).then((()=>{t=void 0,s||e.onContinue?.()})),d=()=>{if(s)return;let t;const i=0===n?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(u).catch((t=>{if(s)return;const i=e.retry??(a?0:3),c=e.retryDelay??A,u="function"==typeof c?c(n,t):c,p=!0===i||"number"==typeof i&&n<i||"function"==typeof i&&i(n,t);!r&&p?(n++,e.onFail?.(n,t),function(e){return new Promise((t=>{setTimeout(t,e)}))}(u).then((()=>o()?void 0:l())).then((()=>{r?h(t):d()}))):h(t)}))};return{promise:i,cancel:t=>{s||(h(new N(t)),e.abort?.())},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:c,start:()=>(c()?d():l().then(d),i)}}var U=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},s=e=>setTimeout(e,0);const i=n=>{t?e.push(n):s((()=>{r(n)}))};return{batch:i=>{let o;t++;try{o=i()}finally{t--,t||(()=>{const t=e;e=[],t.length&&s((()=>{n((()=>{t.forEach((e=>{r(e)}))}))}))})()}return o},batchCalls:e=>(...t)=>{i((()=>{e(...t)}))},schedule:i,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{s=e}}}(),x=class{#s;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),u(this.gcTime)&&(this.#s=setTimeout((()=>{this.optionalRemove()}),this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(a?1/0:3e5))}clearGcTimeout(){this.#s&&(clearTimeout(this.#s),this.#s=void 0)}},F=class extends x{#i;#o;#a;#c;#u;#h;#l;constructor(e){super(),this.#l=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#a=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#i=function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=e.state??this.#i,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#u?.promise}setOptions(e){this.options={...this.#h,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#a.remove(this)}setData(e,t){const r=E(this.state.data,e,this.options);return this.#d({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#d({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#u?.promise;return this.#u?.cancel(e),t?t.then(c).catch(c):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#i)}isActive(){return this.observers.some((e=>!1!==d(e.options.enabled,this)))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===C||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some((e=>e.getCurrentResult().isStale)):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!h(this.state.dataUpdatedAt,e)}onFocus(){const e=this.observers.find((e=>e.shouldFetchOnWindowFocus()));e?.refetch({cancelRefetch:!1}),this.#u?.continue()}onOnline(){const e=this.observers.find((e=>e.shouldFetchOnReconnect()));e?.refetch({cancelRefetch:!1}),this.#u?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter((t=>t!==e)),this.observers.length||(this.#u&&(this.#l?this.#u.cancel({revert:!0}):this.#u.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#d({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#u)return this.#u.continueRetry(),this.#u.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find((e=>e.options.queryFn));e&&this.setOptions(e.options)}"production"!==process.env.NODE_ENV&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#l=!0,r.signal)})},s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:()=>{const e=R(this.options,t),r={client:this.#c,queryKey:this.queryKey,meta:this.meta};return n(r),this.#l=!1,this.options.persister?this.options.persister(e,r,this):e(r)}};n(s),this.options.behavior?.onFetch(s,this),this.#o=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#d({type:"fetch",meta:s.fetchOptions?.meta});const i=e=>{L(e)&&e.silent||this.#d({type:"error",error:e}),L(e)||(this.#a.config.onError?.(e,this),this.#a.config.onSettled?.(this.state.data,e,this)),this.scheduleGc()};return this.#u=M({initialPromise:t?.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{if(void 0===e)return"production"!==process.env.NODE_ENV&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),void i(new Error(`${this.queryHash} data is undefined`));try{this.setData(e)}catch(e){return void i(e)}this.#a.config.onSuccess?.(e,this),this.#a.config.onSettled?.(e,this.state.error,this),this.scheduleGc()},onError:i,onFail:(e,t)=>{this.#d({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#d({type:"pause"})},onContinue:()=>{this.#d({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}),this.#u.start()}#d(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...j(t.data,this.options),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=e.error;return L(r)&&r.revert&&this.#o?{...this.#o,fetchStatus:"idle"}:{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),U.batch((()=>{this.observers.forEach((e=>{e.onQueryUpdate()})),this.#a.notify({query:this,type:"updated",action:e})}))}};function j(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:D(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}var q=class extends o{constructor(e={}){super(),this.config=e,this.#p=new Map}#p;build(e,t,r){const n=t.queryKey,s=t.queryHash??m(n,t);let i=this.get(s);return i||(i=new F({client:e,queryKey:n,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(i)),i}add(e){this.#p.has(e.queryHash)||(this.#p.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#p.get(e.queryHash);t&&(e.destroy(),t===e&&this.#p.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){U.batch((()=>{this.getAll().forEach((e=>{this.remove(e)}))}))}get(e){return this.#p.get(e)}getAll(){return[...this.#p.values()]}find(e){const t={exact:!0,...e};return this.getAll().find((e=>p(t,e)))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter((t=>p(e,t))):t}notify(e){U.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}onFocus(){U.batch((()=>{this.getAll().forEach((e=>{e.onFocus()}))}))}onOnline(){U.batch((()=>{this.getAll().forEach((e=>{e.onOnline()}))}))}},H=class extends x{#f;#m;#u;constructor(e){super(),this.mutationId=e.mutationId,this.#m=e.mutationCache,this.#f=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#f.includes(e)||(this.#f.push(e),this.clearGcTimeout(),this.#m.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#f=this.#f.filter((t=>t!==e)),this.scheduleGc(),this.#m.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#f.length||("pending"===this.state.status?this.scheduleGc():this.#m.remove(this))}continue(){return this.#u?.continue()??this.execute(this.state.variables)}async execute(e){this.#u=M({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#d({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#d({type:"pause"})},onContinue:()=>{this.#d({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#m.canRun(this)});const t="pending"===this.state.status,r=!this.#u.canStart();try{if(!t){this.#d({type:"pending",variables:e,isPaused:r}),await(this.#m.config.onMutate?.(e,this));const t=await(this.options.onMutate?.(e));t!==this.state.context&&this.#d({type:"pending",context:t,variables:e,isPaused:r})}const n=await this.#u.start();return await(this.#m.config.onSuccess?.(n,e,this.state.context,this)),await(this.options.onSuccess?.(n,e,this.state.context)),await(this.#m.config.onSettled?.(n,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(n,null,e,this.state.context)),this.#d({type:"success",data:n}),n}catch(t){try{throw await(this.#m.config.onError?.(t,e,this.state.context,this)),await(this.options.onError?.(t,e,this.state.context)),await(this.#m.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,t,e,this.state.context)),t}finally{this.#d({type:"error",error:t})}}finally{this.#m.runNext(this)}}#d(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),U.batch((()=>{this.#f.forEach((t=>{t.onMutationUpdate(e)})),this.#m.notify({mutation:this,type:"updated",action:e})}))}};var $=class extends o{constructor(e={}){super(),this.config=e,this.#g=new Set,this.#y=new Map,this.#v=0}#g;#y;#v;build(e,t,r){const n=new H({mutationCache:this,mutationId:++this.#v,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#g.add(e);const t=V(e);if("string"==typeof t){const r=this.#y.get(t);r?r.push(e):this.#y.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#g.delete(e)){const t=V(e);if("string"==typeof t){const r=this.#y.get(t);if(r)if(r.length>1){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#y.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=V(e);if("string"==typeof t){const r=this.#y.get(t),n=r?.find((e=>"pending"===e.state.status));return!n||n===e}return!0}runNext(e){const t=V(e);if("string"==typeof t){const r=this.#y.get(t)?.find((t=>t!==e&&t.state.isPaused));return r?.continue()??Promise.resolve()}return Promise.resolve()}clear(){U.batch((()=>{this.#g.forEach((e=>{this.notify({type:"removed",mutation:e})})),this.#g.clear(),this.#y.clear()}))}getAll(){return Array.from(this.#g)}find(e){const t={exact:!0,...e};return this.getAll().find((e=>f(t,e)))}findAll(e={}){return this.getAll().filter((t=>f(e,t)))}notify(e){U.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}resumePausedMutations(){const e=this.getAll().filter((e=>e.state.isPaused));return U.batch((()=>Promise.all(e.map((e=>e.continue().catch(c))))))}};function V(e){return e.options.scope?.id}function B(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let r=!1;const u=R(t.options,t.fetchOptions),h=async(e,n,s)=>{if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);const i={client:t.client,queryKey:t.queryKey,pageParam:n,direction:s?"backward":"forward",meta:t.options.meta};var o;o=i,Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",(()=>{r=!0})),t.signal)});const a=await u(i),{maxPages:c}=t.options,h=s?S:T;return{pages:h(e.pages,a,c),pageParams:h(e.pageParams,n,c)}};if(s&&i.length){const e="backward"===s,t={pages:i,pageParams:o},r=(e?Q:z)(n,t);a=await h(t,r,e)}else{const t=e??i.length;do{const e=0===c?o[0]??n.initialPageParam:z(n,a);if(c>0&&null==e)break;a=await h(a,e),c++}while(c<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function z(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Q(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var W=class extends o{constructor(e,t){super(),this.options=t,this.#c=e,this.#b=null,this.#w=P(),this.options.experimental_prefetchInRender||this.#w.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#c;#_=void 0;#I=void 0;#E=void 0;#T;#S;#w;#b;#C;#R;#k;#O;#P;#A;#D=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#_.addObserver(this),K(this.#_,this.options)?this.#N():this.updateResult(),this.#L())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G(this.#_,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G(this.#_,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#M(),this.#U(),this.#_.removeObserver(this)}setOptions(e,t){const r=this.options,n=this.#_;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof d(this.options.enabled,this.#_))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#_.setOptions(this.options),r._defaulted&&!b(this.options,r)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#_,observer:this});const s=this.hasListeners();s&&J(this.#_,n,this.options,r)&&this.#N(),this.updateResult(t),!s||this.#_===n&&d(this.options.enabled,this.#_)===d(r.enabled,this.#_)&&l(this.options.staleTime,this.#_)===l(r.staleTime,this.#_)||this.#F();const i=this.#j();!s||this.#_===n&&d(this.options.enabled,this.#_)===d(r.enabled,this.#_)&&i===this.#A||this.#q(i)}getOptimisticResult(e){const t=this.#c.getQueryCache().build(this.#c,e),r=this.createResult(t,e);return function(e,t){if(!b(e.getCurrentResult(),t))return!0;return!1}(this,r)&&(this.#E=r,this.#S=this.options,this.#T=this.#_.state),r}getCurrentResult(){return this.#E}trackResult(e,t){const r={};return Object.keys(e).forEach((n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),t?.(n),e[n])})})),r}trackProp(e){this.#D.add(e)}getCurrentQuery(){return this.#_}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#c.defaultQueryOptions(e),r=this.#c.getQueryCache().build(this.#c,t);return r.fetch().then((()=>this.createResult(r,t)))}fetch(e){return this.#N({...e,cancelRefetch:e.cancelRefetch??!0}).then((()=>(this.updateResult(),this.#E)))}#N(e){this.#x();let t=this.#_.fetch(this.options,e);return e?.throwOnError||(t=t.catch(c)),t}#F(){this.#M();const e=l(this.options.staleTime,this.#_);if(a||this.#E.isStale||!u(e))return;const t=h(this.#E.dataUpdatedAt,e)+1;this.#O=setTimeout((()=>{this.#E.isStale||this.updateResult()}),t)}#j(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#_):this.options.refetchInterval)??!1}#q(e){this.#U(),this.#A=e,!a&&!1!==d(this.options.enabled,this.#_)&&u(this.#A)&&0!==this.#A&&(this.#P=setInterval((()=>{(this.options.refetchIntervalInBackground||k.isFocused())&&this.#N()}),this.#A))}#L(){this.#F(),this.#q(this.#j())}#M(){this.#O&&(clearTimeout(this.#O),this.#O=void 0)}#U(){this.#P&&(clearInterval(this.#P),this.#P=void 0)}createResult(e,t){const r=this.#_,n=this.options,s=this.#E,i=this.#T,o=this.#S,a=e!==r?e.state:this.#I,{state:c}=e;let u,h={...c},l=!1;if(t._optimisticResults){const s=this.hasListeners(),i=!s&&K(e,t),o=s&&J(e,r,t,n);(i||o)&&(h={...h,...j(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(h.fetchStatus="idle")}let{error:d,errorUpdatedAt:p,status:f}=h;if(t.select&&void 0!==h.data)if(s&&h.data===i?.data&&t.select===this.#C)u=this.#R;else try{this.#C=t.select,u=t.select(h.data),u=E(s?.data,u,t),this.#R=u,this.#b=null}catch(e){this.#b=e}else u=h.data;if(void 0!==t.placeholderData&&void 0===u&&"pending"===f){let e;if(s?.isPlaceholderData&&t.placeholderData===o?.placeholderData)e=s.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(this.#k?.state.data,this.#k):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.#b=null}catch(e){this.#b=e}void 0!==e&&(f="success",u=E(s?.data,e,t),l=!0)}this.#b&&(d=this.#b,u=this.#R,p=Date.now(),f="error");const m="fetching"===h.fetchStatus,g="pending"===f,y="error"===f,v=g&&m,b=void 0!==u,w={status:f,fetchStatus:h.fetchStatus,isPending:g,isSuccess:"success"===f,isError:y,isInitialLoading:v,isLoading:v,data:u,dataUpdatedAt:h.dataUpdatedAt,error:d,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>a.dataUpdateCount||h.errorUpdateCount>a.errorUpdateCount,isFetching:m,isRefetching:m&&!g,isLoadingError:y&&!b,isPaused:"paused"===h.fetchStatus,isPlaceholderData:l,isRefetchError:y&&b,isStale:X(e,t),refetch:this.refetch,promise:this.#w};if(this.options.experimental_prefetchInRender){const t=e=>{"error"===w.status?e.reject(w.error):void 0!==w.data&&e.resolve(w.data)},n=()=>{const e=this.#w=w.promise=P();t(e)},s=this.#w;switch(s.status){case"pending":e.queryHash===r.queryHash&&t(s);break;case"fulfilled":"error"!==w.status&&w.data===s.value||n();break;case"rejected":"error"===w.status&&w.error===s.reason||n()}}return w}updateResult(e){const t=this.#E,r=this.createResult(this.#_,this.options);if(this.#T=this.#_.state,this.#S=this.options,void 0!==this.#T.data&&(this.#k=this.#_),b(r,t))return;this.#E=r;const n={};!1!==e?.listeners&&(()=>{if(!t)return!0;const{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#D.size)return!0;const n=new Set(r??this.#D);return this.options.throwOnError&&n.add("error"),Object.keys(this.#E).some((e=>{const r=e;return this.#E[r]!==t[r]&&n.has(r)}))})()&&(n.listeners=!0),this.#H({...n,...e})}#x(){const e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#_)return;const t=this.#_;this.#_=e,this.#I=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#L()}#H(e){U.batch((()=>{e.listeners&&this.listeners.forEach((e=>{e(this.#E)})),this.#c.getQueryCache().notify({query:this.#_,type:"observerResultsUpdated"})}))}};function K(e,t){return function(e,t){return!1!==d(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&G(e,t,t.refetchOnMount)}function G(e,t,r){if(!1!==d(t.enabled,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&X(e,t)}return!1}function J(e,t,r,n){return(e!==t||!1===d(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&X(e,r)}function X(e,t){return!1!==d(t.enabled,e)&&e.isStaleByTime(l(t.staleTime,e))}var Y,Z={exports:{}},ee={};var te,re,ne={};
2
+ /**
3
+ * @license React
4
+ * react-jsx-runtime.development.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */function se(){return te||(te=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===U?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case T:return"Fragment";case E:return"Portal";case C:return"Profiler";case S:return"StrictMode";case P:return"Suspense";case A:return"SuspenseList"}if("object"==typeof t)switch("number"==typeof t.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case k:return(t.displayName||"Context")+".Provider";case R:return(t._context.displayName||"Context")+".Consumer";case O:var r=t.render;return(t=t.displayName)||(t=""!==(t=r.displayName||r.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case D:return null!==(r=t.displayName||null)?r:e(t.type)||"Memo";case N:r=t._payload,t=t._init;try{return e(t(r))}catch(e){}}return null}function r(e){return""+e}function n(e){try{r(e);var t=!1}catch(e){t=!0}if(t){var n=(t=console).error,s="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),r(e)}}function s(){}function i(e){if(void 0===V)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);V=t&&t[1]||"",B=-1<e.stack.indexOf("\n at")?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+V+e+B}function o(e,t){if(!e||Q)return"";var r=W.get(e);if(void 0!==r)return r;Q=!0,r=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var n;n=x.H,x.H=null,function(){if(0===$){f=console.log,m=console.info,g=console.warn,y=console.error,v=console.group,b=console.groupCollapsed,w=console.groupEnd;var e={configurable:!0,enumerable:!0,value:s,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}$++}();try{var o={DetermineComponentFrameRoot:function(){try{if(t){var r=function(){throw Error()};if(Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(r,[])}catch(e){var n=e}Reflect.construct(e,[],r)}else{try{r.call()}catch(e){n=e}e.call(r.prototype)}}else{try{throw Error()}catch(e){n=e}(r=e())&&"function"==typeof r.catch&&r.catch((function(){}))}}catch(e){if(e&&n&&"string"==typeof e.stack)return[e.stack,n.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=o.DetermineComponentFrameRoot(),u=c[0],h=c[1];if(u&&h){var l=u.split("\n"),d=h.split("\n");for(c=a=0;a<l.length&&!l[a].includes("DetermineComponentFrameRoot");)a++;for(;c<d.length&&!d[c].includes("DetermineComponentFrameRoot");)c++;if(a===l.length||c===d.length)for(a=l.length-1,c=d.length-1;1<=a&&0<=c&&l[a]!==d[c];)c--;for(;1<=a&&0<=c;a--,c--)if(l[a]!==d[c]){if(1!==a||1!==c)do{if(a--,0>--c||l[a]!==d[c]){var p="\n"+l[a].replace(" at new "," at ");return e.displayName&&p.includes("<anonymous>")&&(p=p.replace("<anonymous>",e.displayName)),"function"==typeof e&&W.set(e,p),p}}while(1<=a&&0<=c);break}}}finally{Q=!1,x.H=n,function(){if(0==--$){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},e,{value:f}),info:j({},e,{value:m}),warn:j({},e,{value:g}),error:j({},e,{value:y}),group:j({},e,{value:v}),groupCollapsed:j({},e,{value:b}),groupEnd:j({},e,{value:w})})}0>$&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=r}return l=(l=e?e.displayName||e.name:"")?i(l):"","function"==typeof e&&W.set(e,l),l}function a(e){if(null==e)return"";if("function"==typeof e){var t=e.prototype;return o(e,!(!t||!t.isReactComponent))}if("string"==typeof e)return i(e);switch(e){case P:return i("Suspense");case A:return i("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case O:return e=o(e.render,!1);case D:return a(e.type);case N:t=e._payload,e=e._init;try{return a(e(t))}catch(e){}}return""}function c(){var e=x.A;return null===e?null:e.getOwner()}function u(){var t=e(this.type);return G[t]||(G[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(t=this.props.ref)?t:null}function h(t,r,s,i,o,a){if("string"==typeof t||"function"==typeof t||t===T||t===C||t===S||t===P||t===A||t===L||"object"==typeof t&&null!==t&&(t.$$typeof===N||t.$$typeof===D||t.$$typeof===k||t.$$typeof===R||t.$$typeof===O||t.$$typeof===q||void 0!==t.getModuleId)){var h=r.children;if(void 0!==h)if(i)if(H(h)){for(i=0;i<h.length;i++)l(h[i],t);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(h,t)}else h="",(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(h+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),null===t?i="null":H(t)?i="array":void 0!==t&&t.$$typeof===I?(i="<"+(e(t.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):i=typeof t,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",i,h);if(F.call(r,"key")){h=e(t);var d=Object.keys(r).filter((function(e){return"key"!==e}));i=0<d.length?"{key: someKey, "+d.join(": ..., ")+": ...}":"{key: someKey}",J[h+i]||(d=0<d.length?"{"+d.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',i,h,d,h),J[h+i]=!0)}if(h=null,void 0!==s&&(n(s),h=""+s),function(e){if(F.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(r)&&(n(r.key),h=""+r.key),"key"in r)for(var p in s={},r)"key"!==p&&(s[p]=r[p]);else s=r;return h&&function(e,t){function r(){z||(z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(s,"function"==typeof t?t.displayName||t.name||"Unknown":t),function(e,t,r,n,s,i){return r=i.ref,e={$$typeof:I,type:e,key:t,props:i,_owner:s},null!==(void 0!==r?r:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:u}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,h,a,0,c(),s)}function l(e,t){if("object"==typeof e&&e&&e.$$typeof!==K)if(H(e))for(var r=0;r<e.length;r++){var n=e[r];d(n)&&p(n,t)}else if(d(e))e._store&&(e._store.validated=1);else if(null===e||"object"!=typeof e?r=null:r="function"==typeof(r=M&&e[M]||e["@@iterator"])?r:null,"function"==typeof r&&r!==e.entries&&(r=r.call(e))!==e)for(;!(e=r.next()).done;)d(e.value)&&p(e.value,t)}function d(e){return"object"==typeof e&&null!==e&&e.$$typeof===I}function p(t,r){if(t._store&&!t._store.validated&&null==t.key&&(t._store.validated=1,r=function(t){var r="",n=c();return n&&(n=e(n.type))&&(r="\n\nCheck the render method of `"+n+"`."),r||(t=e(t))&&(r="\n\nCheck the top-level render call using <"+t+">."),r}(r),!X[r])){X[r]=!0;var n="";t&&null!=t._owner&&t._owner!==c()&&(n=null,"number"==typeof t._owner.tag?n=e(t._owner.type):"string"==typeof t._owner.name&&(n=t._owner.name),n=" It was passed a child from "+n+".");var s=x.getCurrentStack;x.getCurrentStack=function(){var e=a(t.type);return s&&(e+=s()||""),e},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',r,n),x.getCurrentStack=s}}var f,m,g,y,v,b,w,_=t,I=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),k=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),L=Symbol.for("react.offscreen"),M=Symbol.iterator,U=Symbol.for("react.client.reference"),x=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,j=Object.assign,q=Symbol.for("react.client.reference"),H=Array.isArray,$=0;s.__reactDisabledLog=!0;var V,B,z,Q=!1,W=new("function"==typeof WeakMap?WeakMap:Map),K=Symbol.for("react.client.reference"),G={},J={},X={};ne.Fragment=T,ne.jsx=function(e,t,r,n,s){return h(e,t,r,!1,0,s)},ne.jsxs=function(e,t,r,n,s){return h(e,t,r,!0,0,s)}}()),ne}var ie=(re||(re=1,"production"===process.env.NODE_ENV?Z.exports=function(){if(Y)return ee;Y=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(t,r,n){var s=null;if(void 0!==n&&(s=""+n),void 0!==r.key&&(s=""+r.key),"key"in r)for(var i in n={},r)"key"!==i&&(n[i]=r[i]);else n=r;return r=n.ref,{$$typeof:e,type:t,key:s,ref:void 0!==r?r:null,props:n}}return ee.Fragment=t,ee.jsx=r,ee.jsxs=r,ee}():Z.exports=se()),Z.exports),oe=e.createContext(void 0),ae=({client:t,children:r})=>(e.useEffect((()=>(t.mount(),()=>{t.unmount()})),[t]),ie.jsx(oe.Provider,{value:t,children:r})),ce=e.createContext(!1);ce.Provider;var ue=e.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}());function he(){}var le=(e,t,r)=>t.fetchOptimistic(e).catch((()=>{r.clearReset()}));function de(t,r,n){if("production"!==process.env.NODE_ENV&&("object"!=typeof t||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const s=(()=>{const t=e.useContext(oe);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t})(),i=e.useContext(ce),o=e.useContext(ue),c=s.defaultQueryOptions(t);s.getDefaultOptions().queries?._experimental_beforeQuery?.(c),c._optimisticResults=i?"isRestoring":"optimistic",(e=>{const t=e.staleTime;e.suspense&&(e.staleTime="function"==typeof t?(...e)=>Math.max(t(...e),1e3):Math.max(t??1e3,1e3),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3)))})(c),((e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))})(c,o),(t=>{e.useEffect((()=>{t.clearReset()}),[t])})(o);const u=!s.getQueryCache().get(c.queryHash),[h]=e.useState((()=>new r(s,c))),l=h.getOptimisticResult(c),d=!i&&!1!==t.subscribed;if(e.useSyncExternalStore(e.useCallback((e=>{const t=d?h.subscribe(U.batchCalls(e)):he;return h.updateResult(),t}),[h,d]),(()=>h.getCurrentResult()),(()=>h.getCurrentResult())),e.useEffect((()=>{h.setOptions(c,{listeners:!1})}),[c,h]),((e,t)=>e?.suspense&&t.isPending)(c,l))throw le(c,h,o);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>{return e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&void 0===e.data||(i=r,o=[e.error,n],"function"==typeof i?i(...o):!!i));var i,o})({result:l,errorResetBoundary:o,throwOnError:c.throwOnError,query:s.getQueryCache().get(c.queryHash),suspense:c.suspense}))throw l.error;if(s.getDefaultOptions().queries?._experimental_afterQuery?.(c,l),c.experimental_prefetchInRender&&!a&&((e,t)=>e.isLoading&&e.isFetching&&!t)(l,i)){const e=u?le(c,h,o):s.getQueryCache().get(c.queryHash)?.promise;e?.catch(he).finally((()=>{h.updateResult()}))}return c.notifyOnChangeProps?l:h.trackResult(l)}const pe=({title:e,description:r})=>t.createElement("div",{className:"w-full flex-col items-center justify-center gap-2"},t.createElement("img",{className:"h-44 w-auto max-w-md",src:"https://banner2.cleanpng.com/20180531/egc/avo4mnj68.webp"}),t.createElement("h1",null,e),t.createElement("h2",null,r));class fe extends Error{response;request;options;constructor(e,t,r){const n=`${e.status||0===e.status?e.status:""} ${e.statusText||""}`.trim();super(`Request failed with ${n?`status code ${n}`:"an unknown error"}: ${t.method} ${t.url}`),this.name="HTTPError",this.response=e,this.request=t,this.options=r}}class me extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}const ge=e=>null!==e&&"object"==typeof e,ye=(...e)=>{for(const t of e)if((!ge(t)||Array.isArray(t))&&void 0!==t)throw new TypeError("The `options` argument must be an object");return _e({},...e)},ve=(e={},t={})=>{const r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,s=new globalThis.Headers(t);for(const[e,t]of s.entries())n&&"undefined"===t||void 0===t?r.delete(e):r.set(e,t);return r};function be(e,t,r){return Object.hasOwn(t,r)&&void 0===t[r]?[]:_e(e[r]??[],t[r]??[])}const we=(e={},t={})=>({beforeRequest:be(e,t,"beforeRequest"),beforeRetry:be(e,t,"beforeRetry"),afterResponse:be(e,t,"afterResponse"),beforeError:be(e,t,"beforeError")}),_e=(...e)=>{let t={},r={},n={};for(const s of e)if(Array.isArray(s))Array.isArray(t)||(t=[]),t=[...t,...s];else if(ge(s)){for(let[e,r]of Object.entries(s))ge(r)&&e in t&&(r=_e(t[e],r)),t={...t,[e]:r};ge(s.hooks)&&(n=we(n,s.hooks),t.hooks=n),ge(s.headers)&&(r=ve(r,s.headers),t.headers=r)}return t},Ie=(()=>{let e=!1,t=!1;const r="function"==typeof globalThis.ReadableStream,n="function"==typeof globalThis.Request;if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(e){if(e instanceof Error&&"unsupported BodyInit type"===e.message)return!1;throw e}return e&&!t})(),Ee="function"==typeof globalThis.AbortController,Te="function"==typeof globalThis.ReadableStream,Se="function"==typeof globalThis.FormData,Ce=["get","post","put","patch","head","delete"],Re={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},ke=2147483647,Oe=Symbol("stop"),Pe={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},Ae={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},De=e=>Ce.includes(e)?e.toUpperCase():e,Ne={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Le=(e={})=>{if("number"==typeof e)return{...Ne,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Ne,...e}};class Me{static create(e,t){const r=new Me(e,t),n=async()=>{if("number"==typeof r._options.timeout&&r._options.timeout>ke)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await r._fetch();for(const t of r._options.hooks.afterResponse){const n=await t(r.request,r._options,r._decorateResponse(e.clone()));n instanceof globalThis.Response&&(e=n)}if(r._decorateResponse(e),!e.ok&&r._options.throwHttpErrors){let t=new fe(e,r.request,r._options);for(const e of r._options.hooks.beforeError)t=await e(t);throw t}if(r._options.onDownloadProgress){if("function"!=typeof r._options.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!Te)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return r._stream(e.clone(),r._options.onDownloadProgress)}return e},s=r._options.retry.methods.includes(r.request.method.toLowerCase())?r._retry(n):n();for(const[e,n]of Object.entries(Re))s[e]=async()=>{r.request.headers.set("accept",r.request.headers.get("accept")||n);const i=await s;if("json"===e){if(204===i.status)return"";if(0===(await i.clone().arrayBuffer()).byteLength)return"";if(t.parseJson)return t.parseJson(await i.text())}return i[e]()};return s}request;abortController;_retryCount=0;_input;_options;constructor(e,t={}){if(this._input=e,this._options={...t,headers:ve(this._input.headers,t.headers),hooks:we({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},t.hooks),method:De(t.method??this._input.method??"GET"),prefixUrl:String(t.prefixUrl||""),retry:Le(t.retry),throwHttpErrors:!1!==t.throwHttpErrors,timeout:t.timeout??1e4,fetch:t.fetch??globalThis.fetch.bind(globalThis)},"string"!=typeof this._input&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&"string"==typeof this._input){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(Ee){this.abortController=new globalThis.AbortController;const e=this._options.signal??this._input.signal;e?.aborted&&this.abortController.abort(e?.reason),e?.addEventListener("abort",(()=>{this.abortController.abort(e.reason)})),this._options.signal=this.abortController.signal}if(Ie&&(this._options.duplex="half"),void 0!==this._options.json&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const e="?"+("string"==typeof this._options.searchParams?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),t=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,e);!(Se&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)||this._options.headers&&this._options.headers["content-type"]||this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(t,{...this.request}),this._options)}}_calculateRetryDelay(e){if(this._retryCount++,this._retryCount>this._options.retry.limit||e instanceof me)throw e;if(e instanceof fe){if(!this._options.retry.statusCodes.includes(e.response.status))throw e;const t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this._options.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now());const r=this._options.retry.maxRetryAfter??e;return e<r?e:r}if(413===e.response.status)throw e}const t=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,t)}_decorateResponse(e){return this._options.parseJson&&(e.json=async()=>this._options.parseJson(await e.text())),e}async _retry(e){try{return await e()}catch(t){const r=Math.min(this._calculateRetryDelay(t),ke);if(this._retryCount<1)throw t;await async function(e,{signal:t}){return new Promise(((r,n)=>{function s(){clearTimeout(i),n(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",s,{once:!0}));const i=setTimeout((()=>{t?.removeEventListener("abort",s),r()}),e)}))}(r,{signal:this._options.signal});for(const e of this._options.hooks.beforeRetry){if(await e({request:this.request,options:this._options,error:t,retryCount:this._retryCount})===Oe)return}return this._retry(e)}}async _fetch(){for(const e of this._options.hooks.beforeRequest){const t=await e(this.request,this._options);if(t instanceof Request){this.request=t;break}if(t instanceof Response)return t}const e=((e,t)=>{const r={};for(const n in t)n in Ae||n in Pe||n in e||(r[n]=t[n]);return r})(this.request,this._options),t=this.request;return this.request=t.clone(),!1===this._options.timeout?this._options.fetch(t,e):async function(e,t,r,n){return new Promise(((s,i)=>{const o=setTimeout((()=>{r&&r.abort(),i(new me(e))}),n.timeout);n.fetch(e,t).then(s).catch(i).then((()=>{clearTimeout(o)}))}))}(t,e,this.abortController,this._options)}_stream(e,t){const r=Number(e.headers.get("content-length"))||0;let n=0;return 204===e.status?(t&&t({percent:1,totalBytes:r,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(s){const i=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array),await async function e(){const{done:o,value:a}=await i.read();if(o)s.close();else{if(t){n+=a.byteLength;t({percent:0===r?0:n/r,transferredBytes:n,totalBytes:r},a)}s.enqueue(a),await e()}}()}}),{status:e.status,statusText:e.statusText,headers:e.headers})}}
11
+ /*! MIT License © Sindre Sorhus */const Ue=e=>{const t=(t,r)=>Me.create(t,ye(e,r));for(const r of Ce)t[r]=(t,n)=>Me.create(t,ye(e,n,{method:r}));return t.create=e=>Ue(ye(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),Ue(ye(e,t))),t.stop=Oe,t},xe=Ue(),Fe=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let s=e.charCodeAt(n);s<128?t[r++]=s:s<2048?(t[r++]=s>>6|192,t[r++]=63&s|128):55296==(64512&s)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++n)),t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=63&s|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=63&s|128)}return t},je={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:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const s=e[t],i=t+1<e.length,o=i?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),n.push(r[u],r[h],r[l],r[d])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Fe(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const s=e[r++];if(s<128)t[n++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[r++];t[n++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}else{const i=e[r++],o=e[r++];t[n++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const s=r[e.charAt(t++)],i=t<e.length?r[e.charAt(t)]:0;++t;const o=t<e.length?r[e.charAt(t)]:64;++t;const a=t<e.length?r[e.charAt(t)]:64;if(++t,null==s||null==i||null==o||null==a)throw new qe;const c=s<<2|i>>4;if(n.push(c),64!==o){const e=i<<4&240|o>>2;if(n.push(e),64!==a){const e=o<<6&192|a;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class qe extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const He=function(e){return function(e){const t=Fe(e);return je.encodeByteArray(t,!0)}(e).replace(/\./g,"")},$e=function(e){try{return je.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
12
+ /**
13
+ * @license
14
+ * Copyright 2022 Google LLC
15
+ *
16
+ * Licensed under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License.
18
+ * You may obtain a copy of the License at
19
+ *
20
+ * http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software
23
+ * distributed under the License is distributed on an "AS IS" BASIS,
24
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
+ * See the License for the specific language governing permissions and
26
+ * limitations under the License.
27
+ */
28
+ const Ve=()=>
29
+ /**
30
+ * @license
31
+ * Copyright 2022 Google LLC
32
+ *
33
+ * Licensed under the Apache License, Version 2.0 (the "License");
34
+ * you may not use this file except in compliance with the License.
35
+ * You may obtain a copy of the License at
36
+ *
37
+ * http://www.apache.org/licenses/LICENSE-2.0
38
+ *
39
+ * Unless required by applicable law or agreed to in writing, software
40
+ * distributed under the License is distributed on an "AS IS" BASIS,
41
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42
+ * See the License for the specific language governing permissions and
43
+ * limitations under the License.
44
+ */
45
+ function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,Be=()=>{try{return Ve()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&$e(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},ze=()=>{var e;return null===(e=Be())||void 0===e?void 0:e.config},Qe=e=>{var t;return null===(t=Be())||void 0===t?void 0:t[`_${e}`]};
46
+ /**
47
+ * @license
48
+ * Copyright 2017 Google LLC
49
+ *
50
+ * Licensed under the Apache License, Version 2.0 (the "License");
51
+ * you may not use this file except in compliance with the License.
52
+ * You may obtain a copy of the License at
53
+ *
54
+ * http://www.apache.org/licenses/LICENSE-2.0
55
+ *
56
+ * Unless required by applicable law or agreed to in writing, software
57
+ * distributed under the License is distributed on an "AS IS" BASIS,
58
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
+ * See the License for the specific language governing permissions and
60
+ * limitations under the License.
61
+ */
62
+ class We{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,r))}}}
63
+ /**
64
+ * @license
65
+ * Copyright 2017 Google LLC
66
+ *
67
+ * Licensed under the Apache License, Version 2.0 (the "License");
68
+ * you may not use this file except in compliance with the License.
69
+ * You may obtain a copy of the License at
70
+ *
71
+ * http://www.apache.org/licenses/LICENSE-2.0
72
+ *
73
+ * Unless required by applicable law or agreed to in writing, software
74
+ * distributed under the License is distributed on an "AS IS" BASIS,
75
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
76
+ * See the License for the specific language governing permissions and
77
+ * limitations under the License.
78
+ */function Ke(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class Ge extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,Ge.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Je.prototype.create)}}class Je{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,s=this.errors[e],i=s?function(e,t){return e.replace(Xe,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(s,r):"Error",o=`${this.serviceName}: ${i} (${n}).`;return new Ge(n,o,r)}}const Xe=/\{\$([^}]+)}/g;function Ye(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const s of r){if(!n.includes(s))return!1;const r=e[s],i=t[s];if(Ze(r)&&Ze(i)){if(!Ye(r,i))return!1}else if(r!==i)return!1}for(const e of n)if(!r.includes(e))return!1;return!0}function Ze(e){return null!==e&&"object"==typeof e}
79
+ /**
80
+ * @license
81
+ * Copyright 2017 Google LLC
82
+ *
83
+ * Licensed under the Apache License, Version 2.0 (the "License");
84
+ * you may not use this file except in compliance with the License.
85
+ * You may obtain a copy of the License at
86
+ *
87
+ * http://www.apache.org/licenses/LICENSE-2.0
88
+ *
89
+ * Unless required by applicable law or agreed to in writing, software
90
+ * distributed under the License is distributed on an "AS IS" BASIS,
91
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92
+ * See the License for the specific language governing permissions and
93
+ * limitations under the License.
94
+ */function et(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach((e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}class tt{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r},void 0===n.next&&(n.next=rt),void 0===n.error&&(n.error=rt),void 0===n.complete&&(n.complete=rt);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}})),this.observers.push(n),s}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function rt(){}
95
+ /**
96
+ * @license
97
+ * Copyright 2021 Google LLC
98
+ *
99
+ * Licensed under the Apache License, Version 2.0 (the "License");
100
+ * you may not use this file except in compliance with the License.
101
+ * You may obtain a copy of the License at
102
+ *
103
+ * http://www.apache.org/licenses/LICENSE-2.0
104
+ *
105
+ * Unless required by applicable law or agreed to in writing, software
106
+ * distributed under the License is distributed on an "AS IS" BASIS,
107
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
108
+ * See the License for the specific language governing permissions and
109
+ * limitations under the License.
110
+ */function nt(e){return e&&e._delegate?e._delegate:e}class st{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}
111
+ /**
112
+ * @license
113
+ * Copyright 2019 Google LLC
114
+ *
115
+ * Licensed under the Apache License, Version 2.0 (the "License");
116
+ * you may not use this file except in compliance with the License.
117
+ * You may obtain a copy of the License at
118
+ *
119
+ * http://www.apache.org/licenses/LICENSE-2.0
120
+ *
121
+ * Unless required by applicable law or agreed to in writing, software
122
+ * distributed under the License is distributed on an "AS IS" BASIS,
123
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124
+ * See the License for the specific language governing permissions and
125
+ * limitations under the License.
126
+ */const it="[DEFAULT]";
127
+ /**
128
+ * @license
129
+ * Copyright 2019 Google LLC
130
+ *
131
+ * Licensed under the Apache License, Version 2.0 (the "License");
132
+ * you may not use this file except in compliance with the License.
133
+ * You may obtain a copy of the License at
134
+ *
135
+ * http://www.apache.org/licenses/LICENSE-2.0
136
+ *
137
+ * Unless required by applicable law or agreed to in writing, software
138
+ * distributed under the License is distributed on an "AS IS" BASIS,
139
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
140
+ * See the License for the specific language governing permissions and
141
+ * limitations under the License.
142
+ */class ot{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 e=new We;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(r)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:r})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
143
+ /**
144
+ * @license
145
+ * Copyright 2019 Google LLC
146
+ *
147
+ * Licensed under the Apache License, Version 2.0 (the "License");
148
+ * you may not use this file except in compliance with the License.
149
+ * You may obtain a copy of the License at
150
+ *
151
+ * http://www.apache.org/licenses/LICENSE-2.0
152
+ *
153
+ * Unless required by applicable law or agreed to in writing, software
154
+ * distributed under the License is distributed on an "AS IS" BASIS,
155
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
156
+ * See the License for the specific language governing permissions and
157
+ * limitations under the License.
158
+ */(e))try{this.getOrInitializeService({instanceIdentifier:it})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e=it){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((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e=it){return this.instances.has(e)}getOptions(e=it){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[e,t]of this.instancesDeferred.entries()){r===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var r;const n=this.normalizeInstanceIdentifier(t),s=null!==(r=this.onInitCallbacks.get(n))&&void 0!==r?r:new Set;s.add(e),this.onInitCallbacks.set(n,s);const i=this.instances.get(n);return i&&e(i,n),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const n of r)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===it?void 0:n),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}var n;return r||null}normalizeInstanceIdentifier(e=it){return this.component?this.component.multipleInstances?e:it:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class at{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 ot(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}
159
+ /**
160
+ * @license
161
+ * Copyright 2017 Google LLC
162
+ *
163
+ * Licensed under the Apache License, Version 2.0 (the "License");
164
+ * you may not use this file except in compliance with the License.
165
+ * You may obtain a copy of the License at
166
+ *
167
+ * http://www.apache.org/licenses/LICENSE-2.0
168
+ *
169
+ * Unless required by applicable law or agreed to in writing, software
170
+ * distributed under the License is distributed on an "AS IS" BASIS,
171
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
172
+ * See the License for the specific language governing permissions and
173
+ * limitations under the License.
174
+ */var ct;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(ct||(ct={}));const ut={debug:ct.DEBUG,verbose:ct.VERBOSE,info:ct.INFO,warn:ct.WARN,error:ct.ERROR,silent:ct.SILENT},ht=ct.INFO,lt={[ct.DEBUG]:"log",[ct.VERBOSE]:"log",[ct.INFO]:"info",[ct.WARN]:"warn",[ct.ERROR]:"error"},dt=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),s=lt[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${n}] ${e.name}:`,...r)};class pt{constructor(e){this.name=e,this._logLevel=ht,this._logHandler=dt,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in ct))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?ut[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,ct.DEBUG,...e),this._logHandler(this,ct.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,ct.VERBOSE,...e),this._logHandler(this,ct.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,ct.INFO,...e),this._logHandler(this,ct.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,ct.WARN,...e),this._logHandler(this,ct.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,ct.ERROR,...e),this._logHandler(this,ct.ERROR,...e)}}let ft,mt;const gt=new WeakMap,yt=new WeakMap,vt=new WeakMap,bt=new WeakMap,wt=new WeakMap;let _t={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return yt.get(e);if("objectStoreNames"===t)return e.objectStoreNames||vt.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Tt(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function It(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(mt||(mt=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(St(this),t),Tt(gt.get(this))}:function(...t){return Tt(e.apply(St(this),t))}:function(t,...r){const n=e.call(St(this),t,...r);return vt.set(n,t.sort?t.sort():[t]),Tt(n)}}function Et(e){return"function"==typeof e?It(e):(e instanceof IDBTransaction&&function(e){if(yt.has(e))return;const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",i),e.removeEventListener("abort",i)},s=()=>{t(),n()},i=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",s),e.addEventListener("error",i),e.addEventListener("abort",i)}));yt.set(e,t)}(e),t=e,(ft||(ft=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,_t):e);var t}function Tt(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("success",s),e.removeEventListener("error",i)},s=()=>{t(Tt(e.result)),n()},i=()=>{r(e.error),n()};e.addEventListener("success",s),e.addEventListener("error",i)}));return t.then((t=>{t instanceof IDBCursor&&gt.set(t,e)})).catch((()=>{})),wt.set(t,e),t}(e);if(bt.has(e))return bt.get(e);const t=Et(e);return t!==e&&(bt.set(e,t),wt.set(t,e)),t}const St=e=>wt.get(e);const Ct=["get","getKey","getAll","getAllKeys","count"],Rt=["put","add","delete","clear"],kt=new Map;function Ot(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(kt.get(t))return kt.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,s=Rt.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!s&&!Ct.includes(r))return;const i=async function(e,...t){const i=this.transaction(e,s?"readwrite":"readonly");let o=i.store;return n&&(o=o.index(t.shift())),(await Promise.all([o[r](...t),s&&i.done]))[0]};return kt.set(t,i),i}_t=(e=>({...e,get:(t,r,n)=>Ot(t,r)||e.get(t,r,n),has:(t,r)=>!!Ot(t,r)||e.has(t,r)}))(_t);
175
+ /**
176
+ * @license
177
+ * Copyright 2019 Google LLC
178
+ *
179
+ * Licensed under the Apache License, Version 2.0 (the "License");
180
+ * you may not use this file except in compliance with the License.
181
+ * You may obtain a copy of the License at
182
+ *
183
+ * http://www.apache.org/licenses/LICENSE-2.0
184
+ *
185
+ * Unless required by applicable law or agreed to in writing, software
186
+ * distributed under the License is distributed on an "AS IS" BASIS,
187
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
188
+ * See the License for the specific language governing permissions and
189
+ * limitations under the License.
190
+ */
191
+ class Pt{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const At="@firebase/app",Dt="0.11.1",Nt=new pt("@firebase/app"),Lt="@firebase/app-compat",Mt="@firebase/analytics-compat",Ut="@firebase/analytics",xt="@firebase/app-check-compat",Ft="@firebase/app-check",jt="@firebase/auth",qt="@firebase/auth-compat",Ht="@firebase/database",$t="@firebase/data-connect",Vt="@firebase/database-compat",Bt="@firebase/functions",zt="@firebase/functions-compat",Qt="@firebase/installations",Wt="@firebase/installations-compat",Kt="@firebase/messaging",Gt="@firebase/messaging-compat",Jt="@firebase/performance",Xt="@firebase/performance-compat",Yt="@firebase/remote-config",Zt="@firebase/remote-config-compat",er="@firebase/storage",tr="@firebase/storage-compat",rr="@firebase/firestore",nr="@firebase/vertexai",sr="@firebase/firestore-compat",ir="firebase",or="[DEFAULT]",ar={[At]:"fire-core",[Lt]:"fire-core-compat",[Ut]:"fire-analytics",[Mt]:"fire-analytics-compat",[Ft]:"fire-app-check",[xt]:"fire-app-check-compat",[jt]:"fire-auth",[qt]:"fire-auth-compat",[Ht]:"fire-rtdb",[$t]:"fire-data-connect",[Vt]:"fire-rtdb-compat",[Bt]:"fire-fn",[zt]:"fire-fn-compat",[Qt]:"fire-iid",[Wt]:"fire-iid-compat",[Kt]:"fire-fcm",[Gt]:"fire-fcm-compat",[Jt]:"fire-perf",[Xt]:"fire-perf-compat",[Yt]:"fire-rc",[Zt]:"fire-rc-compat",[er]:"fire-gcs",[tr]:"fire-gcs-compat",[rr]:"fire-fst",[sr]:"fire-fst-compat",[nr]:"fire-vertex","fire-js":"fire-js",[ir]:"fire-js-all"},cr=new Map,ur=new Map,hr=new Map;function lr(e,t){try{e.container.addComponent(t)}catch(r){Nt.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function dr(e){const t=e.name;if(hr.has(t))return Nt.debug(`There were multiple attempts to register component ${t}.`),!1;hr.set(t,e);for(const t of cr.values())lr(t,e);for(const t of ur.values())lr(t,e);return!0}function pr(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function fr(e){return null!=e&&void 0!==e.settings}
192
+ /**
193
+ * @license
194
+ * Copyright 2019 Google LLC
195
+ *
196
+ * Licensed under the Apache License, Version 2.0 (the "License");
197
+ * you may not use this file except in compliance with the License.
198
+ * You may obtain a copy of the License at
199
+ *
200
+ * http://www.apache.org/licenses/LICENSE-2.0
201
+ *
202
+ * Unless required by applicable law or agreed to in writing, software
203
+ * distributed under the License is distributed on an "AS IS" BASIS,
204
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ * See the License for the specific language governing permissions and
206
+ * limitations under the License.
207
+ */const mr=new Je("app","Firebase",{"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."});
208
+ /**
209
+ * @license
210
+ * Copyright 2019 Google LLC
211
+ *
212
+ * Licensed under the Apache License, Version 2.0 (the "License");
213
+ * you may not use this file except in compliance with the License.
214
+ * You may obtain a copy of the License at
215
+ *
216
+ * http://www.apache.org/licenses/LICENSE-2.0
217
+ *
218
+ * Unless required by applicable law or agreed to in writing, software
219
+ * distributed under the License is distributed on an "AS IS" BASIS,
220
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
221
+ * See the License for the specific language governing permissions and
222
+ * limitations under the License.
223
+ */
224
+ class gr{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new st("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 mr.create("app-deleted",{appName:this._name})}}
225
+ /**
226
+ * @license
227
+ * Copyright 2019 Google LLC
228
+ *
229
+ * Licensed under the Apache License, Version 2.0 (the "License");
230
+ * you may not use this file except in compliance with the License.
231
+ * You may obtain a copy of the License at
232
+ *
233
+ * http://www.apache.org/licenses/LICENSE-2.0
234
+ *
235
+ * Unless required by applicable law or agreed to in writing, software
236
+ * distributed under the License is distributed on an "AS IS" BASIS,
237
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
238
+ * See the License for the specific language governing permissions and
239
+ * limitations under the License.
240
+ */const yr="11.3.1";function vr(e,t={}){let r=e;if("object"!=typeof t){t={name:t}}const n=Object.assign({name:or,automaticDataCollectionEnabled:!1},t),s=n.name;if("string"!=typeof s||!s)throw mr.create("bad-app-name",{appName:String(s)});if(r||(r=ze()),!r)throw mr.create("no-options");const i=cr.get(s);if(i){if(Ye(r,i.options)&&Ye(n,i.config))return i;throw mr.create("duplicate-app",{appName:s})}const o=new at(s);for(const e of hr.values())o.addComponent(e);const a=new gr(r,n,o);return cr.set(s,a),a}function br(e,t,r){var n;let s=null!==(n=ar[e])&&void 0!==n?n:e;r&&(s+=`-${r}`);const i=s.match(/\s|\//),o=t.match(/\s|\//);if(i||o){const e=[`Unable to register library "${s}" with version "${t}":`];return i&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Nt.warn(e.join(" "))}dr(new st(`${s}-version`,(()=>({library:s,version:t})),"VERSION"))}
241
+ /**
242
+ * @license
243
+ * Copyright 2021 Google LLC
244
+ *
245
+ * Licensed under the Apache License, Version 2.0 (the "License");
246
+ * you may not use this file except in compliance with the License.
247
+ * You may obtain a copy of the License at
248
+ *
249
+ * http://www.apache.org/licenses/LICENSE-2.0
250
+ *
251
+ * Unless required by applicable law or agreed to in writing, software
252
+ * distributed under the License is distributed on an "AS IS" BASIS,
253
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
254
+ * See the License for the specific language governing permissions and
255
+ * limitations under the License.
256
+ */const wr="firebase-heartbeat-store";let _r=null;function Ir(){return _r||(_r=function(e,t,{blocked:r,upgrade:n,blocking:s,terminated:i}={}){const o=indexedDB.open(e,t),a=Tt(o);return n&&o.addEventListener("upgradeneeded",(e=>{n(Tt(o.result),e.oldVersion,e.newVersion,Tt(o.transaction),e)})),r&&o.addEventListener("blocked",(e=>r(e.oldVersion,e.newVersion,e))),a.then((e=>{i&&e.addEventListener("close",(()=>i())),s&&e.addEventListener("versionchange",(e=>s(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(wr)}catch(e){console.warn(e)}}}).catch((e=>{throw mr.create("idb-open",{originalErrorMessage:e.message})}))),_r}async function Er(e,t){try{const r=(await Ir()).transaction(wr,"readwrite"),n=r.objectStore(wr);await n.put(t,Tr(e)),await r.done}catch(e){if(e instanceof Ge)Nt.warn(e.message);else{const t=mr.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});Nt.warn(t.message)}}}function Tr(e){return`${e.name}!${e.options.appId}`}
257
+ /**
258
+ * @license
259
+ * Copyright 2021 Google LLC
260
+ *
261
+ * Licensed under the Apache License, Version 2.0 (the "License");
262
+ * you may not use this file except in compliance with the License.
263
+ * You may obtain a copy of the License at
264
+ *
265
+ * http://www.apache.org/licenses/LICENSE-2.0
266
+ *
267
+ * Unless required by applicable law or agreed to in writing, software
268
+ * distributed under the License is distributed on an "AS IS" BASIS,
269
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
270
+ * See the License for the specific language governing permissions and
271
+ * limitations under the License.
272
+ */class Sr{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Rr(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=Cr();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some((e=>e.date===n)))return;if(this._heartbeatsCache.heartbeats.push({date:n,agent:r}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t}
273
+ /**
274
+ * @license
275
+ * Copyright 2019 Google LLC
276
+ *
277
+ * Licensed under the Apache License, Version 2.0 (the "License");
278
+ * you may not use this file except in compliance with the License.
279
+ * You may obtain a copy of the License at
280
+ *
281
+ * http://www.apache.org/licenses/LICENSE-2.0
282
+ *
283
+ * Unless required by applicable law or agreed to in writing, software
284
+ * distributed under the License is distributed on an "AS IS" BASIS,
285
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286
+ * See the License for the specific language governing permissions and
287
+ * limitations under the License.
288
+ */(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Nt.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=Cr(),{heartbeatsToSend:r,unsentEntries:n}=function(e,t=1024){const r=[];let n=e.slice();for(const s of e){const e=r.find((e=>e.agent===s.agent));if(e){if(e.dates.push(s.date),kr(r)>t){e.dates.pop();break}}else if(r.push({agent:s.agent,dates:[s.date]}),kr(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),s=He(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return Nt.warn(e),""}}}function Cr(){return(new Date).toISOString().substring(0,10)}class Rr{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise(((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(n);s.onsuccess=()=>{s.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},s.onupgradeneeded=()=>{r=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Ir()).transaction(wr),r=await t.objectStore(wr).get(Tr(e));return await t.done,r}catch(e){if(e instanceof Ge)Nt.warn(e.message);else{const t=mr.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});Nt.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return Er(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return Er(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function kr(e){return He(JSON.stringify({version:2,heartbeats:e})).length}var Or;Or="",dr(new st("platform-logger",(e=>new Pt(e)),"PRIVATE")),dr(new st("heartbeat",(e=>new Sr(e)),"PRIVATE")),br(At,Dt,Or),br(At,Dt,"esm2017"),br("fire-js","");let Pr;
289
+ /**
290
+ * @license
291
+ * Copyright 2020 Google LLC
292
+ *
293
+ * Licensed under the Apache License, Version 2.0 (the "License");
294
+ * you may not use this file except in compliance with the License.
295
+ * You may obtain a copy of the License at
296
+ *
297
+ * http://www.apache.org/licenses/LICENSE-2.0
298
+ *
299
+ * Unless required by applicable law or agreed to in writing, software
300
+ * distributed under the License is distributed on an "AS IS" BASIS,
301
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
302
+ * See the License for the specific language governing permissions and
303
+ * limitations under the License.
304
+ */
305
+ br("firebase","11.3.1","app");const Ar=e=>(Pr||(Pr=vr(e)),Pr);function Dr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]])}return r}function Nr(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}"function"==typeof SuppressedError&&SuppressedError;const Lr=Nr,Mr=new Je("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Ur=new pt("@firebase/auth");function xr(e,...t){Ur.logLevel<=ct.ERROR&&Ur.error(`Auth (${yr}): ${e}`,...t)}
306
+ /**
307
+ * @license
308
+ * Copyright 2020 Google LLC
309
+ *
310
+ * Licensed under the Apache License, Version 2.0 (the "License");
311
+ * you may not use this file except in compliance with the License.
312
+ * You may obtain a copy of the License at
313
+ *
314
+ * http://www.apache.org/licenses/LICENSE-2.0
315
+ *
316
+ * Unless required by applicable law or agreed to in writing, software
317
+ * distributed under the License is distributed on an "AS IS" BASIS,
318
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
319
+ * See the License for the specific language governing permissions and
320
+ * limitations under the License.
321
+ */function Fr(e,...t){throw $r(e,...t)}function jr(e,...t){return $r(e,...t)}function qr(e,t,r){const n=Object.assign(Object.assign({},Lr()),{[t]:r});return new Je("auth","Firebase",n).create(t,{appName:e.name})}function Hr(e){return qr(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function $r(e,...t){if("string"!=typeof e){const r=t[0],n=[...t.slice(1)];return n[0]&&(n[0].appName=e.name),e._errorFactory.create(r,...n)}return Mr.create(e,...t)}function Vr(e,t,...r){if(!e)throw $r(t,...r)}function Br(e){const t="INTERNAL ASSERTION FAILED: "+e;throw xr(t),new Error(t)}function zr(e,t){e||Br(t)}
322
+ /**
323
+ * @license
324
+ * Copyright 2020 Google LLC
325
+ *
326
+ * Licensed under the Apache License, Version 2.0 (the "License");
327
+ * you may not use this file except in compliance with the License.
328
+ * You may obtain a copy of the License at
329
+ *
330
+ * http://www.apache.org/licenses/LICENSE-2.0
331
+ *
332
+ * Unless required by applicable law or agreed to in writing, software
333
+ * distributed under the License is distributed on an "AS IS" BASIS,
334
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
335
+ * See the License for the specific language governing permissions and
336
+ * limitations under the License.
337
+ */function Qr(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Wr(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}
338
+ /**
339
+ * @license
340
+ * Copyright 2020 Google LLC
341
+ *
342
+ * Licensed under the Apache License, Version 2.0 (the "License");
343
+ * you may not use this file except in compliance with the License.
344
+ * You may obtain a copy of the License at
345
+ *
346
+ * http://www.apache.org/licenses/LICENSE-2.0
347
+ *
348
+ * Unless required by applicable law or agreed to in writing, software
349
+ * distributed under the License is distributed on an "AS IS" BASIS,
350
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
351
+ * See the License for the specific language governing permissions and
352
+ * limitations under the License.
353
+ */function Kr(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Wr()&&"https:"!==Wr()&&!function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()&&!("connection"in navigator)||navigator.onLine}
354
+ /**
355
+ * @license
356
+ * Copyright 2020 Google LLC
357
+ *
358
+ * Licensed under the Apache License, Version 2.0 (the "License");
359
+ * you may not use this file except in compliance with the License.
360
+ * You may obtain a copy of the License at
361
+ *
362
+ * http://www.apache.org/licenses/LICENSE-2.0
363
+ *
364
+ * Unless required by applicable law or agreed to in writing, software
365
+ * distributed under the License is distributed on an "AS IS" BASIS,
366
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
367
+ * See the License for the specific language governing permissions and
368
+ * limitations under the License.
369
+ */
370
+ class Gr{constructor(e,t){this.shortDelay=e,this.longDelay=t,zr(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ke())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Kr()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
371
+ /**
372
+ * @license
373
+ * Copyright 2020 Google LLC
374
+ *
375
+ * Licensed under the Apache License, Version 2.0 (the "License");
376
+ * you may not use this file except in compliance with the License.
377
+ * You may obtain a copy of the License at
378
+ *
379
+ * http://www.apache.org/licenses/LICENSE-2.0
380
+ *
381
+ * Unless required by applicable law or agreed to in writing, software
382
+ * distributed under the License is distributed on an "AS IS" BASIS,
383
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
384
+ * See the License for the specific language governing permissions and
385
+ * limitations under the License.
386
+ */function Jr(e,t){zr(e.emulator,"Emulator should always be set here");const{url:r}=e.emulator;return t?`${r}${t.startsWith("/")?t.slice(1):t}`:r}
387
+ /**
388
+ * @license
389
+ * Copyright 2020 Google LLC
390
+ *
391
+ * Licensed under the Apache License, Version 2.0 (the "License");
392
+ * you may not use this file except in compliance with the License.
393
+ * You may obtain a copy of the License at
394
+ *
395
+ * http://www.apache.org/licenses/LICENSE-2.0
396
+ *
397
+ * Unless required by applicable law or agreed to in writing, software
398
+ * distributed under the License is distributed on an "AS IS" BASIS,
399
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
400
+ * See the License for the specific language governing permissions and
401
+ * limitations under the License.
402
+ */class Xr{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Br("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Br("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Br("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
403
+ /**
404
+ * @license
405
+ * Copyright 2020 Google LLC
406
+ *
407
+ * Licensed under the Apache License, Version 2.0 (the "License");
408
+ * you may not use this file except in compliance with the License.
409
+ * You may obtain a copy of the License at
410
+ *
411
+ * http://www.apache.org/licenses/LICENSE-2.0
412
+ *
413
+ * Unless required by applicable law or agreed to in writing, software
414
+ * distributed under the License is distributed on an "AS IS" BASIS,
415
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
416
+ * See the License for the specific language governing permissions and
417
+ * limitations under the License.
418
+ */const Yr={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Zr=new Gr(3e4,6e4);
419
+ /**
420
+ * @license
421
+ * Copyright 2020 Google LLC
422
+ *
423
+ * Licensed under the Apache License, Version 2.0 (the "License");
424
+ * you may not use this file except in compliance with the License.
425
+ * You may obtain a copy of the License at
426
+ *
427
+ * http://www.apache.org/licenses/LICENSE-2.0
428
+ *
429
+ * Unless required by applicable law or agreed to in writing, software
430
+ * distributed under the License is distributed on an "AS IS" BASIS,
431
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
432
+ * See the License for the specific language governing permissions and
433
+ * limitations under the License.
434
+ */function en(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function tn(e,t,r,n,s={}){return rn(e,s,(async()=>{let s={},i={};n&&("GET"===t?i=n:s={body:JSON.stringify(n)});const o=et(Object.assign({key:e.config.apiKey},i)).slice(1),a=await e._getAdditionalHeaders();a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode);const c=Object.assign({method:t,headers:a},s);return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="no-referrer"),Xr.fetch()(sn(e,e.config.apiHost,r,o),c)}))}async function rn(e,t,r){e._canInitEmulator=!1;const n=Object.assign(Object.assign({},Yr),t);try{const t=new on(e),s=await Promise.race([r(),t.promise]);t.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw an(e,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const t=s.ok?i.errorMessage:i.error.message,[r,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===r)throw an(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===r)throw an(e,"email-already-in-use",i);if("USER_DISABLED"===r)throw an(e,"user-disabled",i);const a=n[r]||r.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw qr(e,a,o);Fr(e,a)}}catch(t){if(t instanceof Ge)throw t;Fr(e,"network-request-failed",{message:String(t)})}}async function nn(e,t,r,n,s={}){const i=await tn(e,t,r,n,s);return"mfaPendingCredential"in i&&Fr(e,"multi-factor-auth-required",{_serverResponse:i}),i}function sn(e,t,r,n){const s=`${t}${r}?${n}`;return e.config.emulator?Jr(e.config,s):`${e.config.apiScheme}://${s}`}class on{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(jr(this.auth,"network-request-failed"))),Zr.get())}))}}function an(e,t,r){const n={appName:e.name};r.email&&(n.email=r.email),r.phoneNumber&&(n.phoneNumber=r.phoneNumber);const s=jr(e,t,n);return s.customData._tokenResponse=r,s}
435
+ /**
436
+ * @license
437
+ * Copyright 2020 Google LLC
438
+ *
439
+ * Licensed under the Apache License, Version 2.0 (the "License");
440
+ * you may not use this file except in compliance with the License.
441
+ * You may obtain a copy of the License at
442
+ *
443
+ * http://www.apache.org/licenses/LICENSE-2.0
444
+ *
445
+ * Unless required by applicable law or agreed to in writing, software
446
+ * distributed under the License is distributed on an "AS IS" BASIS,
447
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
448
+ * See the License for the specific language governing permissions and
449
+ * limitations under the License.
450
+ */async function cn(e,t){return tn(e,"POST","/v1/accounts:lookup",t)}
451
+ /**
452
+ * @license
453
+ * Copyright 2020 Google LLC
454
+ *
455
+ * Licensed under the Apache License, Version 2.0 (the "License");
456
+ * you may not use this file except in compliance with the License.
457
+ * You may obtain a copy of the License at
458
+ *
459
+ * http://www.apache.org/licenses/LICENSE-2.0
460
+ *
461
+ * Unless required by applicable law or agreed to in writing, software
462
+ * distributed under the License is distributed on an "AS IS" BASIS,
463
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
464
+ * See the License for the specific language governing permissions and
465
+ * limitations under the License.
466
+ */function un(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function hn(e){return 1e3*Number(e)}function ln(e){const[t,r,n]=e.split(".");if(void 0===t||void 0===r||void 0===n)return xr("JWT malformed, contained fewer than 3 sections"),null;try{const e=$e(r);return e?JSON.parse(e):(xr("Failed to decode base64 JWT payload"),null)}catch(e){return xr("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function dn(e){const t=ln(e);return Vr(t,"internal-error"),Vr(void 0!==t.exp,"internal-error"),Vr(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}
467
+ /**
468
+ * @license
469
+ * Copyright 2020 Google LLC
470
+ *
471
+ * Licensed under the Apache License, Version 2.0 (the "License");
472
+ * you may not use this file except in compliance with the License.
473
+ * You may obtain a copy of the License at
474
+ *
475
+ * http://www.apache.org/licenses/LICENSE-2.0
476
+ *
477
+ * Unless required by applicable law or agreed to in writing, software
478
+ * distributed under the License is distributed on an "AS IS" BASIS,
479
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
480
+ * See the License for the specific language governing permissions and
481
+ * limitations under the License.
482
+ */async function pn(e,t,r=!1){if(r)return t;try{return await t}catch(t){throw t instanceof Ge&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}
483
+ /**
484
+ * @license
485
+ * Copyright 2020 Google LLC
486
+ *
487
+ * Licensed under the Apache License, Version 2.0 (the "License");
488
+ * you may not use this file except in compliance with the License.
489
+ * You may obtain a copy of the License at
490
+ *
491
+ * http://www.apache.org/licenses/LICENSE-2.0
492
+ *
493
+ * Unless required by applicable law or agreed to in writing, software
494
+ * distributed under the License is distributed on an "AS IS" BASIS,
495
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
496
+ * See the License for the specific language governing permissions and
497
+ * limitations under the License.
498
+ */(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class fn{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null==e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}
499
+ /**
500
+ * @license
501
+ * Copyright 2020 Google LLC
502
+ *
503
+ * Licensed under the Apache License, Version 2.0 (the "License");
504
+ * you may not use this file except in compliance with the License.
505
+ * You may obtain a copy of the License at
506
+ *
507
+ * http://www.apache.org/licenses/LICENSE-2.0
508
+ *
509
+ * Unless required by applicable law or agreed to in writing, software
510
+ * distributed under the License is distributed on an "AS IS" BASIS,
511
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
512
+ * See the License for the specific language governing permissions and
513
+ * limitations under the License.
514
+ */class mn{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=un(this.lastLoginAt),this.creationTime=un(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
515
+ /**
516
+ * @license
517
+ * Copyright 2019 Google LLC
518
+ *
519
+ * Licensed under the Apache License, Version 2.0 (the "License");
520
+ * you may not use this file except in compliance with the License.
521
+ * You may obtain a copy of the License at
522
+ *
523
+ * http://www.apache.org/licenses/LICENSE-2.0
524
+ *
525
+ * Unless required by applicable law or agreed to in writing, software
526
+ * distributed under the License is distributed on an "AS IS" BASIS,
527
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
528
+ * See the License for the specific language governing permissions and
529
+ * limitations under the License.
530
+ */async function gn(e){var t;const r=e.auth,n=await e.getIdToken(),s=await pn(e,cn(r,{idToken:n}));Vr(null==s?void 0:s.users.length,r,"internal-error");const i=s.users[0];e._notifyReloadListener(i);const o=(null===(t=i.providerUserInfo)||void 0===t?void 0:t.length)?yn(i.providerUserInfo):[],a=(c=e.providerData,u=o,[...c.filter((e=>!u.some((t=>t.providerId===e.providerId)))),...u]);var c,u;const h=e.isAnonymous,l=!(e.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,p={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new mn(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(e,p)}function yn(e){return e.map((e=>{var{providerId:t}=e,r=Dr(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}}))}
531
+ /**
532
+ * @license
533
+ * Copyright 2020 Google LLC
534
+ *
535
+ * Licensed under the Apache License, Version 2.0 (the "License");
536
+ * you may not use this file except in compliance with the License.
537
+ * You may obtain a copy of the License at
538
+ *
539
+ * http://www.apache.org/licenses/LICENSE-2.0
540
+ *
541
+ * Unless required by applicable law or agreed to in writing, software
542
+ * distributed under the License is distributed on an "AS IS" BASIS,
543
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
544
+ * See the License for the specific language governing permissions and
545
+ * limitations under the License.
546
+ */
547
+ /**
548
+ * @license
549
+ * Copyright 2020 Google LLC
550
+ *
551
+ * Licensed under the Apache License, Version 2.0 (the "License");
552
+ * you may not use this file except in compliance with the License.
553
+ * You may obtain a copy of the License at
554
+ *
555
+ * http://www.apache.org/licenses/LICENSE-2.0
556
+ *
557
+ * Unless required by applicable law or agreed to in writing, software
558
+ * distributed under the License is distributed on an "AS IS" BASIS,
559
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
560
+ * See the License for the specific language governing permissions and
561
+ * limitations under the License.
562
+ */
563
+ class vn{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Vr(e.idToken,"internal-error"),Vr(void 0!==e.idToken,"internal-error"),Vr(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):dn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Vr(0!==e.length,"internal-error");const t=dn(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(Vr(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:n,expiresIn:s}=await async function(e,t){const r=await rn(e,{},(async()=>{const r=et({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:n,apiKey:s}=e.config,i=sn(e,n,"/v1/token",`key=${s}`),o=await e._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Xr.fetch()(i,{method:"POST",headers:o,body:r})}));return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}(e,t);this.updateTokensAndExpiration(r,n,Number(s))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){const{refreshToken:r,accessToken:n,expirationTime:s}=t,i=new vn;return r&&(Vr("string"==typeof r,"internal-error",{appName:e}),i.refreshToken=r),n&&(Vr("string"==typeof n,"internal-error",{appName:e}),i.accessToken=n),s&&(Vr("number"==typeof s,"internal-error",{appName:e}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new vn,this.toJSON())}_performRefresh(){return Br("not implemented")}}
564
+ /**
565
+ * @license
566
+ * Copyright 2020 Google LLC
567
+ *
568
+ * Licensed under the Apache License, Version 2.0 (the "License");
569
+ * you may not use this file except in compliance with the License.
570
+ * You may obtain a copy of the License at
571
+ *
572
+ * http://www.apache.org/licenses/LICENSE-2.0
573
+ *
574
+ * Unless required by applicable law or agreed to in writing, software
575
+ * distributed under the License is distributed on an "AS IS" BASIS,
576
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
577
+ * See the License for the specific language governing permissions and
578
+ * limitations under the License.
579
+ */function bn(e,t){Vr("string"==typeof e||void 0===e,"internal-error",{appName:t})}class wn{constructor(e){var{uid:t,auth:r,stsTokenManager:n}=e,s=Dr(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new fn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new mn(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await pn(this,this.stsTokenManager.getToken(this.auth,e));return Vr(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const r=nt(e),n=await r.getIdToken(t),s=ln(n);Vr(s&&s.exp&&s.auth_time&&s.iat,r.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:n,authTime:un(hn(s.auth_time)),issuedAtTime:un(hn(s.iat)),expirationTime:un(hn(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=nt(e);await gn(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Vr(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new wn(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){Vr(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await gn(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(fr(this.auth.app))return Promise.reject(Hr(this.auth));const e=await this.getIdToken();return await pn(this,async function(e,t){return tn(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r,n,s,i,o,a,c,u;const h=null!==(r=t.displayName)&&void 0!==r?r:void 0,l=null!==(n=t.email)&&void 0!==n?n:void 0,d=null!==(s=t.phoneNumber)&&void 0!==s?s:void 0,p=null!==(i=t.photoURL)&&void 0!==i?i:void 0,f=null!==(o=t.tenantId)&&void 0!==o?o:void 0,m=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,g=null!==(c=t.createdAt)&&void 0!==c?c:void 0,y=null!==(u=t.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:b,isAnonymous:w,providerData:_,stsTokenManager:I}=t;Vr(v&&I,e,"internal-error");const E=vn.fromJSON(this.name,I);Vr("string"==typeof v,e,"internal-error"),bn(h,e.name),bn(l,e.name),Vr("boolean"==typeof b,e,"internal-error"),Vr("boolean"==typeof w,e,"internal-error"),bn(d,e.name),bn(p,e.name),bn(f,e.name),bn(m,e.name),bn(g,e.name),bn(y,e.name);const T=new wn({uid:v,auth:e,email:l,emailVerified:b,displayName:h,isAnonymous:w,photoURL:p,phoneNumber:d,tenantId:f,stsTokenManager:E,createdAt:g,lastLoginAt:y});return _&&Array.isArray(_)&&(T.providerData=_.map((e=>Object.assign({},e)))),m&&(T._redirectEventId=m),T}static async _fromIdTokenResponse(e,t,r=!1){const n=new vn;n.updateFromServerResponse(t);const s=new wn({uid:t.localId,auth:e,stsTokenManager:n,isAnonymous:r});return await gn(s),s}static async _fromGetAccountInfoResponse(e,t,r){const n=t.users[0];Vr(void 0!==n.localId,"internal-error");const s=void 0!==n.providerUserInfo?yn(n.providerUserInfo):[],i=!(n.email&&n.passwordHash||(null==s?void 0:s.length)),o=new vn;o.updateFromIdToken(r);const a=new wn({uid:n.localId,auth:e,stsTokenManager:o,isAnonymous:i}),c={uid:n.localId,displayName:n.displayName||null,photoURL:n.photoUrl||null,email:n.email||null,emailVerified:n.emailVerified||!1,phoneNumber:n.phoneNumber||null,tenantId:n.tenantId||null,providerData:s,metadata:new mn(n.createdAt,n.lastLoginAt),isAnonymous:!(n.email&&n.passwordHash||(null==s?void 0:s.length))};return Object.assign(a,c),a}}
580
+ /**
581
+ * @license
582
+ * Copyright 2020 Google LLC
583
+ *
584
+ * Licensed under the Apache License, Version 2.0 (the "License");
585
+ * you may not use this file except in compliance with the License.
586
+ * You may obtain a copy of the License at
587
+ *
588
+ * http://www.apache.org/licenses/LICENSE-2.0
589
+ *
590
+ * Unless required by applicable law or agreed to in writing, software
591
+ * distributed under the License is distributed on an "AS IS" BASIS,
592
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
593
+ * See the License for the specific language governing permissions and
594
+ * limitations under the License.
595
+ */const _n=new Map;function In(e){zr(e instanceof Function,"Expected a class definition");let t=_n.get(e);return t?(zr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,_n.set(e,t),t)}
596
+ /**
597
+ * @license
598
+ * Copyright 2019 Google LLC
599
+ *
600
+ * Licensed under the Apache License, Version 2.0 (the "License");
601
+ * you may not use this file except in compliance with the License.
602
+ * You may obtain a copy of the License at
603
+ *
604
+ * http://www.apache.org/licenses/LICENSE-2.0
605
+ *
606
+ * Unless required by applicable law or agreed to in writing, software
607
+ * distributed under the License is distributed on an "AS IS" BASIS,
608
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
609
+ * See the License for the specific language governing permissions and
610
+ * limitations under the License.
611
+ */class En{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}En.type="NONE";const Tn=En;
612
+ /**
613
+ * @license
614
+ * Copyright 2019 Google LLC
615
+ *
616
+ * Licensed under the Apache License, Version 2.0 (the "License");
617
+ * you may not use this file except in compliance with the License.
618
+ * You may obtain a copy of the License at
619
+ *
620
+ * http://www.apache.org/licenses/LICENSE-2.0
621
+ *
622
+ * Unless required by applicable law or agreed to in writing, software
623
+ * distributed under the License is distributed on an "AS IS" BASIS,
624
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
625
+ * See the License for the specific language governing permissions and
626
+ * limitations under the License.
627
+ */function Sn(e,t,r){return`firebase:${e}:${t}:${r}`}class Cn{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:n,name:s}=this.auth;this.fullUserKey=Sn(this.userKey,n.apiKey,s),this.fullPersistenceKey=Sn("persistence",n.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?wn._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new Cn(In(Tn),e,r);const n=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let s=n[0]||In(Tn);const i=Sn(r,e.config.apiKey,e.name);let o=null;for(const r of t)try{const t=await r._get(i);if(t){const n=wn._fromJSON(e,t);r!==s&&(o=n),s=r;break}}catch(e){}const a=n.filter((e=>e._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(t.map((async e=>{if(e!==s)try{await e._remove(i)}catch(e){}}))),new Cn(s,e,r)):new Cn(s,e,r)}}
628
+ /**
629
+ * @license
630
+ * Copyright 2020 Google LLC
631
+ *
632
+ * Licensed under the Apache License, Version 2.0 (the "License");
633
+ * you may not use this file except in compliance with the License.
634
+ * You may obtain a copy of the License at
635
+ *
636
+ * http://www.apache.org/licenses/LICENSE-2.0
637
+ *
638
+ * Unless required by applicable law or agreed to in writing, software
639
+ * distributed under the License is distributed on an "AS IS" BASIS,
640
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
641
+ * See the License for the specific language governing permissions and
642
+ * limitations under the License.
643
+ */function Rn(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(An(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(kn(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Nn(t))return"Blackberry";if(Ln(t))return"Webos";if(On(t))return"Safari";if((t.includes("chrome/")||Pn(t))&&!t.includes("edge/"))return"Chrome";if(Dn(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=e.match(t);if(2===(null==r?void 0:r.length))return r[1]}return"Other"}function kn(e=Ke()){return/firefox\//i.test(e)}function On(e=Ke()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Pn(e=Ke()){return/crios\//i.test(e)}function An(e=Ke()){return/iemobile/i.test(e)}function Dn(e=Ke()){return/android/i.test(e)}function Nn(e=Ke()){return/blackberry/i.test(e)}function Ln(e=Ke()){return/webos/i.test(e)}function Mn(e=Ke()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Un(){return function(){const e=Ke();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function xn(e=Ke()){return Mn(e)||Dn(e)||Ln(e)||Nn(e)||/windows phone/i.test(e)||An(e)}
644
+ /**
645
+ * @license
646
+ * Copyright 2020 Google LLC
647
+ *
648
+ * Licensed under the Apache License, Version 2.0 (the "License");
649
+ * you may not use this file except in compliance with the License.
650
+ * You may obtain a copy of the License at
651
+ *
652
+ * http://www.apache.org/licenses/LICENSE-2.0
653
+ *
654
+ * Unless required by applicable law or agreed to in writing, software
655
+ * distributed under the License is distributed on an "AS IS" BASIS,
656
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
657
+ * See the License for the specific language governing permissions and
658
+ * limitations under the License.
659
+ */function Fn(e,t=[]){let r;switch(e){case"Browser":r=Rn(Ke());break;case"Worker":r=`${Rn(Ke())}-${e}`;break;default:r=e}const n=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${yr}/${n}`}
660
+ /**
661
+ * @license
662
+ * Copyright 2022 Google LLC
663
+ *
664
+ * Licensed under the Apache License, Version 2.0 (the "License");
665
+ * you may not use this file except in compliance with the License.
666
+ * You may obtain a copy of the License at
667
+ *
668
+ * http://www.apache.org/licenses/LICENSE-2.0
669
+ *
670
+ * Unless required by applicable law or agreed to in writing, software
671
+ * distributed under the License is distributed on an "AS IS" BASIS,
672
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
673
+ * See the License for the specific language governing permissions and
674
+ * limitations under the License.
675
+ */class jn{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=t=>new Promise(((r,n)=>{try{r(e(t))}catch(e){n(e)}}));r.onAbort=t,this.queue.push(r);const n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}
676
+ /**
677
+ * @license
678
+ * Copyright 2023 Google LLC
679
+ *
680
+ * Licensed under the Apache License, Version 2.0 (the "License");
681
+ * you may not use this file except in compliance with the License.
682
+ * You may obtain a copy of the License at
683
+ *
684
+ * http://www.apache.org/licenses/LICENSE-2.0
685
+ *
686
+ * Unless required by applicable law or agreed to in writing, software
687
+ * distributed under the License is distributed on an "AS IS" BASIS,
688
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
689
+ * See the License for the specific language governing permissions and
690
+ * limitations under the License.
691
+ */class qn{constructor(e){var t,r,n,s;const i=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=i.minPasswordLength)&&void 0!==t?t:6,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),void 0!==i.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),void 0!==i.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),void 0!==i.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),void 0!==i.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(n=null===(r=e.allowedNonAlphanumericCharacters)||void 0===r?void 0:r.join(""))&&void 0!==n?n:"",this.forceUpgradeOnSignin=null!==(s=e.forceUpgradeOnSignin)&&void 0!==s&&s,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,n,s,i,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(r=a.meetsMaxPasswordLength)||void 0===r||r),a.isValid&&(a.isValid=null===(n=a.containsLowercaseLetter)||void 0===n||n),a.isValid&&(a.isValid=null===(s=a.containsUppercaseLetter)||void 0===s||s),a.isValid&&(a.isValid=null===(i=a.containsNumericCharacter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,n=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),n&&(t.meetsMaxPasswordLength=e.length<=n)}validatePasswordCharacterOptions(e,t){let r;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let n=0;n<e.length;n++)r=e.charAt(n),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,n,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=n)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}
692
+ /**
693
+ * @license
694
+ * Copyright 2020 Google LLC
695
+ *
696
+ * Licensed under the Apache License, Version 2.0 (the "License");
697
+ * you may not use this file except in compliance with the License.
698
+ * You may obtain a copy of the License at
699
+ *
700
+ * http://www.apache.org/licenses/LICENSE-2.0
701
+ *
702
+ * Unless required by applicable law or agreed to in writing, software
703
+ * distributed under the License is distributed on an "AS IS" BASIS,
704
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
705
+ * See the License for the specific language governing permissions and
706
+ * limitations under the License.
707
+ */class Hn{constructor(e,t,r,n){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Vn(this),this.idTokenSubscription=new Vn(this),this.beforeStateQueue=new jn(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Mr,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=In(t)),this._initializationPromise=this.queue((async()=>{var r,n;if(!this._deleted&&(this.persistenceManager=await Cn.create(this,e),!this._deleted)){if(null===(r=this._popupRedirectResolver)||void 0===r?void 0:r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(n=this.currentUser)||void 0===n?void 0:n.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await cn(this,{idToken:e}),r=await wn._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(fr(this.app)){const e=this.app.settings.authIdToken;return e?new Promise((t=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(e).then(t,t)))})):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let n=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const r=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,i=null==n?void 0:n._redirectEventId,o=await this.tryRedirectSignIn(e);r&&r!==i||!(null==o?void 0:o.user)||(n=o.user,s=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=r,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(e)))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return Vr(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await gn(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(fr(this.app))return Promise.reject(Hr(this));const t=e?nt(e):null;return t&&Vr(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&Vr(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return fr(this.app)?Promise.reject(Hr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return fr(this.app)?Promise.reject(Hr(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(In(e))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return tn(e,"GET","/v2/passwordPolicy",en(e,t))}
708
+ /**
709
+ * @license
710
+ * Copyright 2023 Google LLC
711
+ *
712
+ * Licensed under the Apache License, Version 2.0 (the "License");
713
+ * you may not use this file except in compliance with the License.
714
+ * You may obtain a copy of the License at
715
+ *
716
+ * http://www.apache.org/licenses/LICENSE-2.0
717
+ *
718
+ * Unless required by applicable law or agreed to in writing, software
719
+ * distributed under the License is distributed on an "AS IS" BASIS,
720
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
721
+ * See the License for the specific language governing permissions and
722
+ * limitations under the License.
723
+ */(this),t=new qn(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Je("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise(((e,t)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged((()=>{r(),e()}),t)}}))}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return tn(e,"POST","/v2/accounts:revokeToken",en(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return null===e?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&In(e)||this._popupRedirectResolver;Vr(t,this,"argument-error"),this.redirectPersistenceManager=await Cn.create(this,[In(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(r=this.redirectUser)||void 0===r?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,n){if(this._deleted)return()=>{};const s="function"==typeof t?t:t.next.bind(t);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Vr(o,this,"internal-error"),o.then((()=>{i||s(this.currentUser)})),"function"==typeof t){const s=e.addObserver(t,r,n);return()=>{i=!0,s()}}{const r=e.addObserver(t);return()=>{i=!0,r()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Vr(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Fn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);const n=await this._getAppCheckToken();return n&&(t["X-Firebase-AppCheck"]=n),t}async _getAppCheckToken(){var e;if(fr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){Ur.logLevel<=ct.WARN&&Ur.warn(`Auth (${yr}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function $n(e){return nt(e)}class Vn{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const r=new tt(e,t);return r.subscribe.bind(r)}((e=>this.observer=e))}get next(){return Vr(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
724
+ /**
725
+ * @license
726
+ * Copyright 2020 Google LLC
727
+ *
728
+ * Licensed under the Apache License, Version 2.0 (the "License");
729
+ * you may not use this file except in compliance with the License.
730
+ * You may obtain a copy of the License at
731
+ *
732
+ * http://www.apache.org/licenses/LICENSE-2.0
733
+ *
734
+ * Unless required by applicable law or agreed to in writing, software
735
+ * distributed under the License is distributed on an "AS IS" BASIS,
736
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
737
+ * See the License for the specific language governing permissions and
738
+ * limitations under the License.
739
+ */let Bn={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function zn(e,t,r){const n=$n(e);Vr(n._canInitEmulator,n,"emulator-config-failed"),Vr(/^https?:\/\//.test(t),n,"invalid-emulator-scheme");const s=Qn(t),{host:i,port:o}=function(e){const t=Qn(e),r=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!r)return{host:"",port:null};const n=r[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(n);if(s){const e=s[1];return{host:e,port:Wn(n.substr(e.length+1))}}{const[e,t]=n.split(":");return{host:e,port:Wn(t)}}}(t),a=null===o?"":`:${o}`;n.config.emulator={url:`${s}//${i}${a}/`},n.settings.appVerificationDisabledForTesting=!0,n.emulatorConfig=Object.freeze({host:i,port:o,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:!1})}),function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}
740
+ /**
741
+ * @license
742
+ * Copyright 2020 Google LLC
743
+ *
744
+ * Licensed under the Apache License, Version 2.0 (the "License");
745
+ * you may not use this file except in compliance with the License.
746
+ * You may obtain a copy of the License at
747
+ *
748
+ * http://www.apache.org/licenses/LICENSE-2.0
749
+ *
750
+ * Unless required by applicable law or agreed to in writing, software
751
+ * distributed under the License is distributed on an "AS IS" BASIS,
752
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
753
+ * See the License for the specific language governing permissions and
754
+ * limitations under the License.
755
+ */()}function Qn(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Wn(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Kn{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Br("not implemented")}_getIdTokenResponse(e){return Br("not implemented")}_linkToIdToken(e,t){return Br("not implemented")}_getReauthenticationResolver(e){return Br("not implemented")}}
756
+ /**
757
+ * @license
758
+ * Copyright 2020 Google LLC
759
+ *
760
+ * Licensed under the Apache License, Version 2.0 (the "License");
761
+ * you may not use this file except in compliance with the License.
762
+ * You may obtain a copy of the License at
763
+ *
764
+ * http://www.apache.org/licenses/LICENSE-2.0
765
+ *
766
+ * Unless required by applicable law or agreed to in writing, software
767
+ * distributed under the License is distributed on an "AS IS" BASIS,
768
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
769
+ * See the License for the specific language governing permissions and
770
+ * limitations under the License.
771
+ */async function Gn(e,t){return nn(e,"POST","/v1/accounts:signInWithIdp",en(e,t))}
772
+ /**
773
+ * @license
774
+ * Copyright 2020 Google LLC
775
+ *
776
+ * Licensed under the Apache License, Version 2.0 (the "License");
777
+ * you may not use this file except in compliance with the License.
778
+ * You may obtain a copy of the License at
779
+ *
780
+ * http://www.apache.org/licenses/LICENSE-2.0
781
+ *
782
+ * Unless required by applicable law or agreed to in writing, software
783
+ * distributed under the License is distributed on an "AS IS" BASIS,
784
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
785
+ * See the License for the specific language governing permissions and
786
+ * limitations under the License.
787
+ */class Jn extends Kn{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Jn(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Fr("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:r,signInMethod:n}=t,s=Dr(t,["providerId","signInMethod"]);if(!r||!n)return null;const i=new Jn(r,n);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(e){return Gn(e,this.buildRequest())}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,Gn(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Gn(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=et(t)}return e}}
788
+ /**
789
+ * @license
790
+ * Copyright 2020 Google LLC
791
+ *
792
+ * Licensed under the Apache License, Version 2.0 (the "License");
793
+ * you may not use this file except in compliance with the License.
794
+ * You may obtain a copy of the License at
795
+ *
796
+ * http://www.apache.org/licenses/LICENSE-2.0
797
+ *
798
+ * Unless required by applicable law or agreed to in writing, software
799
+ * distributed under the License is distributed on an "AS IS" BASIS,
800
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
801
+ * See the License for the specific language governing permissions and
802
+ * limitations under the License.
803
+ */class Xn{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}
804
+ /**
805
+ * @license
806
+ * Copyright 2019 Google LLC
807
+ *
808
+ * Licensed under the Apache License, Version 2.0 (the "License");
809
+ * you may not use this file except in compliance with the License.
810
+ * You may obtain a copy of the License at
811
+ *
812
+ * http://www.apache.org/licenses/LICENSE-2.0
813
+ *
814
+ * Unless required by applicable law or agreed to in writing, software
815
+ * distributed under the License is distributed on an "AS IS" BASIS,
816
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
817
+ * See the License for the specific language governing permissions and
818
+ * limitations under the License.
819
+ */class Yn extends Xn{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}
820
+ /**
821
+ * @license
822
+ * Copyright 2020 Google LLC
823
+ *
824
+ * Licensed under the Apache License, Version 2.0 (the "License");
825
+ * you may not use this file except in compliance with the License.
826
+ * You may obtain a copy of the License at
827
+ *
828
+ * http://www.apache.org/licenses/LICENSE-2.0
829
+ *
830
+ * Unless required by applicable law or agreed to in writing, software
831
+ * distributed under the License is distributed on an "AS IS" BASIS,
832
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
833
+ * See the License for the specific language governing permissions and
834
+ * limitations under the License.
835
+ */class Zn extends Yn{constructor(){super("facebook.com")}static credential(e){return Jn._fromParams({providerId:Zn.PROVIDER_ID,signInMethod:Zn.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Zn.credentialFromTaggedObject(e)}static credentialFromError(e){return Zn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Zn.credential(e.oauthAccessToken)}catch(e){return null}}}Zn.FACEBOOK_SIGN_IN_METHOD="facebook.com",Zn.PROVIDER_ID="facebook.com";
836
+ /**
837
+ * @license
838
+ * Copyright 2020 Google LLC
839
+ *
840
+ * Licensed under the Apache License, Version 2.0 (the "License");
841
+ * you may not use this file except in compliance with the License.
842
+ * You may obtain a copy of the License at
843
+ *
844
+ * http://www.apache.org/licenses/LICENSE-2.0
845
+ *
846
+ * Unless required by applicable law or agreed to in writing, software
847
+ * distributed under the License is distributed on an "AS IS" BASIS,
848
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
849
+ * See the License for the specific language governing permissions and
850
+ * limitations under the License.
851
+ */
852
+ class es extends Yn{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Jn._fromParams({providerId:es.PROVIDER_ID,signInMethod:es.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return es.credentialFromTaggedObject(e)}static credentialFromError(e){return es.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return es.credential(t,r)}catch(e){return null}}}es.GOOGLE_SIGN_IN_METHOD="google.com",es.PROVIDER_ID="google.com";
853
+ /**
854
+ * @license
855
+ * Copyright 2020 Google LLC
856
+ *
857
+ * Licensed under the Apache License, Version 2.0 (the "License");
858
+ * you may not use this file except in compliance with the License.
859
+ * You may obtain a copy of the License at
860
+ *
861
+ * http://www.apache.org/licenses/LICENSE-2.0
862
+ *
863
+ * Unless required by applicable law or agreed to in writing, software
864
+ * distributed under the License is distributed on an "AS IS" BASIS,
865
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
866
+ * See the License for the specific language governing permissions and
867
+ * limitations under the License.
868
+ */
869
+ class ts extends Yn{constructor(){super("github.com")}static credential(e){return Jn._fromParams({providerId:ts.PROVIDER_ID,signInMethod:ts.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ts.credentialFromTaggedObject(e)}static credentialFromError(e){return ts.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ts.credential(e.oauthAccessToken)}catch(e){return null}}}ts.GITHUB_SIGN_IN_METHOD="github.com",ts.PROVIDER_ID="github.com";
870
+ /**
871
+ * @license
872
+ * Copyright 2020 Google LLC
873
+ *
874
+ * Licensed under the Apache License, Version 2.0 (the "License");
875
+ * you may not use this file except in compliance with the License.
876
+ * You may obtain a copy of the License at
877
+ *
878
+ * http://www.apache.org/licenses/LICENSE-2.0
879
+ *
880
+ * Unless required by applicable law or agreed to in writing, software
881
+ * distributed under the License is distributed on an "AS IS" BASIS,
882
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
883
+ * See the License for the specific language governing permissions and
884
+ * limitations under the License.
885
+ */
886
+ class rs extends Yn{constructor(){super("twitter.com")}static credential(e,t){return Jn._fromParams({providerId:rs.PROVIDER_ID,signInMethod:rs.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return rs.credentialFromTaggedObject(e)}static credentialFromError(e){return rs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return rs.credential(t,r)}catch(e){return null}}}rs.TWITTER_SIGN_IN_METHOD="twitter.com",rs.PROVIDER_ID="twitter.com";
887
+ /**
888
+ * @license
889
+ * Copyright 2020 Google LLC
890
+ *
891
+ * Licensed under the Apache License, Version 2.0 (the "License");
892
+ * you may not use this file except in compliance with the License.
893
+ * You may obtain a copy of the License at
894
+ *
895
+ * http://www.apache.org/licenses/LICENSE-2.0
896
+ *
897
+ * Unless required by applicable law or agreed to in writing, software
898
+ * distributed under the License is distributed on an "AS IS" BASIS,
899
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
900
+ * See the License for the specific language governing permissions and
901
+ * limitations under the License.
902
+ */
903
+ class ns{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,n=!1){const s=await wn._fromIdTokenResponse(e,r,n),i=ss(r);return new ns({user:s,providerId:i,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const n=ss(r);return new ns({user:e,providerId:n,_tokenResponse:r,operationType:t})}}function ss(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}
904
+ /**
905
+ * @license
906
+ * Copyright 2020 Google LLC
907
+ *
908
+ * Licensed under the Apache License, Version 2.0 (the "License");
909
+ * you may not use this file except in compliance with the License.
910
+ * You may obtain a copy of the License at
911
+ *
912
+ * http://www.apache.org/licenses/LICENSE-2.0
913
+ *
914
+ * Unless required by applicable law or agreed to in writing, software
915
+ * distributed under the License is distributed on an "AS IS" BASIS,
916
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
917
+ * See the License for the specific language governing permissions and
918
+ * limitations under the License.
919
+ */class is extends Ge{constructor(e,t,r,n){var s;super(t.code,t.message),this.operationType=r,this.user=n,Object.setPrototypeOf(this,is.prototype),this.customData={appName:e.name,tenantId:null!==(s=e.tenantId)&&void 0!==s?s:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,n){return new is(e,t,r,n)}}function os(e,t,r,n){return("reauthenticate"===t?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch((r=>{if("auth/multi-factor-auth-required"===r.code)throw is._fromErrorAndOperation(e,r,t,n);throw r}))}
920
+ /**
921
+ * @license
922
+ * Copyright 2020 Google LLC
923
+ *
924
+ * Licensed under the Apache License, Version 2.0 (the "License");
925
+ * you may not use this file except in compliance with the License.
926
+ * You may obtain a copy of the License at
927
+ *
928
+ * http://www.apache.org/licenses/LICENSE-2.0
929
+ *
930
+ * Unless required by applicable law or agreed to in writing, software
931
+ * distributed under the License is distributed on an "AS IS" BASIS,
932
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
933
+ * See the License for the specific language governing permissions and
934
+ * limitations under the License.
935
+ */
936
+ async function as(e,t){if(fr(e.app))return Promise.reject(Hr(e));const r=$n(e),n=
937
+ /**
938
+ * @license
939
+ * Copyright 2020 Google LLC
940
+ *
941
+ * Licensed under the Apache License, Version 2.0 (the "License");
942
+ * you may not use this file except in compliance with the License.
943
+ * You may obtain a copy of the License at
944
+ *
945
+ * http://www.apache.org/licenses/LICENSE-2.0
946
+ *
947
+ * Unless required by applicable law or agreed to in writing, software
948
+ * distributed under the License is distributed on an "AS IS" BASIS,
949
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
950
+ * See the License for the specific language governing permissions and
951
+ * limitations under the License.
952
+ */await async function(e,t){return nn(e,"POST","/v1/accounts:signInWithCustomToken",en(e,t))}(r,{token:t,returnSecureToken:!0}),s=await ns._fromIdTokenResponse(r,"signIn",n);return await r._updateCurrentUser(s.user),s}
953
+ /**
954
+ * @license
955
+ * Copyright 2020 Google LLC
956
+ *
957
+ * Licensed under the Apache License, Version 2.0 (the "License");
958
+ * you may not use this file except in compliance with the License.
959
+ * You may obtain a copy of the License at
960
+ *
961
+ * http://www.apache.org/licenses/LICENSE-2.0
962
+ *
963
+ * Unless required by applicable law or agreed to in writing, software
964
+ * distributed under the License is distributed on an "AS IS" BASIS,
965
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
966
+ * See the License for the specific language governing permissions and
967
+ * limitations under the License.
968
+ */const cs="__sak";
969
+ /**
970
+ * @license
971
+ * Copyright 2019 Google LLC
972
+ *
973
+ * Licensed under the Apache License, Version 2.0 (the "License");
974
+ * you may not use this file except in compliance with the License.
975
+ * You may obtain a copy of the License at
976
+ *
977
+ * http://www.apache.org/licenses/LICENSE-2.0
978
+ *
979
+ * Unless required by applicable law or agreed to in writing, software
980
+ * distributed under the License is distributed on an "AS IS" BASIS,
981
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
982
+ * See the License for the specific language governing permissions and
983
+ * limitations under the License.
984
+ */class us{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(cs,"1"),this.storage.removeItem(cs),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}
985
+ /**
986
+ * @license
987
+ * Copyright 2020 Google LLC
988
+ *
989
+ * Licensed under the Apache License, Version 2.0 (the "License");
990
+ * you may not use this file except in compliance with the License.
991
+ * You may obtain a copy of the License at
992
+ *
993
+ * http://www.apache.org/licenses/LICENSE-2.0
994
+ *
995
+ * Unless required by applicable law or agreed to in writing, software
996
+ * distributed under the License is distributed on an "AS IS" BASIS,
997
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
998
+ * See the License for the specific language governing permissions and
999
+ * limitations under the License.
1000
+ */class hs extends us{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=xn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),n=this.localCache[t];r!==n&&e(t,n,r)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys(((e,t,r)=>{this.notifyListeners(e,r)}));const r=e.key;t?this.detachListener():this.stopPolling();const n=()=>{const e=this.storage.getItem(r);(t||this.localCache[r]!==e)&&this.notifyListeners(r,e)},s=this.storage.getItem(r);Un()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,10):n()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const e of Array.from(r))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}hs.type="LOCAL";const ls=hs;
1001
+ /**
1002
+ * @license
1003
+ * Copyright 2020 Google LLC
1004
+ *
1005
+ * Licensed under the Apache License, Version 2.0 (the "License");
1006
+ * you may not use this file except in compliance with the License.
1007
+ * You may obtain a copy of the License at
1008
+ *
1009
+ * http://www.apache.org/licenses/LICENSE-2.0
1010
+ *
1011
+ * Unless required by applicable law or agreed to in writing, software
1012
+ * distributed under the License is distributed on an "AS IS" BASIS,
1013
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1014
+ * See the License for the specific language governing permissions and
1015
+ * limitations under the License.
1016
+ */class ds extends us{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}ds.type="SESSION";const ps=ds;
1017
+ /**
1018
+ * @license
1019
+ * Copyright 2019 Google LLC
1020
+ *
1021
+ * Licensed under the Apache License, Version 2.0 (the "License");
1022
+ * you may not use this file except in compliance with the License.
1023
+ * You may obtain a copy of the License at
1024
+ *
1025
+ * http://www.apache.org/licenses/LICENSE-2.0
1026
+ *
1027
+ * Unless required by applicable law or agreed to in writing, software
1028
+ * distributed under the License is distributed on an "AS IS" BASIS,
1029
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1030
+ * See the License for the specific language governing permissions and
1031
+ * limitations under the License.
1032
+ */
1033
+ /**
1034
+ * @license
1035
+ * Copyright 2019 Google LLC
1036
+ *
1037
+ * Licensed under the Apache License, Version 2.0 (the "License");
1038
+ * you may not use this file except in compliance with the License.
1039
+ * You may obtain a copy of the License at
1040
+ *
1041
+ * http://www.apache.org/licenses/LICENSE-2.0
1042
+ *
1043
+ * Unless required by applicable law or agreed to in writing, software
1044
+ * distributed under the License is distributed on an "AS IS" BASIS,
1045
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1046
+ * See the License for the specific language governing permissions and
1047
+ * limitations under the License.
1048
+ */
1049
+ class fs{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const r=new fs(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:n,data:s}=t.data,i=this.handlersMap[n];if(!(null==i?void 0:i.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:n});const o=Array.from(i).map((async e=>e(t.origin,s))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})))}(o);t.ports[0].postMessage({status:"done",eventId:r,eventType:n,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
1050
+ /**
1051
+ * @license
1052
+ * Copyright 2020 Google LLC
1053
+ *
1054
+ * Licensed under the Apache License, Version 2.0 (the "License");
1055
+ * you may not use this file except in compliance with the License.
1056
+ * You may obtain a copy of the License at
1057
+ *
1058
+ * http://www.apache.org/licenses/LICENSE-2.0
1059
+ *
1060
+ * Unless required by applicable law or agreed to in writing, software
1061
+ * distributed under the License is distributed on an "AS IS" BASIS,
1062
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1063
+ * See the License for the specific language governing permissions and
1064
+ * limitations under the License.
1065
+ */
1066
+ function ms(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}
1067
+ /**
1068
+ * @license
1069
+ * Copyright 2019 Google LLC
1070
+ *
1071
+ * Licensed under the Apache License, Version 2.0 (the "License");
1072
+ * you may not use this file except in compliance with the License.
1073
+ * You may obtain a copy of the License at
1074
+ *
1075
+ * http://www.apache.org/licenses/LICENSE-2.0
1076
+ *
1077
+ * Unless required by applicable law or agreed to in writing, software
1078
+ * distributed under the License is distributed on an "AS IS" BASIS,
1079
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1080
+ * See the License for the specific language governing permissions and
1081
+ * limitations under the License.
1082
+ */fs.receivers=[];class gs{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const n="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!n)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=ms("",20);n.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),r);i={messageChannel:n,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(t.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),n.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[n.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
1083
+ /**
1084
+ * @license
1085
+ * Copyright 2020 Google LLC
1086
+ *
1087
+ * Licensed under the Apache License, Version 2.0 (the "License");
1088
+ * you may not use this file except in compliance with the License.
1089
+ * You may obtain a copy of the License at
1090
+ *
1091
+ * http://www.apache.org/licenses/LICENSE-2.0
1092
+ *
1093
+ * Unless required by applicable law or agreed to in writing, software
1094
+ * distributed under the License is distributed on an "AS IS" BASIS,
1095
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1096
+ * See the License for the specific language governing permissions and
1097
+ * limitations under the License.
1098
+ */function ys(){return window}
1099
+ /**
1100
+ * @license
1101
+ * Copyright 2020 Google LLC.
1102
+ *
1103
+ * Licensed under the Apache License, Version 2.0 (the "License");
1104
+ * you may not use this file except in compliance with the License.
1105
+ * You may obtain a copy of the License at
1106
+ *
1107
+ * http://www.apache.org/licenses/LICENSE-2.0
1108
+ *
1109
+ * Unless required by applicable law or agreed to in writing, software
1110
+ * distributed under the License is distributed on an "AS IS" BASIS,
1111
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1112
+ * See the License for the specific language governing permissions and
1113
+ * limitations under the License.
1114
+ */
1115
+ function vs(){return void 0!==ys().WorkerGlobalScope&&"function"==typeof ys().importScripts}
1116
+ /**
1117
+ * @license
1118
+ * Copyright 2019 Google LLC
1119
+ *
1120
+ * Licensed under the Apache License, Version 2.0 (the "License");
1121
+ * you may not use this file except in compliance with the License.
1122
+ * You may obtain a copy of the License at
1123
+ *
1124
+ * http://www.apache.org/licenses/LICENSE-2.0
1125
+ *
1126
+ * Unless required by applicable law or agreed to in writing, software
1127
+ * distributed under the License is distributed on an "AS IS" BASIS,
1128
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1129
+ * See the License for the specific language governing permissions and
1130
+ * limitations under the License.
1131
+ */
1132
+ const bs="firebaseLocalStorageDb",ws="firebaseLocalStorage",_s="fbase_key";class Is{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function Es(e,t){return e.transaction([ws],t?"readwrite":"readonly").objectStore(ws)}function Ts(){const e=indexedDB.open(bs,1);return new Promise(((t,r)=>{e.addEventListener("error",(()=>{r(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(ws,{keyPath:_s})}catch(e){r(e)}})),e.addEventListener("success",(async()=>{const r=e.result;r.objectStoreNames.contains(ws)?t(r):(r.close(),await function(){const e=indexedDB.deleteDatabase(bs);return new Is(e).toPromise()}(),t(await Ts()))}))}))}async function Ss(e,t,r){const n=Es(e,!0).put({[_s]:t,value:r});return new Is(n).toPromise()}function Cs(e,t){const r=Es(e,!0).delete(t);return new Is(r).toPromise()}class Rs{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Ts()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return vs()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=fs._getInstance(vs()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new gs(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&(null===(e=r[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=r[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Ts();return await Ss(e,cs,"1"),await Cs(e,cs),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((r=>Ss(r,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const r=Es(e,!1).get(t),n=await new Is(r).toPromise();return void 0===n?null:n.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>Cs(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Es(e,!1).getAll();return new Is(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],r=new Set;if(0!==e.length)for(const{fbase_key:n,value:s}of e)r.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(s)&&(this.notifyListeners(n,s),t.push(n));for(const e of Object.keys(this.localCache))this.localCache[e]&&!r.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const e of Array.from(r))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Rs.type="LOCAL";const ks=Rs;new Gr(3e4,6e4);
1133
+ /**
1134
+ * @license
1135
+ * Copyright 2019 Google LLC
1136
+ *
1137
+ * Licensed under the Apache License, Version 2.0 (the "License");
1138
+ * you may not use this file except in compliance with the License.
1139
+ * You may obtain a copy of the License at
1140
+ *
1141
+ * http://www.apache.org/licenses/LICENSE-2.0
1142
+ *
1143
+ * Unless required by applicable law or agreed to in writing, software
1144
+ * distributed under the License is distributed on an "AS IS" BASIS,
1145
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1146
+ * See the License for the specific language governing permissions and
1147
+ * limitations under the License.
1148
+ */
1149
+ class Os extends Kn{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Gn(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Gn(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Gn(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function Ps(e){
1150
+ /**
1151
+ * @license
1152
+ * Copyright 2020 Google LLC
1153
+ *
1154
+ * Licensed under the Apache License, Version 2.0 (the "License");
1155
+ * you may not use this file except in compliance with the License.
1156
+ * You may obtain a copy of the License at
1157
+ *
1158
+ * http://www.apache.org/licenses/LICENSE-2.0
1159
+ *
1160
+ * Unless required by applicable law or agreed to in writing, software
1161
+ * distributed under the License is distributed on an "AS IS" BASIS,
1162
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1163
+ * See the License for the specific language governing permissions and
1164
+ * limitations under the License.
1165
+ */
1166
+ return async function(e,t,r=!1){if(fr(e.app))return Promise.reject(Hr(e));const n="signIn",s=await os(e,n,t),i=await ns._fromIdTokenResponse(e,n,s);return r||await e._updateCurrentUser(i.user),i}(e.auth,new Os(e),e.bypassAuthState)}function As(e){const{auth:t,user:r}=e;return Vr(r,t,"internal-error"),
1167
+ /**
1168
+ * @license
1169
+ * Copyright 2019 Google LLC
1170
+ *
1171
+ * Licensed under the Apache License, Version 2.0 (the "License");
1172
+ * you may not use this file except in compliance with the License.
1173
+ * You may obtain a copy of the License at
1174
+ *
1175
+ * http://www.apache.org/licenses/LICENSE-2.0
1176
+ *
1177
+ * Unless required by applicable law or agreed to in writing, software
1178
+ * distributed under the License is distributed on an "AS IS" BASIS,
1179
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1180
+ * See the License for the specific language governing permissions and
1181
+ * limitations under the License.
1182
+ */
1183
+ async function(e,t,r=!1){const{auth:n}=e;if(fr(n.app))return Promise.reject(Hr(n));const s="reauthenticate";try{const i=await pn(e,os(n,s,t,e),r);Vr(i.idToken,n,"internal-error");const o=ln(i.idToken);Vr(o,n,"internal-error");const{sub:a}=o;return Vr(e.uid===a,n,"user-mismatch"),ns._forOperation(e,s,i)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&Fr(n,"user-mismatch"),e}}(r,new Os(e),e.bypassAuthState)}async function Ds(e){const{auth:t,user:r}=e;return Vr(r,t,"internal-error"),async function(e,t,r=!1){const n=await pn(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return ns._forOperation(e,"link",n)}(r,new Os(e),e.bypassAuthState)}
1184
+ /**
1185
+ * @license
1186
+ * Copyright 2020 Google LLC
1187
+ *
1188
+ * Licensed under the Apache License, Version 2.0 (the "License");
1189
+ * you may not use this file except in compliance with the License.
1190
+ * You may obtain a copy of the License at
1191
+ *
1192
+ * http://www.apache.org/licenses/LICENSE-2.0
1193
+ *
1194
+ * Unless required by applicable law or agreed to in writing, software
1195
+ * distributed under the License is distributed on an "AS IS" BASIS,
1196
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1197
+ * See the License for the specific language governing permissions and
1198
+ * limitations under the License.
1199
+ */class Ns{constructor(e,t,r,n,s=!1){this.auth=e,this.resolver=r,this.user=n,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:n,tenantId:s,error:i,type:o}=e;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:t,sessionId:r,tenantId:s||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Ps;case"linkViaPopup":case"linkViaRedirect":return Ds;case"reauthViaPopup":case"reauthViaRedirect":return As;default:Fr(this.auth,"internal-error")}}resolve(e){zr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){zr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
1200
+ /**
1201
+ * @license
1202
+ * Copyright 2020 Google LLC
1203
+ *
1204
+ * Licensed under the Apache License, Version 2.0 (the "License");
1205
+ * you may not use this file except in compliance with the License.
1206
+ * You may obtain a copy of the License at
1207
+ *
1208
+ * http://www.apache.org/licenses/LICENSE-2.0
1209
+ *
1210
+ * Unless required by applicable law or agreed to in writing, software
1211
+ * distributed under the License is distributed on an "AS IS" BASIS,
1212
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1213
+ * See the License for the specific language governing permissions and
1214
+ * limitations under the License.
1215
+ */const Ls=new Gr(2e3,1e4);class Ms extends Ns{constructor(e,t,r,n,s){super(e,t,n,s),this.provider=r,this.authWindow=null,this.pollId=null,Ms.currentPopupAction&&Ms.currentPopupAction.cancel(),Ms.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Vr(e,this.auth,"internal-error"),e}async onExecution(){zr(1===this.filter.length,"Popup operations only handle one event");const e=ms();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(jr(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(jr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ms.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;(null===(r=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===r?void 0:r.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(jr(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,Ls.get())};e()}}Ms.currentPopupAction=null;
1216
+ /**
1217
+ * @license
1218
+ * Copyright 2020 Google LLC
1219
+ *
1220
+ * Licensed under the Apache License, Version 2.0 (the "License");
1221
+ * you may not use this file except in compliance with the License.
1222
+ * You may obtain a copy of the License at
1223
+ *
1224
+ * http://www.apache.org/licenses/LICENSE-2.0
1225
+ *
1226
+ * Unless required by applicable law or agreed to in writing, software
1227
+ * distributed under the License is distributed on an "AS IS" BASIS,
1228
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1229
+ * See the License for the specific language governing permissions and
1230
+ * limitations under the License.
1231
+ */
1232
+ const Us="pendingRedirect",xs=new Map;class Fs extends Ns{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=xs.get(this.auth._key());if(!e){try{const t=await async function(e,t){const r=function(e){return Sn(Us,e.config.apiKey,e.name)}(t),n=function(e){return In(e._redirectPersistence)}(e);if(!await n._isAvailable())return!1;const s="true"===await n._get(r);return await n._remove(r),s}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}xs.set(this.auth._key(),e)}return this.bypassAuthState||xs.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function js(e,t){xs.set(e._key(),t)}async function qs(e,t,r=!1){if(fr(e.app))return Promise.reject(Hr(e));const n=$n(e),s=
1233
+ /**
1234
+ * @license
1235
+ * Copyright 2021 Google LLC
1236
+ *
1237
+ * Licensed under the Apache License, Version 2.0 (the "License");
1238
+ * you may not use this file except in compliance with the License.
1239
+ * You may obtain a copy of the License at
1240
+ *
1241
+ * http://www.apache.org/licenses/LICENSE-2.0
1242
+ *
1243
+ * Unless required by applicable law or agreed to in writing, software
1244
+ * distributed under the License is distributed on an "AS IS" BASIS,
1245
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1246
+ * See the License for the specific language governing permissions and
1247
+ * limitations under the License.
1248
+ */
1249
+ function(e,t){return t?In(t):(Vr(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(n,t),i=new Fs(n,s,r),o=await i.execute();return o&&!r&&(delete o.user._redirectEventId,await n._persistUserIfCurrent(o.user),await n._setRedirectUser(null,t)),o}
1250
+ /**
1251
+ * @license
1252
+ * Copyright 2020 Google LLC
1253
+ *
1254
+ * Licensed under the Apache License, Version 2.0 (the "License");
1255
+ * you may not use this file except in compliance with the License.
1256
+ * You may obtain a copy of the License at
1257
+ *
1258
+ * http://www.apache.org/licenses/LICENSE-2.0
1259
+ *
1260
+ * Unless required by applicable law or agreed to in writing, software
1261
+ * distributed under the License is distributed on an "AS IS" BASIS,
1262
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1263
+ * See the License for the specific language governing permissions and
1264
+ * limitations under the License.
1265
+ */class Hs{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Vs(e);default:return!1}}
1266
+ /**
1267
+ * @license
1268
+ * Copyright 2020 Google LLC
1269
+ *
1270
+ * Licensed under the Apache License, Version 2.0 (the "License");
1271
+ * you may not use this file except in compliance with the License.
1272
+ * You may obtain a copy of the License at
1273
+ *
1274
+ * http://www.apache.org/licenses/LICENSE-2.0
1275
+ *
1276
+ * Unless required by applicable law or agreed to in writing, software
1277
+ * distributed under the License is distributed on an "AS IS" BASIS,
1278
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1279
+ * See the License for the specific language governing permissions and
1280
+ * limitations under the License.
1281
+ */(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!Vs(e)){const n=(null===(r=e.error.code)||void 0===r?void 0:r.split("auth/")[1])||"internal-error";t.onError(jr(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has($s(e))}saveEventToCache(e){this.cachedEventUids.add($s(e)),this.lastProcessedEventTime=Date.now()}}function $s(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function Vs({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}
1282
+ /**
1283
+ * @license
1284
+ * Copyright 2020 Google LLC
1285
+ *
1286
+ * Licensed under the Apache License, Version 2.0 (the "License");
1287
+ * you may not use this file except in compliance with the License.
1288
+ * You may obtain a copy of the License at
1289
+ *
1290
+ * http://www.apache.org/licenses/LICENSE-2.0
1291
+ *
1292
+ * Unless required by applicable law or agreed to in writing, software
1293
+ * distributed under the License is distributed on an "AS IS" BASIS,
1294
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1295
+ * See the License for the specific language governing permissions and
1296
+ * limitations under the License.
1297
+ */
1298
+ const Bs=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,zs=/^https?/;async function Qs(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return tn(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(Ws(e))return}catch(e){}Fr(e,"unauthorized-domain")}function Ws(e){const t=Qr(),{protocol:r,hostname:n}=new URL(t);if(e.startsWith("chrome-extension://")){const s=new URL(e);return""===s.hostname&&""===n?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&s.hostname===n}if(!zs.test(r))return!1;if(Bs.test(e))return n===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(n)}
1299
+ /**
1300
+ * @license
1301
+ * Copyright 2020 Google LLC.
1302
+ *
1303
+ * Licensed under the Apache License, Version 2.0 (the "License");
1304
+ * you may not use this file except in compliance with the License.
1305
+ * You may obtain a copy of the License at
1306
+ *
1307
+ * http://www.apache.org/licenses/LICENSE-2.0
1308
+ *
1309
+ * Unless required by applicable law or agreed to in writing, software
1310
+ * distributed under the License is distributed on an "AS IS" BASIS,
1311
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312
+ * See the License for the specific language governing permissions and
1313
+ * limitations under the License.
1314
+ */const Ks=new Gr(3e4,6e4);function Gs(){const e=ys().___jsl;if(null==e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}function Js(e){return new Promise(((t,r)=>{var n,s,i,o;function a(){Gs(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Gs(),r(jr(e,"network-request-failed"))},timeout:Ks.get()})}if(null===(s=null===(n=ys().gapi)||void 0===n?void 0:n.iframes)||void 0===s?void 0:s.Iframe)t(gapi.iframes.getContext());else{if(!(null===(i=ys().gapi)||void 0===i?void 0:i.load)){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return ys()[t]=()=>{gapi.load?a():r(jr(e,"network-request-failed"))},(o=`${Bn.gapiScript}?onload=${t}`,Bn.loadJS(o)).catch((e=>r(e)))}a()}})).catch((e=>{throw Xs=null,e}))}let Xs=null;
1315
+ /**
1316
+ * @license
1317
+ * Copyright 2020 Google LLC.
1318
+ *
1319
+ * Licensed under the Apache License, Version 2.0 (the "License");
1320
+ * you may not use this file except in compliance with the License.
1321
+ * You may obtain a copy of the License at
1322
+ *
1323
+ * http://www.apache.org/licenses/LICENSE-2.0
1324
+ *
1325
+ * Unless required by applicable law or agreed to in writing, software
1326
+ * distributed under the License is distributed on an "AS IS" BASIS,
1327
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1328
+ * See the License for the specific language governing permissions and
1329
+ * limitations under the License.
1330
+ */
1331
+ const Ys=new Gr(5e3,15e3),Zs={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ei=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ti(e){const t=e.config;Vr(t.authDomain,e,"auth-domain-config-required");const r=t.emulator?Jr(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,n={apiKey:t.apiKey,appName:e.name,v:yr},s=ei.get(e.config.apiHost);s&&(n.eid=s);const i=e._getFrameworks();return i.length&&(n.fw=i.join(",")),`${r}?${et(n).slice(1)}`}async function ri(e){const t=await function(e){return Xs=Xs||Js(e),Xs}(e),r=ys().gapi;return Vr(r,e,"internal-error"),t.open({where:document.body,url:ti(e),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Zs,dontclear:!0},(t=>new Promise((async(r,n)=>{await t.restyle({setHideOnLeave:!1});const s=jr(e,"network-request-failed"),i=ys().setTimeout((()=>{n(s)}),Ys.get());function o(){ys().clearTimeout(i),r(t)}t.ping(o).then(o,(()=>{n(s)}))}))))}
1332
+ /**
1333
+ * @license
1334
+ * Copyright 2020 Google LLC.
1335
+ *
1336
+ * Licensed under the Apache License, Version 2.0 (the "License");
1337
+ * you may not use this file except in compliance with the License.
1338
+ * You may obtain a copy of the License at
1339
+ *
1340
+ * http://www.apache.org/licenses/LICENSE-2.0
1341
+ *
1342
+ * Unless required by applicable law or agreed to in writing, software
1343
+ * distributed under the License is distributed on an "AS IS" BASIS,
1344
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1345
+ * See the License for the specific language governing permissions and
1346
+ * limitations under the License.
1347
+ */const ni={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class si{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function ii(e,t,r,n=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-n)/2,0).toString();let a="";const c=Object.assign(Object.assign({},ni),{width:n.toString(),height:s.toString(),top:i,left:o}),u=Ke().toLowerCase();r&&(a=Pn(u)?"_blank":r),kn(u)&&(t=t||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce(((e,[t,r])=>`${e}${t}=${r},`),"");if(function(e=Ke()){var t;return Mn(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(u)&&"_self"!==a)return function(e,t){const r=document.createElement("a");r.href=e,r.target=t;const n=document.createEvent("MouseEvent");n.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),r.dispatchEvent(n)}
1348
+ /**
1349
+ * @license
1350
+ * Copyright 2021 Google LLC
1351
+ *
1352
+ * Licensed under the Apache License, Version 2.0 (the "License");
1353
+ * you may not use this file except in compliance with the License.
1354
+ * You may obtain a copy of the License at
1355
+ *
1356
+ * http://www.apache.org/licenses/LICENSE-2.0
1357
+ *
1358
+ * Unless required by applicable law or agreed to in writing, software
1359
+ * distributed under the License is distributed on an "AS IS" BASIS,
1360
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1361
+ * See the License for the specific language governing permissions and
1362
+ * limitations under the License.
1363
+ */(t||"",a),new si(null);const l=window.open(t||"",a,h);Vr(l,e,"popup-blocked");try{l.focus()}catch(e){}return new si(l)}const oi="__/auth/handler",ai="emulator/auth/handler",ci=encodeURIComponent("fac");async function ui(e,t,r,n,s,i){Vr(e.config.authDomain,e,"auth-domain-config-required"),Vr(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:n,v:yr,eventId:s};if(t instanceof Xn){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))o[e]=t}if(t instanceof Yn){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];const c=await e._getAppCheckToken(),u=c?`#${ci}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${oi}`;return Jr(e,ai)}
1364
+ /**
1365
+ * @license
1366
+ * Copyright 2020 Google LLC
1367
+ *
1368
+ * Licensed under the Apache License, Version 2.0 (the "License");
1369
+ * you may not use this file except in compliance with the License.
1370
+ * You may obtain a copy of the License at
1371
+ *
1372
+ * http://www.apache.org/licenses/LICENSE-2.0
1373
+ *
1374
+ * Unless required by applicable law or agreed to in writing, software
1375
+ * distributed under the License is distributed on an "AS IS" BASIS,
1376
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1377
+ * See the License for the specific language governing permissions and
1378
+ * limitations under the License.
1379
+ */(e)}?${et(a).slice(1)}${u}`}const hi="webStorageSupport";const li=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ps,this._completeRedirectFn=qs,this._overrideRedirectResult=js}async _openPopup(e,t,r,n){var s;zr(null===(s=this.eventManagers[e._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return ii(e,await ui(e,t,r,Qr(),n),ms())}async _openRedirect(e,t,r,n){await this._originValidation(e);return function(e){ys().location.href=e}(await ui(e,t,r,Qr(),n)),new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:r}=this.eventManagers[t];return e?Promise.resolve(e):(zr(r,"If manager is not set, promise should be"),r)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch((()=>{delete this.eventManagers[t]})),r}async initAndGetManager(e){const t=await ri(e),r=new Hs(e);return t.register("authEvent",(t=>{Vr(null==t?void 0:t.authEvent,e,"invalid-auth-event");return{status:r.onEvent(t.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(hi,{type:hi},(r=>{var n;const s=null===(n=null==r?void 0:r[0])||void 0===n?void 0:n[hi];void 0!==s&&t(!!s),Fr(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Qs(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return xn()||On()||Mn()}};var di="@firebase/auth",pi="1.9.0";
1380
+ /**
1381
+ * @license
1382
+ * Copyright 2020 Google LLC
1383
+ *
1384
+ * Licensed under the Apache License, Version 2.0 (the "License");
1385
+ * you may not use this file except in compliance with the License.
1386
+ * You may obtain a copy of the License at
1387
+ *
1388
+ * http://www.apache.org/licenses/LICENSE-2.0
1389
+ *
1390
+ * Unless required by applicable law or agreed to in writing, software
1391
+ * distributed under the License is distributed on an "AS IS" BASIS,
1392
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1393
+ * See the License for the specific language governing permissions and
1394
+ * limitations under the License.
1395
+ */
1396
+ class fi{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Vr(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
1397
+ /**
1398
+ * @license
1399
+ * Copyright 2020 Google LLC
1400
+ *
1401
+ * Licensed under the Apache License, Version 2.0 (the "License");
1402
+ * you may not use this file except in compliance with the License.
1403
+ * You may obtain a copy of the License at
1404
+ *
1405
+ * http://www.apache.org/licenses/LICENSE-2.0
1406
+ *
1407
+ * Unless required by applicable law or agreed to in writing, software
1408
+ * distributed under the License is distributed on an "AS IS" BASIS,
1409
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1410
+ * See the License for the specific language governing permissions and
1411
+ * limitations under the License.
1412
+ */
1413
+ /**
1414
+ * @license
1415
+ * Copyright 2021 Google LLC
1416
+ *
1417
+ * Licensed under the Apache License, Version 2.0 (the "License");
1418
+ * you may not use this file except in compliance with the License.
1419
+ * You may obtain a copy of the License at
1420
+ *
1421
+ * http://www.apache.org/licenses/LICENSE-2.0
1422
+ *
1423
+ * Unless required by applicable law or agreed to in writing, software
1424
+ * distributed under the License is distributed on an "AS IS" BASIS,
1425
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1426
+ * See the License for the specific language governing permissions and
1427
+ * limitations under the License.
1428
+ */
1429
+ const mi=Qe("authIdTokenMaxAge")||300;let gi=null;function yi(e=function(e=or){const t=cr.get(e);if(!t&&e===or&&ze())return vr();if(!t)throw mr.create("no-app",{appName:e});return t}()){const t=pr(e,"auth");if(t.isInitialized())return t.getImmediate();const r=
1430
+ /**
1431
+ * @license
1432
+ * Copyright 2020 Google LLC
1433
+ *
1434
+ * Licensed under the Apache License, Version 2.0 (the "License");
1435
+ * you may not use this file except in compliance with the License.
1436
+ * You may obtain a copy of the License at
1437
+ *
1438
+ * http://www.apache.org/licenses/LICENSE-2.0
1439
+ *
1440
+ * Unless required by applicable law or agreed to in writing, software
1441
+ * distributed under the License is distributed on an "AS IS" BASIS,
1442
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1443
+ * See the License for the specific language governing permissions and
1444
+ * limitations under the License.
1445
+ */
1446
+ function(e,t){const r=pr(e,"auth");if(r.isInitialized()){const e=r.getImmediate();if(Ye(r.getOptions(),null!=t?t:{}))return e;Fr(e,"already-initialized")}return r.initialize({options:t})}(e,{popupRedirectResolver:li,persistence:[ks,ls,ps]}),n=Qe("authTokenSyncURL");if(n&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(n,location.origin);if(location.origin===e.origin){const t=(s=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),r=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>mi)return;const n=null==t?void 0:t.token;gi!==n&&(gi=n,await fetch(s,{method:n?"POST":"DELETE",headers:n?{Authorization:`Bearer ${n}`}:{}}))});!function(e,t,r){nt(e).beforeAuthStateChanged(t,r)}(r,t,(()=>t(r.currentUser))),function(e,t,r,n){nt(e).onIdTokenChanged(t,r,n)}(r,(e=>t(e)))}}var s;const i=(o="auth",null===(c=null===(a=Be())||void 0===a?void 0:a.emulatorHosts)||void 0===c?void 0:c[o]);var o,a,c;return i&&zn(r,`http://${i}`),r}var vi;Bn={loadJS:e=>new Promise(((t,r)=>{const n=document.createElement("script");var s,i;n.setAttribute("src",e),n.onload=t,n.onerror=e=>{const t=jr("internal-error");t.customData=e,r(t)},n.type="text/javascript",n.charset="UTF-8",(null!==(i=null===(s=document.getElementsByTagName("head"))||void 0===s?void 0:s[0])&&void 0!==i?i:document).appendChild(n)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},vi="Browser",dr(new st("auth",((e,{options:t})=>{const r=e.getProvider("app").getImmediate(),n=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=r.options;Vr(i&&!i.includes(":"),"invalid-api-key",{appName:r.name});const a={apiKey:i,authDomain:o,clientPlatform:vi,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Fn(vi)},c=new Hn(r,n,s,a);return function(e,t){const r=(null==t?void 0:t.persistence)||[],n=(Array.isArray(r)?r:[r]).map(In);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(n,null==t?void 0:t.popupRedirectResolver)}(c,t),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,r)=>{e.getProvider("auth-internal").initialize()}))),dr(new st("auth-internal",(e=>(e=>new fi(e))($n(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),br(di,pi,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(vi)),br(di,pi,"esm2017");const bi=i(void 0),wi=({organizationId:e,uid:i,fname:o,lname:a,children:c})=>{const[u,h]=r(!0),[l,d]=r(null),[p,f]=r(null),m=n(null),g=n(null),y=n(null),{isLoading:v,data:b,error:w}=de({queryKey:[`organization-${e}`],queryFn:async()=>{try{const t=await xe.get(`${process.env.API_BASE_URL}/${e}/initialize`,{headers:{"x-org-id":e}}).json();if(t.error)throw new Error(t.error);return t.data}catch(e){throw new Error(e?.message||"Failed to fetch organization details")}}},W);s((()=>{let t,r;if(b?.firebaseConfig){const n=Ar(b.firebaseConfig);m.current=yi(n),r=m.current?.onIdTokenChanged((async e=>{e?(g.current&&(f(g.current),g.current=null),t&&clearInterval(t),t=setInterval((()=>{m.current?.currentUser?.getIdToken(!0)}),27e5)):(f(null),clearInterval(t)),h(!1)})),i&&o&&a&&_(e,i,o,a)}return()=>{r&&r(),clearInterval(t)}}),[b]),s((()=>{m?.current&&_(e,i,o,a)}),[i,o,a]);const _=async(e,t,r,n)=>{var s;await(s=m?.current,nt(s).signOut()),f(null),d(null),h(!0);try{const s=await xe.post(`http://localhost:3000/api/connect/${e}/external-login`,{json:{uid:t,fname:r,lname:n},headers:{"x-org-id":e}}).json(),{user:i,authToken:o}=s.data;I(o,i,e)}catch(e){console.error(e)}},I=async(e,t,r=null)=>{d(null),h(!0),g.current=t,y.current=r;try{await(n=m.current,s=ps,nt(n).setPersistence(s)),await as(m.current,e)}catch(e){h(!1),g.current=null,y.current=null}var n,s};return t.createElement(bi.Provider,{value:{organizationId:e,organizationLoading:v,organization:b,organizationError:w,userLoading:u,user:p,userError:l,getAccessToken:async()=>m.current?.currentUser?.getIdToken()}},c)};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===r&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}('@import "tailwindcss";@theme{--color-border:0 0% 89.8%;--color-input:0 0% 89.8%;--color-primary:89 37 18;--color-primary-content:255 255 255;--color-secondary:0 168 50;--color-secondary-content:255 255 255;--color-reward-name:0 0 0;--color-header-bg:255 210 0;--color-header-text:255 255 255;--color-footer-bg:255 210 0;--color-footer-text:89 37 18;--color-hero-text:255 255 255;--color-challenge-tile-bg:255 255 255;--color-reward-tile-bg:255 255 255;--radius-reward-card:13px;--radius-input:1.5rem;--radius-button:1.5rem;--radius-tiles:1.5rem;--radius-cards:1.5rem}');const _i=new class{#$;#m;#h;#V;#B;#z;#Q;#W;constructor(e={}){this.#$=e.queryCache||new q,this.#m=e.mutationCache||new $,this.#h=e.defaultOptions||{},this.#V=new Map,this.#B=new Map,this.#z=0}mount(){this.#z++,1===this.#z&&(this.#Q=k.subscribe((async e=>{e&&(await this.resumePausedMutations(),this.#$.onFocus())})),this.#W=O.subscribe((async e=>{e&&(await this.resumePausedMutations(),this.#$.onOnline())})))}unmount(){this.#z--,0===this.#z&&(this.#Q?.(),this.#Q=void 0,this.#W?.(),this.#W=void 0)}isFetching(e){return this.#$.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#m.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#$.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#$.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(l(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#$.findAll(e).map((({queryKey:e,state:t})=>[e,t.data]))}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=this.#$.get(n.queryHash),i=s?.state.data,o=function(e,t){return"function"==typeof e?e(t):e}(t,i);if(void 0!==o)return this.#$.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return U.batch((()=>this.#$.findAll(e).map((({queryKey:e})=>[e,this.setQueryData(e,t,r)]))))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#$.get(t.queryHash)?.state}removeQueries(e){const t=this.#$;U.batch((()=>{t.findAll(e).forEach((e=>{t.remove(e)}))}))}resetQueries(e,t){const r=this.#$,n={type:"active",...e};return U.batch((()=>(r.findAll(e).forEach((e=>{e.reset()})),this.refetchQueries(n,t))))}cancelQueries(e,t={}){const r={revert:!0,...t},n=U.batch((()=>this.#$.findAll(e).map((e=>e.cancel(r)))));return Promise.all(n).then(c).catch(c)}invalidateQueries(e,t={}){return U.batch((()=>{if(this.#$.findAll(e).forEach((e=>{e.invalidate()})),"none"===e?.refetchType)return Promise.resolve();const r={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(r,t)}))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=U.batch((()=>this.#$.findAll(e).filter((e=>!e.isDisabled())).map((e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(c)),"paused"===e.state.fetchStatus?Promise.resolve():t}))));return Promise.all(n).then(c)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const r=this.#$.build(this,t);return r.isStaleByTime(l(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(c).catch(c)}fetchInfiniteQuery(e){return e.behavior=B(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(c).catch(c)}ensureInfiniteQueryData(e){return e.behavior=B(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return O.isOnline()?this.#m.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#$}getMutationCache(){return this.#m}getDefaultOptions(){return this.#h}setDefaultOptions(e){this.#h=e}setQueryDefaults(e,t){this.#V.set(g(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#V.values()],r={};return t.forEach((t=>{y(e,t.queryKey)&&Object.assign(r,t.defaultOptions)})),r}setMutationDefaults(e,t){this.#B.set(g(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#B.values()];let r={};return t.forEach((t=>{y(e,t.mutationKey)&&(r={...r,...t.defaultOptions})})),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#h.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=m(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===C&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#h.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#$.clear(),this.#m.clear()}},Ii=({organizationId:e="668fad7117504f56822de3ce",uid:r="1",fname:n="Siddhartha",lname:s="Maity"})=>(console.log("organizationId",e),e?t.createElement(ae,{client:_i},t.createElement(wi,{organizationId:e,uid:r,fname:n,lname:s},t.createElement("div",{style:{width:"100vw",overflow:"auto"}},t.createElement("h2",null,"KEPLER45B: ","https://beta.qratilabs.com")))):t.createElement(pe,{title:"Organization ID is required!",description:"Please contact the administrator for more information"}));export{Ii as QratiConnectReact};