import { computeItemLinks } from "../../core/_internal/computeItemLinks";
/**
 * Compute the links that get appended to a Hub Template
 * search result and entity
 *
 * @param item
 * @param requestOptions
 */
export function computeLinks(item, requestOptions) {
    var _a;
    const links = computeItemLinks(item, requestOptions);
    // If a solution template is deployed, we don't support
    // managing it in the workspace, so we kick users to AGO
    const isDeployed = (_a = item.typeKeywords) === null || _a === void 0 ? void 0 : _a.includes("Deployed");
    const { self, siteRelative, workspaceRelative } = links;
    // templates have an advanced edit link
    const advancedEditRelative = `${siteRelative
        .split("/")
        .slice(0, -1)
        .join("/")}/edit/advanced`;
    return Object.assign(Object.assign({}, links), { 
        // handle deployed templates
        workspaceRelative: isDeployed ? self : workspaceRelative, 
        // add advanced edit relative link
        advancedEditRelative });
}
//# sourceMappingURL=computeLinks.js.map