"use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkWK7URKCLjs = require('./chunk-WK7URKCL.js');















var _chunkY35EZVFKjs = require('./chunk-Y35EZVFK.js');







var _chunkE5IERNNKjs = require('./chunk-E5IERNNK.js');


var _chunkVCW7SZ6Jjs = require('./chunk-VCW7SZ6J.js');










var _chunkY5WQY5GSjs = require('./chunk-Y5WQY5GS.js');


var _chunkDLEEPDK7js = require('./chunk-DLEEPDK7.js');




var _chunkR2MJP25Ojs = require('./chunk-R2MJP25O.js');


var _chunk7K74W2G3js = require('./chunk-7K74W2G3.js');


var _chunkQ2LZCTWPjs = require('./chunk-Q2LZCTWP.js');






var _chunkOTKMOSH2js = require('./chunk-OTKMOSH2.js');




var _chunkSQA7G4TEjs = require('./chunk-SQA7G4TE.js');


var _chunk6C3VEZWHjs = require('./chunk-6C3VEZWH.js');

// src/TaskThese.ts
var TaskThese_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, TaskThese_exports, {
  ApT: () => ApT,
  Bifunctor: () => Bifunctor,
  FromEither: () => FromEither,
  FromIO: () => FromIO,
  FromTask: () => FromTask,
  FromThese: () => FromThese,
  Functor: () => Functor2,
  Pointed: () => Pointed2,
  URI: () => URI,
  bifunctorTaskThese: () => bifunctorTaskThese,
  bimap: () => bimap2,
  both: () => both3,
  flap: () => flap2,
  fold: () => fold,
  foldW: () => foldW,
  fromEither: () => fromEither,
  fromIO: () => fromIO2,
  fromIOEither: () => fromIOEither,
  fromIOK: () => fromIOK2,
  fromOption: () => fromOption2,
  fromOptionK: () => fromOptionK2,
  fromPredicate: () => fromPredicate2,
  fromTask: () => fromTask,
  fromTaskK: () => fromTaskK2,
  fromThese: () => fromThese,
  fromTheseK: () => fromTheseK2,
  functorTaskThese: () => functorTaskThese,
  getApplicative: () => getApplicative,
  getApply: () => getApply,
  getChain: () => getChain,
  getMonad: () => getMonad,
  getSemigroup: () => getSemigroup2,
  left: () => left2,
  leftIO: () => leftIO,
  leftTask: () => leftTask,
  map: () => map4,
  mapLeft: () => mapLeft2,
  match: () => match2,
  matchE: () => matchE2,
  matchEW: () => matchEW,
  matchW: () => matchW,
  of: () => of2,
  right: () => right2,
  rightIO: () => rightIO,
  rightTask: () => rightTask,
  swap: () => swap2,
  taskThese: () => taskThese,
  toTuple: () => toTuple,
  toTuple2: () => toTuple22,
  traverseReadonlyArrayWithIndex: () => traverseReadonlyArrayWithIndex,
  traverseReadonlyArrayWithIndexSeq: () => traverseReadonlyArrayWithIndexSeq,
  traverseReadonlyNonEmptyArrayWithIndex: () => traverseReadonlyNonEmptyArrayWithIndex3,
  traverseReadonlyNonEmptyArrayWithIndexSeq: () => traverseReadonlyNonEmptyArrayWithIndexSeq
});
var left2 = /* @__PURE__ */ _chunkY35EZVFKjs.left.call(void 0, _chunkY5WQY5GSjs.Pointed);
var right2 = /* @__PURE__ */ _chunkY35EZVFKjs.right.call(void 0, _chunkY5WQY5GSjs.Pointed);
var both3 = /* @__PURE__ */ _chunkY35EZVFKjs.both.call(void 0, _chunkY5WQY5GSjs.Pointed);
var rightTask = /* @__PURE__ */ _chunkY35EZVFKjs.rightF.call(void 0, _chunkY5WQY5GSjs.Functor);
var leftTask = /* @__PURE__ */ _chunkY35EZVFKjs.leftF.call(void 0, _chunkY5WQY5GSjs.Functor);
var rightIO = /* @__PURE__ */ _chunkSQA7G4TEjs.flow.call(void 0, _chunkY5WQY5GSjs.fromIO, rightTask);
var leftIO = /* @__PURE__ */ _chunkSQA7G4TEjs.flow.call(void 0, _chunkY5WQY5GSjs.fromIO, leftTask);
var fromEither = _chunkY5WQY5GSjs.of;
var fromThese = _chunkY5WQY5GSjs.of;
var fromIO2 = rightIO;
var fromIOEither = _chunkY5WQY5GSjs.fromIO;
var fromTask = rightTask;
var match2 = /* @__PURE__ */ _chunkY35EZVFKjs.match.call(void 0, _chunkY5WQY5GSjs.Functor);
var matchW = match2;
var matchE2 = /* @__PURE__ */ _chunkY35EZVFKjs.matchE.call(void 0, _chunkY5WQY5GSjs.Monad);
var fold = matchE2;
var matchEW = fold;
var foldW = matchEW;
var swap2 = /* @__PURE__ */ _chunkY35EZVFKjs.swap.call(void 0, _chunkY5WQY5GSjs.Functor);
var _map = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, map4(f));
var _bimap = (fa, f, g) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, bimap2(f, g));
var _mapLeft = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, mapLeft2(f));
var map4 = /* @__PURE__ */ _chunkY35EZVFKjs.map.call(void 0, 
  _chunkY5WQY5GSjs.Functor
);
var bimap2 = /* @__PURE__ */ _chunkY35EZVFKjs.bimap.call(void 0, _chunkY5WQY5GSjs.Functor);
var mapLeft2 = /* @__PURE__ */ _chunkY35EZVFKjs.mapLeft.call(void 0, 
  _chunkY5WQY5GSjs.Functor
);
var of2 = right2;
var URI = "TaskThese";
var getApply = (A, S) => {
  const ap2 = _chunkY35EZVFKjs.ap.call(void 0, A, S);
  return {
    URI,
    _E: void 0,
    map: _map,
    ap: (fab, fa) => _chunkSQA7G4TEjs.pipe.call(void 0, fab, ap2(fa))
  };
};
function getApplicative(A, S) {
  const { ap: ap2 } = getApply(A, S);
  return {
    URI,
    _E: void 0,
    map: _map,
    ap: ap2,
    of: of2
  };
}
function getChain(S) {
  const A = getApply(_chunkY5WQY5GSjs.ApplicativePar, S);
  const chain2 = _chunkY35EZVFKjs.chain.call(void 0, _chunkY5WQY5GSjs.Monad, S);
  return {
    URI,
    _E: void 0,
    map: _map,
    ap: A.ap,
    chain: (ma, f) => _chunkSQA7G4TEjs.pipe.call(void 0, ma, chain2(f))
  };
}
function getMonad(S) {
  const A = getApplicative(_chunkY5WQY5GSjs.ApplicativePar, S);
  const C = getChain(S);
  return {
    URI,
    _E: void 0,
    map: _map,
    ap: A.ap,
    of: of2,
    chain: C.chain,
    fromIO: fromIO2,
    fromTask
  };
}
var Functor2 = {
  URI,
  map: _map
};
var flap2 = /* @__PURE__ */ _chunk7K74W2G3js.flap.call(void 0, Functor2);
var Pointed2 = {
  URI,
  of: of2
};
var Bifunctor = {
  URI,
  bimap: _bimap,
  mapLeft: _mapLeft
};
var FromEither = {
  URI,
  fromEither
};
var fromOption2 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromOption.call(void 0, FromEither);
var fromOptionK2 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromOptionK.call(void 0, FromEither);
var fromPredicate2 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromPredicate.call(void 0, FromEither);
var FromThese = {
  URI,
  fromThese
};
var fromTheseK2 = /* @__PURE__ */ _chunkWK7URKCLjs.fromTheseK.call(void 0, FromThese);
var FromIO = {
  URI,
  fromIO: fromIO2
};
var fromIOK2 = /* @__PURE__ */ _chunkDLEEPDK7js.fromIOK.call(void 0, FromIO);
var FromTask = {
  URI,
  fromIO: fromIO2,
  fromTask
};
var fromTaskK2 = /* @__PURE__ */ _chunkVCW7SZ6Jjs.fromTaskK.call(void 0, FromTask);
var toTuple22 = /* @__PURE__ */ _chunkY35EZVFKjs.toTuple2.call(void 0, _chunkY5WQY5GSjs.Functor);
var ApT = /* @__PURE__ */ of2(_chunkOTKMOSH2js.emptyReadonlyArray);
var traverseReadonlyNonEmptyArrayWithIndex3 = (S) => {
  const g = _chunkE5IERNNKjs.traverseReadonlyNonEmptyArrayWithIndex.call(void 0, S);
  return (f) => _chunkSQA7G4TEjs.flow.call(void 0, _chunkY5WQY5GSjs.traverseReadonlyNonEmptyArrayWithIndex.call(void 0, f), _chunkY5WQY5GSjs.map.call(void 0, g(_chunkSQA7G4TEjs.SK)));
};
var traverseReadonlyArrayWithIndex = (S) => (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndex3(S)(f);
  return (as) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as) ? g(as) : ApT;
};
var traverseReadonlyNonEmptyArrayWithIndexSeq = (S) => (f) => (as) => () => _chunkOTKMOSH2js.tail.call(void 0, as).reduce(
  (acc, a, i) => acc.then(
    (ebs) => _chunkE5IERNNKjs.isLeft.call(void 0, ebs) ? acc : f(i + 1, a)().then((eb) => {
      if (_chunkE5IERNNKjs.isLeft.call(void 0, eb)) {
        return eb;
      }
      if (_chunkE5IERNNKjs.isBoth.call(void 0, eb)) {
        const right3 = ebs.right;
        right3.push(eb.right);
        return _chunkE5IERNNKjs.isBoth.call(void 0, ebs) ? _chunkE5IERNNKjs.both.call(void 0, S.concat(ebs.left, eb.left), right3) : _chunkE5IERNNKjs.both.call(void 0, eb.left, right3);
      }
      ebs.right.push(eb.right);
      return ebs;
    })
  ),
  f(0, _chunkOTKMOSH2js.head.call(void 0, as))().then(_chunkE5IERNNKjs.map.call(void 0, _chunkOTKMOSH2js.singleton))
);
var traverseReadonlyArrayWithIndexSeq = (S) => (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndexSeq(S)(f);
  return (as) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as) ? g(as) : ApT;
};
var functorTaskThese = {
  URI,
  map: _map
};
var bifunctorTaskThese = {
  URI,
  bimap: _bimap,
  mapLeft: _mapLeft
};
var toTuple = (e, a) => toTuple22(
  () => e,
  () => a
);
var taskThese = {
  URI,
  map: _map,
  bimap: _bimap,
  mapLeft: _mapLeft
};
var getSemigroup2 = (SE, SA) => _chunkQ2LZCTWPjs.getApplySemigroup.call(void 0, (0, _chunkY5WQY5GSjs.ApplySeq))(_chunkE5IERNNKjs.getSemigroup.call(void 0, SE, SA));
























































exports.left = left2; exports.right = right2; exports.both = both3; exports.rightTask = rightTask; exports.leftTask = leftTask; exports.rightIO = rightIO; exports.leftIO = leftIO; exports.fromEither = fromEither; exports.fromThese = fromThese; exports.fromIO = fromIO2; exports.fromIOEither = fromIOEither; exports.fromTask = fromTask; exports.match = match2; exports.matchW = matchW; exports.matchE = matchE2; exports.fold = fold; exports.matchEW = matchEW; exports.foldW = foldW; exports.swap = swap2; exports.map = map4; exports.bimap = bimap2; exports.mapLeft = mapLeft2; exports.of = of2; exports.URI = URI; exports.getApply = getApply; exports.getApplicative = getApplicative; exports.getChain = getChain; exports.getMonad = getMonad; exports.Functor = Functor2; exports.flap = flap2; exports.Pointed = Pointed2; exports.Bifunctor = Bifunctor; exports.FromEither = FromEither; exports.fromOption = fromOption2; exports.fromOptionK = fromOptionK2; exports.fromPredicate = fromPredicate2; exports.FromThese = FromThese; exports.fromTheseK = fromTheseK2; exports.FromIO = FromIO; exports.fromIOK = fromIOK2; exports.FromTask = FromTask; exports.fromTaskK = fromTaskK2; exports.toTuple2 = toTuple22; exports.ApT = ApT; exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex3; exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex; exports.traverseReadonlyNonEmptyArrayWithIndexSeq = traverseReadonlyNonEmptyArrayWithIndexSeq; exports.traverseReadonlyArrayWithIndexSeq = traverseReadonlyArrayWithIndexSeq; exports.functorTaskThese = functorTaskThese; exports.bifunctorTaskThese = bifunctorTaskThese; exports.toTuple = toTuple; exports.taskThese = taskThese; exports.getSemigroup = getSemigroup2; exports.TaskThese_exports = TaskThese_exports;
