import{g as t,a as n,_ as e,C as r,r as s,S as i}from"./p-38dfe2d0.js";
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const o="FirebaseError";class u extends Error{constructor(t,n,e){super(n);this.code=t;this.customData=e;this.name=o;Object.setPrototypeOf(this,u.prototype);if(Error.captureStackTrace){Error.captureStackTrace(this,c.prototype.create)}}}class c{constructor(t,n,e){this.service=t;this.serviceName=n;this.errors=e}create(t,...n){const e=n[0]||{};const r=`${this.service}/${t}`;const s=this.errors[t];const i=s?l(s,e):"Error";const o=`${this.serviceName}: ${i} (${r}).`;const c=new u(r,o,e);return c}}function l(t,n){return t.replace(a,((t,e)=>{const r=n[e];return r!=null?String(r):`<${e}?>`}))}const a=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function f(t){if(t&&t._delegate){return t._delegate}else{return t}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const h="firebasestorage.googleapis.com";const d="storageBucket";const w=2*60*1e3;const p=10*60*1e3;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class g extends u{constructor(t,n){super(m(t),`Firebase Storage: ${n} (${m(t)})`);this.customData={serverResponse:null};this._baseMessage=this.message;Object.setPrototypeOf(this,g.prototype)}_codeEquals(t){return m(t)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(t){this.customData.serverResponse=t;if(this.customData.serverResponse){this.message=`${this._baseMessage}\n${this.customData.serverResponse}`}else{this.message=this._baseMessage}}}function m(t){return"storage/"+t}function b(){const t="An unknown error occurred, please check the error payload for "+"server response.";return new g("unknown",t)}function y(t){return new g("object-not-found","Object '"+t+"' does not exist.")}function R(t){return new g("quota-exceeded","Quota for bucket '"+t+"' exceeded, please view quota on "+"https://firebase.google.com/pricing/.")}function v(){const t="User is not authenticated, please authenticate using Firebase "+"Authentication and try again.";return new g("unauthenticated",t)}function U(){return new g("unauthorized-app","This app does not have permission to access Firebase Storage on this project.")}function k(t){return new g("unauthorized","User does not have permission to access '"+t+"'.")}function $(){return new g("retry-limit-exceeded","Max retry time for operation exceeded, please try again.")}function T(){return new g("canceled","User canceled the upload/download.")}function A(t){return new g("invalid-url","Invalid URL '"+t+"'.")}function x(t){return new g("invalid-default-bucket","Invalid default bucket '"+t+"'.")}function E(){return new g("no-default-bucket","No default bucket "+"found. Did you set the '"+d+"' property when initializing the app?")}function B(){return new g("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function S(){return new g("no-download-url","The given file does not have any download URLs.")}function _(t){return new g("invalid-argument",t)}function C(){return new g("app-deleted","The Firebase app was deleted.")}function I(t){return new g("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 O(t,n){return new g("invalid-format","String does not match format '"+t+"': "+n)}function P(t){throw new g("internal-error","Internal error: "+t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class j{constructor(t,n){this.bucket=t;this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)}bucketOnlyServerUrl(){const t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o"}static makeFromBucketSpec(t,n){let e;try{e=j.makeFromUrl(t,n)}catch(n){return new j(t,"")}if(e.path===""){return e}else{throw x(t)}}static makeFromUrl(t,n){let e=null;const r="([A-Za-z0-9.\\-_]+)";function s(t){if(t.path.charAt(t.path.length-1)==="/"){t.path_=t.path_.slice(0,-1)}}const i="(/(.*))?$";const o=new RegExp("^gs://"+r+i,"i");const u={bucket:1,path:3};function c(t){t.path_=decodeURIComponent(t.path)}const l="v[A-Za-z0-9_]+";const a=n.replace(/[.]/g,"\\.");const f="(/([^?#]*).*)?$";const d=new RegExp(`^https?://${a}/${l}/b/${r}/o${f}`,"i");const w={bucket:1,path:3};const p=n===h?"(?:storage.googleapis.com|storage.cloud.google.com)":n;const g="([^?#]*)";const m=new RegExp(`^https?://${p}/${r}/${g}`,"i");const b={bucket:1,path:2};const y=[{regex:o,indices:u,postModify:s},{regex:d,indices:w,postModify:c},{regex:m,indices:b,postModify:c}];for(let n=0;n<y.length;n++){const r=y[n];const s=r.regex.exec(t);if(s){const t=s[r.indices.bucket];let n=s[r.indices.path];if(!n){n=""}e=new j(t,n);r.postModify(e);break}}if(e==null){throw A(t)}return e}}class L{constructor(t){this.promise_=Promise.reject(t)}getPromise(){return this.promise_}cancel(t=false){}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function M(t,n,e){let r=1;let s=null;let i=null;let o=false;let u=0;function c(){return u===2}let l=false;function a(...t){if(!l){l=true;n.apply(null,t)}}function f(n){s=setTimeout((()=>{s=null;t(d,c())}),n)}function h(){if(i){clearTimeout(i)}}function d(t,...n){if(l){h();return}if(t){h();a.call(null,t,...n);return}const e=c()||o;if(e){h();a.call(null,t,...n);return}if(r<64){r*=2}let s;if(u===1){u=2;s=0}else{s=(r+Math.random())*1e3}f(s)}let w=false;function p(t){if(w){return}w=true;h();if(l){return}if(s!==null){if(!t){u=2}clearTimeout(s);f(0)}else{if(!t){u=1}}}f(0);i=setTimeout((()=>{o=true;p(true)}),e);return p}function F(t){t(false)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function z(t){return t!==void 0}function N(t){return typeof t==="object"&&!Array.isArray(t)}function q(t){return typeof t==="string"||t instanceof String}function D(t){return W()&&t instanceof Blob}function W(){return typeof Blob!=="undefined"}function H(t,n,e,r){if(r<n){throw _(`Invalid value for '${t}'. Expected ${n} or greater.`)}if(r>e){throw _(`Invalid value for '${t}'. Expected ${e} or less.`)}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function K(t,n,e){let r=n;if(e==null){r=`https://${n}`}return`${e}://${r}/v0${t}`}function X(t){const n=encodeURIComponent;let e="?";for(const r in t){if(t.hasOwnProperty(r)){const s=n(r)+"="+n(t[r]);e=e+s+"&"}}e=e.slice(0,-1);return e}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Z;(function(t){t[t["NO_ERROR"]=0]="NO_ERROR";t[t["NETWORK_ERROR"]=1]="NETWORK_ERROR";t[t["ABORT"]=2]="ABORT"})(Z||(Z={}));
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class G{constructor(t,n,e,r,s,i,o,u,c,l,a){this.url_=t;this.method_=n;this.headers_=e;this.body_=r;this.successCodes_=s;this.additionalRetryCodes_=i;this.callback_=o;this.errorCallback_=u;this.timeout_=c;this.progressCallback_=l;this.connectionFactory_=a;this.pendingConnection_=null;this.backoffId_=null;this.canceled_=false;this.appDelete_=false;this.promise_=new Promise(((t,n)=>{this.resolve_=t;this.reject_=n;this.start_()}))}start_(){const t=(t,n)=>{if(n){t(false,new J(false,null,true));return}const e=this.connectionFactory_();this.pendingConnection_=e;const r=t=>{const n=t.loaded;const e=t.lengthComputable?t.total:-1;if(this.progressCallback_!==null){this.progressCallback_(n,e)}};if(this.progressCallback_!==null){e.addUploadProgressListener(r)}e.send(this.url_,this.method_,this.body_,this.headers_).then((()=>{if(this.progressCallback_!==null){e.removeUploadProgressListener(r)}this.pendingConnection_=null;const n=e.getErrorCode()===Z.NO_ERROR;const s=e.getStatus();if(!n||this.isRetryStatusCode_(s)){const n=e.getErrorCode()===Z.ABORT;t(false,new J(false,null,n));return}const i=this.successCodes_.indexOf(s)!==-1;t(true,new J(i,e))}))};const n=(t,n)=>{const e=this.resolve_;const r=this.reject_;const s=n.connection;if(n.wasSuccessCode){try{const t=this.callback_(s,s.getResponse());if(z(t)){e(t)}else{e()}}catch(t){r(t)}}else{if(s!==null){const t=b();t.serverResponse=s.getErrorText();if(this.errorCallback_){r(this.errorCallback_(s,t))}else{r(t)}}else{if(n.canceled){const t=this.appDelete_?C():T();r(t)}else{const t=$();r(t)}}}};if(this.canceled_){n(false,new J(false,null,true))}else{this.backoffId_=M(t,n,this.timeout_)}}getPromise(){return this.promise_}cancel(t){this.canceled_=true;this.appDelete_=t||false;if(this.backoffId_!==null){F(this.backoffId_)}if(this.pendingConnection_!==null){this.pendingConnection_.abort()}}isRetryStatusCode_(t){const n=t>=500&&t<600;const e=[408,429];const r=e.indexOf(t)!==-1;const s=this.additionalRetryCodes_.indexOf(t)!==-1;return n||r||s}}class J{constructor(t,n,e){this.wasSuccessCode=t;this.connection=n;this.canceled=!!e}}function Q(t,n){if(n!==null&&n.length>0){t["Authorization"]="Firebase "+n}}function V(t,n){t["X-Firebase-Storage-Version"]="webjs/"+(n!==null&&n!==void 0?n:"AppManager")}function Y(t,n){if(n){t["X-Firebase-GMPID"]=n}}function tt(t,n){if(n!==null){t["X-Firebase-AppCheck"]=n}}function nt(t,n,e,r,s,i){const o=X(t.urlParams);const u=t.url+o;const c=Object.assign({},t.headers);Y(c,n);Q(c,e);V(c,i);tt(c,r);return new G(u,t.method,c,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function et(){if(typeof BlobBuilder!=="undefined"){return BlobBuilder}else if(typeof WebKitBlobBuilder!=="undefined"){return WebKitBlobBuilder}else{return undefined}}function rt(...t){const n=et();if(n!==undefined){const e=new n;for(let n=0;n<t.length;n++){e.append(t[n])}return e.getBlob()}else{if(W()){return new Blob(t)}else{throw new g("unsupported-environment","This browser doesn't seem to support creating Blobs")}}}function st(t,n,e){if(t.webkitSlice){return t.webkitSlice(n,e)}else if(t.mozSlice){return t.mozSlice(n,e)}else if(t.slice){return t.slice(n,e)}return null}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function it(t){return atob(t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const ot={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class ut{constructor(t,n){this.data=t;this.contentType=n||null}}function ct(t,n){switch(t){case ot.RAW:return new ut(lt(n));case ot.BASE64:case ot.BASE64URL:return new ut(ft(t,n));case ot.DATA_URL:return new ut(dt(n),wt(n))}throw b()}function lt(t){const n=[];for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);if(r<=127){n.push(r)}else{if(r<=2047){n.push(192|r>>6,128|r&63)}else{if((r&64512)===55296){const s=e<t.length-1&&(t.charCodeAt(e+1)&64512)===56320;if(!s){n.push(239,191,189)}else{const s=r;const i=t.charCodeAt(++e);r=65536|(s&1023)<<10|i&1023;n.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}}else{if((r&64512)===56320){n.push(239,191,189)}else{n.push(224|r>>12,128|r>>6&63,128|r&63)}}}}}return new Uint8Array(n)}function at(t){let n;try{n=decodeURIComponent(t)}catch(t){throw O(ot.DATA_URL,"Malformed data URL.")}return lt(n)}function ft(t,n){switch(t){case ot.BASE64:{const e=n.indexOf("-")!==-1;const r=n.indexOf("_")!==-1;if(e||r){const n=e?"-":"_";throw O(t,"Invalid character '"+n+"' found: is it base64url encoded?")}break}case ot.BASE64URL:{const e=n.indexOf("+")!==-1;const r=n.indexOf("/")!==-1;if(e||r){const n=e?"+":"/";throw O(t,"Invalid character '"+n+"' found: is it base64 encoded?")}n=n.replace(/-/g,"+").replace(/_/g,"/");break}}let e;try{e=it(n)}catch(n){throw O(t,"Invalid character found")}const r=new Uint8Array(e.length);for(let t=0;t<e.length;t++){r[t]=e.charCodeAt(t)}return r}class ht{constructor(t){this.base64=false;this.contentType=null;const n=t.match(/^data:([^,]+)?,/);if(n===null){throw O(ot.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>")}const e=n[1]||null;if(e!=null){this.base64=pt(e,";base64");this.contentType=this.base64?e.substring(0,e.length-";base64".length):e}this.rest=t.substring(t.indexOf(",")+1)}}function dt(t){const n=new ht(t);if(n.base64){return ft(ot.BASE64,n.rest)}else{return at(n.rest)}}function wt(t){const n=new ht(t);return n.contentType}function pt(t,n){const e=t.length>=n.length;if(!e){return false}return t.substring(t.length-n.length)===n}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class gt{constructor(t,n){let e=0;let r="";if(D(t)){this.data_=t;e=t.size;r=t.type}else if(t instanceof ArrayBuffer){if(n){this.data_=new Uint8Array(t)}else{this.data_=new Uint8Array(t.byteLength);this.data_.set(new Uint8Array(t))}e=this.data_.length}else if(t instanceof Uint8Array){if(n){this.data_=t}else{this.data_=new Uint8Array(t.length);this.data_.set(t)}e=t.length}this.size_=e;this.type_=r}size(){return this.size_}type(){return this.type_}slice(t,n){if(D(this.data_)){const e=this.data_;const r=st(e,t,n);if(r===null){return null}return new gt(r)}else{const e=new Uint8Array(this.data_.buffer,t,n-t);return new gt(e,true)}}static getBlob(...t){if(W()){const n=t.map((t=>{if(t instanceof gt){return t.data_}else{return t}}));return new gt(rt.apply(null,n))}else{const n=t.map((t=>{if(q(t)){return ct(ot.RAW,t).data}else{return t.data_}}));let e=0;n.forEach((t=>{e+=t.byteLength}));const r=new Uint8Array(e);let s=0;n.forEach((t=>{for(let n=0;n<t.length;n++){r[s++]=t[n]}}));return new gt(r,true)}}uploadData(){return this.data_}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function mt(t){let n;try{n=JSON.parse(t)}catch(t){return null}if(N(n)){return n}else{return null}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function bt(t){if(t.length===0){return null}const n=t.lastIndexOf("/");if(n===-1){return""}const e=t.slice(0,n);return e}function yt(t,n){const e=n.split("/").filter((t=>t.length>0)).join("/");if(t.length===0){return e}else{return t+"/"+e}}function Rt(t){const n=t.lastIndexOf("/",t.length-2);if(n===-1){return t}else{return t.slice(n+1)}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function vt(t,n){return n}class Ut{constructor(t,n,e,r){this.server=t;this.local=n||t;this.writable=!!e;this.xform=r||vt}}let kt=null;function $t(t){if(!q(t)||t.length<2){return t}else{return Rt(t)}}function Tt(){if(kt){return kt}const t=[];t.push(new Ut("bucket"));t.push(new Ut("generation"));t.push(new Ut("metageneration"));t.push(new Ut("name","fullPath",true));function n(t,n){return $t(n)}const e=new Ut("name");e.xform=n;t.push(e);function r(t,n){if(n!==undefined){return Number(n)}else{return n}}const s=new Ut("size");s.xform=r;t.push(s);t.push(new Ut("timeCreated"));t.push(new Ut("updated"));t.push(new Ut("md5Hash",null,true));t.push(new Ut("cacheControl",null,true));t.push(new Ut("contentDisposition",null,true));t.push(new Ut("contentEncoding",null,true));t.push(new Ut("contentLanguage",null,true));t.push(new Ut("contentType",null,true));t.push(new Ut("metadata","customMetadata",true));kt=t;return kt}function At(t,n){function e(){const e=t["bucket"];const r=t["fullPath"];const s=new j(e,r);return n._makeStorageReference(s)}Object.defineProperty(t,"ref",{get:e})}function xt(t,n,e){const r={};r["type"]="file";const s=e.length;for(let t=0;t<s;t++){const s=e[t];r[s.local]=s.xform(r,n[s.server])}At(r,t);return r}function Et(t,n,e){const r=mt(n);if(r===null){return null}const s=r;return xt(t,s,e)}function Bt(t,n,e,r){const s=mt(n);if(s===null){return null}if(!q(s["downloadTokens"])){return null}const i=s["downloadTokens"];if(i.length===0){return null}const o=encodeURIComponent;const u=i.split(",");const c=u.map((n=>{const s=t["bucket"];const i=t["fullPath"];const u="/b/"+o(s)+"/o/"+o(i);const c=K(u,e,r);const l=X({alt:"media",token:n});return c+l}));return c[0]}function St(t,n){const e={};const r=n.length;for(let s=0;s<r;s++){const r=n[s];if(r.writable){e[r.server]=t[r.local]}}return JSON.stringify(e)}class _t{constructor(t,n,e,r){this.url=t;this.method=n;this.handler=e;this.timeout=r;this.urlParams={};this.headers={};this.body=null;this.errorHandler=null;this.progressCallback=null;this.successCodes=[200];this.additionalRetryCodes=[]}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Ct(t){if(!t){throw b()}}function It(t,n){function e(e,r){const s=Et(t,r,n);Ct(s!==null);return s}return e}function Ot(t,n){function e(e,r){const s=Et(t,r,n);Ct(s!==null);return Bt(s,r,t.host,t._protocol)}return e}function Pt(t){function n(n,e){let r;if(n.getStatus()===401){if(n.getErrorText().includes("Firebase App Check token is invalid")){r=U()}else{r=v()}}else{if(n.getStatus()===402){r=R(t.bucket)}else{if(n.getStatus()===403){r=k(t.path)}else{r=e}}}r.serverResponse=e.serverResponse;return r}return n}function jt(t){const n=Pt(t);function e(e,r){let s=n(e,r);if(e.getStatus()===404){s=y(t.path)}s.serverResponse=r.serverResponse;return s}return e}function Lt(t,n,e){const r=n.fullServerUrl();const s=K(r,t.host,t._protocol);const i="GET";const o=t.maxOperationRetryTime;const u=new _t(s,i,Ot(t,e),o);u.errorHandler=jt(n);return u}function Mt(t,n){return t&&t["contentType"]||n&&n.type()||"application/octet-stream"}function Ft(t,n,e){const r=Object.assign({},e);r["fullPath"]=t.path;r["size"]=n.size();if(!r["contentType"]){r["contentType"]=Mt(null,n)}return r}function zt(t,n,e,r,s){const i=n.bucketOnlyServerUrl();const o={"X-Goog-Upload-Protocol":"multipart"};function u(){let t="";for(let n=0;n<2;n++){t=t+Math.random().toString().slice(2)}return t}const c=u();o["Content-Type"]="multipart/related; boundary="+c;const l=Ft(n,r,s);const a=St(l,e);const f="--"+c+"\r\n"+"Content-Type: application/json; charset=utf-8\r\n\r\n"+a+"\r\n--"+c+"\r\n"+"Content-Type: "+l["contentType"]+"\r\n\r\n";const h="\r\n--"+c+"--";const d=gt.getBlob(f,r,h);if(d===null){throw B()}const w={name:l["fullPath"]};const p=K(i,t.host,t._protocol);const g="POST";const m=t.maxUploadRetryTime;const b=new _t(p,g,It(t,e),m);b.urlParams=w;b.headers=o;b.body=d.uploadData();b.errorHandler=Pt(n);return b}class Nt{constructor(){this.sent_=false;this.xhr_=new XMLHttpRequest;this.initXhr();this.errorCode_=Z.NO_ERROR;this.sendPromise_=new Promise((t=>{this.xhr_.addEventListener("abort",(()=>{this.errorCode_=Z.ABORT;t()}));this.xhr_.addEventListener("error",(()=>{this.errorCode_=Z.NETWORK_ERROR;t()}));this.xhr_.addEventListener("load",(()=>{t()}))}))}send(t,n,e,r){if(this.sent_){throw P("cannot .send() more than once")}this.sent_=true;this.xhr_.open(n,t,true);if(r!==undefined){for(const t in r){if(r.hasOwnProperty(t)){this.xhr_.setRequestHeader(t,r[t].toString())}}}if(e!==undefined){this.xhr_.send(e)}else{this.xhr_.send()}return this.sendPromise_}getErrorCode(){if(!this.sent_){throw P("cannot .getErrorCode() before sending")}return this.errorCode_}getStatus(){if(!this.sent_){throw P("cannot .getStatus() before sending")}try{return this.xhr_.status}catch(t){return-1}}getResponse(){if(!this.sent_){throw P("cannot .getResponse() before sending")}return this.xhr_.response}getErrorText(){if(!this.sent_){throw P("cannot .getErrorText() before sending")}return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(t){return this.xhr_.getResponseHeader(t)}addUploadProgressListener(t){if(this.xhr_.upload!=null){this.xhr_.upload.addEventListener("progress",t)}}removeUploadProgressListener(t){if(this.xhr_.upload!=null){this.xhr_.upload.removeEventListener("progress",t)}}}class qt extends Nt{initXhr(){this.xhr_.responseType="text"}}function Dt(){return new qt}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Wt{constructor(t,n){this._service=t;if(n instanceof j){this._location=n}else{this._location=j.makeFromUrl(n,t.host)}}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(t,n){return new Wt(t,n)}get root(){const t=new j(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Rt(this._location.path)}get storage(){return this._service}get parent(){const t=bt(this._location.path);if(t===null){return null}const n=new j(this._location.bucket,t);return new Wt(this._service,n)}_throwIfRoot(t){if(this._location.path===""){throw I(t)}}}function Ht(t,n,e){t._throwIfRoot("uploadBytes");const r=zt(t.storage,t._location,Tt(),new gt(n,true),e);return t.storage.makeRequestWithTokens(r,Dt).then((n=>({metadata:n,ref:t})))}function Kt(t){t._throwIfRoot("getDownloadURL");const n=Lt(t.storage,t._location,Tt());return t.storage.makeRequestWithTokens(n,Dt).then((t=>{if(t===null){throw S()}return t}))}function Xt(t,n){const e=yt(t._location.path,n);const r=new j(t._location.bucket,e);return new Wt(t.storage,r)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Zt(t){return/^[A-Za-z]+:\/\//.test(t)}function Gt(t,n){return new Wt(t,n)}function Jt(t,n){if(t instanceof Yt){const e=t;if(e._bucket==null){throw E()}const r=new Wt(e,e._bucket);if(n!=null){return Jt(r,n)}else{return r}}else{if(n!==undefined){return Xt(t,n)}else{return t}}}function Qt(t,n){if(n&&Zt(n)){if(t instanceof Yt){return Gt(t,n)}else{throw _("To use ref(service, url), the first argument must be a Storage instance.")}}else{return Jt(t,n)}}function Vt(t,n){const e=n===null||n===void 0?void 0:n[d];if(e==null){return null}return j.makeFromBucketSpec(e,t)}class Yt{constructor(t,n,e,r,s){this.app=t;this._authProvider=n;this._appCheckProvider=e;this._url=r;this._firebaseVersion=s;this._bucket=null;this._host=h;this._protocol="https";this._appId=null;this._deleted=false;this._maxOperationRetryTime=w;this._maxUploadRetryTime=p;this._requests=new Set;if(r!=null){this._bucket=j.makeFromBucketSpec(r,this._host)}else{this._bucket=Vt(this._host,this.app.options)}}get host(){return this._host}set host(t){this._host=t;if(this._url!=null){this._bucket=j.makeFromBucketSpec(this._url,t)}else{this._bucket=Vt(t,this.app.options)}}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){H("time",0,Number.POSITIVE_INFINITY,t);this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){H("time",0,Number.POSITIVE_INFINITY,t);this._maxOperationRetryTime=t}async _getAuthToken(){if(this._overrideAuthToken){return this._overrideAuthToken}const t=this._authProvider.getImmediate({optional:true});if(t){const n=await t.getToken();if(n!==null){return n.accessToken}}return null}async _getAppCheckToken(){const t=this._appCheckProvider.getImmediate({optional:true});if(t){const n=await t.getToken();return n.token}return null}_delete(){if(!this._deleted){this._deleted=true;this._requests.forEach((t=>t.cancel()));this._requests.clear()}return Promise.resolve()}_makeStorageReference(t){return new Wt(this,t)}_makeRequest(t,n,e,r){if(!this._deleted){const s=nt(t,this._appId,e,r,n,this._firebaseVersion);this._requests.add(s);s.getPromise().then((()=>this._requests.delete(s)),(()=>this._requests.delete(s)));return s}else{return new L(C())}}async makeRequestWithTokens(t,n){const[e,r]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(t,n,e,r).getPromise()}}const tn="@firebase/storage";const nn="0.9.9";
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const en="storage";function rn(t,n,e){t=f(t);return Ht(t,n,e)}function sn(t){t=f(t);return Kt(t)}function on(t,n){t=f(t);return Qt(t,n)}function un(e=t(),r){e=f(e);const s=n(e,en);const i=s.getImmediate({identifier:r});return i}function cn(t,{instanceIdentifier:n}){const e=t.getProvider("app").getImmediate();const r=t.getProvider("auth-internal");const s=t.getProvider("app-check-internal");return new Yt(e,r,s,n,i)}function ln(){e(new r(en,cn,"PUBLIC").setMultipleInstances(true));s(tn,nn,"");s(tn,nn,"esm2017")}ln();export{sn as a,un as g,on as r,rn as u};
//# sourceMappingURL=p-c5cc6a20.js.map