/**
 * Describes the different fallback modes that a given page can have.
 */ "use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
0 && (module.exports = {
    FallbackMode: null,
    fallbackToStaticPathsResult: null,
    parseFallbackField: null,
    parseFallbackStaticPathsResult: null
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    FallbackMode: function() {
        return FallbackMode;
    },
    fallbackToStaticPathsResult: function() {
        return fallbackToStaticPathsResult;
    },
    parseFallbackField: function() {
        return parseFallbackField;
    },
    parseFallbackStaticPathsResult: function() {
        return parseFallbackStaticPathsResult;
    }
});
var FallbackMode;
(function(FallbackMode) {
    /**
   * A BLOCKING_STATIC_RENDER fallback will block the request until the page is
   * generated. No fallback page will be rendered, and users will have to wait
   * to render the page.
   */ FallbackMode["BLOCKING_STATIC_RENDER"] = "BLOCKING_STATIC_RENDER";
    /**
   * When set to PRERENDER, a fallback page will be sent to users in place of
   * forcing them to wait for the page to be generated. This allows the user to
   * see a rendered page earlier.
   */ FallbackMode["STATIC_PRERENDER"] = "STATIC_PRERENDER";
    /**
   * When set to NOT_FOUND, pages that are not already prerendered will result
   * in a not found response.
   */ FallbackMode["NOT_FOUND"] = "NOT_FOUND";
})(FallbackMode || (FallbackMode = {}));
function parseFallbackField(fallbackField) {
    if (typeof fallbackField === 'string') {
        return "STATIC_PRERENDER";
    } else if (fallbackField === null) {
        return "BLOCKING_STATIC_RENDER";
    } else if (fallbackField === false) {
        return "NOT_FOUND";
    } else if (fallbackField === undefined) {
        return undefined;
    } else {
        throw new Error(`Invalid fallback option: ${fallbackField}. Fallback option must be a string, null, undefined, or false.`);
    }
}
function parseFallbackStaticPathsResult(result) {
    if (result === true) {
        return "STATIC_PRERENDER";
    } else if (result === 'blocking') {
        return "BLOCKING_STATIC_RENDER";
    } else {
        return "NOT_FOUND";
    }
}
function fallbackToStaticPathsResult(fallback) {
    switch(fallback){
        case "STATIC_PRERENDER":
            return true;
        case "BLOCKING_STATIC_RENDER":
            return 'blocking';
        case "NOT_FOUND":
        default:
            return false;
    }
}

//# sourceMappingURL=fallback.js.map