export var INITIAL_FENCE_STATE = {
    inFenced: false,
    fenceChar: '',
    fenceLen: 0
};
export var updateFenceStateForLine = function updateFenceStateForLine(state, line) {
    var trimmed = line.trimStart();
    var match = trimmed.match(/^(`{3,}|~{3,})(.*)$/);
    if (!match) return state;
    var char = match[1][0];
    var len = match[1].length;
    var after = match[2];
    if (!state.inFenced) {
        return {
            inFenced: true,
            fenceChar: char,
            fenceLen: len
        };
    }
    if (char === state.fenceChar && len >= state.fenceLen && /^\s*$/.test(after)) {
        return {
            inFenced: false,
            fenceChar: '',
            fenceLen: 0
        };
    }
    return state;
};
