// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';

var Ord$OptolithClient = require("../../Data/Ord.bs.js");
var ListH$OptolithClient = require("../../Data/ListH.bs.js");
var Maybe$OptolithClient = require("../../Data/Maybe.bs.js");

function getSeparator(type_, staticData) {
  if (type_) {
    return staticData.messages.general_or;
  } else {
    return staticData.messages.general_and;
  }
}

function format(type_, staticData, xs) {
  if (xs) {
    if (xs.tl) {
      return Maybe$OptolithClient.maybe("", (function (param) {
                    var lastStr = param[1];
                    var initStr = ListH$OptolithClient.intercalate(", ", param[0]);
                    return initStr + (" " + (getSeparator(type_, staticData) + (" " + lastStr)));
                  }), ListH$OptolithClient.Extra.unsnoc(xs));
    } else {
      return xs.hd;
    }
  } else {
    return "";
  }
}

var ListFormat = {
  format: format
};

function compare(collator, a, b) {
  return Ord$OptolithClient.toOrdering(collator.compare(a, b));
}

function Collator_create(prim) {
  return Intl.Collator(prim);
}

function Collator_createWithOptions(prim, prim$1) {
  return Intl.Collator(prim, prim$1);
}

var Collator = {
  create: Collator_create,
  createWithOptions: Collator_createWithOptions,
  compare: compare
};

exports.ListFormat = ListFormat;
exports.Collator = Collator;
/* No side effect */
