"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SLUG_ORG_SEPARATOR_KEYWORD = exports.SLUG_ORG_SEPARATOR_URI = void 0;
exports.uriSlugToKeywordSlug = uriSlugToKeywordSlug;
exports.keywordSlugToUriSlug = keywordSlugToUriSlug;
// TODO: use these const in other utils
exports.SLUG_ORG_SEPARATOR_URI = "::";
exports.SLUG_ORG_SEPARATOR_KEYWORD = "|";
// TODO: work out how to unify content slug fns
// https: github.com/Esri/hub.js/blob/master/packages/common/src/content/index.ts#L301-L348
/**
 * Uri slugs have `::` as a separator, but we need to use `|` in the typeKeywords. This function
 * converts a uri slug to a typeKeyword slug.
 * @param slug
 * @returns
 */
function uriSlugToKeywordSlug(slug) {
    if (slug.indexOf(exports.SLUG_ORG_SEPARATOR_URI) > -1) {
        slug = slug.replace(exports.SLUG_ORG_SEPARATOR_URI, exports.SLUG_ORG_SEPARATOR_KEYWORD);
    }
    return slug;
}
/**
 * Convert a typeKeyword slug to a uri slug. This is the reverse of uriSlugToKeywordSlug
 * @param slug
 * @returns
 */
function keywordSlugToUriSlug(slug) {
    if (slug.indexOf(exports.SLUG_ORG_SEPARATOR_KEYWORD) > -1) {
        slug = slug.replace(exports.SLUG_ORG_SEPARATOR_KEYWORD, exports.SLUG_ORG_SEPARATOR_URI);
    }
    return slug;
}
//# sourceMappingURL=slugConverters.js.map