"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAutoFocus = void 0;
var react_1 = require("react");
var useAutoFocus = function (inputRef, isEditing) {
    (0, react_1.useEffect)(function () {
        var _a, _b, _c, _d;
        if (isEditing) {
            var position = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length;
            (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
            (_d = inputRef.current) === null || _d === void 0 ? void 0 : _d.setSelectionRange(position, position);
        }
    }, [inputRef, isEditing]);
};
exports.useAutoFocus = useAutoFocus;
