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








var _chunkM3AZDBPNjs = require('./chunk-M3AZDBPN.js');

















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





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



var _chunkKT2LSWBGjs = require('./chunk-KT2LSWBG.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/IOOption.ts
var IOOption_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, IOOption_exports, {
  Alt: () => Alt,
  Alternative: () => Alternative,
  ApT: () => ApT,
  Applicative: () => Applicative,
  Apply: () => Apply2,
  Chain: () => Chain2,
  ChainRec: () => ChainRec,
  Compactable: () => Compactable2,
  Do: () => Do,
  Filterable: () => Filterable2,
  FromEither: () => FromEither,
  FromIO: () => FromIO,
  Functor: () => Functor3,
  Monad: () => Monad2,
  MonadIO: () => MonadIO,
  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: () => chainEitherK,
  chainFirst: () => chainFirst,
  chainFirstEitherK: () => chainFirstEitherK,
  chainFirstIOK: () => chainFirstIOK,
  chainIOK: () => chainIOK,
  chainNullableK: () => chainNullableK2,
  chainOptionK: () => chainOptionK,
  chainRec: () => chainRec,
  compact: () => compact2,
  do: () => do_2,
  filter: () => filter2,
  filterMap: () => filterMap2,
  flap: () => flap2,
  flatMap: () => flatMap2,
  flatMapEither: () => flatMapEither2,
  flatMapIO: () => flatMapIO2,
  flatMapNullable: () => flatMapNullable,
  flatMapOption: () => flatMapOption,
  flatten: () => flatten,
  fold: () => fold,
  fromEither: () => fromEither3,
  fromEitherK: () => fromEitherK2,
  fromIO: () => fromIO,
  fromIOEither: () => fromIOEither,
  fromIOK: () => fromIOK2,
  fromNullable: () => fromNullable2,
  fromNullableK: () => fromNullableK2,
  fromOption: () => fromOption,
  fromOptionK: () => fromOptionK2,
  fromPredicate: () => fromPredicate2,
  getOrElse: () => getOrElse2,
  getOrElseW: () => getOrElseW,
  guard: () => guard2,
  let: () => let_2,
  map: () => map3,
  match: () => match2,
  matchE: () => matchE2,
  matchEW: () => matchEW,
  matchW: () => matchW,
  none: () => none,
  of: () => of2,
  partition: () => partition2,
  partitionMap: () => partitionMap2,
  separate: () => separate2,
  some: () => some3,
  tap: () => tap2,
  tapEither: () => tapEither2,
  tapIO: () => tapIO2,
  throwError: () => throwError,
  toNullable: () => toNullable2,
  toUndefined: () => toUndefined2,
  traverseReadonlyArrayWithIndex: () => traverseReadonlyArrayWithIndex,
  traverseReadonlyNonEmptyArrayWithIndex: () => traverseReadonlyNonEmptyArrayWithIndex3,
  zero: () => zero2
});
var some3 = /* @__PURE__ */ _chunk3OEWROFOjs.some.call(void 0, _chunkM3AZDBPNjs.Pointed);
var fromPredicate2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromPredicate.call(void 0, _chunkM3AZDBPNjs.Pointed);
var fromOption = _chunkM3AZDBPNjs.of;
var fromEither3 = /* @__PURE__ */ _chunk3OEWROFOjs.fromEither.call(void 0, _chunkM3AZDBPNjs.Pointed);
var fromIO = /* @__PURE__ */ _chunk3OEWROFOjs.fromF.call(void 0, _chunkM3AZDBPNjs.Functor);
var fromIOEither = /* @__PURE__ */ _chunkM3AZDBPNjs.map.call(void 0, _chunkS2Z5L3RBjs.fromEither);
var match2 = /* @__PURE__ */ _chunk3OEWROFOjs.match.call(void 0, 
  _chunkM3AZDBPNjs.Functor
);
var matchW = match2;
var matchE2 = /* @__PURE__ */ _chunk3OEWROFOjs.matchE.call(void 0, _chunkM3AZDBPNjs.Chain);
var fold = matchE2;
var matchEW = matchE2;
var getOrElse2 = /* @__PURE__ */ _chunk3OEWROFOjs.getOrElse.call(void 0, _chunkM3AZDBPNjs.Monad);
var getOrElseW = getOrElse2;
var toUndefined2 = _chunkM3AZDBPNjs.map.call(void 0, _chunkS2Z5L3RBjs.toUndefined);
var toNullable2 = _chunkM3AZDBPNjs.map.call(void 0, _chunkS2Z5L3RBjs.toNullable);
var fromNullable2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromNullable.call(void 0, _chunkM3AZDBPNjs.Pointed);
var fromNullableK2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromNullableK.call(void 0, _chunkM3AZDBPNjs.Pointed);
var chainNullableK2 = /* @__PURE__ */ _chunk3OEWROFOjs.chainNullableK.call(void 0, _chunkM3AZDBPNjs.Monad);
var fromOptionK2 = /* @__PURE__ */ _chunk3OEWROFOjs.fromOptionK.call(void 0, _chunkM3AZDBPNjs.Pointed);
var map3 = /* @__PURE__ */ _chunk3OEWROFOjs.map.call(void 0, _chunkM3AZDBPNjs.Functor);
var ap2 = /* @__PURE__ */ _chunk3OEWROFOjs.ap.call(void 0, _chunkM3AZDBPNjs.Apply);
var of2 = some3;
var flatMap2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk3OEWROFOjs.flatMap.call(void 0, _chunkM3AZDBPNjs.Monad));
var flatten = /* @__PURE__ */ flatMap2(_chunkSQA7G4TEjs.identity);
var alt2 = /* @__PURE__ */ _chunk3OEWROFOjs.alt.call(void 0, 
  _chunkM3AZDBPNjs.Monad
);
var altW = alt2;
var zero2 = /* @__PURE__ */ _chunk3OEWROFOjs.zero.call(void 0, _chunkM3AZDBPNjs.Pointed);
var throwError = zero2;
var none = /* @__PURE__ */ zero2();
var compact2 = /* @__PURE__ */ _chunkKT2LSWBGjs.compact.call(void 0, _chunkM3AZDBPNjs.Functor, _chunkS2Z5L3RBjs.Compactable);
var separate2 = /* @__PURE__ */ _chunkKT2LSWBGjs.separate.call(void 0, _chunkM3AZDBPNjs.Functor, _chunkS2Z5L3RBjs.Compactable, _chunkS2Z5L3RBjs.Functor2);
var filter2 = /* @__PURE__ */ _chunkAL2I6MSRjs.filter.call(void 0, _chunkM3AZDBPNjs.Functor, _chunkS2Z5L3RBjs.Filterable);
var filterMap2 = /* @__PURE__ */ _chunkAL2I6MSRjs.filterMap.call(void 0, 
  _chunkM3AZDBPNjs.Functor,
  _chunkS2Z5L3RBjs.Filterable
);
var partition2 = /* @__PURE__ */ _chunkAL2I6MSRjs.partition.call(void 0, _chunkM3AZDBPNjs.Functor, _chunkS2Z5L3RBjs.Filterable);
var partitionMap2 = /* @__PURE__ */ _chunkAL2I6MSRjs.partitionMap.call(void 0, _chunkM3AZDBPNjs.Functor, _chunkS2Z5L3RBjs.Filterable);
var _map = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, map3(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 = "IOOption";
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 Apply2 = {
  URI,
  map: _map,
  ap: _ap
};
var apFirst2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apFirst.call(void 0, Apply2);
var apSecond2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apSecond.call(void 0, Apply2);
var Applicative = {
  URI,
  map: _map,
  ap: _ap,
  of: of2
};
var Chain2 = {
  URI,
  map: _map,
  ap: _ap,
  chain: flatMap2
};
var chainRec = (a, f) => () => {
  let current = f(a)();
  while (true) {
    if (_chunkS2Z5L3RBjs.isSome.call(void 0, current) && _chunkOTKMOSH2js.isLeft.call(void 0, current.value)) {
      current = 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
};
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 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
};
var MonadThrow = {
  ...Monad2,
  throwError
};
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 _FlatMap = {
  flatMap: flatMap2
};
var _FromIO = {
  fromIO: FromIO.fromIO
};
var _FromEither = {
  fromEither: fromEither3
};
var flatMapIO2 = _chunkOTKMOSH2js.flatMapIO.call(void 0, _FromIO, _FlatMap);
var flatMapOption = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 
  2,
  (self, f) => flatMap2(self, fromOptionK2(f))
);
var flatMapEither2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapEither.call(void 0, _FromEither, _FlatMap);
var flatMapNullable = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 
  2,
  (self, f) => flatMap2(self, fromNullableK2(f))
);
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 chainEitherK = flatMapEither2;
var chainFirstEitherK = tapEither2;
var chainOptionK = flatMapOption;
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 apS2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apS.call(void 0, Apply2);
var ApT = /* @__PURE__ */ of2(_chunkOTKMOSH2js.emptyReadonlyArray);
var do_2 = _chunkS2Z5L3RBjs.do_3.call(void 0, Pointed2, ChainRec);
var traverseReadonlyNonEmptyArrayWithIndex3 = (f) => _chunkSQA7G4TEjs.flow.call(void 0, _chunkM3AZDBPNjs.traverseReadonlyNonEmptyArrayWithIndex.call(void 0, f), _chunkM3AZDBPNjs.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 chain = flatMap2;
var chainFirst = tap2;























































































exports.some = some3; exports.fromPredicate = fromPredicate2; exports.fromOption = fromOption; exports.fromEither = fromEither3; exports.fromIO = fromIO; exports.fromIOEither = fromIOEither; exports.match = match2; exports.matchW = matchW; exports.matchE = matchE2; exports.fold = fold; exports.matchEW = matchEW; exports.getOrElse = getOrElse2; exports.getOrElseW = getOrElseW; exports.toUndefined = toUndefined2; exports.toNullable = toNullable2; exports.fromNullable = fromNullable2; exports.fromNullableK = fromNullableK2; exports.chainNullableK = chainNullableK2; exports.fromOptionK = fromOptionK2; exports.map = map3; exports.ap = ap2; exports.of = of2; exports.flatMap = flatMap2; exports.flatten = flatten; exports.alt = alt2; exports.altW = altW; exports.zero = zero2; exports.throwError = throwError; exports.none = none; 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.Apply = Apply2; exports.apFirst = apFirst2; exports.apSecond = apSecond2; exports.Applicative = Applicative; exports.Chain = Chain2; exports.chainRec = chainRec; exports.ChainRec = ChainRec; exports.FromEither = FromEither; exports.FromIO = FromIO; exports.tap = tap2; exports.tapEither = tapEither2; exports.tapIO = tapIO2; exports.Alt = Alt; exports.Zero = Zero; exports.guard = guard2; exports.Alternative = Alternative; exports.Monad = Monad2; exports.MonadIO = MonadIO; exports.MonadThrow = MonadThrow; exports.Compactable = Compactable2; exports.Filterable = Filterable2; exports.flatMapIO = flatMapIO2; exports.flatMapOption = flatMapOption; exports.flatMapEither = flatMapEither2; exports.flatMapNullable = flatMapNullable; exports.fromIOK = fromIOK2; exports.chainIOK = chainIOK; exports.chainFirstIOK = chainFirstIOK; exports.fromEitherK = fromEitherK2; exports.chainEitherK = chainEitherK; exports.chainFirstEitherK = chainFirstEitherK; exports.chainOptionK = chainOptionK; exports.Do = Do; exports.bindTo = bindTo2; exports.let_ = let_2; exports.bind = bind2; exports.apS = apS2; exports.ApT = ApT; exports.do_ = do_2; exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex3; exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex; exports.chain = chain; exports.chainFirst = chainFirst; exports.IOOption_exports = IOOption_exports;
