"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var react_1 = require("react"); var useQueue = function (initialValue) { if (initialValue === void 0) { initialValue = []; } var _a = react_1.useState(initialValue), state = _a[0], set = _a[1]; return { add: function (value) { set(function (queue) { return tslib_1.__spreadArrays(queue, [value]); }); }, remove: function () { var result; set(function (_a) { var first = _a[0], rest = _a.slice(1); result = first; return rest; }); return result; }, get first() { return state[0]; }, get last() { return state[state.length - 1]; }, get size() { return state.length; }, }; }; exports.default = useQueue;