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





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


var _chunkS3T27X3Ujs = require('./chunk-S3T27X3U.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/Reader.ts
var Reader_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, Reader_exports, {
  ApT: () => ApT,
  Applicative: () => Applicative,
  Apply: () => Apply,
  Category: () => Category,
  Chain: () => Chain,
  ChainRec: () => ChainRec,
  Choice: () => Choice,
  Do: () => Do,
  Functor: () => Functor,
  Monad: () => Monad,
  Pointed: () => Pointed,
  Profunctor: () => Profunctor,
  Strong: () => Strong,
  URI: () => URI,
  ap: () => ap,
  apFirst: () => apFirst2,
  apFirstW: () => apFirstW,
  apS: () => apS2,
  apSW: () => apSW,
  apSecond: () => apSecond2,
  apSecondW: () => apSecondW,
  apW: () => apW,
  ask: () => ask,
  asks: () => asks,
  asksReader: () => asksReader,
  asksReaderW: () => asksReaderW,
  bind: () => bind2,
  bindTo: () => bindTo2,
  bindW: () => bindW,
  chain: () => chain,
  chainFirst: () => chainFirst,
  chainFirstW: () => chainFirstW,
  chainRec: () => chainRec,
  chainW: () => chainW,
  compose: () => compose,
  do: () => do_2,
  first: () => first,
  flap: () => flap2,
  flatMap: () => flatMap,
  flatten: () => flatten,
  flattenW: () => flattenW,
  getMonoid: () => getMonoid,
  getSemigroup: () => getSemigroup,
  id: () => id,
  left: () => left3,
  let: () => let_2,
  local: () => local,
  map: () => map,
  of: () => of,
  promap: () => promap,
  reader: () => reader,
  right: () => right3,
  second: () => second,
  sequenceArray: () => sequenceArray,
  tap: () => tap2,
  traverseArray: () => traverseArray,
  traverseArrayWithIndex: () => traverseArrayWithIndex,
  traverseReadonlyArrayWithIndex: () => traverseReadonlyArrayWithIndex,
  traverseReadonlyNonEmptyArrayWithIndex: () => traverseReadonlyNonEmptyArrayWithIndex
});
var ask = () => _chunkSQA7G4TEjs.identity;
var asks = _chunkSQA7G4TEjs.identity;
var local = (f) => (ma) => (r2) => ma(f(r2));
var asksReaderW = (f) => (r) => f(r)(r);
var asksReader = asksReaderW;
var _map = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, map(f));
var _ap = (fab, fa) => _chunkSQA7G4TEjs.pipe.call(void 0, fab, ap(fa));
var _compose = (bc, ab) => _chunkSQA7G4TEjs.pipe.call(void 0, bc, compose(ab));
var _promap = (fea, f, g) => _chunkSQA7G4TEjs.pipe.call(void 0, fea, promap(f, g));
var map = (f) => (fa) => (r) => f(fa(r));
var apW = (fa) => (fab) => (r) => fab(r)(fa(r));
var ap = apW;
var of = _chunkSQA7G4TEjs.constant;
var flatMap = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 
  2,
  (ma, f) => (r) => f(ma(r))(r)
);
var flattenW = /* @__PURE__ */ flatMap(_chunkSQA7G4TEjs.identity);
var flatten = flattenW;
var compose = (ab) => (bc) => _chunkSQA7G4TEjs.flow.call(void 0, ab, bc);
var promap = (f, g) => (fea) => (a) => g(fea(f(a)));
var id = () => _chunkSQA7G4TEjs.identity;
var first = (pab) => ([a, c]) => [pab(a), c];
var second = (pbc) => ([a, b]) => [a, pbc(b)];
var left3 = (pab) => _chunkS2Z5L3RBjs.fold.call(void 0, (a) => _chunkOTKMOSH2js.left.call(void 0, pab(a)), _chunkS2Z5L3RBjs.right);
var right3 = (pbc) => _chunkS2Z5L3RBjs.fold.call(void 0, _chunkS2Z5L3RBjs.left, (b) => _chunkOTKMOSH2js.right.call(void 0, pbc(b)));
var URI = "Reader";
var Functor = {
  URI,
  map: _map
};
var flap2 = /* @__PURE__ */ _chunk7K74W2G3js.flap.call(void 0, Functor);
var Pointed = {
  URI,
  of
};
var Apply = {
  URI,
  map: _map,
  ap: _ap
};
var apFirst2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apFirst.call(void 0, Apply);
var apFirstW = apFirst2;
var apSecond2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apSecond.call(void 0, Apply);
var apSecondW = apSecond2;
var Applicative = {
  URI,
  map: _map,
  ap: _ap,
  of
};
var Chain = {
  URI,
  map: _map,
  ap: _ap,
  chain: flatMap
};
var chainRec = (a, f) => (r) => {
  let current = f(a)(r);
  while (_chunkS2Z5L3RBjs.isLeft.call(void 0, current)) {
    current = f(current.left)(r);
  }
  return current.right;
};
var ChainRec = {
  ...Chain,
  chainRec
};
var Monad = {
  URI,
  map: _map,
  of,
  ap: _ap,
  chain: flatMap
};
var tap2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkEBISTSVAjs.tap.call(void 0, Chain));
var Profunctor = {
  URI,
  map: _map,
  promap: _promap
};
var Category = {
  URI,
  compose: _compose,
  id
};
var Strong = {
  URI,
  map: _map,
  promap: _promap,
  first,
  second
};
var Choice = {
  URI,
  map: _map,
  promap: _promap,
  left: left3,
  right: right3
};
var bindTo2 = /* @__PURE__ */ _chunk7K74W2G3js.bindTo.call(void 0, Functor);
var let_2 = /* @__PURE__ */ _chunk7K74W2G3js.let_.call(void 0, Functor);
var bind2 = /* @__PURE__ */ _chunkEBISTSVAjs.bind.call(void 0, Chain);
var bindW = bind2;
var Do = /* @__PURE__ */ of(_chunkOTKMOSH2js.emptyRecord);
var apS2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apS.call(void 0, Apply);
var apSW = apS2;
var ApT = /* @__PURE__ */ of(_chunkOTKMOSH2js.emptyReadonlyArray);
var do_2 = _chunkS2Z5L3RBjs.do_3.call(void 0, 
  Pointed,
  ChainRec
);
var traverseReadonlyNonEmptyArrayWithIndex = (f) => (as) => (r) => {
  const out = [f(0, _chunkOTKMOSH2js.head.call(void 0, as))(r)];
  for (let i = 1; i < as.length; i++) {
    out.push(f(i, as[i])(r));
  }
  return out;
};
var traverseReadonlyArrayWithIndex = (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndex(f);
  return (as) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as) ? g(as) : ApT;
};
var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;
var traverseArray = (f) => traverseReadonlyArrayWithIndex((_, a) => f(a));
var sequenceArray = /* @__PURE__ */ traverseArray(_chunkSQA7G4TEjs.identity);
var chainW = flatMap;
var chain = flatMap;
var chainFirst = tap2;
var chainFirstW = tap2;
var reader = {
  URI,
  map: _map,
  of,
  ap: _ap,
  chain: flatMap,
  promap: _promap,
  compose: _compose,
  id,
  first,
  second,
  left: left3,
  right: right3
};
var getSemigroup = /* @__PURE__ */ _chunkQ2LZCTWPjs.getApplySemigroup.call(void 0, Apply);
var getMonoid = /* @__PURE__ */ _chunkS3T27X3Ujs.getApplicativeMonoid.call(void 0, Applicative);






























































exports.ask = ask; exports.asks = asks; exports.local = local; exports.asksReaderW = asksReaderW; exports.asksReader = asksReader; exports.map = map; exports.apW = apW; exports.ap = ap; exports.of = of; exports.flatMap = flatMap; exports.flattenW = flattenW; exports.flatten = flatten; exports.compose = compose; exports.promap = promap; exports.id = id; exports.first = first; exports.second = second; exports.left = left3; exports.right = right3; exports.URI = URI; exports.Functor = Functor; exports.flap = flap2; exports.Pointed = Pointed; exports.Apply = Apply; exports.apFirst = apFirst2; exports.apFirstW = apFirstW; exports.apSecond = apSecond2; exports.apSecondW = apSecondW; exports.Applicative = Applicative; exports.Chain = Chain; exports.chainRec = chainRec; exports.ChainRec = ChainRec; exports.Monad = Monad; exports.tap = tap2; exports.Profunctor = Profunctor; exports.Category = Category; exports.Strong = Strong; exports.Choice = Choice; exports.bindTo = bindTo2; exports.let_ = let_2; exports.bind = bind2; exports.bindW = bindW; exports.Do = Do; exports.apS = apS2; exports.apSW = apSW; exports.ApT = ApT; exports.do_ = do_2; exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex; exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex; exports.traverseArrayWithIndex = traverseArrayWithIndex; exports.traverseArray = traverseArray; exports.sequenceArray = sequenceArray; exports.chainW = chainW; exports.chain = chain; exports.chainFirst = chainFirst; exports.chainFirstW = chainFirstW; exports.reader = reader; exports.getSemigroup = getSemigroup; exports.getMonoid = getMonoid; exports.Reader_exports = Reader_exports;
