import {
  getMonoid as getMonoid2
} from "./chunk-IYFAWGIJ.mjs";
import {
  concatAll,
  max,
  min,
  reverse,
  semigroupAll,
  semigroupAny,
  semigroupProduct,
  semigroupString,
  semigroupSum,
  semigroupVoid,
  struct,
  tuple
} from "./chunk-CRY5FFSR.mjs";
import {
  has
} from "./chunk-WPJQNT3M.mjs";
import {
  getMonoid
} from "./chunk-ZI34HWXZ.mjs";
import {
  __export
} from "./chunk-QK4PKNB3.mjs";

// src/Monoid.ts
var Monoid_exports = {};
__export(Monoid_exports, {
  concatAll: () => concatAll2,
  fold: () => fold,
  getDualMonoid: () => getDualMonoid,
  getEndomorphismMonoid: () => getEndomorphismMonoid,
  getFunctionMonoid: () => getFunctionMonoid,
  getJoinMonoid: () => getJoinMonoid,
  getMeetMonoid: () => getMeetMonoid,
  getStructMonoid: () => getStructMonoid,
  getTupleMonoid: () => getTupleMonoid,
  max: () => max2,
  min: () => min2,
  monoidAll: () => monoidAll,
  monoidAny: () => monoidAny,
  monoidProduct: () => monoidProduct,
  monoidString: () => monoidString,
  monoidSum: () => monoidSum,
  monoidVoid: () => monoidVoid,
  reverse: () => reverse2,
  struct: () => struct2,
  tuple: () => tuple2
});
var min2 = (B) => ({
  concat: min(B).concat,
  empty: B.top
});
var max2 = (B) => ({
  concat: max(B).concat,
  empty: B.bottom
});
var reverse2 = (M) => ({
  concat: reverse(M).concat,
  empty: M.empty
});
var struct2 = (monoids) => {
  const empty = {};
  for (const k in monoids) {
    if (has.call(monoids, k)) {
      empty[k] = monoids[k].empty;
    }
  }
  return {
    concat: struct(monoids).concat,
    empty
  };
};
var tuple2 = (...monoids) => ({
  concat: tuple(...monoids).concat,
  empty: monoids.map((m) => m.empty)
});
var concatAll2 = (M) => concatAll(M)(M.empty);
var monoidVoid = {
  concat: semigroupVoid.concat,
  empty: void 0
};
var getTupleMonoid = tuple2;
var getStructMonoid = struct2;
var getDualMonoid = reverse2;
var getJoinMonoid = max2;
var getMeetMonoid = min2;
var fold = concatAll2;
var monoidAll = {
  concat: semigroupAll.concat,
  empty: true
};
var monoidAny = {
  concat: semigroupAny.concat,
  empty: false
};
var getFunctionMonoid = getMonoid;
var getEndomorphismMonoid = () => reverse2(getMonoid2());
var monoidString = {
  concat: semigroupString.concat,
  empty: ""
};
var monoidSum = {
  concat: semigroupSum.concat,
  empty: 0
};
var monoidProduct = {
  concat: semigroupProduct.concat,
  empty: 1
};

export {
  min2 as min,
  max2 as max,
  reverse2 as reverse,
  struct2 as struct,
  tuple2 as tuple,
  concatAll2 as concatAll,
  monoidVoid,
  getTupleMonoid,
  getStructMonoid,
  getDualMonoid,
  getJoinMonoid,
  getMeetMonoid,
  fold,
  monoidAll,
  monoidAny,
  getFunctionMonoid,
  getEndomorphismMonoid,
  monoidString,
  monoidSum,
  monoidProduct,
  Monoid_exports
};
