"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeRemove = exports.unsafePublishAll = exports.unsafePollN = exports.unsafePollAllSubscription = exports.unsafePollAllQueue = exports.unsafeOfferAll = exports.unsafeCompletePromise = void 0;
// ets_tracing: off
require("../../Operator");
const Chunk = __importStar(require("../../Collections/Immutable/Chunk"));
const T = __importStar(require("../../Effect"));
const P = __importStar(require("../../Promise"));
/**
 * Unsafely completes a promise with the specified value.
 */
function unsafeCompletePromise(promise, a) {
    P.unsafeDone(T.succeed(a))(promise);
}
exports.unsafeCompletePromise = unsafeCompletePromise;
/**
 * Unsafely offers the specified values to a queue.
 */
function unsafeOfferAll(queue, as) {
    return queue.offerAll(as);
}
exports.unsafeOfferAll = unsafeOfferAll;
/**
 * Unsafely polls all values from a queue.
 */
function unsafePollAllQueue(queue) {
    return queue.pollUpTo(Number.MAX_SAFE_INTEGER);
}
exports.unsafePollAllQueue = unsafePollAllQueue;
/**
 * Unsafely polls all values from a subscription.
 */
function unsafePollAllSubscription(subscription) {
    return subscription.pollUpTo(Number.MAX_SAFE_INTEGER);
}
exports.unsafePollAllSubscription = unsafePollAllSubscription;
/**
 * Unsafely polls the specified number of values from a subscription.
 */
function unsafePollN(subscription, max) {
    return subscription.pollUpTo(max);
}
exports.unsafePollN = unsafePollN;
/**
 * Unsafely publishes the specified values to a hub.
 */
function unsafePublishAll(hub, as) {
    return hub.publishAll(as);
}
exports.unsafePublishAll = unsafePublishAll;
/**
 * Unsafely removes the specified item from a queue.
 */
function unsafeRemove(queue, a) {
    unsafeOfferAll(queue, Chunk.filter_(unsafePollAllQueue(queue), (_) => _ !== a));
}
exports.unsafeRemove = unsafeRemove;
//# sourceMappingURL=unsafe.js.map