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

















var _chunk3OEWROFOjs = require('./chunk-3OEWROFO.js');





var _chunkAL2I6MSRjs = require('./chunk-AL2I6MSR.js');



var _chunkKT2LSWBGjs = require('./chunk-KT2LSWBG.js');



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










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



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











var _chunkS2Z5L3RBjs = require('./chunk-S2Z5L3RB.js');




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


var _chunkD6EN5A4Bjs = require('./chunk-D6EN5A4B.js');






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




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



var _chunkEBISTSVAjs = require('./chunk-EBISTSVA.js');














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






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


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

// src/TaskOption.ts
var TaskOption_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, TaskOption_exports, {
  Alt: () => Alt,
  Alternative: () => Alternative,
  ApT: () => ApT,
  ApplicativePar: () => ApplicativePar,
  ApplicativeSeq: () => ApplicativeSeq,
  ApplyPar: () => ApplyPar2,
  ApplySeq: () => ApplySeq,
  Chain: () => Chain2,
  ChainRec: () => ChainRec,
  Compactable: () => Compactable2,
  Do: () => Do,
  Filterable: () => Filterable2,
  FromEither: () => FromEither,
  FromIO: () => FromIO,
  FromTask: () => FromTask,
  Functor: () => Functor3,
  Monad: () => Monad2,
  MonadIO: () => MonadIO,
  MonadTask: () => MonadTask,
  MonadThrow: () => MonadThrow,
  Pointed: () => Pointed2,
  URI: () => URI,
  Zero: () => Zero,
  alt: () => alt2,
  altW: () => altW,
  ap: () => ap2,
  apFirst: () => apFirst2,
  apS: () => apS2,
  apSecond: () => apSecond2,
  as: () => as2,
  asUnit: () => asUnit2,
  bind: () => bind2,
  bindTo: () => bindTo2,
  chain: () => chain,
  chainEitherK: () => chainEitherK2,
  chainFirst: () => chainFirst,
  chainFirstEitherK: () => chainFirstEitherK,
  chainFirstIOK: () => chainFirstIOK,
  chainFirstTaskK: () => chainFirstTaskK,
  chainIOK: () => chainIOK,
  chainNullableK: () => chainNullableK2,
  chainOptionK: () => chainOptionK2,
  chainRec: () => chainRec,
  chainTaskK: () => chainTaskK,
  compact: () => compact2,
  do: () => do_2,
  filter: () => filter2,
  filterMap: () => filterMap2,
  flap: () => flap2,
  flatMap: () => flatMap2,
  flatMapIO: () => flatMapIO2,
  flatMapTask: () => flatMapTask2,
  flatten: () => flatten,
  fold: () => fold,
  foldW: () => foldW,
  fromEither: () => fromEither3,
  fromEitherK: () => fromEitherK2,
  fromIO: () => fromIO2,
  fromIOK: () => fromIOK2,
  fromNullable: () => fromNullable2,
  fromNullableK: () => fromNullableK2,
  fromOption: () => fromOption,
  fromOptionK: () => fromOptionK2,
  fromPredicate: () => fromPredicate2,
  fromTask: () => fromTask,
  fromTaskEither: () => fromTaskEither,
  fromTaskK: () => fromTaskK2,
  getOrElse: () => getOrElse2,
  getOrElseW: () => getOrElseW,
  guard: () => guard2,
  let: () => let_2,
  map: () => map4,
  match: () => match2,
  matchE: () => matchE2,
  matchEW: () => matchEW,
  matchW: () => matchW,
  none: () => none2,
  of: () => of2,
  partition: () => partition2,
  partitionMap: () => partitionMap2,
  separate: () => separate2,
  sequenceArray: () => sequenceArray,
  sequenceSeqArray: () => sequenceSeqArray,
  some: () => some4,
  tap: () => tap2,
  tapEither: () => tapEither2,
  tapIO: () => tapIO2,
  tapTask: () => tapTask2,
  throwError: () => throwError,
  traverseArray: () => traverseArray,
  traverseArrayWithIndex: () => traverseArrayWithIndex,
  traverseReadonlyArrayWithIndex: () => traverseReadonlyArrayWithIndex,
  traverseReadonlyArrayWithIndexSeq: () => traverseReadonlyArrayWithIndexSeq,
  traverseReadonlyNonEmptyArrayWithIndex: () => traverseReadonlyNonEmptyArrayWithIndex3,
  traverseReadonlyNonEmptyArrayWithIndexSeq: () => traverseReadonlyNonEmptyArrayWithIndexSeq,
  traverseSeqArray: () => traverseSeqArray,
  traverseSeqArrayWithIndex: () => traverseSeqArrayWithIndex,
  tryCatch: () => tryCatch,
  tryCatchK: () => tryCatchK,
  zero: () => zero2
});
var some4 = /* @__PURE__ */ _chunk3OEWROFOjs.some.call(void 0, _chunkY5WQY5GSjs.Pointed);
var fromPredicate2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromPredicate.call(void 0, _chunkY5WQY5GSjs.Pointed);
var fromOption = _chunkY5WQY5GSjs.of;
var fromEither3 = /* @__PURE__ */ _chunk3OEWROFOjs.fromEither.call(void 0, _chunkY5WQY5GSjs.Pointed);
var fromIO2 = (ma) => fromTask(_chunkY5WQY5GSjs.fromIO.call(void 0, ma));
var fromTask = /* @__PURE__ */ _chunk3OEWROFOjs.fromF.call(void 0, _chunkY5WQY5GSjs.Functor);
var fromTaskEither = /* @__PURE__ */ _chunkY5WQY5GSjs.map.call(void 0, _chunkS2Z5L3RBjs.fromEither);
var match2 = /* @__PURE__ */ _chunk3OEWROFOjs.match.call(void 0, _chunkY5WQY5GSjs.Functor);
var matchW = match2;
var matchE2 = /* @__PURE__ */ _chunk3OEWROFOjs.matchE.call(void 0, _chunkY5WQY5GSjs.Chain);
var fold = matchE2;
var matchEW = matchE2;
var foldW = matchEW;
var getOrElse2 = /* @__PURE__ */ _chunk3OEWROFOjs.getOrElse.call(void 0, 
  _chunkY5WQY5GSjs.Monad
);
var getOrElseW = getOrElse2;
var fromNullable2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromNullable.call(void 0, _chunkY5WQY5GSjs.Pointed);
var tryCatch = (f) => async () => {
  try {
    return await f().then(_chunkOTKMOSH2js.some);
  } catch (reason) {
    return _chunkOTKMOSH2js.none;
  }
};
var tryCatchK = (f) => (...a) => tryCatch(() => f(...a));
var fromNullableK2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromNullableK.call(void 0, _chunkY5WQY5GSjs.Pointed);
var chainNullableK2 = /* @__PURE__ */ _chunk3OEWROFOjs.chainNullableK.call(void 0, _chunkY5WQY5GSjs.Monad);
var fromOptionK2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromOptionK.call(void 0, _chunkY5WQY5GSjs.Pointed);
var chainOptionK2 = /* @__PURE__ */ _chunk3OEWROFOjs.chainOptionK.call(void 0, _chunkY5WQY5GSjs.Monad);
var map4 = /* @__PURE__ */ _chunk3OEWROFOjs.map.call(void 0, _chunkY5WQY5GSjs.Functor);
var ap2 = /* @__PURE__ */ _chunk3OEWROFOjs.ap.call(void 0, 
  _chunkY5WQY5GSjs.ApplyPar
);
var of2 = some4;
var _FromIO = {
  fromIO: fromIO2
};
var _FromTask = {
  fromTask
};
var flatMap2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk3OEWROFOjs.flatMap.call(void 0, _chunkY5WQY5GSjs.Monad));
var _FlatMap = {
  flatMap: flatMap2
};
var flatMapIO2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapIO.call(void 0, _FromIO, _FlatMap);
var flatMapTask2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapTask.call(void 0, _FromTask, _FlatMap);
var flatten = /* @__PURE__ */ flatMap2(_chunkSQA7G4TEjs.identity);
var alt2 = /* @__PURE__ */ _chunk3OEWROFOjs.alt.call(void 0, 
  _chunkY5WQY5GSjs.Monad
);
var altW = alt2;
var zero2 = /* @__PURE__ */ _chunk3OEWROFOjs.zero.call(void 0, _chunkY5WQY5GSjs.Pointed);
var throwError = zero2;
var none2 = /* @__PURE__ */ zero2();
var compact2 = /* @__PURE__ */ _chunkKT2LSWBGjs.compact.call(void 0, _chunkY5WQY5GSjs.Functor, _chunkS2Z5L3RBjs.Compactable);
var separate2 = /* @__PURE__ */ _chunkKT2LSWBGjs.separate.call(void 0, _chunkY5WQY5GSjs.Functor, _chunkS2Z5L3RBjs.Compactable, _chunkS2Z5L3RBjs.Functor2);
var filter2 = /* @__PURE__ */ _chunkAL2I6MSRjs.filter.call(void 0, _chunkY5WQY5GSjs.Functor, _chunkS2Z5L3RBjs.Filterable);
var filterMap2 = /* @__PURE__ */ _chunkAL2I6MSRjs.filterMap.call(void 0, _chunkY5WQY5GSjs.Functor, _chunkS2Z5L3RBjs.Filterable);
var partition2 = /* @__PURE__ */ _chunkAL2I6MSRjs.partition.call(void 0, _chunkY5WQY5GSjs.Functor, _chunkS2Z5L3RBjs.Filterable);
var partitionMap2 = /* @__PURE__ */ _chunkAL2I6MSRjs.partitionMap.call(void 0, 
  _chunkY5WQY5GSjs.Functor,
  _chunkS2Z5L3RBjs.Filterable
);
var _map = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, map4(f));
var _ap = (fab, fa) => _chunkSQA7G4TEjs.pipe.call(void 0, fab, ap2(fa));
var _alt = (fa, that) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, alt2(that));
var _filter = (fa, predicate) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, filter2(predicate));
var _filterMap = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, filterMap2(f));
var _partition = (fa, predicate) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, partition2(predicate));
var _partitionMap = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, partitionMap2(f));
var URI = "TaskOption";
var Functor3 = {
  URI,
  map: _map
};
var as2 = _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk7K74W2G3js.as.call(void 0, Functor3));
var asUnit2 = _chunk7K74W2G3js.asUnit.call(void 0, Functor3);
var flap2 = /* @__PURE__ */ _chunk7K74W2G3js.flap.call(void 0, Functor3);
var Pointed2 = {
  URI,
  of: of2
};
var ApplyPar2 = {
  URI,
  map: _map,
  ap: _ap
};
var apFirst2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apFirst.call(void 0, ApplyPar2);
var apSecond2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apSecond.call(void 0, ApplyPar2);
var ApplicativePar = {
  URI,
  map: _map,
  ap: _ap,
  of: of2
};
var _apSeq = (fab, fa) => flatMap2(fab, (f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, map4(f)));
var ApplySeq = {
  URI,
  map: _map,
  ap: _apSeq
};
var ApplicativeSeq = {
  URI,
  map: _map,
  ap: _apSeq,
  of: of2
};
var Chain2 = {
  URI,
  map: _map,
  ap: _ap,
  chain: flatMap2
};
var chainRec = (a, f) => async () => {
  let current = await f(a)();
  while (true) {
    if (_chunkS2Z5L3RBjs.isSome.call(void 0, current) && _chunkOTKMOSH2js.isLeft.call(void 0, current.value)) {
      current = await f(current.value.left)();
      continue;
    }
    if (_chunkS2Z5L3RBjs.isNone.call(void 0, current)) {
      return current;
    }
    if (_chunkOTKMOSH2js.isRight.call(void 0, current.value)) {
      return _chunkS2Z5L3RBjs.some.call(void 0, current.value.right);
    }
  }
};
var ChainRec = {
  ...Chain2,
  chainRec
};
var FromEither = {
  URI,
  fromEither: fromEither3
};
var FromIO = {
  URI,
  fromIO: fromIO2
};
var FromTask = {
  URI,
  fromIO: fromIO2,
  fromTask
};
var tap2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkEBISTSVAjs.tap.call(void 0, Chain2));
var tapEither2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkR2MJP25Ojs.tapEither.call(void 0, FromEither, Chain2));
var tapIO2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkDLEEPDK7js.tapIO.call(void 0, FromIO, Chain2));
var tapTask2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkVCW7SZ6Jjs.tapTask.call(void 0, FromTask, Chain2));
var Alt = {
  URI,
  map: _map,
  alt: _alt
};
var Zero = {
  URI,
  zero: zero2
};
var guard2 = /* @__PURE__ */ _chunkD6EN5A4Bjs.guard.call(void 0, Zero, Pointed2);
var Alternative = {
  URI,
  map: _map,
  ap: _ap,
  of: of2,
  alt: _alt,
  zero: zero2
};
var Monad2 = {
  URI,
  map: _map,
  ap: _ap,
  of: of2,
  chain: flatMap2
};
var MonadIO = {
  URI,
  map: _map,
  ap: _ap,
  of: of2,
  chain: flatMap2,
  fromIO: fromIO2
};
var MonadThrow = {
  ...Monad2,
  throwError
};
var MonadTask = {
  URI,
  map: _map,
  ap: _ap,
  of: of2,
  chain: flatMap2,
  fromIO: fromIO2,
  fromTask
};
var Compactable2 = {
  URI,
  compact: compact2,
  separate: separate2
};
var Filterable2 = {
  URI,
  map: _map,
  compact: compact2,
  separate: separate2,
  filter: _filter,
  filterMap: _filterMap,
  partition: _partition,
  partitionMap: _partitionMap
};
var fromIOK2 = /* @__PURE__ */ _chunkDLEEPDK7js.fromIOK.call(void 0, FromIO);
var chainIOK = flatMapIO2;
var chainFirstIOK = tapIO2;
var fromEitherK2 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromEitherK.call(void 0, FromEither);
var chainEitherK2 = /* @__PURE__ */ _chunkR2MJP25Ojs.chainEitherK.call(void 0, FromEither, Chain2);
var chainFirstEitherK = tapEither2;
var fromTaskK2 = /* @__PURE__ */ _chunkVCW7SZ6Jjs.fromTaskK.call(void 0, FromTask);
var chainTaskK = flatMapTask2;
var chainFirstTaskK = tapTask2;
var Do = /* @__PURE__ */ of2(_chunkOTKMOSH2js.emptyRecord);
var bindTo2 = /* @__PURE__ */ _chunk7K74W2G3js.bindTo.call(void 0, Functor3);
var let_2 = /* @__PURE__ */ _chunk7K74W2G3js.let_.call(void 0, Functor3);
var bind2 = /* @__PURE__ */ _chunkEBISTSVAjs.bind.call(void 0, Chain2);
var do_2 = _chunkS2Z5L3RBjs.do_3.call(void 0, Pointed2, ChainRec);
var apS2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apS.call(void 0, ApplyPar2);
var ApT = /* @__PURE__ */ of2(_chunkOTKMOSH2js.emptyReadonlyArray);
var traverseReadonlyNonEmptyArrayWithIndex3 = (f) => _chunkSQA7G4TEjs.flow.call(void 0, _chunkY5WQY5GSjs.traverseReadonlyNonEmptyArrayWithIndex.call(void 0, f), _chunkY5WQY5GSjs.map.call(void 0, _chunkS2Z5L3RBjs.traverseReadonlyNonEmptyArrayWithIndex2.call(void 0, _chunkSQA7G4TEjs.SK)));
var traverseReadonlyArrayWithIndex = (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndex3(f);
  return (as3) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as3) ? g(as3) : ApT;
};
var traverseReadonlyNonEmptyArrayWithIndexSeq = (f) => (as3) => () => _chunkOTKMOSH2js.tail.call(void 0, as3).reduce(
  (acc, a, i) => acc.then(
    (obs) => _chunkOTKMOSH2js.isNone.call(void 0, obs) ? acc : f(i + 1, a)().then((ob) => {
      if (_chunkOTKMOSH2js.isNone.call(void 0, ob)) {
        return ob;
      }
      obs.value.push(ob.value);
      return obs;
    })
  ),
  f(0, _chunkOTKMOSH2js.head.call(void 0, as3))().then(_chunkS2Z5L3RBjs.map2.call(void 0, _chunkOTKMOSH2js.singleton))
);
var traverseReadonlyArrayWithIndexSeq = (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndexSeq(f);
  return (as3) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as3) ? g(as3) : ApT;
};
var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;
var traverseArray = (f) => traverseReadonlyArrayWithIndex((_, a) => f(a));
var sequenceArray = /* @__PURE__ */ traverseArray(_chunkSQA7G4TEjs.identity);
var traverseSeqArrayWithIndex = traverseReadonlyArrayWithIndexSeq;
var traverseSeqArray = (f) => traverseReadonlyArrayWithIndexSeq((_, a) => f(a));
var sequenceSeqArray = /* @__PURE__ */ traverseSeqArray(_chunkSQA7G4TEjs.identity);
var chain = flatMap2;
var chainFirst = tap2;







































































































exports.some = some4; exports.fromPredicate = fromPredicate2; exports.fromOption = fromOption; exports.fromEither = fromEither3; exports.fromIO = fromIO2; exports.fromTask = fromTask; exports.fromTaskEither = fromTaskEither; exports.match = match2; exports.matchW = matchW; exports.matchE = matchE2; exports.fold = fold; exports.matchEW = matchEW; exports.foldW = foldW; exports.getOrElse = getOrElse2; exports.getOrElseW = getOrElseW; exports.fromNullable = fromNullable2; exports.tryCatch = tryCatch; exports.tryCatchK = tryCatchK; exports.fromNullableK = fromNullableK2; exports.chainNullableK = chainNullableK2; exports.fromOptionK = fromOptionK2; exports.chainOptionK = chainOptionK2; exports.map = map4; exports.ap = ap2; exports.of = of2; exports.flatMap = flatMap2; exports.flatMapIO = flatMapIO2; exports.flatMapTask = flatMapTask2; exports.flatten = flatten; exports.alt = alt2; exports.altW = altW; exports.zero = zero2; exports.throwError = throwError; exports.none = none2; exports.compact = compact2; exports.separate = separate2; exports.filter = filter2; exports.filterMap = filterMap2; exports.partition = partition2; exports.partitionMap = partitionMap2; exports.URI = URI; exports.Functor = Functor3; exports.as = as2; exports.asUnit = asUnit2; exports.flap = flap2; exports.Pointed = Pointed2; exports.ApplyPar = ApplyPar2; exports.apFirst = apFirst2; exports.apSecond = apSecond2; exports.ApplicativePar = ApplicativePar; exports.ApplySeq = ApplySeq; exports.ApplicativeSeq = ApplicativeSeq; exports.Chain = Chain2; exports.chainRec = chainRec; exports.ChainRec = ChainRec; exports.FromEither = FromEither; exports.FromIO = FromIO; exports.FromTask = FromTask; exports.tap = tap2; exports.tapEither = tapEither2; exports.tapIO = tapIO2; exports.tapTask = tapTask2; exports.Alt = Alt; exports.Zero = Zero; exports.guard = guard2; exports.Alternative = Alternative; exports.Monad = Monad2; exports.MonadIO = MonadIO; exports.MonadThrow = MonadThrow; exports.MonadTask = MonadTask; exports.Compactable = Compactable2; exports.Filterable = Filterable2; exports.fromIOK = fromIOK2; exports.chainIOK = chainIOK; exports.chainFirstIOK = chainFirstIOK; exports.fromEitherK = fromEitherK2; exports.chainEitherK = chainEitherK2; exports.chainFirstEitherK = chainFirstEitherK; exports.fromTaskK = fromTaskK2; exports.chainTaskK = chainTaskK; exports.chainFirstTaskK = chainFirstTaskK; exports.Do = Do; exports.bindTo = bindTo2; exports.let_ = let_2; exports.bind = bind2; exports.do_ = do_2; exports.apS = apS2; exports.ApT = ApT; exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex3; exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex; exports.traverseReadonlyNonEmptyArrayWithIndexSeq = traverseReadonlyNonEmptyArrayWithIndexSeq; exports.traverseReadonlyArrayWithIndexSeq = traverseReadonlyArrayWithIndexSeq; exports.traverseArrayWithIndex = traverseArrayWithIndex; exports.traverseArray = traverseArray; exports.sequenceArray = sequenceArray; exports.traverseSeqArrayWithIndex = traverseSeqArrayWithIndex; exports.traverseSeqArray = traverseSeqArray; exports.sequenceSeqArray = sequenceSeqArray; exports.chain = chain; exports.chainFirst = chainFirst; exports.TaskOption_exports = TaskOption_exports;
