/**
 * Compatibility Layer for Node.js 0.8+
 * Local to this package - contains only needed functions.
 */ "use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get homedir () {
        return homedir;
    },
    get mkdirpSync () {
        return mkdirpSync;
    },
    get objectAssign () {
        return objectAssign;
    },
    get readdirWithTypes () {
        return readdirWithTypes;
    },
    get rmSync () {
        return rmSync;
    },
    get stringEndsWith () {
        return stringEndsWith;
    },
    get tmpdir () {
        return tmpdir;
    }
});
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
var _os = /*#__PURE__*/ _interop_require_default(require("os"));
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
// Use existing require in CJS, or createRequire in ESM (Node 12.2+)
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
function homedir() {
    return typeof _os.default.homedir === 'function' ? _os.default.homedir() : require('homedir-polyfill')();
}
function tmpdir() {
    return typeof _os.default.tmpdir === 'function' ? _os.default.tmpdir() : require('os-shim').tmpdir();
}
/**
 * String.prototype.endsWith wrapper for Node.js 0.8+
 * - Uses native endsWith on Node 4.0+ / ES2015+
 * - Falls back to lastIndexOf on Node 0.8-3.x
 */ var hasEndsWith = typeof String.prototype.endsWith === 'function';
function stringEndsWith(str, search, position) {
    if (hasEndsWith) return str.endsWith(search, position);
    var len = position === undefined ? str.length : position;
    return str.lastIndexOf(search) === len - search.length;
}
function mkdirpSync(dir) {
    var mkdirp = _require('mkdirp-classic');
    mkdirp.sync(dir);
}
function rmSync(dir) {
    var safeRmSync = _require('fs-remove-compat').safeRmSync;
    safeRmSync(dir);
}
function readdirWithTypes(dir) {
    var names = _fs.default.readdirSync(dir);
    return names.map(function(name) {
        var fullPath = _path.default.join(dir, name);
        var stat;
        try {
            stat = _fs.default.statSync(fullPath);
        } catch (_e) {
            // If stat fails, treat as non-directory
            return {
                name: name,
                isDirectory: function() {
                    return false;
                }
            };
        }
        return {
            name: name,
            isDirectory: function() {
                return stat.isDirectory();
            }
        };
    });
}
/**
 * Object.assign wrapper for Node.js 0.8+
 * - Uses native Object.assign on Node 4.0+
 * - Falls back to manual property copy on Node 0.8-3.x
 */ var hasObjectAssign = typeof Object.assign === 'function';
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function objectAssign(target, source) {
    if (hasObjectAssign) return Object.assign(target, source);
    for(var key in source){
        if (_hasOwnProperty.call(source, key)) target[key] = source[key];
    }
    return target;
}
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }