1import{$ as Me,V as Ce,X as Be,Z as Le,_ as Fe,aa as $e,b as xe}from"./chunk-DZ6RN5NJ.js";import{a as we}from"./chunk-FYJMS56R.js";import{e as q}from"./chunk-6IZ6GRES.js";import{b as ye}from"./chunk-AH7NKML5.js";import"./chunk-5XXN6OK2.js";import"./chunk-KHUU7CUW.js";import"./chunk-FPPZ4BUR.js";import{H as Re,g as U,jc as Te,l as P}from"./chunk-E6XDDTAT.js";import{Q as ge,qa as be}from"./chunk-PKOFAN4X.js";import{T as j,U as Ae,ba as Ue,ca as De,da as Pe,ea as ve,ga as Ne,h as ke,j as ne,ja as K,k as Ee,l as Se,m as Oe,x as Ie}from"./chunk-Y544VVXV.js";import{l as m}from"./chunk-GTAS2RK2.js";var je=(()=>{class t{db=P(Ce);getDbObject(n){return Le(this.db,n)}getDbData(n){return m(this,null,function*(){return Be(this.getDbObject(n)).then(s=>{if(s.exists())return s.val();console.log("No data available")}).catch(s=>{console.error(s)})})}setDbObject(n,s){return m(this,null,function*(){return Me(this.getDbObject(n),s).then(()=>{console.log("Data written successfully")}).catch(r=>{console.error(r)})})}updateDbObject(n,s){return m(this,null,function*(){return $e(this.getDbObject(n),s).then(()=>{console.log("Data updated successfully")}).catch(r=>{console.error(r)})})}removeDbObject(n){return m(this,null,function*(){return Fe(this.getDbObject(n)).then(()=>{console.log("Data removed successfully")}).catch(s=>{console.error(s)})})}static \u0275fac=function(s){return new(s||t)};static \u0275prov=U({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var qe=(()=>{class t extends xe{static \u0275fac=(()=>{let n;return function(r){return(n||(n=Re(t)))(r||t)}})();static \u0275prov=U({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Ze="firebasestorage.googleapis.com",Ye="storageBucket",St=120*1e3,Ot=600*1e3,It=1e3;var d=class t extends Ie{constructor(e,n,s=0){super(re(e),`Firebase Storage: ${n} (${re(e)})`),this.status_=s,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,t.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return re(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} 2${this.customData.serverResponse}`:this.message=this._baseMessage}},h=(function(t){return t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment",t})(h||{});function re(t){return"storage/"+t}function fe(){let t="An unknown error occurred, please check the error payload for server response.";return new d(h.UNKNOWN,t)}function At(t){return new d(h.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function Ut(t){return new d(h.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function Dt(){let t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new d(h.UNAUTHENTICATED,t)}function Pt(){return new d(h.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function vt(t){return new d(h.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function Je(){return new d(h.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Qe(){return new d(h.CANCELED,"User canceled the upload/download.")}function Nt(t){return new d(h.INVALID_URL,"Invalid URL '"+t+"'.")}function xt(t){return new d(h.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function Ct(){return new d(h.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Ye+"' property when initializing the app?")}function et(){return new d(h.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Bt(){return new d(h.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function Lt(){return new d(h.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function Ft(t){return new d(h.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function ie(t){return new d(h.INVALID_ARGUMENT,t)}function tt(){return new d(h.APP_DELETED,"The Firebase app was deleted.")}function Mt(t){return new d(h.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function z(t,e){return new d(h.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function H(t){throw new d(h.INTERNAL_ERROR,"Internal error: "+t)}var E=class t{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let s;try{s=t.makeFromUrl(e,n)}catch{return new t(e,"")}if(s.path==="")return s;throw xt(e)}static makeFromUrl(e,n){let s=null,r="([A-Za-z0-9.\\-_]+)";function o(R){R.path.charAt(R.path.length-1)==="/"&&(R.path_=R.path_.slice(0,-1))}let i="(/(.*))?$",c=new RegExp("^gs://"+r+i,"i"),a={bucket:1,path:3};function u(R){R.path_=decodeURIComponent(R.path)}let l="v[A-Za-z0-9_]+",f=n.replace(/[.]/g,"\\."),_="(/([^?#]*).*)?$",g=new RegExp(`^https?://${f}/${l}/b/${r}/o${_}`,"i"),b={bucket:1,path:3},w=n===Ze?"(?:storage.googleapis.com|storage.cloud.google.com)":n,p="([^?#]*)",O=new RegExp(`^https?://${w}/${r}/${p}`,"i"),y=[{regex:c,indices:a,postModify:o},{regex:g,indices:b,postModify:u},{regex:O,indices:{bucket:1,path:2},postModify:u}];for(let R=0;R<y.length;R++){let v=y[R],N=v.regex.exec(e);if(N){let ee=N[v.indices.bucket],$=N[v.indices.path];$||($=""),s=new t(ee,$),v.postModify(s);break}}if(s==null)throw Nt(e);return s}},ae=class{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}};function $t(t,e,n){let s=1,r=null,o=null,i=!1,c=0;function a(){return c===2}let u=!1;function l(...p){u||(u=!0,e.apply(null,p))}function f(p){r=setTimeout(()=>{r=null,t(g,a())},p)}function _(){o&&clearTimeout(o)}function g(p,...O){if(u){_();return}if(p){_(),l.call(null,p,...O);return}if(a()||i){_(),l.call(null,p,...O);return}s<64&&(s*=2);let y;c===1?(c=2,y=0):y=(s+Math.random())*1e3,f(y)}let b=!1;function w(p){b||(b=!0,_(),!u&&(r!==null?(p||(c=2),clearTimeout(r),f(0)):p||(c=1)))}return f(0),o=setTimeout(()=>{i=!0,w(!0)},n),w}function jt(t){t(!1)}function qt(t){return t!==void 0}function Ht(t){return typeof t=="function"}function zt(t){return typeof t=="object"&&!Array.isArray(t)}function Q(t){return typeof t=="string"||t instanceof String}function He(t){return pe()&&t instanceof Blob}function pe(){return typeof Blob<"u"}function ze(t,e,n,s){if(s<e)throw ie(`Invalid value for '${t}'. Expected ${e} or greater.`);if(s>n)throw ie(`Invalid value for '${t}'. Expected ${n} or less.`)}function W(t,e,n){let s=e;return n==null&&(s=`https://${e}`),`${n}://${s}/v0${t}`}function nt(t){let e=encodeURIComponent,n="?";for(let s in t)if(t.hasOwnProperty(s)){let r=e(s)+"="+e(t[s]);n=n+r+"&"}return n=n.slice(0,-1),n}var L=(function(t){return t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_E
vendor: 8,516 bytes, line 2
2RROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT",t})(L||{});function st(t,e){let n=t>=500&&t<600,r=[408,429].indexOf(t)!==-1,o=e.indexOf(t)!==-1;return n||r||o}var ce=class{constructor(e,n,s,r,o,i,c,a,u,l,f,_=!0,g=!1){this.url_=e,this.method_=n,this.headers_=s,this.body_=r,this.successCodes_=o,this.additionalRetryCodes_=i,this.callback_=c,this.errorCallback_=a,this.timeout_=u,this.progressCallback_=l,this.connectionFactory_=f,this.retry=_,this.isUsingEmulator=g,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((b,w)=>{this.resolve_=b,this.reject_=w,this.start_()})}start_(){let e=(s,r)=>{if(r){s(!1,new B(!1,null,!0));return}let o=this.connectionFactory_();this.pendingConnection_=o;let i=c=>{let a=c.loaded,u=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(a,u)};this.progressCallback_!==null&&o.addUploadProgressListener(i),o.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&o.removeUploadProgressListener(i),this.pendingConnection_=null;let c=o.getErrorCode()===L.NO_ERROR,a=o.getStatus();if(!c||st(a,this.additionalRetryCodes_)&&this.retry){let l=o.getErrorCode()===L.ABORT;s(!1,new B(!1,null,l));return}let u=this.successCodes_.indexOf(a)!==-1;s(!0,new B(u,o))})},n=(s,r)=>{let o=this.resolve_,i=this.reject_,c=r.connection;if(r.wasSuccessCode)try{let a=this.callback_(c,c.getResponse());qt(a)?o(a):o()}catch(a){i(a)}else if(c!==null){let a=fe();a.serverResponse=c.getErrorText(),this.errorCallback_?i(this.errorCallback_(c,a)):i(a)}else if(r.canceled){let a=this.appDelete_?tt():Qe();i(a)}else{let a=Je();i(a)}};this.canceled_?n(!1,new B(!1,null,!0)):this.backoffId_=$t(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&jt(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}},B=class{constructor(e,n,s){this.wasSuccessCode=e,this.connection=n,this.canceled=!!s}};function Gt(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function Vt(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function Wt(t,e){e&&(t["X-Firebase-GMPID"]=e)}function Xt(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function Kt(t,e,n,s,r,o,i=!0,c=!1){let a=nt(t.urlParams),u=t.url+a,l=Object.assign({},t.headers);return Wt(l,e),Gt(l,n),Vt(l,o),Xt(l,s),new ce(u,t.method,l,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r,i,c)}function Zt(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function Yt(...t){let e=Zt();if(e!==void 0){let n=new e;for(let s=0;s<t.length;s++)n.append(t[s]);return n.getBlob()}else{if(pe())return new Blob(t);throw new d(h.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function Jt(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}function Qt(t){if(typeof atob>"u")throw Ft("base-64");return atob(t)}var S={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},G=class{constructor(e,n){this.data=e,this.contentType=n||null}};function en(t,e){switch(t){case S.RAW:return new G(rt(e));case S.BASE64:case S.BASE64URL:return new G(ot(t,e));case S.DATA_URL:return new G(nn(e),sn(e))}throw fe()}function rt(t){let e=[];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);if(s<=127)e.push(s);else if(s<=2047)e.push(192|s>>6,128|s&63);else if((s&64512)===55296)if(!(n<t.length-1&&(t.charCodeAt(n+1)&64512)===56320))e.push(239,191,189);else{let o=s,i=t.charCodeAt(++n);s=65536|(o&1023)<<10|i&1023,e.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|s&63)}else(s&64512)===56320?e.push(239,191,189):e.push(224|s>>12,128|s>>6&63,128|s&63)}return new Uint8Array(e)}function tn(t){let e;try{e=decodeURIComponent(t)}catch{throw z(S.DATA_URL,"Malformed data URL.")}return rt(e)}function ot(t,e){switch(t){case S.BASE64:{let r=e.indexOf("-")!==-1,o=e.indexOf("_")!==-1;if(r||o)throw z(t,"Invalid character '"+(r?"-":"_")+"' found: is it base64url encoded?");break}case S.BASE64URL:{let r=e.indexOf("+")!==-1,o=e.indexOf("/")!==-1;if(r||o)throw z(t,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Qt(e)}catch(r){throw r.message.includes("polyfill")?r:z(t,"Invalid character found")}let s=new Uint8Array(n.length);for(let r=0;r<n.length;r++)s[r]=n.charCodeAt(r);return s}var Y=class{constructor(e){this.base64=!1,this.contentType=null;let n=e.match(/^data:([^,]+)?,/);if(n===null)throw z(S.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");let s=n[1]||null;s!=null&&(this.base64=rn(s,";base64"),this.contentType=this.base64?s.substring(0,s.length-7):s),this.rest=e.substring(e.indexOf(",")+1)}};function nn(t){let e=new Y(t);return e.base64?ot(S.BASE64,e.rest):tn(e.rest)}function sn(t){return new Y(t).contentType}function rn(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}var J=class t{constructor(e,n){let s=0,r="";He(e)?(this.data_=e,s=e.size,r=e.type):e instanceof ArrayBuffer?(n?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),s=this.data_.length):e instanceof Uint8Array&&(n?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),s=e.length),this.size_=s,this.type_=r}size(){return this.size_}type(){return this.type_}slice(e,n){if(He(this.data_)){let s=this.data_,r=Jt(s,e,n);return r===null?null:new t(r)}else{let s=new Uint8Array(this.data_.buffer,e,n-e);return new t(s,!0)}}static getBlob(...e){if(pe()){let n=e.map(s=>s instanceof t?s.data_:s);return new t(Yt.apply(null,n))}else{let n=e.map(i=>Q(i)?en(S.RAW,i).data:i.data_),s=0;n.forEach(i=>{s+=i.byteLength});let r=new Uint8Array(s),o=0;return n.forEach(i=>{for(let c=0;c<i.length;c++)r[o++]=i[c]}),new t(r,!0)}}uploadData(){return this.data_}};function it(t){let e;try{e=JSON.parse(t)}catch{return null}return zt(e)?e:null}function on(t){if(t.length===0)return null;let e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function an(t,e){let n=e.split("/").filter(s=>s.length>0).join("/");return t.length===0?n:t+"/"+n}function at(t){let e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}function cn(t,e){return e}var T=class{constructor(e,n,s,r){this.server=e,this.local=n||e,this.writable=!!s,this.xform=r||cn}},Z=null;function un(t){return!Q(t)||t.length<2?t:at(t)}function ct(){if(Z)return Z;let t=[];t.push(new T("bucket")),t.push(new T("generation")),t.push(new T("metageneration")),t.push(new T("name","fullPath",!0));function e(o,i){return un(i)}let n=new T("name");n.xform=e,t.push(n);function s(o,i){return i!==void 0?Number(i):i}let r=new T("size");return r.xform=s,t.push(r),t.push(new T("timeCreated")),t.push(new T("updated")),t.push(new T("md5Hash",null,!0)),t.push(new T("cacheControl",null,!0)),t.push(new T("contentDisposition",null,!0)),t.push(new T("contentEncoding",null,!0)),t.push(new T("contentLanguage",null,!0)),t.push(new T("contentType",null,!0)),t.push(new T("metadata","customMetadata",!0)),Z=t,Z}function ln(t,e){function n(){let s=t.bucket,r=t.fullPath,o=new E(s,r);return e._makeStorageReference(o)}Object.defineProperty(t,"ref",{get:n})}function hn(t,e,n){let s={};s.type="file";let r=n.length;for(let o=0;o<r;o++){let i=n[o];s[i.local]=i.xform(s,e[i.server])}return ln(s,t),s}function ut(t,e,n){let s=it(e);return s===null?null:hn(t,s,n)}function dn(t,e,n,s){let r=it(e);if(r===null||!Q(r.downloadTokens))return null;let o=r.downloadTokens;if(o.length===0)return null;let i=encodeURIComponent;return o.split(",").map(u=>{let l=t.bucket,f=t.fullPath,_="/b/"+i(l)+"/o/"+i(f),g=W(_,n,s),b=nt({alt:"media",token:u});return g+b})[0]}function lt(t,e){let n={},s=e.length;for(let r=0;r<s;r++){let o=e[r];o.writable&&(n[o.server]=t[o.local])}return JSON.stringify(n)}var D=class{constructor(e,n,s,r){this.url=e,this.method=n,this.handler=s,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}};function A(t){if(!t)throw fe()}function _e(t,e){function n(s,r){let o=ut(t,r,e);return A(o!==null),o}return n}function fn(t,e){function n(s,r){let o=ut(t,r,e);return A(o!==null),dn(o,r,t.host,t._protocol)}return n}function X(t){function e(n,s){let r;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invali
2d")?r=Pt():r=Dt():n.getStatus()===402?r=Ut(t.bucket):n.getStatus()===403?r=vt(t.path):r=s,r.status=n.getStatus(),r.serverResponse=s.serverResponse,r}return e}function ht(t){let e=X(t);function n(s,r){let o=e(s,r);return s.getStatus()===404&&(o=At(t.path)),o.serverResponse=r.serverResponse,o}return n}function pn(t,e,n){let s=e.fullServerUrl(),r=W(s,t.host,t._protocol),o="GET",i=t.maxOperationRetryTime,c=new D(r,o,_e(t,n),i);return c.errorHandler=ht(e),c}function _n(t,e,n){let s=e.fullServerUrl(),r=W(s,t.host,t._protocol),o="GET",i=t.maxOperationRetryTime,c=new D(r,o,fn(t,n),i);return c.errorHandler=ht(e),c}function mn(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function dt(t,e,n){let s=Object.assign({},n);return s.fullPath=t.path,s.size=e.size(),s.contentType||(s.contentType=mn(null,e)),s}function gn(t,e,n,s,r){let o=e.bucketOnlyServerUrl(),i={"X-Goog-Upload-Protocol":"multipart"};function c(){let y="";for(let R=0;R<2;R++)y=y+Math.random().toString().slice(2);return y}let a=c();i["Content-Type"]="multipart/related; boundary="+a;let u=dt(e,s,r),l=lt(u,n),f="--"+a+`\r 3Content-Type: application/json; charset=utf-8\r 4\r 5`+l+`\r 6--`+a+`\r 7Content-Type: `+u.contentType+`\r 8\r 9`,_=`\r 10--`+a+"--",g=J.getBlob(f,s,_);if(g===null)throw et();let b={name:u.fullPath},w=W(o,t.host,t._protocol),p="POST",O=t.maxUploadRetryTime,I=new D(w,p,_e(t,n),O);return I.urlParams=b,I.headers=i,I.body=g.uploadData(),I.errorHandler=X(e),I}var F=class{constructor(e,n,s,r){this.current=e,this.total=n,this.finalized=!!s,this.metadata=r||null}};function me(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch{A(!1)}return A(!!n&&(e||["active"]).indexOf(n)!==-1),n}function bn(t,e,n,s,r){let o=e.bucketOnlyServerUrl(),i=dt(e,s,r),c={name:i.fullPath}
vendor: 11,206 bytes, line 10
10,a=W(o,t.host,t._protocol),u="POST",l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":i.contentType,"Content-Type":"application/json; charset=utf-8"},f=lt(i,n),_=t.maxUploadRetryTime;function g(w){me(w);let p;try{p=w.getResponseHeader("X-Goog-Upload-URL")}catch{A(!1)}return A(Q(p)),p}let b=new D(a,u,g,_);return b.urlParams=c,b.headers=l,b.body=f,b.errorHandler=X(e),b}function Rn(t,e,n,s){let r={"X-Goog-Upload-Command":"query"};function o(u){let l=me(u,["active","final"]),f=null;try{f=u.getResponseHeader("X-Goog-Upload-Size-Received")}catch{A(!1)}f||A(!1);let _=Number(f);return A(!isNaN(_)),new F(_,s.size(),l==="final")}let i="POST",c=t.maxUploadRetryTime,a=new D(n,i,o,c);return a.headers=r,a.errorHandler=X(e),a}var Ge=256*1024;function Tn(t,e,n,s,r,o,i,c){let a=new F(0,0);if(i?(a.current=i.current,a.total=i.total):(a.current=0,a.total=s.size()),s.size()!==a.total)throw Bt();let u=a.total-a.current,l=u;r>0&&(l=Math.min(l,r));let f=a.current,_=f+l,g="";l===0?g="finalize":u===l?g="upload, finalize":g="upload";let b={"X-Goog-Upload-Command":g,"X-Goog-Upload-Offset":`${a.current}`},w=s.slice(f,_);if(w===null)throw et();function p(R,v){let N=me(R,["active","final"]),ee=a.current+l,$=s.size(),te;return N==="final"?te=_e(e,o)(R,v):te=null,new F(ee,$,N==="final",te)}let O="POST",I=e.maxUploadRetryTime,y=new D(n,O,p,I);return y.headers=b,y.body=w.uploadData(),y.progressCallback=c||null,y.errorHandler=X(t),y}var k={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function oe(t){switch(t){case"running":case"pausing":case"canceling":return k.RUNNING;case"paused":return k.PAUSED;case"success":return k.SUCCESS;case"canceled":return k.CANCELED;case"error":return k.ERROR;default:return k.ERROR}}var ue=class{constructor(e,n,s){if(Ht(e)||n!=null||s!=null)this.next=e,this.error=n??void 0,this.complete=s??void 0;else{let o=e;this.next=o.next,this.error=o.error,this.complete=o.complete}}};function x(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}var Ve=null,le=class{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=L.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=L.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=L.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,n,s,r,o){if(this.sent_)throw H("cannot .send() more than once");if(ne(e)&&s&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(n,e,!0),o!==void 0)for(let i in o)o.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,o[i].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw H("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw H("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw H("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw H("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}},he=class extends le{initXhr(){this.xhr_.responseType="text"}};function C(){return Ve?Ve():new he}var de=class{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,n,s=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=n,this._metadata=s,this._mappings=ct(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=r=>{if(this._request=void 0,this._chunkMultiplier=1,r._codeEquals(h.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{let o=this.isExponentialBackoffExpired();if(st(r.status,[]))if(o)r=Je();else{this.sleepTime=Math.max(this.sleepTime*2,It),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=r,this._transition("error")}},this._metadataErrorHandler=r=>{this._request=void 0,r._codeEquals(h.CANCELED)?this.completeTransitions_():(this._error=r,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((r,o)=>{this._resolve=r,this._reject=o,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){let e=this._transferred;return n=>this._updateProgress(e+n)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([n,s])=>{switch(this._state){case"running":e(n,s);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,n)=>{let s=bn(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(s,C,e,n);this._request=r,r.getPromise().then(o=>{this._request=void 0,this._uploadUrl=o,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){let e=this._uploadUrl;this._resolveToken((n,s)=>{let r=Rn(this._ref.storage,this._ref._location,e,this._blob),o=this._ref.storage._makeRequest(r,C,n,s);this._request=o,o.getPromise().then(i=>{i=i,this._request=void 0,this._updateProgress(i.current),this._needToFetchStatus=!1,i.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){let e=Ge*this._chunkMultiplier,n=new F(this._transferred,this._blob.size()),s=this._uploadUrl;this._resolveToken((r,o)=>{let i;try{i=Tn(this._ref._location,this._ref.storage,s,this._blob,e,this._mappings,n,this._makeProgressCallback())}catch(a){this._error=a,this._transition("error");return}let c=this._ref.storage._makeRequest(i,C,r,o,!1);this._request=c,c.getPromise().then(a=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(a.current),a.finalized?(this._metadata=a.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){Ge*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,n)=>{let s=pn(this._ref.storage,this._ref._location,this._mappings),r=this._ref.storage._makeRequest(s,C,e,n);this._request=r,r.getPromise().then(o=>{this._request=void 0,this._metadata=o,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,n)=>{let s=gn(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(s,C,e,n);this._request=r,r.getPromise().then(o=>{this._request=void 0,this._metadata=o,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){let n=this._transferred;this._transferred=e,this._transferred!==n&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":let n=this._state==="paused";this._state=e,n&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=Qe(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){let e=oe(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,n,s,r){let o=new ue(n||void 0,s||void 0,r||void 0);return this._addObserver(o),()=>{this._removeObserver(o)}}then(e,n){return this._promise.then(e,n)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){let n=this._observers.indexOf(e);n!==-1&&this._observers.splice(n,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(n=>{this._notifyObserver(n)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(oe(this._state)){case k.SUCCESS:x(this._resolve.bind(null,this.snapshot))();break;case k.CANCELED:case k.ERROR:let n=this._reject;x(n.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(oe(this._state)){case k.RUNNING:case k.PAUSED:e.next&&x(e.next.bind(e,this.snapshot))();break;case k.SUCCESS:e.complete&&x(e.complete.bind(e))();break;case k.CANCELED:case k.ERROR:e.error&&x(e.error.bind(e,this._error))();break;default:e.error&&x(e.error.bind(e,this._error))()}}resume(){let e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){let e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){let e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}};var M=class t{constructor(e,n){this._service=e,n instanceof E?this._location=n:this._location=E.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new t(e,n)}get root(){let e=new E(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return at(this._location.path)}get storage(){return this._service}get parent(){let e=on(this._location.path);if(e===null)return null;let n=new E(this._location.bucket,e);return new t(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw Mt(e)}};function yn(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new de(t,new J(e),n)}function wn(t){t._throwIfRoot("getDownloadURL");let e=_n(t.storage,t._location,ct());return t.storage.makeRequestWithTokens(e,C).then(n=>{if(n===null)throw Lt();return n})}function kn(t,e){let n=an(t._location.path,e),s=new E(t._location.bucket,n);return new M(t.storage,s)}function En(t){return/^[A-Za-z]+:\/\//.test(t)}function Sn(t,e){return new M(t,e)}function ft(t,e){if(t instanceof V){let n=t;if(n._bucket==null)throw Ct();let s=new M(n,n._bucket);return e!=null?ft(s,e):s}else return e!==void 0?kn(t,e):t}
10function On(t,e){if(e&&En(e)){if(t instanceof V)return Sn(t,e);throw ie("To use ref(service, url), the first argument must be a Storage instance.")}else return ft(t,e)}function We(t,e){let n=e?.[Ye];return n==null?null:E.makeFromBucketSpec(n,t)}function In(t,e,n,s={}){t.host=`${e}:${n}`;let r=ne(e);r&&(Ee(`https://${t.host}/b`),Oe("Storage",!0)),t._isUsingEmulator=!0,t._protocol=r?"https":"http";let{mockUserToken:o}=s;o&&(t._overrideAuthToken=typeof o=="string"?o:Se(o,t.app.options.projectId))}var V=class{constructor(e,n,s,r,o,i=!1){this.app=e,this._authProvider=n,this._appCheckProvider=s,this._url=r,this._firebaseVersion=o,this._isUsingEmulator=i,this._bucket=null,this._host=Ze,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=St,this._maxUploadRetryTime=Ot,this._requests=new Set,r!=null?this._bucket=E.makeFromBucketSpec(r,this._host):this._bucket=We(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=E.makeFromBucketSpec(this._url,e):this._bucket=We(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){ze("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){ze("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}_getAuthToken(){return m(this,null,function*(){if(this._overrideAuthToken)return this._overrideAuthToken;let e=this._authProvider.getImmediate({optional:!0});if(e){let n=yield e.getToken();if(n!==null)return n.accessToken}return null})}_getAppCheckToken(){return m(this,null,function*(){if(Pe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=this._appCheckProvider.getImmediate({optional:!0});return e?(yield e.getToken()).token:null})}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new M(this,e)}_makeRequest(e,n,s,r,o=!0){if(this._deleted)return new ae(tt());{let i=Kt(e,this._appId,s,r,n,this._firebaseVersion,o,this._isUsingEmulator);return this._requests.add(i),i.getPromise().then(()=>this._requests.delete(i),()=>this._requests.delete(i)),i}}makeRequestWithTokens(e,n){return m(this,null,function*(){let[s,r]=yield Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,s,r).getPromise()})}},Xe="@firebase/storage",Ke="0.13.14";var pt="storage";function _t(t,e,n){return t=j(t),yn(t,e,n)}function mt(t){return t=j(t),wn(t)}function gt(t,e){return t=j(t),On(t,e)}function bt(t=Ne(),e){t=j(t);let s=De(t,pt).getImmediate({identifier:e}),r=ke("storage");return r&&Rt(s,...r),s}function Rt(t,e,n,s={}){In(t,e,n,s)}function An(t,{instanceIdentifier:e}){let n=t.getProvider("app").getImmediate(),s=t.getProvider("auth-internal"),r=t.getProvider("app-check-internal");return new V(n,s,r,e,ve)}function Un(){Ue(new Ae(pt,An,"PUBLIC").setMultipleInstances(!0)),K(Xe,Ke,""),K(Xe,Ke,"esm2017")}Un();var Tt=q(mt,!0);var yt=q(bt,!0);var wt=q(gt,!0,2);var kt=q(_t,!0);var Et=(()=>{class t{storage=yt();uploadFile(n,s,r){return new Promise((o,i)=>{let c=wt(this.storage,n),a=kt(c,s);a.on("state_changed",u=>{let l=u.bytesTransferred/u.totalBytes*100;r(l),console.log("Upload is "+l+"% done")},u=>{console.error(u),i(u)},()=>{Tt(a.snapshot.ref).then(u=>{console.log("File available at",u),o(u)}).catch(u=>{i(u)})})})}static \u0275fac=function(s){return new(s||t)};static \u0275prov=U({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Rs=(()=>{class t{firebaseDatabaseService=P(je);localDbService=P(qe);tenantService=P(we);storageService=P(Et);$tenantPath=Te(()=>{let n=this.tenantService.$tenant();return n?(n?.acronym||"unknown-project")+"_"+n?.id:null});tenantPath$=ye(this.$tenantPath);getTenantPath(n){return m(this,null,function*(){return((yield ge(this.tenantPath$.pipe(be(o=>!!o))))+"/"+n).replace(/\/\//g,"/")})}updateRemoteDBObject(n,s){return m(this,null,function*(){n=yield this.getTenantPath(n),yield this.firebaseDatabaseService.updateDbObject(n,s)})}createRemoteDBObject(n,s){return m(this,null,function*(){n=yield this.getTenantPath(n),yield this.firebaseDatabaseService.setDbObject(n,s)})}getRemoteDBData(n){return m(this,null,function*(){return n=yield this.getTenantPath(n),yield this.firebaseDatabaseService.getDbData(n)})}deleteRemoteDBObject(n){return m(this,null,function*(){n=yield this.getTenantPath(n),yield this.firebaseDatabaseService.removeDbObject(n)})}getLocalDBData(n){return m(this,null,function*(){return this.localDbService.getTableItems(n)})}addLocalDBData(n,s){return m(this,null,function*(){return yield this.localDbService.addItems(n,s)})}updateLocalDBData(n,s,r){return m(this,null,function*(){return this.localDbService.updateItem(n,s,r)})}uploadFile(n,s,r){return m(this,null,function*(){return n=yield this.getTenantPath(n),this.storageService.uploadFile(n,s,r)})}static \u0275fac=function(s){return new(s||t)};static \u0275prov=U({token:t,factory:t.\u0275fac})}return t})();export{Rs as DBService};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.