"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = require("path");
var raw_url_1 = __importDefault(require("./raw-url"));
// NOTE: there is a similar function in frontend/project/page/url-transform.ts
function getUrlTransform(_a) {
    var id = _a.id, path = _a.path, relativePath = _a.relativePath;
    return function (href, tag) {
        if (href.startsWith("data:"))
            return; // never change data: urls in any way.
        if (tag == "a" || href.includes("://")) {
            // Don't modify anything non-local, i.e., like https://...
            // Also don't modify a tags at all.
            return;
        }
        return (0, raw_url_1.default)({ id: id, path: path, relativePath: (0, path_1.join)(relativePath, href) });
    };
}
exports.default = getUrlTransform;
//# sourceMappingURL=url-transform.js.map