UNPKG

hugbot

Version:

Chatbot maker for HuggingFace Inference API and other AI API providers and backends.

51 lines 3.18 kB
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _FCFSqueue_queue, _FCFSqueue_tail, _FCFSqueue_len; export class FCFSqueue { constructor() { _FCFSqueue_queue.set(this, void 0); _FCFSqueue_tail.set(this, void 0); _FCFSqueue_len.set(this, void 0); __classPrivateFieldSet(this, _FCFSqueue_queue, { thing: null, next: null }, "f"); __classPrivateFieldSet(this, _FCFSqueue_tail, __classPrivateFieldGet(this, _FCFSqueue_queue, "f"), "f"); __classPrivateFieldSet(this, _FCFSqueue_len, 0, "f"); } push(thing) { var _a, _b; if (__classPrivateFieldGet(this, _FCFSqueue_len, "f") === 0) { __classPrivateFieldSet(this, _FCFSqueue_queue, __classPrivateFieldGet(this, _FCFSqueue_tail, "f"), "f"); __classPrivateFieldGet(this, _FCFSqueue_queue, "f").thing = thing; __classPrivateFieldSet(this, _FCFSqueue_len, (_a = __classPrivateFieldGet(this, _FCFSqueue_len, "f"), _a++, _a), "f"); } else { __classPrivateFieldGet(this, _FCFSqueue_tail, "f").next = { thing: thing, next: null }; __classPrivateFieldSet(this, _FCFSqueue_tail, __classPrivateFieldGet(this, _FCFSqueue_tail, "f").next, "f"); __classPrivateFieldSet(this, _FCFSqueue_len, (_b = __classPrivateFieldGet(this, _FCFSqueue_len, "f"), _b++, _b), "f"); } return this; } popLeft() { var _a; if (__classPrivateFieldGet(this, _FCFSqueue_len, "f") === 0) { return null; } else { const thing = __classPrivateFieldGet(this, _FCFSqueue_queue, "f").thing; __classPrivateFieldSet(this, _FCFSqueue_queue, __classPrivateFieldGet(this, _FCFSqueue_queue, "f").next, "f"); __classPrivateFieldSet(this, _FCFSqueue_len, (_a = __classPrivateFieldGet(this, _FCFSqueue_len, "f"), _a--, _a), "f"); return thing; } } get len() { return __classPrivateFieldGet(this, _FCFSqueue_len, "f"); } } _FCFSqueue_queue = new WeakMap(), _FCFSqueue_tail = new WeakMap(), _FCFSqueue_len = new WeakMap(); //# sourceMappingURL=FCFS_queue.js.map