"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const node_path_1 = require("node:path");
const URI_1 = require("../utils/URI");
const Connection_1 = __importDefault(require("../Connection"));
const App_1 = __importDefault(require("../App"));
async function default_1(uri, name) {
    const { id, path } = (0, URI_1.parseURI)(uri);
    const to = (0, node_path_1.join)((0, node_path_1.dirname)(path), name);
    if (path == to) {
        return;
    }
    await Connection_1.default.get(id).rename(path, to);
    if (!(0, URI_1.isLocal)(uri)) {
        App_1.default.remoteWatcher.refresh((0, URI_1.createURI)(id, (0, node_path_1.dirname)(path)));
    }
}
