"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.unsafeMakeBounded =
  exports.unsafeMakeDropping =
  exports.unsafeMakeUnbounded =
  exports.unsafeMakeSliding =
  exports.unsafeCreateQueue_ =
  exports.unsafeCreateQueue =
    void 0
// tracing: off
const id_1 = require("../Fiber/id")
const AtomicBoolean_1 = require("../Support/AtomicBoolean")
const MutableQueue_1 = require("../Support/MutableQueue")
const api_1 = require("./api")
const core_1 = require("./core")
const P = __importStar(require("./promise"))
/**
 * Unsafely creates a queue
 *
 * @dataFirst unsafeCreateQueue_
 */
function unsafeCreateQueue(strategy) {
  return (queue) => unsafeCreateQueue_(queue, strategy)
}
exports.unsafeCreateQueue = unsafeCreateQueue
/**
 * Unsafely creates a queue
 */
function unsafeCreateQueue_(queue, strategy) {
  return (0, api_1.unsafeCreate)(
    queue,
    new MutableQueue_1.Unbounded(),
    P.unsafeMake(id_1.None),
    new AtomicBoolean_1.AtomicBoolean(false),
    strategy
  )
}
exports.unsafeCreateQueue_ = unsafeCreateQueue_
/**
 * Unsafely creates a sliding queue
 */
function unsafeMakeSliding(capacity) {
  return unsafeCreateQueue_(
    new MutableQueue_1.Bounded(capacity),
    new core_1.SlidingStrategy()
  )
}
exports.unsafeMakeSliding = unsafeMakeSliding
/**
 * Unsafely creates a unbounded queue
 */
function unsafeMakeUnbounded() {
  return unsafeCreateQueue_(
    new MutableQueue_1.Unbounded(),
    new core_1.DroppingStrategy()
  )
}
exports.unsafeMakeUnbounded = unsafeMakeUnbounded
/**
 * Unsafely creates a dropping queue
 */
function unsafeMakeDropping(capacity) {
  return unsafeCreateQueue_(
    new MutableQueue_1.Bounded(capacity),
    new core_1.DroppingStrategy()
  )
}
exports.unsafeMakeDropping = unsafeMakeDropping
/**
 * Unsafely creates a bounded queue
 */
function unsafeMakeBounded(capacity) {
  return unsafeCreateQueue_(
    new MutableQueue_1.Bounded(capacity),
    new api_1.BackPressureStrategy()
  )
}
exports.unsafeMakeBounded = unsafeMakeBounded
//# sourceMappingURL=unsafe.js.map
