"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createEvents = void 0;
const tslib_1 = require("tslib");
const PeritextEventDefaults_1 = require("./defaults/PeritextEventDefaults");
const PeritextEventTarget_1 = require("./PeritextEventTarget");
const DomClipboard_1 = require("./clipboard/DomClipboard");
const create_1 = require("../../../json-crdt-extensions/peritext/transfer/create");
/**
 * @todo Move into separately importable file.
 * @todo Rename to `createDefaults`.
 */
const createEvents = (txt) => {
    const et = new PeritextEventTarget_1.PeritextEventTarget();
    const clipboard = typeof navigator === 'object' && navigator && navigator.clipboard
        ? new DomClipboard_1.DomClipboard(navigator.clipboard)
        : undefined;
    const transfer = (0, create_1.create)(txt);
    const defaults = new PeritextEventDefaults_1.PeritextEventDefaults(txt, et, { clipboard, transfer });
    et.defaults = defaults;
    return defaults;
};
exports.createEvents = createEvents;
tslib_1.__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map