SPB Git forge

spb/admin-ka

Public
41commits 1branches 0releases
172.9 MBsize
maindefault branch
19 days agolast push
JavaScript 65.5% Python 17.8% CSS 13% HTML 3.7%
3.5 KB · 77 lines javascript
Raw Blame History
1"use strict";23Object.defineProperty(exports, "__esModule", {4  value: true5});6exports["default"] = void 0;7var _inflate2 = require("../lib/vendor/pako/lib/zlib/inflate.js");8var _zstream = _interopRequireDefault(require("../lib/vendor/pako/lib/zlib/zstream.js"));9function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }10function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }11function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }12function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }13function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }14function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }15function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*16 * noVNC: HTML5 VNC client17 * Copyright (C) 2020 The noVNC authors18 * Licensed under MPL 2.0 (see LICENSE.txt)19 *20 * See README.md for usage and integration instructions.21 */22var Inflate = exports["default"] = /*#__PURE__*/function () {23  function Inflate() {24    _classCallCheck(this, Inflate);25    this.strm = new _zstream["default"]();26    this.chunkSize = 1024 * 10 * 10;27    this.strm.output = new Uint8Array(this.chunkSize);28    (0, _inflate2.inflateInit)(this.strm);29  }30  return _createClass(Inflate, [{31    key: "setInput",32    value: function setInput(data) {33      if (!data) {34        //FIXME: flush remaining data.35        /* eslint-disable camelcase */36        this.strm.input = null;37        this.strm.avail_in = 0;38        this.strm.next_in = 0;39      } else {40        this.strm.input = data;41        this.strm.avail_in = this.strm.input.length;42        this.strm.next_in = 0;43        /* eslint-enable camelcase */44      }45    }46  }, {47    key: "inflate",48    value: function inflate(expected) {49      // resize our output buffer if it's too small50      // (we could just use multiple chunks, but that would cause an extra51      // allocation each time to flatten the chunks)52      if (expected > this.chunkSize) {53        this.chunkSize = expected;54        this.strm.output = new Uint8Array(this.chunkSize);55      }5657      /* eslint-disable camelcase */58      this.strm.next_out = 0;59      this.strm.avail_out = expected;60      /* eslint-enable camelcase */6162      var ret = (0, _inflate2.inflate)(this.strm, 0); // Flush argument not used.63      if (ret < 0) {64        throw new Error("zlib inflate failed");65      }66      if (this.strm.next_out != expected) {67        throw new Error("Incomplete zlib block");68      }69      return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);70    }71  }, {72    key: "reset",73    value: function reset() {74      (0, _inflate2.inflateReset)(this.strm);75    }76  }]);77}();