// src/edge/origin-request.ts
function handler(event, context, callback) {
  const { request } = event.Records[0].cf;
  const { uri } = request;
  const { suffix, appendToDirs } = config;
  if (suffix && uri.match(regexSuffixless)) {
    request.uri = uri + suffix;
    callback(null, request);
    return;
  }
  if (appendToDirs && uri.match(regexTrailingSlash)) {
    request.uri = uri + appendToDirs;
    callback(null, request);
    return;
  }
  callback(null, request);
}
var config = {
  suffix: ".html",
  appendToDirs: "index.html",
  removeTrailingSlash: false
};
var regexSuffixless = /\/[^/.]+$/;
var regexTrailingSlash = /.+\/$/;
export {
  handler
};
