"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Emit = void 0;
exports.apply = apply;

var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/succeedNow"));

var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/die"));

var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/dieMessage"));

var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/data/Maybe/definition"));

var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/collections/Chunk/single"));

var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Exit/operations/mapBoth"));

var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/done"));

var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/fail"));

var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/mapBoth"));

var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/mapError"));

var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Cause/operations/map"));

var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/failCause"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const fileName_1 = "(@effect/core) _src/stream/Stream/Emit.ts";
const Emit = {};
/**
 * @tsplus static ets/Stream/Emit/Ops __call
 */

exports.Emit = Emit;

function apply(fn) {
  const ops = {
    chunk(as, __tsplusTrace) {
      return this(tsplus_module_1.succeedNow(as, fileName_1 + ":78:36"));
    },

    die(err, __tsplusTrace) {
      return this(tsplus_module_2.die(() => err, fileName_1 + ":81:29"));
    },

    dieMessage(message, __tsplusTrace) {
      return this(tsplus_module_3.dieMessage(() => message, fileName_1 + ":84:36"));
    },

    done(exit, __tsplusTrace) {
      return this(tsplus_module_7.done(() => tsplus_module_6.mapBoth_(exit, e => tsplus_module_4.some(e), a => tsplus_module_5.single(a)), fileName_1 + ":88:20"));
    },

    end(__tsplusTrace) {
      return this(tsplus_module_8.fail(() => tsplus_module_4.none, fileName_1 + ":97:30"));
    },

    fail(e, __tsplusTrace) {
      return this(tsplus_module_8.fail(() => tsplus_module_4.some(e), fileName_1 + ":100:30"));
    },

    fromEffect(io, __tsplusTrace) {
      return this(tsplus_module_9.mapBoth_(io, e => tsplus_module_4.some(e), a => tsplus_module_5.single(a), fileName_1 + ":104:19"));
    },

    fromEffectChunk(io, __tsplusTrace) {
      return this(tsplus_module_10.mapError_(io, e => tsplus_module_4.some(e), fileName_1 + ":115:30"));
    },

    halt(cause, __tsplusTrace) {
      return this(tsplus_module_12.failCause(() => tsplus_module_11.map_(cause, e => tsplus_module_4.some(e)), fileName_1 + ":118:35"));
    },

    single(a, __tsplusTrace) {
      return this(tsplus_module_1.succeedNow(tsplus_module_5.single(a), fileName_1 + ":121:36"));
    }

  };
  return Object.assign(fn, ops);
}
//# sourceMappingURL=Emit.js.map