const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
const require_utils$1 = require('../utils.cjs');

//#region ../../node_modules/node-rsa/src/formats/components.js
var require_components = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/node-rsa/src/formats/components.js": ((exports, module) => {
	require_utils$1.default._;
	require_utils$1.default;
	module.exports = {
		privateExport: function(key, options) {
			return {
				n: key.n.toBuffer(),
				e: key.e,
				d: key.d.toBuffer(),
				p: key.p.toBuffer(),
				q: key.q.toBuffer(),
				dmp1: key.dmp1.toBuffer(),
				dmq1: key.dmq1.toBuffer(),
				coeff: key.coeff.toBuffer()
			};
		},
		privateImport: function(key, data, options) {
			if (data.n && data.e && data.d && data.p && data.q && data.dmp1 && data.dmq1 && data.coeff) key.setPrivate(data.n, data.e, data.d, data.p, data.q, data.dmp1, data.dmq1, data.coeff);
			else throw Error("Invalid key data");
		},
		publicExport: function(key, options) {
			return {
				n: key.n.toBuffer(),
				e: key.e
			};
		},
		publicImport: function(key, data, options) {
			if (data.n && data.e) key.setPublic(data.n, data.e);
			else throw Error("Invalid key data");
		},
		autoImport: function(key, data) {
			if (data.n && data.e) if (data.d && data.p && data.q && data.dmp1 && data.dmq1 && data.coeff) {
				module.exports.privateImport(key, data);
				return true;
			} else {
				module.exports.publicImport(key, data);
				return true;
			}
			return false;
		}
	};
}) });

//#endregion
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () {
    return require_components();
  }
});
//# sourceMappingURL=components.cjs.map