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.9 KB · 88 lines javascript
Raw Blame History
1"use strict";23Object.defineProperty(exports, "__esModule", {4  value: true5});6exports["default"] = void 0;7var _deflate2 = require("../lib/vendor/pako/lib/zlib/deflate.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 Deflator = exports["default"] = /*#__PURE__*/function () {23  function Deflator() {24    _classCallCheck(this, Deflator);25    this.strm = new _zstream["default"]();26    this.chunkSize = 1024 * 10 * 10;27    this.outputBuffer = new Uint8Array(this.chunkSize);28    (0, _deflate2.deflateInit)(this.strm, _deflate2.Z_DEFAULT_COMPRESSION);29  }30  return _createClass(Deflator, [{31    key: "deflate",32    value: function deflate(inData) {33      /* eslint-disable camelcase */34      this.strm.input = inData;35      this.strm.avail_in = this.strm.input.length;36      this.strm.next_in = 0;37      this.strm.output = this.outputBuffer;38      this.strm.avail_out = this.chunkSize;39      this.strm.next_out = 0;40      /* eslint-enable camelcase */4142      var lastRet = (0, _deflate2.deflate)(this.strm, _deflate2.Z_FULL_FLUSH);43      var outData = new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);44      if (lastRet < 0) {45        throw new Error("zlib deflate failed");46      }47      if (this.strm.avail_in > 0) {48        // Read chunks until done4950        var chunks = [outData];51        var totalLen = outData.length;52        do {53          /* eslint-disable camelcase */54          this.strm.output = new Uint8Array(this.chunkSize);55          this.strm.next_out = 0;56          this.strm.avail_out = this.chunkSize;57          /* eslint-enable camelcase */5859          lastRet = (0, _deflate2.deflate)(this.strm, _deflate2.Z_FULL_FLUSH);60          if (lastRet < 0) {61            throw new Error("zlib deflate failed");62          }63          var chunk = new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);64          totalLen += chunk.length;65          chunks.push(chunk);66        } while (this.strm.avail_in > 0);6768        // Combine chunks into a single data6970        var newData = new Uint8Array(totalLen);71        var offset = 0;72        for (var i = 0; i < chunks.length; i++) {73          newData.set(chunks[i], offset);74          offset += chunks[i].length;75        }76        outData = newData;77      }7879      /* eslint-disable camelcase */80      this.strm.input = null;81      this.strm.avail_in = 0;82      this.strm.next_in = 0;83      /* eslint-enable camelcase */8485      return outData;86    }87  }]);88}();