"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 types_1 = require("../types");
const URI_1 = require("../utils/URI");
const Connection_1 = __importDefault(require("../Connection"));
const App_1 = __importDefault(require("../App"));
async function default_1(file, force) {
    if (!force) {
        App_1.default.onError({ type: types_1.FailureType.ConfirmClear, file });
        return;
    }
    const { id, path } = (0, URI_1.parseURI)(file);
    await Connection_1.default.get(id).write(path, '');
    if (id != types_1.LocalFileSystemID) {
        App_1.default.remoteWatcher.refresh((0, URI_1.createURI)(id, (0, node_path_1.dirname)(path)));
    }
}
