"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GapCursorSelection = void 0;
exports.isGapCursorSelection = isGapCursorSelection;
const prosemirror_state_1 = require("prosemirror-state");
function isGapCursorSelection(selection) {
    return selection instanceof GapCursorSelection;
}
// @ts-expect-error // TODO: implements toJSON
class GapCursorSelection extends prosemirror_state_1.Selection {
    #_$pos;
    meta;
    selectionName = 'GapCursorSelection';
    get $pos() {
        return this.#_$pos;
    }
    get pos() {
        return this.#_$pos.pos;
    }
    constructor($pos, params) {
        super($pos, $pos);
        this.#_$pos = $pos;
        this.meta = params?.meta;
    }
    eq(other) {
        return (isGapCursorSelection(other) &&
            this.pos === other.pos &&
            this.$pos.doc.eq(other.$pos.doc));
    }
    map(doc, mapping) {
        const $pos = doc.resolve(mapping.map(this.head));
        return prosemirror_state_1.Selection.near($pos);
    }
}
exports.GapCursorSelection = GapCursorSelection;
//# sourceMappingURL=GapCursorSelection.js.map
