"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCreateReplicaFormats = getCreateReplicaFormats;
const _types_1 = require("../_types");
/**
 * @private
 * Returns all the download formats that are defined by the service's /createReplica endpoint.
 *
 * @param entity Hosted Feature Service entity to return download formats for
 * @returns available download formats for the entity
 */
function getCreateReplicaFormats(entity) {
    // TODO: Change to use `extendedProps.serverExtractFormats`
    const allFormats = entity.serverExtractFormats || [];
    // List recognized formats in the order they are defined in CREATE_REPLICA_FORMATS
    const recognizedFormats = _types_1.CREATE_REPLICA_FORMATS.filter((format) => allFormats.includes(format));
    // List any unrecognized formats (we'll append these to the end of the final array)
    const unrecognizedFormats = allFormats.filter((format) => !_types_1.CREATE_REPLICA_FORMATS.includes(format));
    return [...recognizedFormats, ...unrecognizedFormats].map((format) => ({
        type: "dynamic",
        format: format,
    }));
}
//# sourceMappingURL=getCreateReplicaFormats.js.map