HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-4-197 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/web.enelar.com.co/node_modules/rxfire/storage/index.cjs.js
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var storage = require('firebase/storage');
var rxjs = require('rxjs');
var operators = require('rxjs/operators');

function fromTask(task) {
    return new rxjs.Observable(function (subscriber) {
        var lastSnapshot = null;
        var complete = false;
        var hasError = false;
        var error = null;
        var emit = function (snapshot) {
            lastSnapshot = snapshot;
            schedule();
        };
        var id = null;
        /**
         * Schedules an async event to check and emit
         * the most recent snapshot, and complete or error
         * if necessary.
         */
        var schedule = function () {
            if (!id) {
                id = setTimeout(function () {
                    id = null;
                    if (lastSnapshot)
                        subscriber.next(lastSnapshot);
                    if (complete)
                        subscriber.complete();
                    if (hasError)
                        subscriber.error(error);
                });
            }
        };
        subscriber.add(function () {
            // If we have any emissions checks scheduled, cancel them.
            if (id)
                clearTimeout(id);
        });
        // Emit the initial snapshot
        emit(task.snapshot);
        // Take each update and schedule them to be emitted (see `emit`)
        subscriber.add(task.on('state_changed', emit));
        // task is a promise, so we can convert that to an observable,
        // this is done for the ergonomics around making sure we don't
        // try to push errors or completions through closed subscribers
        subscriber.add(rxjs.from(task).subscribe({
            next: emit,
            error: function (err) {
                hasError = true;
                error = err;
                schedule();
            },
            complete: function () {
                complete = true;
                schedule();
            },
        }));
    });
}
function getDownloadURL(ref) {
    return rxjs.from(storage.getDownloadURL(ref));
}
// TODO: fix storage typing in firebase, then apply the same fix here
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getMetadata(ref) {
    return rxjs.from(storage.getMetadata(ref));
}
// MARK: Breaking change (renaming put to uploadBytesResumable)
function uploadBytesResumable(ref, data, metadata) {
    return new rxjs.Observable(function (subscriber) {
        var task = storage.uploadBytesResumable(ref, data, metadata);
        var subscription = fromTask(task).subscribe(subscriber);
        return function unsubscribe() {
            subscription.unsubscribe();
            task.cancel();
        };
    }).pipe(operators.shareReplay({ bufferSize: 1, refCount: true }));
}
// MARK: Breaking change (renaming put to uploadString)
function uploadString(ref, data, format, metadata) {
    return rxjs.from(storage.uploadString(ref, data, format, metadata));
}
function percentage(task) {
    return fromTask(task).pipe(operators.map(function (snapshot) { return ({
        progress: (snapshot.bytesTransferred / snapshot.totalBytes) * 100,
        snapshot: snapshot,
    }); }));
}

exports.fromTask = fromTask;
exports.getDownloadURL = getDownloadURL;
exports.getMetadata = getMetadata;
exports.percentage = percentage;
exports.uploadBytesResumable = uploadBytesResumable;
exports.uploadString = uploadString;
//# sourceMappingURL=index.cjs.js.map