scratch-sb1-converter 2.0.280 → 2.0.281
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +2 -2
- package/playground/main.js +26 -26
- package/playground/view.js +33 -33
package/playground/main.js
CHANGED
|
@@ -151,7 +151,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
|
|
|
151
151
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
152
152
|
|
|
153
153
|
"use strict";
|
|
154
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Adler32\", function() { return Adler32; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
154
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Adler32\", function() { return Adler32; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nvar Adler32 = /*#__PURE__*/function () {\n function Adler32() {\n _classCallCheck(this, Adler32);\n this.adler = 1;\n }\n return _createClass(Adler32, [{\n key: \"update\",\n value: function update(uint8a, position, length) {\n var a = this.adler & 0xffff;\n var b = this.adler >>> 16;\n for (var i = 0; i < length; i++) {\n a = (a + uint8a[position + i]) % 65521;\n b = (b + a) % 65521;\n }\n this.adler = b << 16 | a;\n return this;\n }\n }, {\n key: \"digest\",\n get: function get() {\n return this.adler;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/adler32.js?");
|
|
155
155
|
|
|
156
156
|
/***/ }),
|
|
157
157
|
|
|
@@ -163,7 +163,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
163
163
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
164
164
|
|
|
165
165
|
"use strict";
|
|
166
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Packet\", function() { return Packet; });\nfunction _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); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
166
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Packet\", function() { return Packet; });\nfunction _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); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n/**\n * @typedef {function} PacketConstructor\n */\n/**\n * A packet of bytes represented with getter/setter properties for decoding and\n * encoding values mapped to names, located at known offsets.\n *\n * ```js\n * // Defining a subclass:\n * import {Packet} from '../coders/byte-packets';\n * import {Uint8, Uint16LE} from '../coders/byte-primitives';\n *\n * class MyIdentifiedUint16 extends Packet.extend({\n * binaryType: Uint8,\n * value: Uint16LE\n * }) {}\n *\n * Packet.initConstructor(MyIdentifiedUint16);\n *\n * // One way to use it:\n * const indentifiedUint16 = new MyIdentifiedUint16(uint8a, position);\n * indentifiedUint16.binaryType = IDENTIFIED_UINT_16;\n * indentifiedUint16.value = value;\n * ```\n */\nvar Packet = /*#__PURE__*/function () {\n /**\n * @param {Uint8Array=} [uint8a=new Uint8Array(this.size)] - byte array to\n * encode to and decode from\n * @param {number=} offset - offset in addition to the member offsets to\n * encode to and decode from\n */\n function Packet() {\n var uint8a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Uint8Array(this.size);\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, Packet);\n /**\n * Byte array to encode to and decode from.\n * @type {Uint8Array}\n */\n this.uint8a = uint8a;\n\n /**\n * Offset in addition to the member offsets to encode to and decode\n * from.\n * @type {number}\n */\n this.offset = offset;\n }\n\n /**\n * Check that the decoded values of this Packet match the values in other.\n * @param {object} other - object to match against\n * @returns {boolean} true if all keys in other match values in this packet\n */\n return _createClass(Packet, [{\n key: \"equals\",\n value: function equals(other) {\n for (var key in other) {\n if (this[key] !== other[key]) {\n return false;\n }\n }\n return true;\n }\n }, {\n key: \"view\",\n value: function view() {\n var className = this.constructor.name;\n var obj = {\n toString: function toString() {\n return className;\n }\n };\n for (var key in this.shape) {\n obj[key] = this[key];\n }\n return obj;\n }\n\n /**\n * Initialize the Packet subclass constructor for easy access to static\n * members like size.\n * @param {function} PacketConstructor - constuctor function for the Packet\n * subclass\n * @returns {function} initialized constructor\n */\n }], [{\n key: \"initConstructor\",\n value: function initConstructor(PacketConstructor) {\n PacketConstructor.size = PacketConstructor.prototype.size;\n return PacketConstructor;\n }\n\n /**\n * Extend a subclass of Packet with given BytePrimitive members.\n * @param {object} shape - shape of the packet defined with BytePrimitives\n * @returns {function} Packet subclass constructor\n */\n }, {\n key: \"extend\",\n value: function extend(shape) {\n var DefinedPacket = /*#__PURE__*/function (_Packet) {\n function DefinedPacket() {\n _classCallCheck(this, DefinedPacket);\n return _callSuper(this, DefinedPacket, arguments);\n }\n _inherits(DefinedPacket, _Packet);\n return _createClass(DefinedPacket, [{\n key: \"shape\",\n get: function get() {\n return shape;\n }\n }]);\n }(Packet);\n var position = 0;\n Object.keys(shape).forEach(function (key) {\n Object.defineProperty(DefinedPacket.prototype, key, shape[key].asPropertyObject(position));\n if (shape[key].size === 0) {\n throw new Error('Packet cannot be defined with variable sized members.');\n }\n position += shape[key].size;\n });\n DefinedPacket.prototype.size = position;\n DefinedPacket.size = position;\n return DefinedPacket;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/byte-packets.js?");
|
|
167
167
|
|
|
168
168
|
/***/ }),
|
|
169
169
|
|
|
@@ -175,7 +175,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
175
175
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
176
176
|
|
|
177
177
|
"use strict";
|
|
178
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IS_HOST_LITTLE_ENDIAN\", function() { return IS_HOST_LITTLE_ENDIAN; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BytePrimitive\", function() { return BytePrimitive; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint8\", function() { return Uint8; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint16BE\", function() { return Uint16BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Int16BE\", function() { return Int16BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Int32BE\", function() { return Int32BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint32BE\", function() { return Uint32BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint16LE\", function() { return Uint16LE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint32LE\", function() { return Uint32LE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DoubleBE\", function() { return DoubleBE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FixedAsciiString\", function() { return FixedAsciiString; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _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); }\n\nvar notImplemented = function notImplemented() {\n throw new Error('Not implemented');\n};\n\n/**\n * Is the host computer little or big endian.\n * @const IS_HOST_LITTLE_ENDIAN\n * @type {boolean}\n */\nvar IS_HOST_LITTLE_ENDIAN = function () {\n var ab16 = new Uint16Array(1);\n var ab8 = new Uint8Array(ab16.buffer);\n ab16[0] = 0xaabb;\n return ab8[0] === 0xbb;\n}();\n\n/**\n * @callback BytePrimitive~sizeOfCallback\n * @param {Uint8Array} uint8a\n * @param {number} position\n * @returns {number}\n */\n\n/**\n * @callback BytePrimitive~writeSizeOfCallback\n * @param {Uint8Array} uint8a\n * @param {number} position\n * @param {*} value\n * @returns {number}\n */\n\n/**\n * @callback BytePrimitive~writeCallback\n * @param {Uint8Array} uint8a\n * @param {number} position\n * @param {*} value\n */\n\n/**\n * An interface for reading and writing binary values to typed arrays.\n *\n * Combined with {@link Packet Packet} this makes reading and writing packets\n * of binary values easy.\n */\nvar BytePrimitive = /*#__PURE__*/function () {\n /**\n * @constructor\n * @param {object} options - Options to initialize BytePrimitive instance\n * with.\n * @param {number} [options.size=0] - Fixed size of the BytePrimitive.\n * Should be 0 if the primitive has a variable size.\n * @param {BytePrimitive~sizeOfCallback} [options.sizeOf=() => size] -\n * Variable size of the primitive depending on its value stored in the\n * array.\n * @param {BytePrimitive~writeSizeOfCallback} [options.writeSizeOf] -\n * Variable size of the primitive depending on the value being written.\n * @param {TypedArray} [options.toBytes=new Uint8Array(1)] - Temporary\n * space to copy bytes to/from to translate between a value and its\n * representative byte set.\n * @param {BytePrimitive#read} options.read - How is a value read\n * at the given position of the array.\n * @param {BytePrimitive~writeCallback} [options.write] - How to write a\n * value to the array at the given position.\n */\n function BytePrimitive(_ref) {\n var _ref$size = _ref.size,\n size = _ref$size === void 0 ? 0 : _ref$size,\n _ref$sizeOf = _ref.sizeOf,\n sizeOf = _ref$sizeOf === void 0 ? function () {\n return size;\n } : _ref$sizeOf,\n _ref$writeSizeOf = _ref.writeSizeOf,\n writeSizeOf = _ref$writeSizeOf === void 0 ? notImplemented : _ref$writeSizeOf,\n _ref$toBytes = _ref.toBytes,\n toBytes = _ref$toBytes === void 0 ? new Uint8Array(1) : _ref$toBytes,\n read = _ref.read,\n _ref$write = _ref.write,\n write = _ref$write === void 0 ? notImplemented : _ref$write;\n _classCallCheck(this, BytePrimitive);\n this.size = size;\n this.sizeOf = sizeOf;\n this.writeSizeOf = writeSizeOf;\n this.toBytes = toBytes;\n this.bytes = new Uint8Array(toBytes.buffer);\n this.read = read;\n this.write = write;\n }\n\n /**\n * Create an object that can be used with `Object.defineProperty` to read\n * and write values offset by `position` and the object's `this.offset`\n * from `this.uint8a` by getting or setting the property.\n * @param {number} position - Additional offset with `this.offset` to read\n * from or write to.\n * @returns {object} - A object that can be passed as the third argument to\n * `Object.defineProperty`.\n */\n return _createClass(BytePrimitive, [{\n key: \"asPropertyObject\",\n value: function asPropertyObject(position) {\n var _this = this;\n return {\n get: function get() {\n return _this.read(this.uint8a, position + this.offset);\n },\n set: function set(value) {\n return _this.write(this.uint8a, position + this.offset, value);\n },\n enumerable: true\n };\n }\n\n /**\n * Read a value from `position` in `uint8a`.\n * @param {Uint8Array} uint8a - Array to read from.\n * @param {number} position - Position in `uint8a` to read from.\n * @returns {*} - Value read from `uint8a` at `position`.\n */\n }, {\n key: \"read\",\n value: function read() {\n return null;\n }\n }]);\n}();\n/**\n * @const Uint8\n * @type {BytePrimitive}\n */\nvar Uint8 = new BytePrimitive({\n size: 1,\n read: function read(uint8a, position) {\n return uint8a[position];\n },\n write: function write(uint8a, position, value) {\n uint8a[position] = value;\n return value;\n }\n});\nvar HOSTLE_BE16 = {\n size: 2,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[1] = uint8a[position + 0];\n this.bytes[0] = uint8a[position + 1];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[1];\n uint8a[position + 1] = this.bytes[0];\n return value;\n }\n};\nvar HOSTBE_BE16 = {\n size: 2,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[0] = uint8a[position + 0];\n this.bytes[1] = uint8a[position + 1];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[0];\n uint8a[position + 1] = this.bytes[1];\n return value;\n }\n};\nvar BE16;\nif (IS_HOST_LITTLE_ENDIAN) {\n BE16 = HOSTLE_BE16;\n} else {\n BE16 = HOSTBE_BE16;\n}\n\n/**\n * @const Uint16BE\n * @type {BytePrimitive}\n */\nvar Uint16BE = new BytePrimitive(Object.assign({}, BE16, {\n toBytes: new Uint16Array(1)\n}));\n\n/**\n * @const Int16BE\n * @type {BytePrimitive}\n */\nvar Int16BE = new BytePrimitive(Object.assign({}, BE16, {\n toBytes: new Int16Array(1)\n}));\nvar HOSTLE_BE32 = {\n size: 4,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[3] = uint8a[position + 0];\n this.bytes[2] = uint8a[position + 1];\n this.bytes[1] = uint8a[position + 2];\n this.bytes[0] = uint8a[position + 3];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[3];\n uint8a[position + 1] = this.bytes[2];\n uint8a[position + 2] = this.bytes[1];\n uint8a[position + 3] = this.bytes[0];\n return value;\n }\n};\nvar HOSTBE_BE32 = {\n size: 4,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[0] = uint8a[position + 0];\n this.bytes[1] = uint8a[position + 1];\n this.bytes[2] = uint8a[position + 2];\n this.bytes[3] = uint8a[position + 3];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[0];\n uint8a[position + 1] = this.bytes[1];\n uint8a[position + 2] = this.bytes[2];\n uint8a[position + 3] = this.bytes[3];\n return value;\n }\n};\nvar BE32;\nif (IS_HOST_LITTLE_ENDIAN) {\n BE32 = HOSTLE_BE32;\n} else {\n BE32 = HOSTBE_BE32;\n}\n\n/**\n * @const Int32BE\n * @type {BytePrimitive}\n */\nvar Int32BE = new BytePrimitive(Object.assign({}, BE32, {\n toBytes: new Int32Array(1)\n}));\n\n/**\n * @const Uint32BE\n * @type {BytePrimitive}\n */\nvar Uint32BE = new BytePrimitive(Object.assign({}, BE32, {\n toBytes: new Uint32Array(1)\n}));\nvar LE16;\nif (IS_HOST_LITTLE_ENDIAN) {\n LE16 = HOSTBE_BE16;\n} else {\n LE16 = HOSTLE_BE16;\n}\n\n/**\n * @const Uint16LE\n * @type {BytePrimitive}\n */\nvar Uint16LE = new BytePrimitive(Object.assign({}, LE16, {\n toBytes: new Uint16Array(1)\n}));\nvar LE32;\nif (IS_HOST_LITTLE_ENDIAN) {\n LE32 = HOSTBE_BE32;\n} else {\n LE32 = HOSTLE_BE32;\n}\n\n/**\n * @const Uint32LE\n * @type {BytePrimitive}\n */\nvar Uint32LE = new BytePrimitive(Object.assign({}, LE32, {\n toBytes: new Uint32Array(1)\n}));\nvar HOSTLE_BEDOUBLE = {\n size: 8,\n read: function read(uint8a, position) {\n this.bytes[7] = uint8a[position + 0];\n this.bytes[6] = uint8a[position + 1];\n this.bytes[5] = uint8a[position + 2];\n this.bytes[4] = uint8a[position + 3];\n this.bytes[3] = uint8a[position + 4];\n this.bytes[2] = uint8a[position + 5];\n this.bytes[1] = uint8a[position + 6];\n this.bytes[0] = uint8a[position + 7];\n return this.toBytes[0];\n }\n};\nvar HOSTBE_BEDOUBLE = {\n size: 8,\n read: function read(uint8a, position) {\n this.bytes[7] = uint8a[position + 0];\n this.bytes[6] = uint8a[position + 1];\n this.bytes[5] = uint8a[position + 2];\n this.bytes[4] = uint8a[position + 3];\n this.bytes[3] = uint8a[position + 4];\n this.bytes[2] = uint8a[position + 5];\n this.bytes[1] = uint8a[position + 6];\n this.bytes[0] = uint8a[position + 7];\n return this.toBytes[0];\n }\n};\nvar BEDOUBLE;\nif (IS_HOST_LITTLE_ENDIAN) {\n BEDOUBLE = HOSTLE_BEDOUBLE;\n} else {\n BEDOUBLE = HOSTBE_BEDOUBLE;\n}\n\n/**\n * @const DoubleBE\n * @type {BytePrimitive}\n */\nvar DoubleBE = new BytePrimitive(Object.assign({}, BEDOUBLE, {\n toBytes: new Float64Array(1)\n}));\n\n/**\n * @extends BytePrimitive\n */\nvar FixedAsciiString = /*#__PURE__*/function (_BytePrimitive) {\n /**\n * @param {number} size - Number of bytes the FixedAsciiString uses.\n */\n function FixedAsciiString(size) {\n _classCallCheck(this, FixedAsciiString);\n return _callSuper(this, FixedAsciiString, [{\n size: size,\n read: function read(uint8a, position) {\n var str = '';\n for (var i = 0; i < size; i++) {\n var code = uint8a[position + i];\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(code <= 127, 'Non-ascii character in FixedAsciiString');\n str += String.fromCharCode(code);\n }\n return str;\n },\n write: function write(uint8a, position, value) {\n for (var i = 0; i < size; i++) {\n var code = value.charCodeAt(i);\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(code <= 127, 'Non-ascii character in FixedAsciiString');\n uint8a[position + i] = code;\n }\n return value;\n }\n }]);\n }\n _inherits(FixedAsciiString, _BytePrimitive);\n return _createClass(FixedAsciiString);\n}(BytePrimitive);\n\n\n//# sourceURL=webpack:///./src/coders/byte-primitives.js?");
|
|
178
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IS_HOST_LITTLE_ENDIAN\", function() { return IS_HOST_LITTLE_ENDIAN; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BytePrimitive\", function() { return BytePrimitive; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint8\", function() { return Uint8; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint16BE\", function() { return Uint16BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Int16BE\", function() { return Int16BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Int32BE\", function() { return Int32BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint32BE\", function() { return Uint32BE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint16LE\", function() { return Uint16LE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Uint32LE\", function() { return Uint32LE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DoubleBE\", function() { return DoubleBE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FixedAsciiString\", function() { return FixedAsciiString; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\nvar notImplemented = function notImplemented() {\n throw new Error('Not implemented');\n};\n\n/**\n * Is the host computer little or big endian.\n * @const IS_HOST_LITTLE_ENDIAN\n * @type {boolean}\n */\nvar IS_HOST_LITTLE_ENDIAN = function () {\n var ab16 = new Uint16Array(1);\n var ab8 = new Uint8Array(ab16.buffer);\n ab16[0] = 0xaabb;\n return ab8[0] === 0xbb;\n}();\n\n/**\n * @callback BytePrimitive~sizeOfCallback\n * @param {Uint8Array} uint8a\n * @param {number} position\n * @returns {number}\n */\n\n/**\n * @callback BytePrimitive~writeSizeOfCallback\n * @param {Uint8Array} uint8a\n * @param {number} position\n * @param {*} value\n * @returns {number}\n */\n\n/**\n * @callback BytePrimitive~writeCallback\n * @param {Uint8Array} uint8a\n * @param {number} position\n * @param {*} value\n */\n\n/**\n * An interface for reading and writing binary values to typed arrays.\n *\n * Combined with {@link Packet Packet} this makes reading and writing packets\n * of binary values easy.\n */\nvar BytePrimitive = /*#__PURE__*/function () {\n /**\n * @constructor\n * @param {object} options - Options to initialize BytePrimitive instance\n * with.\n * @param {number} [options.size=0] - Fixed size of the BytePrimitive.\n * Should be 0 if the primitive has a variable size.\n * @param {BytePrimitive~sizeOfCallback} [options.sizeOf=() => size] -\n * Variable size of the primitive depending on its value stored in the\n * array.\n * @param {BytePrimitive~writeSizeOfCallback} [options.writeSizeOf] -\n * Variable size of the primitive depending on the value being written.\n * @param {TypedArray} [options.toBytes=new Uint8Array(1)] - Temporary\n * space to copy bytes to/from to translate between a value and its\n * representative byte set.\n * @param {BytePrimitive#read} options.read - How is a value read\n * at the given position of the array.\n * @param {BytePrimitive~writeCallback} [options.write] - How to write a\n * value to the array at the given position.\n */\n function BytePrimitive(_ref) {\n var _ref$size = _ref.size,\n size = _ref$size === void 0 ? 0 : _ref$size,\n _ref$sizeOf = _ref.sizeOf,\n sizeOf = _ref$sizeOf === void 0 ? function () {\n return size;\n } : _ref$sizeOf,\n _ref$writeSizeOf = _ref.writeSizeOf,\n writeSizeOf = _ref$writeSizeOf === void 0 ? notImplemented : _ref$writeSizeOf,\n _ref$toBytes = _ref.toBytes,\n toBytes = _ref$toBytes === void 0 ? new Uint8Array(1) : _ref$toBytes,\n read = _ref.read,\n _ref$write = _ref.write,\n write = _ref$write === void 0 ? notImplemented : _ref$write;\n _classCallCheck(this, BytePrimitive);\n this.size = size;\n this.sizeOf = sizeOf;\n this.writeSizeOf = writeSizeOf;\n this.toBytes = toBytes;\n this.bytes = new Uint8Array(toBytes.buffer);\n this.read = read;\n this.write = write;\n }\n\n /**\n * Create an object that can be used with `Object.defineProperty` to read\n * and write values offset by `position` and the object's `this.offset`\n * from `this.uint8a` by getting or setting the property.\n * @param {number} position - Additional offset with `this.offset` to read\n * from or write to.\n * @returns {object} - A object that can be passed as the third argument to\n * `Object.defineProperty`.\n */\n return _createClass(BytePrimitive, [{\n key: \"asPropertyObject\",\n value: function asPropertyObject(position) {\n var _this = this;\n return {\n get: function get() {\n return _this.read(this.uint8a, position + this.offset);\n },\n set: function set(value) {\n return _this.write(this.uint8a, position + this.offset, value);\n },\n enumerable: true\n };\n }\n\n /**\n * Read a value from `position` in `uint8a`.\n * @param {Uint8Array} uint8a - Array to read from.\n * @param {number} position - Position in `uint8a` to read from.\n * @returns {*} - Value read from `uint8a` at `position`.\n */\n }, {\n key: \"read\",\n value: function read() {\n return null;\n }\n }]);\n}();\n/**\n * @const Uint8\n * @type {BytePrimitive}\n */\nvar Uint8 = new BytePrimitive({\n size: 1,\n read: function read(uint8a, position) {\n return uint8a[position];\n },\n write: function write(uint8a, position, value) {\n uint8a[position] = value;\n return value;\n }\n});\nvar HOSTLE_BE16 = {\n size: 2,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[1] = uint8a[position + 0];\n this.bytes[0] = uint8a[position + 1];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[1];\n uint8a[position + 1] = this.bytes[0];\n return value;\n }\n};\nvar HOSTBE_BE16 = {\n size: 2,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[0] = uint8a[position + 0];\n this.bytes[1] = uint8a[position + 1];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[0];\n uint8a[position + 1] = this.bytes[1];\n return value;\n }\n};\nvar BE16;\nif (IS_HOST_LITTLE_ENDIAN) {\n BE16 = HOSTLE_BE16;\n} else {\n BE16 = HOSTBE_BE16;\n}\n\n/**\n * @const Uint16BE\n * @type {BytePrimitive}\n */\nvar Uint16BE = new BytePrimitive(Object.assign({}, BE16, {\n toBytes: new Uint16Array(1)\n}));\n\n/**\n * @const Int16BE\n * @type {BytePrimitive}\n */\nvar Int16BE = new BytePrimitive(Object.assign({}, BE16, {\n toBytes: new Int16Array(1)\n}));\nvar HOSTLE_BE32 = {\n size: 4,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[3] = uint8a[position + 0];\n this.bytes[2] = uint8a[position + 1];\n this.bytes[1] = uint8a[position + 2];\n this.bytes[0] = uint8a[position + 3];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[3];\n uint8a[position + 1] = this.bytes[2];\n uint8a[position + 2] = this.bytes[1];\n uint8a[position + 3] = this.bytes[0];\n return value;\n }\n};\nvar HOSTBE_BE32 = {\n size: 4,\n // toBytes: Defined by instance.\n read: function read(uint8a, position) {\n this.bytes[0] = uint8a[position + 0];\n this.bytes[1] = uint8a[position + 1];\n this.bytes[2] = uint8a[position + 2];\n this.bytes[3] = uint8a[position + 3];\n return this.toBytes[0];\n },\n write: function write(uint8a, position, value) {\n this.toBytes[0] = value;\n uint8a[position + 0] = this.bytes[0];\n uint8a[position + 1] = this.bytes[1];\n uint8a[position + 2] = this.bytes[2];\n uint8a[position + 3] = this.bytes[3];\n return value;\n }\n};\nvar BE32;\nif (IS_HOST_LITTLE_ENDIAN) {\n BE32 = HOSTLE_BE32;\n} else {\n BE32 = HOSTBE_BE32;\n}\n\n/**\n * @const Int32BE\n * @type {BytePrimitive}\n */\nvar Int32BE = new BytePrimitive(Object.assign({}, BE32, {\n toBytes: new Int32Array(1)\n}));\n\n/**\n * @const Uint32BE\n * @type {BytePrimitive}\n */\nvar Uint32BE = new BytePrimitive(Object.assign({}, BE32, {\n toBytes: new Uint32Array(1)\n}));\nvar LE16;\nif (IS_HOST_LITTLE_ENDIAN) {\n LE16 = HOSTBE_BE16;\n} else {\n LE16 = HOSTLE_BE16;\n}\n\n/**\n * @const Uint16LE\n * @type {BytePrimitive}\n */\nvar Uint16LE = new BytePrimitive(Object.assign({}, LE16, {\n toBytes: new Uint16Array(1)\n}));\nvar LE32;\nif (IS_HOST_LITTLE_ENDIAN) {\n LE32 = HOSTBE_BE32;\n} else {\n LE32 = HOSTLE_BE32;\n}\n\n/**\n * @const Uint32LE\n * @type {BytePrimitive}\n */\nvar Uint32LE = new BytePrimitive(Object.assign({}, LE32, {\n toBytes: new Uint32Array(1)\n}));\nvar HOSTLE_BEDOUBLE = {\n size: 8,\n read: function read(uint8a, position) {\n this.bytes[7] = uint8a[position + 0];\n this.bytes[6] = uint8a[position + 1];\n this.bytes[5] = uint8a[position + 2];\n this.bytes[4] = uint8a[position + 3];\n this.bytes[3] = uint8a[position + 4];\n this.bytes[2] = uint8a[position + 5];\n this.bytes[1] = uint8a[position + 6];\n this.bytes[0] = uint8a[position + 7];\n return this.toBytes[0];\n }\n};\nvar HOSTBE_BEDOUBLE = {\n size: 8,\n read: function read(uint8a, position) {\n this.bytes[7] = uint8a[position + 0];\n this.bytes[6] = uint8a[position + 1];\n this.bytes[5] = uint8a[position + 2];\n this.bytes[4] = uint8a[position + 3];\n this.bytes[3] = uint8a[position + 4];\n this.bytes[2] = uint8a[position + 5];\n this.bytes[1] = uint8a[position + 6];\n this.bytes[0] = uint8a[position + 7];\n return this.toBytes[0];\n }\n};\nvar BEDOUBLE;\nif (IS_HOST_LITTLE_ENDIAN) {\n BEDOUBLE = HOSTLE_BEDOUBLE;\n} else {\n BEDOUBLE = HOSTBE_BEDOUBLE;\n}\n\n/**\n * @const DoubleBE\n * @type {BytePrimitive}\n */\nvar DoubleBE = new BytePrimitive(Object.assign({}, BEDOUBLE, {\n toBytes: new Float64Array(1)\n}));\n\n/**\n * @extends BytePrimitive\n */\nvar FixedAsciiString = /*#__PURE__*/function (_BytePrimitive) {\n /**\n * @param {number} size - Number of bytes the FixedAsciiString uses.\n */\n function FixedAsciiString(size) {\n _classCallCheck(this, FixedAsciiString);\n return _callSuper(this, FixedAsciiString, [{\n size: size,\n read: function read(uint8a, position) {\n var str = '';\n for (var i = 0; i < size; i++) {\n var code = uint8a[position + i];\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(code <= 127, 'Non-ascii character in FixedAsciiString');\n str += String.fromCharCode(code);\n }\n return str;\n },\n write: function write(uint8a, position, value) {\n for (var i = 0; i < size; i++) {\n var code = value.charCodeAt(i);\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(code <= 127, 'Non-ascii character in FixedAsciiString');\n uint8a[position + i] = code;\n }\n return value;\n }\n }]);\n }\n _inherits(FixedAsciiString, _BytePrimitive);\n return _createClass(FixedAsciiString);\n}(BytePrimitive);\n\n\n//# sourceURL=webpack:///./src/coders/byte-primitives.js?");
|
|
179
179
|
|
|
180
180
|
/***/ }),
|
|
181
181
|
|
|
@@ -187,7 +187,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
187
187
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
188
188
|
|
|
189
189
|
"use strict";
|
|
190
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ByteStream\", function() { return ByteStream; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
190
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ByteStream\", function() { return ByteStream; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\n/**\n * Read and write a stream of {@link BytePrimitive}s, {@link Packet}s, or byte\n * arrays to an ArrayBuffer.\n */\nvar ByteStream = /*#__PURE__*/function () {\n /**\n * @param {ArrayBuffer} buffer - The ArrayBuffer to read from or write to.\n * @param {number=} [position=0] - The position to start reading or writing\n * from in the ArrayBuffer.\n */\n function ByteStream(buffer) {\n var position = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, ByteStream);\n /**\n * The ArrayBuffer to read from or write to.\n * @type {ArrayBuffer}\n */\n this.buffer = buffer;\n\n /**\n * The position to start reading or writing from in the ArrayBuffer.\n * @type {number}\n */\n this.position = position;\n\n /**\n * The typed array view of the buffer to read and write with.\n * @type {Uint8Array}\n */\n this.uint8a = new Uint8Array(this.buffer);\n }\n\n /**\n * Read one instance of a given BytePrimitive and increment position based\n * on the size of that value.\n * @param {BytePrimitive} member - BytePrimitive to read and increment size\n * with.\n * @returns {*} Return the value produced by the BytePrimitive.\n */\n return _createClass(ByteStream, [{\n key: \"read\",\n value: function read(member) {\n var value = member.read(this.uint8a, this.position);\n if (member.size === 0) {\n this.position += member.sizeOf(this.uint8a, this.position);\n } else {\n this.position += member.size;\n }\n return value;\n }\n\n /**\n * Read one instance of a given Packet subclass and increment position\n * based on the size of that value.\n * @param {PacketConstructor} StructType - Packet subclass constructor that\n * can read from the current stream position.\n * @returns {Packet} Instance of a Packet pointed at the position of the\n * stream before calling readStruct.\n */\n }, {\n key: \"readStruct\",\n value: function readStruct(StructType) {\n var obj = new StructType(this.uint8a, this.position);\n this.position += StructType.size;\n return obj;\n }\n\n /**\n * Resize the internal buffer to allow for the needed amount of space.\n * @param {number} needed - How many bytes need to fit in the buffer.\n * @private\n */\n }, {\n key: \"resize\",\n value: function resize(needed) {\n if (this.buffer.byteLength < needed) {\n var uint8a = this.uint8a;\n var nextPowerOf2 = Math.pow(2, Math.ceil(Math.log(needed) / Math.log(2)));\n this.buffer = new ArrayBuffer(nextPowerOf2);\n this.uint8a = new Uint8Array(this.buffer);\n this.uint8a.set(uint8a);\n }\n }\n\n /**\n * Write a value to the stream (with a BytePrimitive defining how to do so)\n * and increment the position.\n * @param {BytePrimitive} member - BytePrimitive to define how to write the\n * value.\n * @param {*} value - Value to write.\n * @returns {*} Value passed to the method.\n */\n }, {\n key: \"write\",\n value: function write(member, value) {\n if (member.size === 0) {\n this.resize(this.position + member.writeSizeOf(value));\n } else {\n this.resize(this.position + member.size);\n }\n member.write(this.uint8a, this.position, value);\n if (member.size === 0) {\n this.position += member.writeSizeOf(this.uint8a, this.position);\n } else {\n this.position += member.size;\n }\n return value;\n }\n\n /**\n * Write data to the stream structured by a given Packet subclass\n * constructor and increment the position.\n * @param {PacketConstructor} StructType - The Packet subclass constructor\n * defining how to write the data.\n * @param {object} data - Data to write.\n * @returns {Packet} - Constructed packet after writing data.\n */\n }, {\n key: \"writeStruct\",\n value: function writeStruct(StructType, data) {\n this.resize(this.position + StructType.size);\n var st = Object.assign(new StructType(this.uint8a, this.position), data);\n this.position += StructType.size;\n return st;\n }\n\n /**\n * Write bytes from the given Uint8Array array to the stream and increment\n * the position.\n * @param {Uint8Array} bytes - Bytes to write to the stream.\n * @param {number=} [start=0] - Where in bytes to start writing from.\n * @param {number=} [end=bytes.length] - Where in bytes to stop writing, excluding position at bytes[end].\n * @returns {Uint8Array} Passed bytes Uint8Array.\n */\n }, {\n key: \"writeBytes\",\n value: function writeBytes(bytes) {\n var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : bytes.length;\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(bytes instanceof Uint8Array, 'writeBytes must be passed an Uint8Array');\n this.resize(this.position + (end - start));\n for (var i = start; i < end; i++) {\n this.uint8a[this.position + i - start] = bytes[i];\n }\n this.position += end - start;\n return bytes;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/byte-stream.js?");
|
|
191
191
|
|
|
192
192
|
/***/ }),
|
|
193
193
|
|
|
@@ -199,7 +199,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
199
199
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
200
200
|
|
|
201
201
|
"use strict";
|
|
202
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CRC32\", function() { return CRC32; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
202
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CRC32\", function() { return CRC32; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nvar CRC32 = /*#__PURE__*/function () {\n function CRC32() {\n _classCallCheck(this, CRC32);\n this.bit = new Uint32Array(1);\n this.crc = 0;\n this.c = 0;\n this.table = [];\n var c;\n for (var i = 0; i < 256; i++) {\n c = i;\n for (var j = 0; j < 8; j++) {\n c = c & 1 ? 0xedb88320 ^ c >>> 1 : c >>> 1;\n }\n this.table[i] = c >>> 0;\n }\n }\n return _createClass(CRC32, [{\n key: \"update\",\n value: function update(uint8a) {\n var position = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var length = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : uint8a.length;\n var crc = ~this.crc >>> 0;\n for (var i = 0; i < length; i++) {\n crc = crc >>> 8 ^ this.table[(crc ^ uint8a[position + i]) & 0xff];\n }\n this.crc = ~crc >>> 0;\n return this;\n }\n }, {\n key: \"digest\",\n get: function get() {\n return this.crc;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/crc32.js?");
|
|
203
203
|
|
|
204
204
|
/***/ }),
|
|
205
205
|
|
|
@@ -211,7 +211,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
211
211
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
212
212
|
|
|
213
213
|
"use strict";
|
|
214
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DEFLATE_BLOCK_SIZE_MAX\", function() { return DEFLATE_BLOCK_SIZE_MAX; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateHeader\", function() { return DeflateHeader; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateChunkStart\", function() { return DeflateChunkStart; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateEnd\", function() { return DeflateEnd; });\n/* harmony import */ var _byte_packets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
214
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DEFLATE_BLOCK_SIZE_MAX\", function() { return DEFLATE_BLOCK_SIZE_MAX; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateHeader\", function() { return DeflateHeader; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateChunkStart\", function() { return DeflateChunkStart; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateEnd\", function() { return DeflateEnd; });\n/* harmony import */ var _byte_packets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar DEFLATE_BLOCK_SIZE_MAX = 0xffff;\n\nvar DeflateHeader = /*#__PURE__*/function (_Packet$extend) {\n function DeflateHeader() {\n _classCallCheck(this, DeflateHeader);\n return _callSuper(this, DeflateHeader, arguments);\n }\n _inherits(DeflateHeader, _Packet$extend);\n return _createClass(DeflateHeader);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].extend({\n cmf: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint8\"],\n flag: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint8\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].initConstructor(DeflateHeader);\n\nvar DeflateChunkStart = /*#__PURE__*/function (_Packet$extend2) {\n function DeflateChunkStart() {\n _classCallCheck(this, DeflateChunkStart);\n return _callSuper(this, DeflateChunkStart, arguments);\n }\n _inherits(DeflateChunkStart, _Packet$extend2);\n return _createClass(DeflateChunkStart);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].extend({\n lastPacket: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint8\"],\n length: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint16LE\"],\n lengthCheck: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint16LE\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].initConstructor(DeflateChunkStart);\n\nvar DeflateEnd = /*#__PURE__*/function (_Packet$extend3) {\n function DeflateEnd() {\n _classCallCheck(this, DeflateEnd);\n return _callSuper(this, DeflateEnd, arguments);\n }\n _inherits(DeflateEnd, _Packet$extend3);\n return _createClass(DeflateEnd);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].extend({\n checksum: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint32LE\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].initConstructor(DeflateEnd);\n\n\n//# sourceURL=webpack:///./src/coders/deflate-packets.js?");
|
|
215
215
|
|
|
216
216
|
/***/ }),
|
|
217
217
|
|
|
@@ -223,7 +223,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
223
223
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
224
224
|
|
|
225
225
|
"use strict";
|
|
226
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateStream\", function() { return DeflateStream; });\n/* harmony import */ var _adler32__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./adler32 */ \"./src/coders/adler32.js\");\n/* harmony import */ var _deflate_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./deflate-packets */ \"./src/coders/deflate-packets.js\");\n/* harmony import */ var _proxy_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./proxy-stream */ \"./src/coders/proxy-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
226
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeflateStream\", function() { return DeflateStream; });\n/* harmony import */ var _adler32__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./adler32 */ \"./src/coders/adler32.js\");\n/* harmony import */ var _deflate_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./deflate-packets */ \"./src/coders/deflate-packets.js\");\n/* harmony import */ var _proxy_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./proxy-stream */ \"./src/coders/proxy-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\nvar DeflateStream = /*#__PURE__*/function (_ProxyStream) {\n function DeflateStream(stream) {\n var _this;\n _classCallCheck(this, DeflateStream);\n _this = _callSuper(this, DeflateStream, [stream]);\n _this.stream.writeStruct(_deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DeflateHeader\"], {\n cmf: 8,\n flag: 29\n });\n _this.adler = new _adler32__WEBPACK_IMPORTED_MODULE_0__[\"Adler32\"]();\n _this.chunk = _this.stream.writeStruct(_deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DeflateChunkStart\"], {\n lastPacket: 0,\n length: 0,\n lengthCheck: 0 ^ 0xffff\n });\n return _this;\n }\n _inherits(DeflateStream, _ProxyStream);\n return _createClass(DeflateStream, [{\n key: \"_deflateIndex\",\n get: function get() {\n return this.chunk.length;\n },\n set: function set(value) {\n this.chunk.length = value;\n this.chunk.lengthCheck = value ^ 0xffff;\n }\n }, {\n key: \"writeStruct\",\n value: function writeStruct(StructType, data) {\n this.writeBytes(Object.assign(new StructType(), data).uint8a);\n }\n }, {\n key: \"writeBytes\",\n value: function writeBytes(bytes) {\n var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : bytes.length;\n var chunkStart = start;\n while (end - chunkStart > 0) {\n if (this._deflateIndex === _deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DEFLATE_BLOCK_SIZE_MAX\"]) {\n this.chunk = this.stream.writeStruct(_deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DeflateChunkStart\"], {\n lastPacket: 0,\n length: 0,\n lengthCheck: 0 ^ 0xffff\n });\n }\n var chunkLength = Math.min(end - chunkStart, _deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DEFLATE_BLOCK_SIZE_MAX\"] - this._deflateIndex);\n this.stream.writeBytes(bytes, chunkStart, chunkStart + chunkLength);\n this._deflateIndex += chunkLength;\n chunkStart += chunkLength;\n }\n this.adler.update(bytes, start, end - start);\n }\n }, {\n key: \"finish\",\n value: function finish() {\n this.chunk.lastPacket = 1;\n this.stream.writeStruct(_deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DeflateEnd\"], {\n checksum: this.adler.digest\n });\n }\n }], [{\n key: \"estimateSize\",\n value: function estimateSize(bodySize) {\n var packets = Math.ceil(bodySize / _deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DEFLATE_BLOCK_SIZE_MAX\"]);\n return _deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DeflateHeader\"].size + packets * _deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DeflateChunkStart\"].size + _deflate_packets__WEBPACK_IMPORTED_MODULE_1__[\"DeflateEnd\"].size + bodySize;\n }\n }]);\n}(_proxy_stream__WEBPACK_IMPORTED_MODULE_2__[\"ProxyStream\"]);\n\n\n//# sourceURL=webpack:///./src/coders/deflate-stream.js?");
|
|
227
227
|
|
|
228
228
|
/***/ }),
|
|
229
229
|
|
|
@@ -235,7 +235,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
235
235
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
236
236
|
|
|
237
237
|
"use strict";
|
|
238
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGChunkStream\", function() { return PNGChunkStream; });\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _crc32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./crc32 */ \"./src/coders/crc32.js\");\n/* harmony import */ var _png_packets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./png-packets */ \"./src/coders/png-packets.js\");\n/* harmony import */ var _proxy_stream__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proxy-stream */ \"./src/coders/proxy-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
238
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGChunkStream\", function() { return PNGChunkStream; });\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _crc32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./crc32 */ \"./src/coders/crc32.js\");\n/* harmony import */ var _png_packets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./png-packets */ \"./src/coders/png-packets.js\");\n/* harmony import */ var _proxy_stream__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proxy-stream */ \"./src/coders/proxy-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\nvar PNGChunkStream = /*#__PURE__*/function (_ProxyStream) {\n function PNGChunkStream(stream) {\n var _this;\n var chunkType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'IHDR';\n _classCallCheck(this, PNGChunkStream);\n _this = _callSuper(this, PNGChunkStream, [stream]);\n _this.start = _this.stream.writeStruct(_png_packets__WEBPACK_IMPORTED_MODULE_2__[\"PNGChunkStart\"], {\n length: 0,\n chunkType: chunkType\n });\n _this.crc = new _crc32__WEBPACK_IMPORTED_MODULE_1__[\"CRC32\"]();\n return _this;\n }\n _inherits(PNGChunkStream, _ProxyStream);\n return _createClass(PNGChunkStream, [{\n key: \"finish\",\n value: function finish() {\n var crcStart = this.start.offset + this.start.size;\n var length = this.position - crcStart;\n this.start.length = length;\n this.crc.update(this.stream.uint8a, crcStart - _byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"].size, length + _byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"].size);\n this.stream.writeStruct(_png_packets__WEBPACK_IMPORTED_MODULE_2__[\"PNGChunkEnd\"], {\n checksum: this.crc.digest\n });\n }\n }], [{\n key: \"size\",\n value: function size(bodySize) {\n return _png_packets__WEBPACK_IMPORTED_MODULE_2__[\"PNGChunkStart\"].size + bodySize + _png_packets__WEBPACK_IMPORTED_MODULE_2__[\"PNGChunkEnd\"].size;\n }\n }]);\n}(_proxy_stream__WEBPACK_IMPORTED_MODULE_3__[\"ProxyStream\"]);\n\n\n//# sourceURL=webpack:///./src/coders/png-chunk-stream.js?");
|
|
239
239
|
|
|
240
240
|
/***/ }),
|
|
241
241
|
|
|
@@ -247,7 +247,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
247
247
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
248
248
|
|
|
249
249
|
"use strict";
|
|
250
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGFile\", function() { return PNGFile; });\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _png_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./png-packets */ \"./src/coders/png-packets.js\");\n/* harmony import */ var _deflate_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./deflate-stream */ \"./src/coders/deflate-stream.js\");\n/* harmony import */ var _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./png-chunk-stream */ \"./src/coders/png-chunk-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
250
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGFile\", function() { return PNGFile; });\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _png_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./png-packets */ \"./src/coders/png-packets.js\");\n/* harmony import */ var _deflate_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./deflate-stream */ \"./src/coders/deflate-stream.js\");\n/* harmony import */ var _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./png-chunk-stream */ \"./src/coders/png-chunk-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\n\n\nvar PNGFile = /*#__PURE__*/function () {\n function PNGFile() {\n _classCallCheck(this, PNGFile);\n }\n return _createClass(PNGFile, [{\n key: \"encode\",\n value: function encode(width, height, pixelsUint8) {\n var rowSize = width * 4 + _png_packets__WEBPACK_IMPORTED_MODULE_1__[\"PNGFilterMethodByte\"].size;\n var bodySize = rowSize * height;\n var size = _png_packets__WEBPACK_IMPORTED_MODULE_1__[\"PNGSignature\"].size +\n // IHDR\n _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__[\"PNGChunkStream\"].size(_png_packets__WEBPACK_IMPORTED_MODULE_1__[\"PNGIHDRChunkBody\"].size) +\n // IDAT\n _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__[\"PNGChunkStream\"].size(_deflate_stream__WEBPACK_IMPORTED_MODULE_2__[\"DeflateStream\"].estimateSize(bodySize)) +\n // IEND\n _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__[\"PNGChunkStream\"].size(0);\n var stream = new _byte_stream__WEBPACK_IMPORTED_MODULE_0__[\"ByteStream\"](new ArrayBuffer(size));\n stream.writeStruct(_png_packets__WEBPACK_IMPORTED_MODULE_1__[\"PNGSignature\"], {\n support8Bit: 0x89,\n png: 'PNG',\n dosLineEnding: '\\r\\n',\n dosEndOfFile: '\\x1a',\n unixLineEnding: '\\n'\n });\n var pngIhdr = new _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__[\"PNGChunkStream\"](stream, 'IHDR');\n pngIhdr.writeStruct(_png_packets__WEBPACK_IMPORTED_MODULE_1__[\"PNGIHDRChunkBody\"], {\n width: width,\n height: height,\n bitDepth: 8,\n colorType: 6,\n compressionMethod: 0,\n filterMethod: 0,\n interlaceMethod: 0\n });\n pngIhdr.finish();\n var pngIdat = new _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__[\"PNGChunkStream\"](stream, 'IDAT');\n var deflate = new _deflate_stream__WEBPACK_IMPORTED_MODULE_2__[\"DeflateStream\"](pngIdat);\n var pixelsIndex = 0;\n while (pixelsIndex < pixelsUint8.length) {\n deflate.writeStruct(_png_packets__WEBPACK_IMPORTED_MODULE_1__[\"PNGFilterMethodByte\"], {\n method: 0\n });\n var partialLength = Math.min(pixelsUint8.length - pixelsIndex, rowSize - _png_packets__WEBPACK_IMPORTED_MODULE_1__[\"PNGFilterMethodByte\"].size);\n deflate.writeBytes(pixelsUint8, pixelsIndex, pixelsIndex + partialLength);\n pixelsIndex += partialLength;\n }\n deflate.finish();\n pngIdat.finish();\n var pngIend = new _png_chunk_stream__WEBPACK_IMPORTED_MODULE_3__[\"PNGChunkStream\"](stream, 'IEND');\n pngIend.finish();\n return stream.buffer;\n }\n }], [{\n key: \"encode\",\n value: function encode(width, height, pixels) {\n return new PNGFile().encode(width, height, pixels);\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/png-file.js?");
|
|
251
251
|
|
|
252
252
|
/***/ }),
|
|
253
253
|
|
|
@@ -259,7 +259,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
259
259
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
260
260
|
|
|
261
261
|
"use strict";
|
|
262
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGSignature\", function() { return PNGSignature; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGChunkStart\", function() { return PNGChunkStart; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGChunkEnd\", function() { return PNGChunkEnd; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGIHDRChunkBody\", function() { return PNGIHDRChunkBody; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGFilterMethodByte\", function() { return PNGFilterMethodByte; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _byte_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
262
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGSignature\", function() { return PNGSignature; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGChunkStart\", function() { return PNGChunkStart; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGChunkEnd\", function() { return PNGChunkEnd; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGIHDRChunkBody\", function() { return PNGIHDRChunkBody; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PNGFilterMethodByte\", function() { return PNGFilterMethodByte; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _byte_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\nvar PNGSignature = /*#__PURE__*/function (_Packet$extend) {\n function PNGSignature() {\n _classCallCheck(this, PNGSignature);\n return _callSuper(this, PNGSignature, arguments);\n }\n _inherits(PNGSignature, _Packet$extend);\n return _createClass(PNGSignature, null, [{\n key: \"validate\",\n value: function validate() {\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(this.equals({\n support8Bit: 0x89,\n png: 'PNG',\n dosLineEnding: '\\r\\n',\n dosEndOfFile: '\\x1a',\n unixLineEnding: '\\n'\n }), 'PNGSignature does not match the expected values');\n }\n }]);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].extend({\n support8Bit: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"],\n png: new _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](3),\n dosLineEnding: new _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](2),\n dosEndOfFile: new _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](1),\n unixLineEnding: new _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](1)\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].initConstructor(PNGSignature);\n\nvar PNGChunkStart = /*#__PURE__*/function (_Packet$extend2) {\n function PNGChunkStart() {\n _classCallCheck(this, PNGChunkStart);\n return _callSuper(this, PNGChunkStart, arguments);\n }\n _inherits(PNGChunkStart, _Packet$extend2);\n return _createClass(PNGChunkStart);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].extend({\n length: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint32BE\"],\n chunkType: new _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](4)\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].initConstructor(PNGChunkStart);\n\nvar PNGChunkEnd = /*#__PURE__*/function (_Packet$extend3) {\n function PNGChunkEnd() {\n _classCallCheck(this, PNGChunkEnd);\n return _callSuper(this, PNGChunkEnd, arguments);\n }\n _inherits(PNGChunkEnd, _Packet$extend3);\n return _createClass(PNGChunkEnd);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].extend({\n checksum: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint32BE\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].initConstructor(PNGChunkEnd);\n\nvar PNGIHDRChunkBody = /*#__PURE__*/function (_Packet$extend4) {\n function PNGIHDRChunkBody() {\n _classCallCheck(this, PNGIHDRChunkBody);\n return _callSuper(this, PNGIHDRChunkBody, arguments);\n }\n _inherits(PNGIHDRChunkBody, _Packet$extend4);\n return _createClass(PNGIHDRChunkBody);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].extend({\n width: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint32BE\"],\n height: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint32BE\"],\n bitDepth: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"],\n colorType: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"],\n compressionMethod: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"],\n filterMethod: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"],\n interlaceMethod: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].initConstructor(PNGIHDRChunkBody);\n\nvar PNGFilterMethodByte = /*#__PURE__*/function (_Packet$extend5) {\n function PNGFilterMethodByte() {\n _classCallCheck(this, PNGFilterMethodByte);\n return _callSuper(this, PNGFilterMethodByte, arguments);\n }\n _inherits(PNGFilterMethodByte, _Packet$extend5);\n return _createClass(PNGFilterMethodByte);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].extend({\n method: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].initConstructor(PNGFilterMethodByte);\n\n\n//# sourceURL=webpack:///./src/coders/png-packets.js?");
|
|
263
263
|
|
|
264
264
|
/***/ }),
|
|
265
265
|
|
|
@@ -271,7 +271,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
271
271
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
272
272
|
|
|
273
273
|
"use strict";
|
|
274
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ProxyStream\", function() { return ProxyStream; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
274
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ProxyStream\", function() { return ProxyStream; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nvar ProxyStream = /*#__PURE__*/function () {\n function ProxyStream(stream) {\n _classCallCheck(this, ProxyStream);\n this.stream = stream;\n }\n return _createClass(ProxyStream, [{\n key: \"uint8a\",\n get: function get() {\n return this.stream.uint8a;\n },\n set: function set(value) {\n this.stream.uint8a = value;\n }\n }, {\n key: \"position\",\n get: function get() {\n return this.stream.position;\n },\n set: function set(value) {\n this.stream.position = value;\n }\n }, {\n key: \"writeStruct\",\n value: function writeStruct(StructType, data) {\n return this.stream.writeStruct(StructType, data);\n }\n }, {\n key: \"writeBytes\",\n value: function writeBytes(bytes) {\n var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : bytes.length;\n return this.stream.writeBytes(bytes, start, end);\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/proxy-stream.js?");
|
|
275
275
|
|
|
276
276
|
/***/ }),
|
|
277
277
|
|
|
@@ -283,7 +283,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
283
283
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
284
284
|
|
|
285
285
|
"use strict";
|
|
286
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SqueakImage\", function() { return SqueakImage; });\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _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); }\n\n\nvar defaultColorMap = [0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFF808080, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, 0xFFFFFF00, 0xFFFF00FF, 0xFF202020, 0xFF404040, 0xFF606060, 0xFF9F9F9F, 0xFFBFBFBF, 0xFFDFDFDF, 0xFF080808, 0xFF101010, 0xFF181818, 0xFF282828, 0xFF303030, 0xFF383838, 0xFF484848, 0xFF505050, 0xFF585858, 0xFF686868, 0xFF707070, 0xFF787878, 0xFF878787, 0xFF8F8F8F, 0xFF979797, 0xFFA7A7A7, 0xFFAFAFAF, 0xFFB7B7B7, 0xFFC7C7C7, 0xFFCFCFCF, 0xFFD7D7D7, 0xFFE7E7E7, 0xFFEFEFEF, 0xFFF7F7F7, 0xFF000000, 0xFF003300, 0xFF006600, 0xFF009900, 0xFF00CC00, 0xFF00FF00, 0xFF000033, 0xFF003333, 0xFF006633, 0xFF009933, 0xFF00CC33, 0xFF00FF33, 0xFF000066, 0xFF003366, 0xFF006666, 0xFF009966, 0xFF00CC66, 0xFF00FF66, 0xFF000099, 0xFF003399, 0xFF006699, 0xFF009999, 0xFF00CC99, 0xFF00FF99, 0xFF0000CC, 0xFF0033CC, 0xFF0066CC, 0xFF0099CC, 0xFF00CCCC, 0xFF00FFCC, 0xFF0000FF, 0xFF0033FF, 0xFF0066FF, 0xFF0099FF, 0xFF00CCFF, 0xFF00FFFF, 0xFF330000, 0xFF333300, 0xFF336600, 0xFF339900, 0xFF33CC00, 0xFF33FF00, 0xFF330033, 0xFF333333, 0xFF336633, 0xFF339933, 0xFF33CC33, 0xFF33FF33, 0xFF330066, 0xFF333366, 0xFF336666, 0xFF339966, 0xFF33CC66, 0xFF33FF66, 0xFF330099, 0xFF333399, 0xFF336699, 0xFF339999, 0xFF33CC99, 0xFF33FF99, 0xFF3300CC, 0xFF3333CC, 0xFF3366CC, 0xFF3399CC, 0xFF33CCCC, 0xFF33FFCC, 0xFF3300FF, 0xFF3333FF, 0xFF3366FF, 0xFF3399FF, 0xFF33CCFF, 0xFF33FFFF, 0xFF660000, 0xFF663300, 0xFF666600, 0xFF669900, 0xFF66CC00, 0xFF66FF00, 0xFF660033, 0xFF663333, 0xFF666633, 0xFF669933, 0xFF66CC33, 0xFF66FF33, 0xFF660066, 0xFF663366, 0xFF666666, 0xFF669966, 0xFF66CC66, 0xFF66FF66, 0xFF660099, 0xFF663399, 0xFF666699, 0xFF669999, 0xFF66CC99, 0xFF66FF99, 0xFF6600CC, 0xFF6633CC, 0xFF6666CC, 0xFF6699CC, 0xFF66CCCC, 0xFF66FFCC, 0xFF6600FF, 0xFF6633FF, 0xFF6666FF, 0xFF6699FF, 0xFF66CCFF, 0xFF66FFFF, 0xFF990000, 0xFF993300, 0xFF996600, 0xFF999900, 0xFF99CC00, 0xFF99FF00, 0xFF990033, 0xFF993333, 0xFF996633, 0xFF999933, 0xFF99CC33, 0xFF99FF33, 0xFF990066, 0xFF993366, 0xFF996666, 0xFF999966, 0xFF99CC66, 0xFF99FF66, 0xFF990099, 0xFF993399, 0xFF996699, 0xFF999999, 0xFF99CC99, 0xFF99FF99, 0xFF9900CC, 0xFF9933CC, 0xFF9966CC, 0xFF9999CC, 0xFF99CCCC, 0xFF99FFCC, 0xFF9900FF, 0xFF9933FF, 0xFF9966FF, 0xFF9999FF, 0xFF99CCFF, 0xFF99FFFF, 0xFFCC0000, 0xFFCC3300, 0xFFCC6600, 0xFFCC9900, 0xFFCCCC00, 0xFFCCFF00, 0xFFCC0033, 0xFFCC3333, 0xFFCC6633, 0xFFCC9933, 0xFFCCCC33, 0xFFCCFF33, 0xFFCC0066, 0xFFCC3366, 0xFFCC6666, 0xFFCC9966, 0xFFCCCC66, 0xFFCCFF66, 0xFFCC0099, 0xFFCC3399, 0xFFCC6699, 0xFFCC9999, 0xFFCCCC99, 0xFFCCFF99, 0xFFCC00CC, 0xFFCC33CC, 0xFFCC66CC, 0xFFCC99CC, 0xFFCCCCCC, 0xFFCCFFCC, 0xFFCC00FF, 0xFFCC33FF, 0xFFCC66FF, 0xFFCC99FF, 0xFFCCCCFF, 0xFFCCFFFF, 0xFFFF0000, 0xFFFF3300, 0xFFFF6600, 0xFFFF9900, 0xFFFFCC00, 0xFFFFFF00, 0xFFFF0033, 0xFFFF3333, 0xFFFF6633, 0xFFFF9933, 0xFFFFCC33, 0xFFFFFF33, 0xFFFF0066, 0xFFFF3366, 0xFFFF6666, 0xFFFF9966, 0xFFFFCC66, 0xFFFFFF66, 0xFFFF0099, 0xFFFF3399, 0xFFFF6699, 0xFFFF9999, 0xFFFFCC99, 0xFFFFFF99, 0xFFFF00CC, 0xFFFF33CC, 0xFFFF66CC, 0xFFFF99CC, 0xFFFFCCCC, 0xFFFFFFCC, 0xFFFF00FF, 0xFFFF33FF, 0xFFFF66FF, 0xFFFF99FF, 0xFFFFCCFF, 0xFFFFFFFF];\nvar defaultOneBitColorMap = [0xFFFFFFFF, 0xFF000000];\nvar VariableIntBE = new _byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"BytePrimitive\"]({\n sizeOf: function sizeOf(uint8a, position) {\n var count = uint8a[position];\n if (count <= 223) return 1;\n if (count <= 254) return 2;\n return 5;\n },\n read: function read(uint8a, position) {\n var count = uint8a[position];\n if (count <= 223) return count;\n if (count <= 254) return (count - 224) * 256 + uint8a[position + 1];\n return _byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"].read(uint8a, position + 1);\n }\n});\nvar SqueakImage = /*#__PURE__*/function () {\n function SqueakImage() {\n _classCallCheck(this, SqueakImage);\n }\n return _createClass(SqueakImage, [{\n key: \"decode\",\n value: function decode(width, height, depth, bytes, colormap) {\n var pixels = this.decodePixels(bytes, depth === 32);\n if (depth <= 8) {\n if (!colormap) {\n colormap = depth === 1 ? defaultOneBitColorMap : defaultColorMap;\n }\n return this.unpackPixels(pixels, width, height, depth, colormap);\n } else if (depth === 16) {\n return this.raster16To32(pixels, width, height);\n } else if (depth === 32) {\n return pixels;\n }\n throw new Error('Unhandled Squeak Image depth.');\n }\n }, {\n key: \"decodePixels\",\n value: function decodePixels(bytes, withAlpha) {\n var result;\n\n // Already decompressed\n if (Array.isArray(bytes) || bytes instanceof Uint32Array) {\n result = new Uint32Array(bytes);\n if (withAlpha) {\n for (var _i = 0; _i < result.length; _i++) {\n if (result[_i] !== 0) {\n result[_i] = 0xff000000 | result[_i];\n }\n }\n }\n return result;\n }\n var stream = new _byte_stream__WEBPACK_IMPORTED_MODULE_1__[\"ByteStream\"](bytes.buffer, bytes.byteOffset);\n var pixelsOut = stream.read(VariableIntBE);\n result = new Uint32Array(pixelsOut);\n var i = 0;\n while (i < pixelsOut) {\n var runLengthAndCode = stream.read(VariableIntBE);\n var runLength = runLengthAndCode >> 2;\n var code = runLengthAndCode & 3;\n var w = void 0;\n switch (code) {\n case 0:\n i += runLength;\n break;\n case 1:\n w = stream.read(_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n w = w << 24 | w << 16 | w << 8 | w;\n if (withAlpha && w !== 0) {\n w |= 0xff000000;\n }\n for (var j = 0; j < runLength; j++) {\n result[i++] = w;\n }\n break;\n case 2:\n w = stream.read(_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"]);\n if (withAlpha && w !== 0) {\n w |= 0xff000000;\n }\n for (var _j = 0; _j < runLength; _j++) {\n result[i++] = w;\n }\n break;\n case 3:\n for (var _j2 = 0; _j2 < runLength; _j2++) {\n w = stream.read(_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"]);\n if (withAlpha && w !== 0) {\n w |= 0xff000000;\n }\n result[i++] = w;\n }\n }\n }\n return result;\n }\n }, {\n key: \"unpackPixels\",\n value: function unpackPixels(words, width, height, depth, colormap) {\n var result = new Uint32Array(width * height);\n var mask = (1 << depth) - 1;\n var pixelsPerWord = 32 / depth;\n var dst = 0;\n var src = 0;\n for (var y = 0; y < height; y++) {\n var word = void 0;\n var shift = -1;\n for (var x = 0; x < width; x++) {\n if (shift < 0) {\n shift = depth * (pixelsPerWord - 1);\n word = words[src++];\n }\n result[dst++] = colormap[word >> shift & mask];\n shift -= depth;\n }\n }\n return result;\n }\n }, {\n key: \"raster16To32\",\n value: function raster16To32(words, width, height) {\n var result = new Uint32Array(2 * words.length);\n var shift;\n var word;\n var pix;\n var src = 0;\n var dst = 0;\n for (var y = 0; y < height; y++) {\n shift = -1;\n for (var x = 0; x < width; x++) {\n if (shift < 0) {\n shift = 16;\n word = words[src++];\n }\n pix = word >> shift & 0xffff;\n if (pix !== 0) {\n var red = pix >> 7 & 248;\n var green = pix >> 2 & 248;\n var blue = pix << 3 & 248;\n pix = 0xff000000 | red << 16 | green << 8 | blue;\n }\n result[dst++] = pix;\n shift -= 16;\n }\n }\n return result;\n }\n }, {\n key: \"buildCustomColormap\",\n value: function buildCustomColormap(depth, colors, table) {\n var result = new Uint32Array(1 << depth);\n for (var i = 0; i < colors.length; i++) {\n result[i] = table[colors[i].index - 1];\n }\n return result;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/squeak-image.js?");
|
|
286
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SqueakImage\", function() { return SqueakImage; });\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\nvar defaultColorMap = [0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFF808080, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, 0xFFFFFF00, 0xFFFF00FF, 0xFF202020, 0xFF404040, 0xFF606060, 0xFF9F9F9F, 0xFFBFBFBF, 0xFFDFDFDF, 0xFF080808, 0xFF101010, 0xFF181818, 0xFF282828, 0xFF303030, 0xFF383838, 0xFF484848, 0xFF505050, 0xFF585858, 0xFF686868, 0xFF707070, 0xFF787878, 0xFF878787, 0xFF8F8F8F, 0xFF979797, 0xFFA7A7A7, 0xFFAFAFAF, 0xFFB7B7B7, 0xFFC7C7C7, 0xFFCFCFCF, 0xFFD7D7D7, 0xFFE7E7E7, 0xFFEFEFEF, 0xFFF7F7F7, 0xFF000000, 0xFF003300, 0xFF006600, 0xFF009900, 0xFF00CC00, 0xFF00FF00, 0xFF000033, 0xFF003333, 0xFF006633, 0xFF009933, 0xFF00CC33, 0xFF00FF33, 0xFF000066, 0xFF003366, 0xFF006666, 0xFF009966, 0xFF00CC66, 0xFF00FF66, 0xFF000099, 0xFF003399, 0xFF006699, 0xFF009999, 0xFF00CC99, 0xFF00FF99, 0xFF0000CC, 0xFF0033CC, 0xFF0066CC, 0xFF0099CC, 0xFF00CCCC, 0xFF00FFCC, 0xFF0000FF, 0xFF0033FF, 0xFF0066FF, 0xFF0099FF, 0xFF00CCFF, 0xFF00FFFF, 0xFF330000, 0xFF333300, 0xFF336600, 0xFF339900, 0xFF33CC00, 0xFF33FF00, 0xFF330033, 0xFF333333, 0xFF336633, 0xFF339933, 0xFF33CC33, 0xFF33FF33, 0xFF330066, 0xFF333366, 0xFF336666, 0xFF339966, 0xFF33CC66, 0xFF33FF66, 0xFF330099, 0xFF333399, 0xFF336699, 0xFF339999, 0xFF33CC99, 0xFF33FF99, 0xFF3300CC, 0xFF3333CC, 0xFF3366CC, 0xFF3399CC, 0xFF33CCCC, 0xFF33FFCC, 0xFF3300FF, 0xFF3333FF, 0xFF3366FF, 0xFF3399FF, 0xFF33CCFF, 0xFF33FFFF, 0xFF660000, 0xFF663300, 0xFF666600, 0xFF669900, 0xFF66CC00, 0xFF66FF00, 0xFF660033, 0xFF663333, 0xFF666633, 0xFF669933, 0xFF66CC33, 0xFF66FF33, 0xFF660066, 0xFF663366, 0xFF666666, 0xFF669966, 0xFF66CC66, 0xFF66FF66, 0xFF660099, 0xFF663399, 0xFF666699, 0xFF669999, 0xFF66CC99, 0xFF66FF99, 0xFF6600CC, 0xFF6633CC, 0xFF6666CC, 0xFF6699CC, 0xFF66CCCC, 0xFF66FFCC, 0xFF6600FF, 0xFF6633FF, 0xFF6666FF, 0xFF6699FF, 0xFF66CCFF, 0xFF66FFFF, 0xFF990000, 0xFF993300, 0xFF996600, 0xFF999900, 0xFF99CC00, 0xFF99FF00, 0xFF990033, 0xFF993333, 0xFF996633, 0xFF999933, 0xFF99CC33, 0xFF99FF33, 0xFF990066, 0xFF993366, 0xFF996666, 0xFF999966, 0xFF99CC66, 0xFF99FF66, 0xFF990099, 0xFF993399, 0xFF996699, 0xFF999999, 0xFF99CC99, 0xFF99FF99, 0xFF9900CC, 0xFF9933CC, 0xFF9966CC, 0xFF9999CC, 0xFF99CCCC, 0xFF99FFCC, 0xFF9900FF, 0xFF9933FF, 0xFF9966FF, 0xFF9999FF, 0xFF99CCFF, 0xFF99FFFF, 0xFFCC0000, 0xFFCC3300, 0xFFCC6600, 0xFFCC9900, 0xFFCCCC00, 0xFFCCFF00, 0xFFCC0033, 0xFFCC3333, 0xFFCC6633, 0xFFCC9933, 0xFFCCCC33, 0xFFCCFF33, 0xFFCC0066, 0xFFCC3366, 0xFFCC6666, 0xFFCC9966, 0xFFCCCC66, 0xFFCCFF66, 0xFFCC0099, 0xFFCC3399, 0xFFCC6699, 0xFFCC9999, 0xFFCCCC99, 0xFFCCFF99, 0xFFCC00CC, 0xFFCC33CC, 0xFFCC66CC, 0xFFCC99CC, 0xFFCCCCCC, 0xFFCCFFCC, 0xFFCC00FF, 0xFFCC33FF, 0xFFCC66FF, 0xFFCC99FF, 0xFFCCCCFF, 0xFFCCFFFF, 0xFFFF0000, 0xFFFF3300, 0xFFFF6600, 0xFFFF9900, 0xFFFFCC00, 0xFFFFFF00, 0xFFFF0033, 0xFFFF3333, 0xFFFF6633, 0xFFFF9933, 0xFFFFCC33, 0xFFFFFF33, 0xFFFF0066, 0xFFFF3366, 0xFFFF6666, 0xFFFF9966, 0xFFFFCC66, 0xFFFFFF66, 0xFFFF0099, 0xFFFF3399, 0xFFFF6699, 0xFFFF9999, 0xFFFFCC99, 0xFFFFFF99, 0xFFFF00CC, 0xFFFF33CC, 0xFFFF66CC, 0xFFFF99CC, 0xFFFFCCCC, 0xFFFFFFCC, 0xFFFF00FF, 0xFFFF33FF, 0xFFFF66FF, 0xFFFF99FF, 0xFFFFCCFF, 0xFFFFFFFF];\nvar defaultOneBitColorMap = [0xFFFFFFFF, 0xFF000000];\nvar VariableIntBE = new _byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"BytePrimitive\"]({\n sizeOf: function sizeOf(uint8a, position) {\n var count = uint8a[position];\n if (count <= 223) return 1;\n if (count <= 254) return 2;\n return 5;\n },\n read: function read(uint8a, position) {\n var count = uint8a[position];\n if (count <= 223) return count;\n if (count <= 254) return (count - 224) * 256 + uint8a[position + 1];\n return _byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"].read(uint8a, position + 1);\n }\n});\nvar SqueakImage = /*#__PURE__*/function () {\n function SqueakImage() {\n _classCallCheck(this, SqueakImage);\n }\n return _createClass(SqueakImage, [{\n key: \"decode\",\n value: function decode(width, height, depth, bytes, colormap) {\n var pixels = this.decodePixels(bytes, depth === 32);\n if (depth <= 8) {\n if (!colormap) {\n colormap = depth === 1 ? defaultOneBitColorMap : defaultColorMap;\n }\n return this.unpackPixels(pixels, width, height, depth, colormap);\n } else if (depth === 16) {\n return this.raster16To32(pixels, width, height);\n } else if (depth === 32) {\n return pixels;\n }\n throw new Error('Unhandled Squeak Image depth.');\n }\n }, {\n key: \"decodePixels\",\n value: function decodePixels(bytes, withAlpha) {\n var result;\n\n // Already decompressed\n if (Array.isArray(bytes) || bytes instanceof Uint32Array) {\n result = new Uint32Array(bytes);\n if (withAlpha) {\n for (var _i = 0; _i < result.length; _i++) {\n if (result[_i] !== 0) {\n result[_i] = 0xff000000 | result[_i];\n }\n }\n }\n return result;\n }\n var stream = new _byte_stream__WEBPACK_IMPORTED_MODULE_1__[\"ByteStream\"](bytes.buffer, bytes.byteOffset);\n var pixelsOut = stream.read(VariableIntBE);\n result = new Uint32Array(pixelsOut);\n var i = 0;\n while (i < pixelsOut) {\n var runLengthAndCode = stream.read(VariableIntBE);\n var runLength = runLengthAndCode >> 2;\n var code = runLengthAndCode & 3;\n var w = void 0;\n switch (code) {\n case 0:\n i += runLength;\n break;\n case 1:\n w = stream.read(_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n w = w << 24 | w << 16 | w << 8 | w;\n if (withAlpha && w !== 0) {\n w |= 0xff000000;\n }\n for (var j = 0; j < runLength; j++) {\n result[i++] = w;\n }\n break;\n case 2:\n w = stream.read(_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"]);\n if (withAlpha && w !== 0) {\n w |= 0xff000000;\n }\n for (var _j = 0; _j < runLength; _j++) {\n result[i++] = w;\n }\n break;\n case 3:\n for (var _j2 = 0; _j2 < runLength; _j2++) {\n w = stream.read(_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint32BE\"]);\n if (withAlpha && w !== 0) {\n w |= 0xff000000;\n }\n result[i++] = w;\n }\n }\n }\n return result;\n }\n }, {\n key: \"unpackPixels\",\n value: function unpackPixels(words, width, height, depth, colormap) {\n var result = new Uint32Array(width * height);\n var mask = (1 << depth) - 1;\n var pixelsPerWord = 32 / depth;\n var dst = 0;\n var src = 0;\n for (var y = 0; y < height; y++) {\n var word = void 0;\n var shift = -1;\n for (var x = 0; x < width; x++) {\n if (shift < 0) {\n shift = depth * (pixelsPerWord - 1);\n word = words[src++];\n }\n result[dst++] = colormap[word >> shift & mask];\n shift -= depth;\n }\n }\n return result;\n }\n }, {\n key: \"raster16To32\",\n value: function raster16To32(words, width, height) {\n var result = new Uint32Array(2 * words.length);\n var shift;\n var word;\n var pix;\n var src = 0;\n var dst = 0;\n for (var y = 0; y < height; y++) {\n shift = -1;\n for (var x = 0; x < width; x++) {\n if (shift < 0) {\n shift = 16;\n word = words[src++];\n }\n pix = word >> shift & 0xffff;\n if (pix !== 0) {\n var red = pix >> 7 & 248;\n var green = pix >> 2 & 248;\n var blue = pix << 3 & 248;\n pix = 0xff000000 | red << 16 | green << 8 | blue;\n }\n result[dst++] = pix;\n shift -= 16;\n }\n }\n return result;\n }\n }, {\n key: \"buildCustomColormap\",\n value: function buildCustomColormap(depth, colors, table) {\n var result = new Uint32Array(1 << depth);\n for (var i = 0; i < colors.length; i++) {\n result[i] = table[colors[i].index - 1];\n }\n return result;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/squeak-image.js?");
|
|
287
287
|
|
|
288
288
|
/***/ }),
|
|
289
289
|
|
|
@@ -295,7 +295,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
295
295
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
296
296
|
|
|
297
297
|
"use strict";
|
|
298
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SqueakSound\", function() { return SqueakSound; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
298
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SqueakSound\", function() { return SqueakSound; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\n\nvar SQUEAK_SOUND_STEP_SIZE_TABLE = [7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767];\nvar SQUEAK_SOUND_INDEX_TABLES = {\n 2: [-1, 2, -1, 2],\n 3: [-1, -1, 2, 4, -1, -1, 2, 4],\n 4: [-1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8],\n 5: [-1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16]\n};\nvar SqueakSound = /*#__PURE__*/function () {\n function SqueakSound(bitsPerSample) {\n _classCallCheck(this, SqueakSound);\n this.bitsPerSample = bitsPerSample;\n this.indexTable = SQUEAK_SOUND_INDEX_TABLES[bitsPerSample];\n this.signMask = 1 << bitsPerSample - 1;\n this.valueMask = this.signMask - 1;\n this.valueHighBit = this.signMask >> 1;\n this.bitPosition = 0;\n this.currentByte = 0;\n this.stream = null;\n this.end = 0;\n }\n return _createClass(SqueakSound, [{\n key: \"decode\",\n value: function decode(data) {\n // Reset position information.\n this.bitPosition = 0;\n this.currentByte = 0;\n this.stream = new _byte_stream__WEBPACK_IMPORTED_MODULE_2__[\"ByteStream\"](data.buffer, data.byteOffset);\n this.end = data.byteOffset + data.length;\n var size = Math.floor(data.length * 8 / this.bitsPerSample);\n var result = new Int16Array(size);\n var sample = 0;\n var index = 0;\n for (var i = 0; i < size; i++) {\n var code = this.nextCode();\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(code >= 0, 'Ran out of bits in Squeak Sound');\n var step = SQUEAK_SOUND_STEP_SIZE_TABLE[index];\n var delta = 0;\n for (var bit = this.valueHighBit; bit > 0; bit = bit >> 1) {\n if ((code & bit) !== 0) {\n delta += step;\n }\n step = step >> 1;\n }\n delta += step;\n sample += (code & this.signMask) === 0 ? delta : -delta;\n index += this.indexTable[code];\n if (index < 0) index = 0;\n if (index > 88) index = 88;\n if (sample > 32767) sample = 32767;\n if (sample < -32768) sample = -32768;\n result[i] = sample;\n }\n return result;\n }\n }, {\n key: \"nextCode\",\n value: function nextCode() {\n var remaining = this.bitsPerSample;\n var shift = remaining - this.bitPosition;\n var result = shift < 0 ? this.currentByte >> -shift : this.currentByte << shift;\n while (shift > 0) {\n remaining -= this.bitPosition;\n if (this.end - this.stream.position > 0) {\n this.currentByte = this.stream.read(_byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint8\"]);\n this.bitPosition = 8;\n } else {\n this.currentByte = 0;\n this.bitPosition = 0;\n return -1;\n }\n shift = remaining - this.bitPosition;\n result += shift < 0 ? this.currentByte >> -shift : this.currentByte << shift;\n }\n this.bitPosition -= remaining;\n this.currentByte = this.currentByte & 0xff >> 8 - this.bitPosition;\n return result;\n }\n }], [{\n key: \"samples\",\n value: function samples(bitsPerSample, data) {\n return data.length * 8 / bitsPerSample;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/squeak-sound.js?");
|
|
299
299
|
|
|
300
300
|
/***/ }),
|
|
301
301
|
|
|
@@ -307,7 +307,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
307
307
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
308
308
|
|
|
309
309
|
"use strict";
|
|
310
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVFile\", function() { return WAVFile; });\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _wav_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wav-packets */ \"./src/coders/wav-packets.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
310
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVFile\", function() { return WAVFile; });\n/* harmony import */ var _byte_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _wav_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wav-packets */ \"./src/coders/wav-packets.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\nvar WAVFile = /*#__PURE__*/function () {\n function WAVFile() {\n _classCallCheck(this, WAVFile);\n }\n return _createClass(WAVFile, [{\n key: \"encode\",\n value: function encode(intSamples) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$channels = _ref.channels,\n channels = _ref$channels === void 0 ? 1 : _ref$channels,\n _ref$sampleRate = _ref.sampleRate,\n sampleRate = _ref$sampleRate === void 0 ? 22050 : _ref$sampleRate;\n var samplesUint8 = new Uint8Array(intSamples.buffer, intSamples.byteOffset, intSamples.byteLength);\n var size = _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVESignature\"].size + _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"].size + _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEFMTChunkBody\"].size + _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"].size + samplesUint8.length;\n var stream = new _byte_stream__WEBPACK_IMPORTED_MODULE_0__[\"ByteStream\"](new ArrayBuffer(size));\n stream.writeStruct(_wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVESignature\"], {\n riff: 'RIFF',\n length: size - 8,\n wave: 'WAVE'\n });\n stream.writeStruct(_wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"], {\n chunkType: 'fmt ',\n length: _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEFMTChunkBody\"].size\n });\n stream.writeStruct(_wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEFMTChunkBody\"], {\n format: 1,\n channels: channels,\n sampleRate: sampleRate,\n bytesPerSec: sampleRate * 2 * channels,\n blockAlignment: channels * 2,\n bitsPerSample: 16\n });\n stream.writeStruct(_wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"], {\n chunkType: 'data',\n length: size - stream.position - _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"].size\n });\n stream.writeBytes(samplesUint8);\n return stream.uint8a;\n }\n }], [{\n key: \"encode\",\n value: function encode(intSamples, options) {\n return new WAVFile().encode(intSamples, options);\n }\n }, {\n key: \"samples\",\n value: function samples(bytes) {\n var headerLength = new _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"](bytes, _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVESignature\"].size).length;\n var bodyLength = new _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"](bytes, _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVESignature\"].size + _wav_packets__WEBPACK_IMPORTED_MODULE_1__[\"WAVEChunkStart\"].size + headerLength).length;\n return bodyLength / 2;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/coders/wav-file.js?");
|
|
311
311
|
|
|
312
312
|
/***/ }),
|
|
313
313
|
|
|
@@ -319,7 +319,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
319
319
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
320
320
|
|
|
321
321
|
"use strict";
|
|
322
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVESignature\", function() { return WAVESignature; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVEChunkStart\", function() { return WAVEChunkStart; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVEFMTChunkBody\", function() { return WAVEFMTChunkBody; });\n/* harmony import */ var _byte_packets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
322
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVESignature\", function() { return WAVESignature; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVEChunkStart\", function() { return WAVEChunkStart; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WAVEFMTChunkBody\", function() { return WAVEFMTChunkBody; });\n/* harmony import */ var _byte_packets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar WAVESignature = /*#__PURE__*/function (_Packet$extend) {\n function WAVESignature() {\n _classCallCheck(this, WAVESignature);\n return _callSuper(this, WAVESignature, arguments);\n }\n _inherits(WAVESignature, _Packet$extend);\n return _createClass(WAVESignature);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].extend({\n riff: new _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"FixedAsciiString\"](4),\n length: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint32LE\"],\n wave: new _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"FixedAsciiString\"](4)\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].initConstructor(WAVESignature);\n\nvar WAVEChunkStart = /*#__PURE__*/function (_Packet$extend2) {\n function WAVEChunkStart() {\n _classCallCheck(this, WAVEChunkStart);\n return _callSuper(this, WAVEChunkStart, arguments);\n }\n _inherits(WAVEChunkStart, _Packet$extend2);\n return _createClass(WAVEChunkStart);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].extend({\n chunkType: new _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"FixedAsciiString\"](4),\n length: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint32LE\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].initConstructor(WAVEChunkStart);\n\nvar WAVEFMTChunkBody = /*#__PURE__*/function (_Packet$extend3) {\n function WAVEFMTChunkBody() {\n _classCallCheck(this, WAVEFMTChunkBody);\n return _callSuper(this, WAVEFMTChunkBody, arguments);\n }\n _inherits(WAVEFMTChunkBody, _Packet$extend3);\n return _createClass(WAVEFMTChunkBody);\n}(_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].extend({\n format: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint16LE\"],\n channels: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint16LE\"],\n sampleRate: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint32LE\"],\n bytesPerSec: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint32LE\"],\n blockAlignment: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint16LE\"],\n bitsPerSample: _byte_primitives__WEBPACK_IMPORTED_MODULE_1__[\"Uint16LE\"]\n}));\n_byte_packets__WEBPACK_IMPORTED_MODULE_0__[\"Packet\"].initConstructor(WAVEFMTChunkBody);\n\n\n//# sourceURL=webpack:///./src/coders/wav-packets.js?");
|
|
323
323
|
|
|
324
324
|
/***/ }),
|
|
325
325
|
|
|
@@ -331,7 +331,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
331
331
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
332
332
|
|
|
333
333
|
"use strict";
|
|
334
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SB1Signature\", function() { return SB1Signature; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SB1Header\", function() { return SB1Header; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _coders_byte_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coders/byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./coders/byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
334
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SB1Signature\", function() { return SB1Signature; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SB1Header\", function() { return SB1Header; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _coders_byte_packets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coders/byte-packets */ \"./src/coders/byte-packets.js\");\n/* harmony import */ var _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./coders/byte-primitives */ \"./src/coders/byte-primitives.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n/**\n * @augments Packet\n */\nvar SB1Signature = /*#__PURE__*/function (_Packet$extend) {\n function SB1Signature() {\n _classCallCheck(this, SB1Signature);\n return _callSuper(this, SB1Signature, arguments);\n }\n _inherits(SB1Signature, _Packet$extend);\n return _createClass(SB1Signature, [{\n key: \"validate\",\n value:\n /**\n * Is this a valid SB1Signature?\n * @method\n * @throws {AssertionError} Throws if it is not valid.\n */\n function validate() {\n _util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"].validate(this.equals({\n version: 'ScratchV01'\n }) || this.equals({\n version: 'ScratchV02'\n }), 'Invalid Scratch file signature.');\n }\n }]);\n}(_coders_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].extend({\n /**\n * 10 byte ascii string equaling `'ScratchV01'` or `'ScratchV02'`.\n * @type {string}\n * @memberof SB1Signature#\n */\n version: new _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](10),\n /**\n * Number of bytes in the info block.\n * @type {number}\n * @memberof SB1Signature#\n */\n infoByteLength: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint32BE\"]\n}));\n_coders_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].initConstructor(SB1Signature);\nvar SB1Header = /*#__PURE__*/function (_Packet$extend2) {\n function SB1Header() {\n _classCallCheck(this, SB1Header);\n return _callSuper(this, SB1Header, arguments);\n }\n _inherits(SB1Header, _Packet$extend2);\n return _createClass(SB1Header, [{\n key: \"validate\",\n value: function validate() {\n _util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"].validate(this.equals({\n ObjS: 'ObjS',\n ObjSValue: 1,\n Stch: 'Stch',\n StchValue: 1\n }), 'Invalid Scratch file info packet header.');\n }\n }]);\n}(_coders_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].extend({\n ObjS: new _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](4),\n ObjSValue: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"],\n Stch: new _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"FixedAsciiString\"](4),\n StchValue: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint8\"],\n numObjects: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Uint32BE\"]\n}));\n_coders_byte_packets__WEBPACK_IMPORTED_MODULE_1__[\"Packet\"].initConstructor(SB1Header);\n\n\n//# sourceURL=webpack:///./src/sb1-file-packets.js?");
|
|
335
335
|
|
|
336
336
|
/***/ }),
|
|
337
337
|
|
|
@@ -343,7 +343,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
343
343
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
344
344
|
|
|
345
345
|
"use strict";
|
|
346
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SB1File\", function() { return SB1File; });\n/* harmony import */ var _coders_byte_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./coders/byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _squeak_byte_take_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./squeak/byte-take-iterator */ \"./src/squeak/byte-take-iterator.js\");\n/* harmony import */ var _squeak_field_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./squeak/field-iterator */ \"./src/squeak/field-iterator.js\");\n/* harmony import */ var _squeak_type_iterator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./squeak/type-iterator */ \"./src/squeak/type-iterator.js\");\n/* harmony import */ var _squeak_reference_fixer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./squeak/reference-fixer */ \"./src/squeak/reference-fixer.js\");\n/* harmony import */ var _squeak_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./squeak/types */ \"./src/squeak/types.js\");\n/* harmony import */ var _to_sb2_fake_zip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./to-sb2/fake-zip */ \"./src/to-sb2/fake-zip.js\");\n/* harmony import */ var _to_sb2_json_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./to-sb2/json-generator */ \"./src/to-sb2/json-generator.js\");\n/* harmony import */ var _sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sb1-file-packets */ \"./src/sb1-file-packets.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
346
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SB1File\", function() { return SB1File; });\n/* harmony import */ var _coders_byte_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./coders/byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _squeak_byte_take_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./squeak/byte-take-iterator */ \"./src/squeak/byte-take-iterator.js\");\n/* harmony import */ var _squeak_field_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./squeak/field-iterator */ \"./src/squeak/field-iterator.js\");\n/* harmony import */ var _squeak_type_iterator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./squeak/type-iterator */ \"./src/squeak/type-iterator.js\");\n/* harmony import */ var _squeak_reference_fixer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./squeak/reference-fixer */ \"./src/squeak/reference-fixer.js\");\n/* harmony import */ var _squeak_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./squeak/types */ \"./src/squeak/types.js\");\n/* harmony import */ var _to_sb2_fake_zip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./to-sb2/fake-zip */ \"./src/to-sb2/fake-zip.js\");\n/* harmony import */ var _to_sb2_json_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./to-sb2/json-generator */ \"./src/to-sb2/json-generator.js\");\n/* harmony import */ var _sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sb1-file-packets */ \"./src/sb1-file-packets.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\n\n\n\n\n\n\n\nvar SB1File = /*#__PURE__*/function () {\n function SB1File(buffer) {\n _classCallCheck(this, SB1File);\n this.buffer = buffer;\n this.stream = new _coders_byte_stream__WEBPACK_IMPORTED_MODULE_0__[\"ByteStream\"](buffer);\n this.signature = this.stream.readStruct(_sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__[\"SB1Signature\"]);\n this.signature.validate();\n this.infoHeader = this.stream.readStruct(_sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__[\"SB1Header\"]);\n this.infoHeader.validate();\n this.stream.position += this.signature.infoByteLength - _sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__[\"SB1Header\"].size;\n this.dataHeader = this.stream.readStruct(_sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__[\"SB1Header\"]);\n this.dataHeader.validate();\n }\n return _createClass(SB1File, [{\n key: \"json\",\n get: function get() {\n return Object(_to_sb2_json_generator__WEBPACK_IMPORTED_MODULE_7__[\"toSb2Json\"])({\n info: this.info(),\n stageData: this.data(),\n images: this.images(),\n sounds: this.sounds()\n });\n }\n }, {\n key: \"zip\",\n get: function get() {\n return Object(_to_sb2_fake_zip__WEBPACK_IMPORTED_MODULE_6__[\"toSb2FakeZipApi\"])({\n // Use of this `zip` getter assumes that `json` will be used to\n // fetch the json and not have it read from the produced \"fake\" zip.\n images: this.images(),\n sounds: this.sounds()\n });\n }\n }, {\n key: \"view\",\n value: function view() {\n return {\n signature: this.signature,\n infoHeader: this.infoHeader,\n dataHeader: this.dataHeader,\n toString: function toString() {\n return 'SB1File';\n }\n };\n }\n }, {\n key: \"infoRaw\",\n value: function infoRaw() {\n return new _squeak_byte_take_iterator__WEBPACK_IMPORTED_MODULE_1__[\"ByteTakeIterator\"](new _squeak_field_iterator__WEBPACK_IMPORTED_MODULE_2__[\"FieldIterator\"](this.buffer, this.infoHeader.offset + _sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__[\"SB1Header\"].size), this.signature.infoByteLength + _sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__[\"SB1Signature\"].size);\n }\n }, {\n key: \"infoTable\",\n value: function infoTable() {\n return new _squeak_type_iterator__WEBPACK_IMPORTED_MODULE_3__[\"TypeIterator\"](this.infoRaw());\n }\n }, {\n key: \"info\",\n value: function info() {\n if (!this._info) {\n this._info = new _squeak_reference_fixer__WEBPACK_IMPORTED_MODULE_4__[\"ReferenceFixer\"](this.infoTable()).table[0];\n }\n return this._info;\n }\n }, {\n key: \"dataRaw\",\n value: function dataRaw() {\n return new _squeak_byte_take_iterator__WEBPACK_IMPORTED_MODULE_1__[\"ByteTakeIterator\"](new _squeak_field_iterator__WEBPACK_IMPORTED_MODULE_2__[\"FieldIterator\"](this.buffer, this.dataHeader.offset + _sb1_file_packets__WEBPACK_IMPORTED_MODULE_8__[\"SB1Header\"].size), this.stream.uint8a.length);\n }\n }, {\n key: \"dataTable\",\n value: function dataTable() {\n return new _squeak_type_iterator__WEBPACK_IMPORTED_MODULE_3__[\"TypeIterator\"](this.dataRaw());\n }\n }, {\n key: \"dataFixed\",\n value: function dataFixed() {\n if (!this._data) {\n this._data = new _squeak_reference_fixer__WEBPACK_IMPORTED_MODULE_4__[\"ReferenceFixer\"](this.dataTable()).table;\n }\n return this._data;\n }\n }, {\n key: \"data\",\n value: function data() {\n return this.dataFixed()[0];\n }\n }, {\n key: \"images\",\n value: function images() {\n var unique = new Set();\n return this.dataFixed().filter(function (obj) {\n if (obj instanceof _squeak_types__WEBPACK_IMPORTED_MODULE_5__[\"ImageMediaData\"]) {\n if (unique.has(obj.crc)) return false;\n unique.add(obj.crc);\n return true;\n }\n return false;\n });\n }\n }, {\n key: \"sounds\",\n value: function sounds() {\n var unique = new Set();\n return this.dataFixed().filter(function (obj) {\n if (obj instanceof _squeak_types__WEBPACK_IMPORTED_MODULE_5__[\"SoundMediaData\"]) {\n if (unique.has(obj.crc)) return false;\n unique.add(obj.crc);\n return true;\n }\n return false;\n });\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/sb1-file.js?");
|
|
347
347
|
|
|
348
348
|
/***/ }),
|
|
349
349
|
|
|
@@ -367,7 +367,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
367
367
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
368
368
|
|
|
369
369
|
"use strict";
|
|
370
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ByteTakeIterator\", function() { return ByteTakeIterator; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
370
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ByteTakeIterator\", function() { return ByteTakeIterator; });\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n/**\n * An iterator that only takes bytes up to a certain position.\n *\n * Take iterators constrain the number of times an inner iterator can return\n * values. Normally it constrains the number of returned values.\n * ByteTakeIterator instead constrains the number of bytes the inner iterator\n * may take from its stream before ByteTakeIterator returns done objects.\n *\n * Primarily used to wrap {@link FieldIterator}.\n */\nvar ByteTakeIterator = /*#__PURE__*/function () {\n /**\n * @param {{stream: ByteStream}} iter - Iterator with `stream` member.\n * @param {number} [maxPosition=Infinity] - Position `stream` may not go\n * beyond when yielding the next value.\n */\n function ByteTakeIterator(iter) {\n var maxPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;\n _classCallCheck(this, ByteTakeIterator);\n this.iter = iter;\n this.maxPosition = maxPosition;\n }\n\n /**\n * @returns {ByteTakeIterator} - Returns itself.\n */\n return _createClass(ByteTakeIterator, [{\n key: Symbol.iterator,\n value: function value() {\n return this;\n }\n\n /**\n * @returns {{value: *, done: boolean}} - Return the next value or indicate\n * the Iterator has reached its end.\n */\n }, {\n key: \"next\",\n value: function next() {\n if (this.iter.stream.position >= this.maxPosition) {\n return {\n value: null,\n done: true\n };\n }\n return this.iter.next();\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/squeak/byte-take-iterator.js?");
|
|
371
371
|
|
|
372
372
|
/***/ }),
|
|
373
373
|
|
|
@@ -379,7 +379,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
379
379
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
380
380
|
|
|
381
381
|
"use strict";
|
|
382
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FieldIterator\", function() { return FieldIterator; });\n/* harmony import */ var _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coders/byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _coders_byte_stream__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coders/byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./byte-primitives */ \"./src/squeak/byte-primitives.js\");\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\nvar _CONSUMER_PROTOS;\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _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); }\n\n\n\n\n\n\n/**\n * Consume values for the byte stream with a iterator-like interface.\n */\nvar Consumer = /*#__PURE__*/function () {\n /**\n * @param {object} options - Define the consumer.\n * @param {function} [options.type=Value] - The {@link Field} type to\n * create.\n * @param {BytePrimitive} options.read - How to read the third Field\n * argument. The third field argument is the value the field represented in\n * the `.sb` file. It is either the Value's value, the Reference's index,\n * or the Header's field size.\n * @param {function} [options.value] - How to produce the third Field\n * argument from a stream. Defaults to `stream =>\n * stream.read(options.read)`.\n */\n function Consumer(_ref) {\n var _ref$type = _ref.type,\n type = _ref$type === void 0 ? _fields__WEBPACK_IMPORTED_MODULE_3__[\"Value\"] : _ref$type,\n read = _ref.read,\n _ref$value = _ref.value,\n value = _ref$value === void 0 ? read ? function (stream) {\n return stream.read(read);\n } : null : _ref$value;\n _classCallCheck(this, Consumer);\n this.type = type;\n this.value = value;\n }\n\n /**\n * @param {ByteStream} stream - Stream to read from.\n * @param {TYPES} classId - FieldObject TYPES identifying the value to read.\n * @param {number} position - Position in the stream the classId was read\n * from.\n * @returns {{value: *, done: boolean}} - An iterator.next() return value.\n */\n return _createClass(Consumer, [{\n key: \"next\",\n value: function next(stream, classId, position) {\n return {\n value: new this.type(classId, position, this.value(stream)),\n done: false\n };\n }\n }]);\n}();\n/**\n * @const CONSUMER_PROTOS\n * @type {Object.<number, {type, read, value}>}\n */\nvar CONSUMER_PROTOS = (_CONSUMER_PROTOS = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_CONSUMER_PROTOS, _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].NULL, {\n value: function value() {\n return null;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].TRUE, {\n value: function value() {\n return true;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].FALSE, {\n value: function value() {\n return false;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SMALL_INT, {\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SMALL_INT_16, {\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int16BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].LARGE_INT_POSITIVE, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"LargeInt\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].LARGE_INT_NEGATIVE, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"LargeInt\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].FLOATING, {\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"DoubleBE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].STRING, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"AsciiString\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SYMBOL, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"AsciiString\"]\n}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_CONSUMER_PROTOS, _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].BYTES, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Bytes\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SOUND, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"SoundBytes\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].BITMAP, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Bitmap32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].UTF8, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"UTF8\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].ARRAY, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].ORDERED_COLLECTION, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SET, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].IDENTITY_SET, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].DICTIONARY, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value(stream) {\n return stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]) * 2;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].IDENTITY_DICTIONARY, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value(stream) {\n return stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]) * 2;\n }\n}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_CONSUMER_PROTOS, _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].COLOR, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"OpaqueColor\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].TRANSLUCENT_COLOR, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"TranslucentColor\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].POINT, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 2;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].RECTANGLE, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 4;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].FORM, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 5;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SQUEAK, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 6;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].OBJECT_REF, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Reference\"],\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"ReferenceBE\"]\n}));\n\n/**\n * @const CONSUMERS\n * @type {Array.<Consumer|null>}\n */\nvar CONSUMERS = Array.from({\n length: 256\n}, function (_, i) {\n if (CONSUMER_PROTOS[i]) return new Consumer(CONSUMER_PROTOS[i]);\n return null;\n});\nvar builtinConsumer = new Consumer({\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"BuiltinObjectHeader\"],\n value: function value() {\n return null;\n }\n});\n\n/**\n * Field iterator.\n */\nvar FieldIterator = /*#__PURE__*/function () {\n /**\n * @param {ArrayBuffer} buffer - Buffer to read from.\n * @param {number} position - Position in buffer to start at.\n */\n function FieldIterator(buffer, position) {\n _classCallCheck(this, FieldIterator);\n this.buffer = buffer;\n this.stream = new _coders_byte_stream__WEBPACK_IMPORTED_MODULE_1__[\"ByteStream\"](buffer, position);\n }\n\n /**\n * @returns {FieldIterator} - Returns this.\n */\n return _createClass(FieldIterator, [{\n key: Symbol.iterator,\n value: function value() {\n return this;\n }\n\n /**\n * @returns {{value: *, done: boolean}} - An iterator.next() value.\n */\n }, {\n key: \"next\",\n value: function next() {\n if (this.stream.position >= this.stream.uint8a.length) {\n return {\n value: null,\n done: true\n };\n }\n var position = this.stream.position;\n var classId = this.stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n var consumer = CONSUMERS[classId];\n if (consumer !== null) {\n return consumer.next(this.stream, classId, position);\n } else if (classId < _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].OBJECT_REF) {\n // TODO: Does this ever happen?\n return builtinConsumer.next(this.stream, classId, position);\n }\n var classVersion = this.stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n var size = this.stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n return {\n value: new _fields__WEBPACK_IMPORTED_MODULE_3__[\"FieldObjectHeader\"](classId, position, classVersion, size),\n done: false\n };\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/squeak/field-iterator.js?");
|
|
382
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FieldIterator\", function() { return FieldIterator; });\n/* harmony import */ var _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coders/byte-primitives */ \"./src/coders/byte-primitives.js\");\n/* harmony import */ var _coders_byte_stream__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coders/byte-stream */ \"./src/coders/byte-stream.js\");\n/* harmony import */ var _byte_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./byte-primitives */ \"./src/squeak/byte-primitives.js\");\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\nvar _CONSUMER_PROTOS;\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\n\n\n\n\n/**\n * Consume values for the byte stream with a iterator-like interface.\n */\nvar Consumer = /*#__PURE__*/function () {\n /**\n * @param {object} options - Define the consumer.\n * @param {function} [options.type=Value] - The {@link Field} type to\n * create.\n * @param {BytePrimitive} options.read - How to read the third Field\n * argument. The third field argument is the value the field represented in\n * the `.sb` file. It is either the Value's value, the Reference's index,\n * or the Header's field size.\n * @param {function} [options.value] - How to produce the third Field\n * argument from a stream. Defaults to `stream =>\n * stream.read(options.read)`.\n */\n function Consumer(_ref) {\n var _ref$type = _ref.type,\n type = _ref$type === void 0 ? _fields__WEBPACK_IMPORTED_MODULE_3__[\"Value\"] : _ref$type,\n read = _ref.read,\n _ref$value = _ref.value,\n value = _ref$value === void 0 ? read ? function (stream) {\n return stream.read(read);\n } : null : _ref$value;\n _classCallCheck(this, Consumer);\n this.type = type;\n this.value = value;\n }\n\n /**\n * @param {ByteStream} stream - Stream to read from.\n * @param {TYPES} classId - FieldObject TYPES identifying the value to read.\n * @param {number} position - Position in the stream the classId was read\n * from.\n * @returns {{value: *, done: boolean}} - An iterator.next() return value.\n */\n return _createClass(Consumer, [{\n key: \"next\",\n value: function next(stream, classId, position) {\n return {\n value: new this.type(classId, position, this.value(stream)),\n done: false\n };\n }\n }]);\n}();\n/**\n * @const CONSUMER_PROTOS\n * @type {Object.<number, {type, read, value}>}\n */\nvar CONSUMER_PROTOS = (_CONSUMER_PROTOS = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_CONSUMER_PROTOS, _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].NULL, {\n value: function value() {\n return null;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].TRUE, {\n value: function value() {\n return true;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].FALSE, {\n value: function value() {\n return false;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SMALL_INT, {\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SMALL_INT_16, {\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int16BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].LARGE_INT_POSITIVE, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"LargeInt\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].LARGE_INT_NEGATIVE, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"LargeInt\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].FLOATING, {\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"DoubleBE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].STRING, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"AsciiString\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SYMBOL, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"AsciiString\"]\n}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_CONSUMER_PROTOS, _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].BYTES, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Bytes\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SOUND, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"SoundBytes\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].BITMAP, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"Bitmap32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].UTF8, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"UTF8\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].ARRAY, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].ORDERED_COLLECTION, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SET, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].IDENTITY_SET, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n read: _coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].DICTIONARY, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value(stream) {\n return stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]) * 2;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].IDENTITY_DICTIONARY, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value(stream) {\n return stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Int32BE\"]) * 2;\n }\n}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_CONSUMER_PROTOS, _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].COLOR, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"OpaqueColor\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].TRANSLUCENT_COLOR, {\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"TranslucentColor\"]\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].POINT, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 2;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].RECTANGLE, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 4;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].FORM, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 5;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].SQUEAK, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Header\"],\n value: function value() {\n return 6;\n }\n}), _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].OBJECT_REF, {\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"Reference\"],\n read: _byte_primitives__WEBPACK_IMPORTED_MODULE_2__[\"ReferenceBE\"]\n}));\n\n/**\n * @const CONSUMERS\n * @type {Array.<Consumer|null>}\n */\nvar CONSUMERS = Array.from({\n length: 256\n}, function (_, i) {\n if (CONSUMER_PROTOS[i]) return new Consumer(CONSUMER_PROTOS[i]);\n return null;\n});\nvar builtinConsumer = new Consumer({\n type: _fields__WEBPACK_IMPORTED_MODULE_3__[\"BuiltinObjectHeader\"],\n value: function value() {\n return null;\n }\n});\n\n/**\n * Field iterator.\n */\nvar FieldIterator = /*#__PURE__*/function () {\n /**\n * @param {ArrayBuffer} buffer - Buffer to read from.\n * @param {number} position - Position in buffer to start at.\n */\n function FieldIterator(buffer, position) {\n _classCallCheck(this, FieldIterator);\n this.buffer = buffer;\n this.stream = new _coders_byte_stream__WEBPACK_IMPORTED_MODULE_1__[\"ByteStream\"](buffer, position);\n }\n\n /**\n * @returns {FieldIterator} - Returns this.\n */\n return _createClass(FieldIterator, [{\n key: Symbol.iterator,\n value: function value() {\n return this;\n }\n\n /**\n * @returns {{value: *, done: boolean}} - An iterator.next() value.\n */\n }, {\n key: \"next\",\n value: function next() {\n if (this.stream.position >= this.stream.uint8a.length) {\n return {\n value: null,\n done: true\n };\n }\n var position = this.stream.position;\n var classId = this.stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n var consumer = CONSUMERS[classId];\n if (consumer !== null) {\n return consumer.next(this.stream, classId, position);\n } else if (classId < _ids__WEBPACK_IMPORTED_MODULE_4__[\"TYPES\"].OBJECT_REF) {\n // TODO: Does this ever happen?\n return builtinConsumer.next(this.stream, classId, position);\n }\n var classVersion = this.stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n var size = this.stream.read(_coders_byte_primitives__WEBPACK_IMPORTED_MODULE_0__[\"Uint8\"]);\n return {\n value: new _fields__WEBPACK_IMPORTED_MODULE_3__[\"FieldObjectHeader\"](classId, position, classVersion, size),\n done: false\n };\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/squeak/field-iterator.js?");
|
|
383
383
|
|
|
384
384
|
/***/ }),
|
|
385
385
|
|
|
@@ -391,7 +391,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
391
391
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
392
392
|
|
|
393
393
|
"use strict";
|
|
394
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FieldObject\", function() { return FieldObject; });\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\nfunction _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); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
394
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FieldObject\", function() { return FieldObject; });\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\nfunction _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); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\n\nvar toTitleCase = function toTitleCase(str) {\n return str.toLowerCase().replace(/_(\\w)/g, function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n letter = _ref2[1];\n return letter.toUpperCase();\n });\n};\n\n/**\n * A object representation of a {@link Header} collecting the given {@link\n * Header#size} in fields.\n */\nvar FieldObject = /*#__PURE__*/function () {\n /**\n * @param {TYPES} classId - {@link TYPES} id that informs what the shape of\n * this object is.\n * @param {number} version - Version number of this object. Some items in\n * the same class may have different content and so will be different\n * versions.\n * @param {Array.<Field>} fields - An array of fields in this FieldObject.\n */\n function FieldObject(_ref3) {\n var classId = _ref3.classId,\n version = _ref3.version,\n fields = _ref3.fields;\n _classCallCheck(this, FieldObject);\n /** @type {number} */\n this.classId = classId;\n\n /** @type {number} */\n this.version = version;\n\n /** @type {Array.<Field>} */\n this.fields = fields;\n }\n\n /**\n * @type {object}\n */\n return _createClass(FieldObject, [{\n key: \"FIELDS\",\n get: function get() {\n return [];\n }\n\n /**\n * @type {Array.<Field>}\n */\n }, {\n key: \"RAW_FIELDS\",\n get: function get() {\n return this.fields;\n }\n }, {\n key: \"string\",\n value: function string(field) {\n return String(this.fields[field]);\n }\n }, {\n key: \"number\",\n value: function number(field) {\n return +this.fields[field];\n }\n }, {\n key: \"boolean\",\n value: function boolean(field) {\n return !!this.fields[field];\n }\n }, {\n key: \"toString\",\n value: function toString() {\n if (this.constructor === FieldObject) {\n return \"\".concat(this.constructor.name, \" \").concat(this.classId, \" \").concat(_ids__WEBPACK_IMPORTED_MODULE_0__[\"TYPE_NAMES\"][this.classId]);\n }\n return this.constructor.name;\n }\n\n /**\n * Define a FieldObject subclass by mapping field names to indices in\n * {@link FieldObject#fields}.\n * @param {object} FIELDS - Mapping of ALL_CAPS keys to index in {@link\n * FieldObject#fields}.\n * @param {function} [Super] - Parent class of the returned subclass.\n * @returns {function} - FieldObject subclass constructor.\n */\n }], [{\n key: \"define\",\n value: function define(FIELDS) {\n var Super = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FieldObject;\n var DefinedObject = /*#__PURE__*/function (_Super) {\n function DefinedObject() {\n _classCallCheck(this, DefinedObject);\n return _callSuper(this, DefinedObject, arguments);\n }\n _inherits(DefinedObject, _Super);\n return _createClass(DefinedObject, [{\n key: \"FIELDS\",\n get: function get() {\n return FIELDS;\n }\n }], [{\n key: \"FIELDS\",\n get: function get() {\n return FIELDS;\n }\n }]);\n }(Super);\n Object.keys(FIELDS).forEach(function (key) {\n var index = FIELDS[key];\n Object.defineProperty(DefinedObject.prototype, toTitleCase(key), {\n get: function get() {\n return this.fields[index];\n }\n });\n });\n return DefinedObject;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/squeak/field-object.js?");
|
|
395
395
|
|
|
396
396
|
/***/ }),
|
|
397
397
|
|
|
@@ -403,7 +403,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
403
403
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
404
404
|
|
|
405
405
|
"use strict";
|
|
406
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Field\", function() { return Field; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"value\", function() { return valueOf; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Value\", function() { return Value; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Header\", function() { return Header; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Reference\", function() { return Reference; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BuiltinObjectHeader\", function() { return BuiltinObjectHeader; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FieldObjectHeader\", function() { return FieldObjectHeader; });\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
406
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Field\", function() { return Field; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"value\", function() { return valueOf; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Value\", function() { return Value; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Header\", function() { return Header; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Reference\", function() { return Reference; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BuiltinObjectHeader\", function() { return BuiltinObjectHeader; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FieldObjectHeader\", function() { return FieldObjectHeader; });\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\n\n\n/**\n * An abstract value contained in a `.sb` file.\n *\n * `.sb` files are made up of two blocks of Fields. Each field in the binary\n * file defines its \"class\" and is possibly followed by some binary data\n * depending on the class. Each class explicitly defines what follows. Knowing\n * all the possible classes each block can be broken up into a series of Field\n * objects.\n */\nvar Field = /*#__PURE__*/_createClass(\n/**\n * @param {TYPES} classId - The class identifier of this Field.\n * @param {number} position - Byte position in the `.sb` file.\n */\nfunction Field(classId, position) {\n _classCallCheck(this, Field);\n /**\n * The class identifier of this Field.\n * @type {TYPES}\n */\n this.classId = classId;\n\n /**\n * Byte position in the `.sb` file.\n * @type {number}\n */\n this.position = position;\n});\nvar valueOf = function valueOf(obj) {\n if (_typeof(obj) === 'object' && obj) return obj.valueOf();\n return obj;\n};\n\n/**\n * A concrete value contained in a `.sb` file.\n * @extends Field\n */\nvar Value = /*#__PURE__*/function (_Field) {\n /**\n * @param {TYPES} classId - The class identifier of this Field.\n * @param {number} position - Byte position in the `.sb` file.\n * @param {*} value - A value decoded according to `classId` from an `.sb`\n * file.\n */\n function Value(classId, position, value) {\n var _this;\n _classCallCheck(this, Value);\n _this = _callSuper(this, Value, [classId, position]);\n\n /**\n * A value decoded according to `classId` from an `.sb` file.\n * @type {*}\n */\n _this.value = value;\n return _this;\n }\n _inherits(Value, _Field);\n return _createClass(Value, [{\n key: \"valueOf\",\n value: function valueOf() {\n return this.value;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n if (this.classId === _ids__WEBPACK_IMPORTED_MODULE_0__[\"TYPES\"].TRANSLUCENT_COLOR || this.classId === _ids__WEBPACK_IMPORTED_MODULE_0__[\"TYPES\"].COLOR) {\n // TODO: Can colors be 32 bit in scratch-packets?\n return this.value & 0xffffff;\n }\n return this.value;\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return this.value;\n }\n }]);\n}(Field);\n/**\n * A header for a FieldObject representing its class and how many fields are in\n * the object.\n *\n * The `size` of a header is the number of Fields that appear in the byte\n * stream after the header that are related to the header. That set of `size`\n * length Fields make up a FieldObject of `classId` passed to this header.\n * @extends Field\n */\nvar Header = /*#__PURE__*/function (_Field2) {\n /**\n * @param {TYPES} classId - The class identifier of this Field.\n * @param {number} position - Byte position in the `.sb` file.\n * @param {number} size - The number of fields to collect.\n */\n function Header(classId, position, size) {\n var _this2;\n _classCallCheck(this, Header);\n _this2 = _callSuper(this, Header, [classId, position]);\n\n /**\n * The number of fields to collect.\n * @type {number}\n */\n _this2.size = size;\n return _this2;\n }\n _inherits(Header, _Field2);\n return _createClass(Header);\n}(Field);\n/**\n * A integer reference of an object in an array produced by TypeIterator of\n * Values and FieldObjects.\n * @extends Field\n */\nvar Reference = /*#__PURE__*/function (_Field3) {\n /**\n * @param {TYPES} classId - The class identifier of this Field.\n * @param {number} position - Byte position in the `.sb` file.\n * @param {number} index - The index this Reference refers to.\n */\n function Reference(classId, position, index) {\n var _this3;\n _classCallCheck(this, Reference);\n _this3 = _callSuper(this, Reference, [classId, position]);\n\n /**\n * The index this Reference refers to.\n * @type {number}\n */\n _this3.index = index;\n return _this3;\n }\n _inherits(Reference, _Field3);\n return _createClass(Reference, [{\n key: \"valueOf\",\n value: function valueOf() {\n return \"Ref(\".concat(this.index, \")\");\n }\n }]);\n}(Field);\n/**\n * An object header of 0 size.\n * @extends Header\n */\nvar BuiltinObjectHeader = /*#__PURE__*/function (_Header) {\n function BuiltinObjectHeader(classId, position) {\n _classCallCheck(this, BuiltinObjectHeader);\n return _callSuper(this, BuiltinObjectHeader, [classId, position, 0]);\n }\n _inherits(BuiltinObjectHeader, _Header);\n return _createClass(BuiltinObjectHeader);\n}(Header);\n/**\n * An object header with an id more than 99, a version, and a size. The version\n * and size appear in the `sb` file as one byte for version followed by another\n * byte for the size.\n * @extends Header\n */\nvar FieldObjectHeader = /*#__PURE__*/function (_Header2) {\n /**\n * @param {TYPES} classId - The class identifier of this Field.\n * @param {number} position - Byte position in the `.sb` file.\n * @param {number} version - The version of this instance of a certain\n * value.\n * @param {number} size - The number of fields in this object.\n */\n function FieldObjectHeader(classId, position, version, size) {\n var _this4;\n _classCallCheck(this, FieldObjectHeader);\n _this4 = _callSuper(this, FieldObjectHeader, [classId, position, size]);\n\n /**\n * The version of this instance of a certain value.\n * @type {number}\n */\n _this4.version = version;\n return _this4;\n }\n _inherits(FieldObjectHeader, _Header2);\n return _createClass(FieldObjectHeader);\n}(Header);\n\n\n//# sourceURL=webpack:///./src/squeak/fields.js?");
|
|
407
407
|
|
|
408
408
|
/***/ }),
|
|
409
409
|
|
|
@@ -427,7 +427,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
427
427
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
428
428
|
|
|
429
429
|
"use strict";
|
|
430
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ReferenceFixer\", function() { return ReferenceFixer; });\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
430
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ReferenceFixer\", function() { return ReferenceFixer; });\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\nvar ReferenceFixer = /*#__PURE__*/function () {\n function ReferenceFixer(table) {\n _classCallCheck(this, ReferenceFixer);\n this.table = Array.from(table);\n this.fixed = this.fix(this.table);\n }\n return _createClass(ReferenceFixer, [{\n key: \"fix\",\n value: function fix() {\n var fixed = [];\n for (var i = 0; i < this.table.length; i++) {\n this.fixItem(this.table[i]);\n fixed.push(this.table[i]);\n }\n return fixed;\n }\n }, {\n key: \"fixItem\",\n value: function fixItem(item) {\n if (typeof item.fields !== 'undefined') {\n item = item.fields;\n }\n if (Array.isArray(item)) {\n for (var i = 0; i < item.length; i++) {\n item[i] = this.deref(item[i]);\n }\n }\n }\n }, {\n key: \"deref\",\n value: function deref(ref) {\n if (ref instanceof _fields__WEBPACK_IMPORTED_MODULE_0__[\"Reference\"]) {\n return this.table[ref.index - 1];\n }\n return ref;\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/squeak/reference-fixer.js?");
|
|
431
431
|
|
|
432
432
|
/***/ }),
|
|
433
433
|
|
|
@@ -439,7 +439,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
439
439
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
440
440
|
|
|
441
441
|
"use strict";
|
|
442
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TypeIterator\", function() { return TypeIterator; });\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\n/* harmony import */ var _field_object__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./field-object */ \"./src/squeak/field-object.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ \"./src/squeak/types.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
442
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TypeIterator\", function() { return TypeIterator; });\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\n/* harmony import */ var _field_object__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./field-object */ \"./src/squeak/field-object.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ \"./src/squeak/types.js\");\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\n\nvar TypeIterator = /*#__PURE__*/function () {\n function TypeIterator(valueIterator) {\n _classCallCheck(this, TypeIterator);\n this.valueIterator = valueIterator;\n }\n return _createClass(TypeIterator, [{\n key: Symbol.iterator,\n value: function value() {\n return this;\n }\n }, {\n key: \"next\",\n value: function next() {\n var nextHeader = this.valueIterator.next();\n if (nextHeader.done) {\n return nextHeader;\n }\n var header = nextHeader.value;\n var classId = header.classId;\n var value = header;\n if (header instanceof _fields__WEBPACK_IMPORTED_MODULE_0__[\"Header\"]) {\n value = [];\n for (var i = 0; i < header.size; i++) {\n value.push(this.next().value);\n }\n }\n if (_types__WEBPACK_IMPORTED_MODULE_2__[\"FIELD_OBJECT_CONTRUCTORS\"][classId] !== null || header instanceof _fields__WEBPACK_IMPORTED_MODULE_0__[\"FieldObjectHeader\"]) {\n var constructor = _types__WEBPACK_IMPORTED_MODULE_2__[\"FIELD_OBJECT_CONTRUCTORS\"][header.classId] || _field_object__WEBPACK_IMPORTED_MODULE_1__[\"FieldObject\"];\n value = new constructor({\n classId: header.classId,\n version: header.version,\n fields: value\n });\n }\n return {\n value: value,\n done: false\n };\n }\n }]);\n}();\n\n\n//# sourceURL=webpack:///./src/squeak/type-iterator.js?");
|
|
443
443
|
|
|
444
444
|
/***/ }),
|
|
445
445
|
|
|
@@ -451,7 +451,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
451
451
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
452
452
|
|
|
453
453
|
"use strict";
|
|
454
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointData\", function() { return PointData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RectangleData\", function() { return RectangleData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageData\", function() { return ImageData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StageData\", function() { return StageData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpriteData\", function() { return SpriteData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextDetailsData\", function() { return TextDetailsData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageMediaData\", function() { return ImageMediaData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UncompressedData\", function() { return UncompressedData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SoundMediaData\", function() { return SoundMediaData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ListWatcherData\", function() { return ListWatcherData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AlignmentData\", function() { return AlignmentData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphData\", function() { return MorphData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StaticStringData\", function() { return StaticStringData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UpdatingStringData\", function() { return UpdatingStringData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WatcherReadoutFrameData\", function() { return WatcherReadoutFrameData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WATCHER_MODES\", function() { return WATCHER_MODES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WatcherData\", function() { return WatcherData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FIELD_OBJECT_CONTRUCTORS\", function() { return FIELD_OBJECT_CONTRUCTORS; });\n/* harmony import */ var _coders_crc32__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coders/crc32 */ \"./src/coders/crc32.js\");\n/* harmony import */ var _coders_squeak_image__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coders/squeak-image */ \"./src/coders/squeak-image.js\");\n/* harmony import */ var _coders_squeak_sound__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../coders/squeak-sound */ \"./src/coders/squeak-sound.js\");\n/* harmony import */ var _coders_wav_file__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../coders/wav-file */ \"./src/coders/wav-file.js\");\n/* harmony import */ var _field_object__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./field-object */ \"./src/squeak/field-object.js\");\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\n/* harmony import */ var js_md5__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! js-md5 */ \"./node_modules/js-md5/src/md5.js\");\n/* harmony import */ var js_md5__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(js_md5__WEBPACK_IMPORTED_MODULE_7__);\nfunction _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); }\nvar _FIELD_OBJECT_CONTRUC;\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\n\n\n\n/**\n * @extends FieldObject\n */\nvar PointData = /*#__PURE__*/function (_FieldObject$define) {\n function PointData() {\n _classCallCheck(this, PointData);\n return _callSuper(this, PointData, arguments);\n }\n _inherits(PointData, _FieldObject$define);\n return _createClass(PointData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n /**\n * @memberof PointData#\n * @type {Value}\n */\n X: 0,\n /**\n * @memberof PointData#\n * @type {Value}\n */\n Y: 1\n}));\n\nvar RectangleData = /*#__PURE__*/function (_FieldObject$define2) {\n function RectangleData() {\n _classCallCheck(this, RectangleData);\n return _callSuper(this, RectangleData, arguments);\n }\n _inherits(RectangleData, _FieldObject$define2);\n return _createClass(RectangleData, [{\n key: \"width\",\n get: function get() {\n return this.x2 - this.x;\n }\n }, {\n key: \"height\",\n get: function get() {\n return this.y2 - this.y;\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n X: 0,\n Y: 1,\n X2: 2,\n Y2: 3\n}));\n\nvar _bgra2rgbaInPlace = function _bgra2rgbaInPlace(uint8a) {\n for (var i = 0; i < uint8a.length; i += 4) {\n var r = uint8a[i + 2];\n var b = uint8a[i + 0];\n uint8a[i + 2] = b;\n uint8a[i + 0] = r;\n }\n return uint8a;\n};\n\n/**\n * @extends FieldObject\n */\nvar ImageData = /*#__PURE__*/function (_FieldObject$define3) {\n function ImageData() {\n _classCallCheck(this, ImageData);\n return _callSuper(this, ImageData, arguments);\n }\n _inherits(ImageData, _FieldObject$define3);\n return _createClass(ImageData, [{\n key: \"decoded\",\n get:\n /**\n * @type {Uint8Array}\n */\n function get() {\n if (!this._decoded) {\n this._decoded = _bgra2rgbaInPlace(new Uint8Array(new _coders_squeak_image__WEBPACK_IMPORTED_MODULE_1__[\"SqueakImage\"]().decode(this.width.value, this.height.value, this.depth.value, this.bytes.value, this.colormap && this.colormap.map(function (color) {\n return color.valueOf();\n })).buffer));\n }\n return this._decoded;\n }\n\n /**\n * @type {string}\n */\n }, {\n key: \"extension\",\n get: function get() {\n return 'uncompressed';\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n WIDTH: 0,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n HEIGHT: 1,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n DEPTH: 2,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n BYTES: 4,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n COLORMAP: 5\n}));\n\nvar StageData = /*#__PURE__*/function (_FieldObject$define4) {\n function StageData() {\n _classCallCheck(this, StageData);\n return _callSuper(this, StageData, arguments);\n }\n _inherits(StageData, _FieldObject$define4);\n return _createClass(StageData, [{\n key: \"spriteOrderInLibrary\",\n get: function get() {\n return this.fields[this.FIELDS.SPRITE_ORDER_IN_LIBRARY] || null;\n }\n }, {\n key: \"tempoBPM\",\n get: function get() {\n return this.fields[this.FIELDS.TEMPO_BPM] || 0;\n }\n }, {\n key: \"lists\",\n get: function get() {\n return this.fields[this.FIELDS.LISTS] || [];\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n STAGE_CONTENTS: 2,\n OBJ_NAME: 6,\n VARS: 7,\n BLOCKS_BIN: 8,\n IS_CLONE: 9,\n MEDIA: 10,\n CURRENT_COSTUME: 11,\n ZOOM: 12,\n H_PAN: 13,\n V_PAN: 14,\n OBSOLETE_SAVED_STATE: 15,\n SPRITE_ORDER_IN_LIBRARY: 16,\n VOLUME: 17,\n TEMPO_BPM: 18,\n SCENE_STATES: 19,\n LISTS: 20\n}));\n\nvar SpriteData = /*#__PURE__*/function (_FieldObject$define5) {\n function SpriteData() {\n _classCallCheck(this, SpriteData);\n return _callSuper(this, SpriteData, arguments);\n }\n _inherits(SpriteData, _FieldObject$define5);\n return _createClass(SpriteData, [{\n key: \"scratchX\",\n get: function get() {\n return this.box.x + this.currentCostume.rotationCenter.x - 240;\n }\n }, {\n key: \"scratchY\",\n get: function get() {\n return 180 - (this.box.y + this.currentCostume.rotationCenter.y);\n }\n }, {\n key: \"visible\",\n get: function get() {\n return (this.fields[this.FIELDS.VISIBLE] & 1) === 0;\n }\n }, {\n key: \"tempoBPM\",\n get: function get() {\n return this.fields[this.FIELDS.TEMPO_BPM] || 0;\n }\n }, {\n key: \"lists\",\n get: function get() {\n return this.fields[this.FIELDS.LISTS] || [];\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n PARENT: 1,\n COLOR: 3,\n VISIBLE: 4,\n OBJ_NAME: 6,\n VARS: 7,\n BLOCKS_BIN: 8,\n IS_CLONE: 9,\n MEDIA: 10,\n CURRENT_COSTUME: 11,\n VISIBILITY: 12,\n SCALE_POINT: 13,\n ROTATION_DEGREES: 14,\n ROTATION_STYLE: 15,\n VOLUME: 16,\n TEMPO_BPM: 17,\n DRAGGABLE: 18,\n SCENE_STATES: 19,\n LISTS: 20\n}));\n\nvar TextDetailsData = /*#__PURE__*/function (_FieldObject$define6) {\n function TextDetailsData() {\n _classCallCheck(this, TextDetailsData);\n return _callSuper(this, TextDetailsData, arguments);\n }\n _inherits(TextDetailsData, _FieldObject$define6);\n return _createClass(TextDetailsData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n RECTANGLE: 0,\n FONT: 8,\n COLOR: 9,\n LINES: 11\n}));\n\nvar ImageMediaData = /*#__PURE__*/function (_FieldObject$define7) {\n function ImageMediaData() {\n _classCallCheck(this, ImageMediaData);\n return _callSuper(this, ImageMediaData, arguments);\n }\n _inherits(ImageMediaData, _FieldObject$define7);\n return _createClass(ImageMediaData, [{\n key: \"image\",\n get: function get() {\n if (this.oldComposite instanceof ImageData) {\n return this.oldComposite;\n }\n if (this.baseLayerData.value) {\n return null;\n }\n return this.bitmap;\n }\n }, {\n key: \"width\",\n get: function get() {\n if (this.image === null) {\n return -1;\n }\n return this.image.width;\n }\n }, {\n key: \"height\",\n get: function get() {\n if (this.image === null) {\n return -1;\n }\n return this.image.height;\n }\n }, {\n key: \"rawBytes\",\n get: function get() {\n if (this.image === null) {\n return this.baseLayerData.value.slice();\n }\n return this.image.bytes.value;\n }\n }, {\n key: \"decoded\",\n get: function get() {\n if (this.image === null) {\n return this.baseLayerData.value.slice();\n }\n return this.image.decoded;\n }\n }, {\n key: \"crc\",\n get: function get() {\n if (!this._crc) {\n var crc = new _coders_crc32__WEBPACK_IMPORTED_MODULE_0__[\"CRC32\"]().update(new Uint8Array(new Uint32Array([this.bitmap.width]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.height]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.depth]).buffer)).update(this.rawBytes);\n this._crc = crc.digest;\n }\n return this._crc;\n }\n }, {\n key: \"extension\",\n get: function get() {\n if (this.oldComposite instanceof ImageData) return 'uncompressed';\n if (this.baseLayerData.value) return 'jpg';\n return 'uncompressed';\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return \"ImageMediaData \\\"\".concat(this.costumeName, \"\\\"\");\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n COSTUME_NAME: 0,\n BITMAP: 1,\n ROTATION_CENTER: 2,\n TEXT_DETAILS: 3,\n BASE_LAYER_DATA: 4,\n OLD_COMPOSITE: 5\n}));\n\nvar UncompressedData = /*#__PURE__*/function (_FieldObject$define8) {\n function UncompressedData() {\n _classCallCheck(this, UncompressedData);\n return _callSuper(this, UncompressedData, arguments);\n }\n _inherits(UncompressedData, _FieldObject$define8);\n return _createClass(UncompressedData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n DATA: 3,\n RATE: 4\n}));\n\nvar reverseBytes16 = function reverseBytes16(input) {\n var uint8a = new Uint8Array(input);\n for (var i = 0; i < uint8a.length; i += 2) {\n uint8a[i] = input[i + 1];\n uint8a[i + 1] = input[i];\n }\n return uint8a;\n};\nvar SoundMediaData = /*#__PURE__*/function (_FieldObject$define9) {\n function SoundMediaData() {\n _classCallCheck(this, SoundMediaData);\n return _callSuper(this, SoundMediaData, arguments);\n }\n _inherits(SoundMediaData, _FieldObject$define9);\n return _createClass(SoundMediaData, [{\n key: \"rate\",\n get: function get() {\n if (this.uncompressed.data.value.length !== 0) {\n return this.uncompressed.rate;\n }\n return this.fields[this.FIELDS.RATE];\n }\n }, {\n key: \"rawBytes\",\n get: function get() {\n if (this.data && this.data.value) {\n return this.data.value;\n }\n return this.uncompressed.data.value;\n }\n }, {\n key: \"decoded\",\n get: function get() {\n if (!this._decoded) {\n if (this.data && this.data.value) {\n this._decoded = new _coders_squeak_sound__WEBPACK_IMPORTED_MODULE_2__[\"SqueakSound\"](this.bitsPerSample.value).decode(this.data.value);\n } else {\n this._decoded = new Int16Array(reverseBytes16(this.uncompressed.data.value.slice()).buffer);\n }\n }\n return this._decoded;\n }\n }, {\n key: \"crc\",\n get: function get() {\n if (!this._crc) {\n this._crc = new _coders_crc32__WEBPACK_IMPORTED_MODULE_0__[\"CRC32\"]().update(new Uint32Array([this.rate])).update(this.rawBytes).digest;\n }\n return this._crc;\n }\n }, {\n key: \"sampleCount\",\n get: function get() {\n if (this.data && this.data.value) {\n return _coders_squeak_sound__WEBPACK_IMPORTED_MODULE_2__[\"SqueakSound\"].samples(this.bitsPerSample.value, this.data.value);\n }\n return this.uncompressed.data.value.length / 2;\n }\n }, {\n key: \"extension\",\n get: function get() {\n return 'pcm';\n }\n }, {\n key: \"wavEncodedData\",\n get: function get() {\n if (!this._wavEncodedData) {\n this._wavEncodedData = new Uint8Array(_coders_wav_file__WEBPACK_IMPORTED_MODULE_3__[\"WAVFile\"].encode(this.decoded, {\n sampleRate: this.rate && this.rate.value\n }));\n }\n return this._wavEncodedData;\n }\n }, {\n key: \"md5\",\n get: function get() {\n if (!this._md5) {\n this._md5 = js_md5__WEBPACK_IMPORTED_MODULE_7___default()(this.wavEncodedData);\n }\n return this._md5;\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return \"SoundMediaData \\\"\".concat(this.name, \"\\\"\");\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n NAME: 0,\n UNCOMPRESSED: 1,\n RATE: 4,\n BITS_PER_SAMPLE: 5,\n DATA: 6\n}));\n\nvar ListWatcherData = /*#__PURE__*/function (_FieldObject$define0) {\n function ListWatcherData() {\n _classCallCheck(this, ListWatcherData);\n return _callSuper(this, ListWatcherData, arguments);\n }\n _inherits(ListWatcherData, _FieldObject$define0);\n return _createClass(ListWatcherData, [{\n key: \"x\",\n get: function get() {\n if (Object(_fields__WEBPACK_IMPORTED_MODULE_5__[\"value\"])(this.hiddenWhenNull) === null) return 5;\n return this.box.x + 1;\n }\n }, {\n key: \"y\",\n get: function get() {\n if (Object(_fields__WEBPACK_IMPORTED_MODULE_5__[\"value\"])(this.hiddenWhenNull) === null) return 5;\n return this.box.y + 1;\n }\n }, {\n key: \"width\",\n get: function get() {\n return this.box.width - 2;\n }\n }, {\n key: \"height\",\n get: function get() {\n return this.box.height - 2;\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n HIDDEN_WHEN_NULL: 1,\n LIST_NAME: 8,\n CONTENTS: 9,\n TARGET: 10\n}));\n\nvar AlignmentData = /*#__PURE__*/function (_FieldObject$define1) {\n function AlignmentData() {\n _classCallCheck(this, AlignmentData);\n return _callSuper(this, AlignmentData, arguments);\n }\n _inherits(AlignmentData, _FieldObject$define1);\n return _createClass(AlignmentData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n PARENT: 1,\n FRAMES: 2,\n COLOR: 3,\n DIRECTION: 8,\n ALIGNMENT: 9\n}));\n\nvar MorphData = /*#__PURE__*/function (_FieldObject$define10) {\n function MorphData() {\n _classCallCheck(this, MorphData);\n return _callSuper(this, MorphData, arguments);\n }\n _inherits(MorphData, _FieldObject$define10);\n return _createClass(MorphData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n PARENT: 1,\n COLOR: 3\n}));\n\nvar StaticStringData = /*#__PURE__*/function (_FieldObject$define11) {\n function StaticStringData() {\n _classCallCheck(this, StaticStringData);\n return _callSuper(this, StaticStringData, arguments);\n }\n _inherits(StaticStringData, _FieldObject$define11);\n return _createClass(StaticStringData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n COLOR: 3,\n VALUE: 8\n}));\n\nvar UpdatingStringData = /*#__PURE__*/function (_FieldObject$define12) {\n function UpdatingStringData() {\n _classCallCheck(this, UpdatingStringData);\n return _callSuper(this, UpdatingStringData, arguments);\n }\n _inherits(UpdatingStringData, _FieldObject$define12);\n return _createClass(UpdatingStringData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n READOUT_FRAME: 1,\n COLOR: 3,\n FONT: 6,\n VALUE: 8,\n TARGET: 10,\n CMD: 11,\n PARAM: 13\n}));\n\nvar WatcherReadoutFrameData = /*#__PURE__*/function (_FieldObject$define13) {\n function WatcherReadoutFrameData() {\n _classCallCheck(this, WatcherReadoutFrameData);\n return _callSuper(this, WatcherReadoutFrameData, arguments);\n }\n _inherits(WatcherReadoutFrameData, _FieldObject$define13);\n return _createClass(WatcherReadoutFrameData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0\n}));\n\nvar WATCHER_MODES = {\n NORMAL: 1,\n LARGE: 2,\n SLIDER: 3,\n TEXT: 4\n};\n\nvar WatcherData = /*#__PURE__*/function (_FieldObject$define14) {\n function WatcherData() {\n _classCallCheck(this, WatcherData);\n return _callSuper(this, WatcherData, arguments);\n }\n _inherits(WatcherData, _FieldObject$define14);\n return _createClass(WatcherData, [{\n key: \"x\",\n get: function get() {\n return this.box.x;\n }\n }, {\n key: \"y\",\n get: function get() {\n return this.box.y;\n }\n }, {\n key: \"mode\",\n get: function get() {\n if (Object(_fields__WEBPACK_IMPORTED_MODULE_5__[\"value\"])(this.slider) === null) {\n if (this.readoutFrame.box.height <= 14) {\n return WATCHER_MODES.NORMAL;\n }\n return WATCHER_MODES.LARGE;\n }\n return WATCHER_MODES.SLIDER;\n }\n }, {\n key: \"isDiscrete\",\n get: function get() {\n return Math.floor(this.sliderMin) === this.sliderMin && Math.floor(this.sliderMax) === this.sliderMax && Math.floor(this.readout.value) === this.readout.value;\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n TARGET: 1,\n SHAPE: 2,\n READOUT: 14,\n READOUT_FRAME: 15,\n SLIDER: 16,\n ALIGNMENT: 17,\n SLIDER_MIN: 20,\n SLIDER_MAX: 21\n}));\n\nvar FIELD_OBJECT_CONTRUCTOR_PROTOS = (_FIELD_OBJECT_CONTRUC = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_FIELD_OBJECT_CONTRUC, _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].POINT, PointData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].RECTANGLE, RectangleData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].FORM, ImageData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SQUEAK, ImageData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SAMPLED_SOUND, UncompressedData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SPRITE, SpriteData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].STAGE, StageData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].IMAGE_MEDIA, ImageMediaData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SOUND_MEDIA, SoundMediaData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].ALIGNMENT, AlignmentData), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_FIELD_OBJECT_CONTRUC, _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].MORPH, MorphData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].WATCHER_READOUT_FRAME, WatcherReadoutFrameData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].STATIC_STRING, StaticStringData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].UPDATING_STRING, UpdatingStringData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].WATCHER, WatcherData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].LIST_WATCHER, ListWatcherData));\nvar FIELD_OBJECT_CONTRUCTORS = Array.from({\n length: 256\n}, function (_, i) {\n return FIELD_OBJECT_CONTRUCTOR_PROTOS[i] || null;\n});\n\n\n//# sourceURL=webpack:///./src/squeak/types.js?");
|
|
454
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointData\", function() { return PointData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RectangleData\", function() { return RectangleData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageData\", function() { return ImageData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StageData\", function() { return StageData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpriteData\", function() { return SpriteData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextDetailsData\", function() { return TextDetailsData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageMediaData\", function() { return ImageMediaData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UncompressedData\", function() { return UncompressedData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SoundMediaData\", function() { return SoundMediaData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ListWatcherData\", function() { return ListWatcherData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AlignmentData\", function() { return AlignmentData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphData\", function() { return MorphData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StaticStringData\", function() { return StaticStringData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UpdatingStringData\", function() { return UpdatingStringData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WatcherReadoutFrameData\", function() { return WatcherReadoutFrameData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WATCHER_MODES\", function() { return WATCHER_MODES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WatcherData\", function() { return WatcherData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FIELD_OBJECT_CONTRUCTORS\", function() { return FIELD_OBJECT_CONTRUCTORS; });\n/* harmony import */ var _coders_crc32__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coders/crc32 */ \"./src/coders/crc32.js\");\n/* harmony import */ var _coders_squeak_image__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coders/squeak-image */ \"./src/coders/squeak-image.js\");\n/* harmony import */ var _coders_squeak_sound__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../coders/squeak-sound */ \"./src/coders/squeak-sound.js\");\n/* harmony import */ var _coders_wav_file__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../coders/wav-file */ \"./src/coders/wav-file.js\");\n/* harmony import */ var _field_object__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./field-object */ \"./src/squeak/field-object.js\");\n/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fields */ \"./src/squeak/fields.js\");\n/* harmony import */ var _ids__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ids */ \"./src/squeak/ids.js\");\n/* harmony import */ var js_md5__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! js-md5 */ \"./node_modules/js-md5/src/md5.js\");\n/* harmony import */ var js_md5__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(js_md5__WEBPACK_IMPORTED_MODULE_7__);\nfunction _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); }\nvar _FIELD_OBJECT_CONTRUC;\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\n\n\n\n/**\n * @extends FieldObject\n */\nvar PointData = /*#__PURE__*/function (_FieldObject$define) {\n function PointData() {\n _classCallCheck(this, PointData);\n return _callSuper(this, PointData, arguments);\n }\n _inherits(PointData, _FieldObject$define);\n return _createClass(PointData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n /**\n * @memberof PointData#\n * @type {Value}\n */\n X: 0,\n /**\n * @memberof PointData#\n * @type {Value}\n */\n Y: 1\n}));\n\nvar RectangleData = /*#__PURE__*/function (_FieldObject$define2) {\n function RectangleData() {\n _classCallCheck(this, RectangleData);\n return _callSuper(this, RectangleData, arguments);\n }\n _inherits(RectangleData, _FieldObject$define2);\n return _createClass(RectangleData, [{\n key: \"width\",\n get: function get() {\n return this.x2 - this.x;\n }\n }, {\n key: \"height\",\n get: function get() {\n return this.y2 - this.y;\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n X: 0,\n Y: 1,\n X2: 2,\n Y2: 3\n}));\n\nvar _bgra2rgbaInPlace = function _bgra2rgbaInPlace(uint8a) {\n for (var i = 0; i < uint8a.length; i += 4) {\n var r = uint8a[i + 2];\n var b = uint8a[i + 0];\n uint8a[i + 2] = b;\n uint8a[i + 0] = r;\n }\n return uint8a;\n};\n\n/**\n * @extends FieldObject\n */\nvar ImageData = /*#__PURE__*/function (_FieldObject$define3) {\n function ImageData() {\n _classCallCheck(this, ImageData);\n return _callSuper(this, ImageData, arguments);\n }\n _inherits(ImageData, _FieldObject$define3);\n return _createClass(ImageData, [{\n key: \"decoded\",\n get:\n /**\n * @type {Uint8Array}\n */\n function get() {\n if (!this._decoded) {\n this._decoded = _bgra2rgbaInPlace(new Uint8Array(new _coders_squeak_image__WEBPACK_IMPORTED_MODULE_1__[\"SqueakImage\"]().decode(this.width.value, this.height.value, this.depth.value, this.bytes.value, this.colormap && this.colormap.map(function (color) {\n return color.valueOf();\n })).buffer));\n }\n return this._decoded;\n }\n\n /**\n * @type {string}\n */\n }, {\n key: \"extension\",\n get: function get() {\n return 'uncompressed';\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n WIDTH: 0,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n HEIGHT: 1,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n DEPTH: 2,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n BYTES: 4,\n /**\n * @memberof ImageData#\n * @type {Value}\n */\n COLORMAP: 5\n}));\n\nvar StageData = /*#__PURE__*/function (_FieldObject$define4) {\n function StageData() {\n _classCallCheck(this, StageData);\n return _callSuper(this, StageData, arguments);\n }\n _inherits(StageData, _FieldObject$define4);\n return _createClass(StageData, [{\n key: \"spriteOrderInLibrary\",\n get: function get() {\n return this.fields[this.FIELDS.SPRITE_ORDER_IN_LIBRARY] || null;\n }\n }, {\n key: \"tempoBPM\",\n get: function get() {\n return this.fields[this.FIELDS.TEMPO_BPM] || 0;\n }\n }, {\n key: \"lists\",\n get: function get() {\n return this.fields[this.FIELDS.LISTS] || [];\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n STAGE_CONTENTS: 2,\n OBJ_NAME: 6,\n VARS: 7,\n BLOCKS_BIN: 8,\n IS_CLONE: 9,\n MEDIA: 10,\n CURRENT_COSTUME: 11,\n ZOOM: 12,\n H_PAN: 13,\n V_PAN: 14,\n OBSOLETE_SAVED_STATE: 15,\n SPRITE_ORDER_IN_LIBRARY: 16,\n VOLUME: 17,\n TEMPO_BPM: 18,\n SCENE_STATES: 19,\n LISTS: 20\n}));\n\nvar SpriteData = /*#__PURE__*/function (_FieldObject$define5) {\n function SpriteData() {\n _classCallCheck(this, SpriteData);\n return _callSuper(this, SpriteData, arguments);\n }\n _inherits(SpriteData, _FieldObject$define5);\n return _createClass(SpriteData, [{\n key: \"scratchX\",\n get: function get() {\n return this.box.x + this.currentCostume.rotationCenter.x - 240;\n }\n }, {\n key: \"scratchY\",\n get: function get() {\n return 180 - (this.box.y + this.currentCostume.rotationCenter.y);\n }\n }, {\n key: \"visible\",\n get: function get() {\n return (this.fields[this.FIELDS.VISIBLE] & 1) === 0;\n }\n }, {\n key: \"tempoBPM\",\n get: function get() {\n return this.fields[this.FIELDS.TEMPO_BPM] || 0;\n }\n }, {\n key: \"lists\",\n get: function get() {\n return this.fields[this.FIELDS.LISTS] || [];\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n PARENT: 1,\n COLOR: 3,\n VISIBLE: 4,\n OBJ_NAME: 6,\n VARS: 7,\n BLOCKS_BIN: 8,\n IS_CLONE: 9,\n MEDIA: 10,\n CURRENT_COSTUME: 11,\n VISIBILITY: 12,\n SCALE_POINT: 13,\n ROTATION_DEGREES: 14,\n ROTATION_STYLE: 15,\n VOLUME: 16,\n TEMPO_BPM: 17,\n DRAGGABLE: 18,\n SCENE_STATES: 19,\n LISTS: 20\n}));\n\nvar TextDetailsData = /*#__PURE__*/function (_FieldObject$define6) {\n function TextDetailsData() {\n _classCallCheck(this, TextDetailsData);\n return _callSuper(this, TextDetailsData, arguments);\n }\n _inherits(TextDetailsData, _FieldObject$define6);\n return _createClass(TextDetailsData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n RECTANGLE: 0,\n FONT: 8,\n COLOR: 9,\n LINES: 11\n}));\n\nvar ImageMediaData = /*#__PURE__*/function (_FieldObject$define7) {\n function ImageMediaData() {\n _classCallCheck(this, ImageMediaData);\n return _callSuper(this, ImageMediaData, arguments);\n }\n _inherits(ImageMediaData, _FieldObject$define7);\n return _createClass(ImageMediaData, [{\n key: \"image\",\n get: function get() {\n if (this.oldComposite instanceof ImageData) {\n return this.oldComposite;\n }\n if (this.baseLayerData.value) {\n return null;\n }\n return this.bitmap;\n }\n }, {\n key: \"width\",\n get: function get() {\n if (this.image === null) {\n return -1;\n }\n return this.image.width;\n }\n }, {\n key: \"height\",\n get: function get() {\n if (this.image === null) {\n return -1;\n }\n return this.image.height;\n }\n }, {\n key: \"rawBytes\",\n get: function get() {\n if (this.image === null) {\n return this.baseLayerData.value.slice();\n }\n return this.image.bytes.value;\n }\n }, {\n key: \"decoded\",\n get: function get() {\n if (this.image === null) {\n return this.baseLayerData.value.slice();\n }\n return this.image.decoded;\n }\n }, {\n key: \"crc\",\n get: function get() {\n if (!this._crc) {\n var crc = new _coders_crc32__WEBPACK_IMPORTED_MODULE_0__[\"CRC32\"]().update(new Uint8Array(new Uint32Array([this.bitmap.width]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.height]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.depth]).buffer)).update(this.rawBytes);\n this._crc = crc.digest;\n }\n return this._crc;\n }\n }, {\n key: \"extension\",\n get: function get() {\n if (this.oldComposite instanceof ImageData) return 'uncompressed';\n if (this.baseLayerData.value) return 'jpg';\n return 'uncompressed';\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return \"ImageMediaData \\\"\".concat(this.costumeName, \"\\\"\");\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n COSTUME_NAME: 0,\n BITMAP: 1,\n ROTATION_CENTER: 2,\n TEXT_DETAILS: 3,\n BASE_LAYER_DATA: 4,\n OLD_COMPOSITE: 5\n}));\n\nvar UncompressedData = /*#__PURE__*/function (_FieldObject$define8) {\n function UncompressedData() {\n _classCallCheck(this, UncompressedData);\n return _callSuper(this, UncompressedData, arguments);\n }\n _inherits(UncompressedData, _FieldObject$define8);\n return _createClass(UncompressedData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n DATA: 3,\n RATE: 4\n}));\n\nvar reverseBytes16 = function reverseBytes16(input) {\n var uint8a = new Uint8Array(input);\n for (var i = 0; i < uint8a.length; i += 2) {\n uint8a[i] = input[i + 1];\n uint8a[i + 1] = input[i];\n }\n return uint8a;\n};\nvar SoundMediaData = /*#__PURE__*/function (_FieldObject$define9) {\n function SoundMediaData() {\n _classCallCheck(this, SoundMediaData);\n return _callSuper(this, SoundMediaData, arguments);\n }\n _inherits(SoundMediaData, _FieldObject$define9);\n return _createClass(SoundMediaData, [{\n key: \"rate\",\n get: function get() {\n if (this.uncompressed.data.value.length !== 0) {\n return this.uncompressed.rate;\n }\n return this.fields[this.FIELDS.RATE];\n }\n }, {\n key: \"rawBytes\",\n get: function get() {\n if (this.data && this.data.value) {\n return this.data.value;\n }\n return this.uncompressed.data.value;\n }\n }, {\n key: \"decoded\",\n get: function get() {\n if (!this._decoded) {\n if (this.data && this.data.value) {\n this._decoded = new _coders_squeak_sound__WEBPACK_IMPORTED_MODULE_2__[\"SqueakSound\"](this.bitsPerSample.value).decode(this.data.value);\n } else {\n this._decoded = new Int16Array(reverseBytes16(this.uncompressed.data.value.slice()).buffer);\n }\n }\n return this._decoded;\n }\n }, {\n key: \"crc\",\n get: function get() {\n if (!this._crc) {\n this._crc = new _coders_crc32__WEBPACK_IMPORTED_MODULE_0__[\"CRC32\"]().update(new Uint32Array([this.rate])).update(this.rawBytes).digest;\n }\n return this._crc;\n }\n }, {\n key: \"sampleCount\",\n get: function get() {\n if (this.data && this.data.value) {\n return _coders_squeak_sound__WEBPACK_IMPORTED_MODULE_2__[\"SqueakSound\"].samples(this.bitsPerSample.value, this.data.value);\n }\n return this.uncompressed.data.value.length / 2;\n }\n }, {\n key: \"extension\",\n get: function get() {\n return 'pcm';\n }\n }, {\n key: \"wavEncodedData\",\n get: function get() {\n if (!this._wavEncodedData) {\n this._wavEncodedData = new Uint8Array(_coders_wav_file__WEBPACK_IMPORTED_MODULE_3__[\"WAVFile\"].encode(this.decoded, {\n sampleRate: this.rate && this.rate.value\n }));\n }\n return this._wavEncodedData;\n }\n }, {\n key: \"md5\",\n get: function get() {\n if (!this._md5) {\n this._md5 = js_md5__WEBPACK_IMPORTED_MODULE_7___default()(this.wavEncodedData);\n }\n return this._md5;\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return \"SoundMediaData \\\"\".concat(this.name, \"\\\"\");\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n NAME: 0,\n UNCOMPRESSED: 1,\n RATE: 4,\n BITS_PER_SAMPLE: 5,\n DATA: 6\n}));\n\nvar ListWatcherData = /*#__PURE__*/function (_FieldObject$define0) {\n function ListWatcherData() {\n _classCallCheck(this, ListWatcherData);\n return _callSuper(this, ListWatcherData, arguments);\n }\n _inherits(ListWatcherData, _FieldObject$define0);\n return _createClass(ListWatcherData, [{\n key: \"x\",\n get: function get() {\n if (Object(_fields__WEBPACK_IMPORTED_MODULE_5__[\"value\"])(this.hiddenWhenNull) === null) return 5;\n return this.box.x + 1;\n }\n }, {\n key: \"y\",\n get: function get() {\n if (Object(_fields__WEBPACK_IMPORTED_MODULE_5__[\"value\"])(this.hiddenWhenNull) === null) return 5;\n return this.box.y + 1;\n }\n }, {\n key: \"width\",\n get: function get() {\n return this.box.width - 2;\n }\n }, {\n key: \"height\",\n get: function get() {\n return this.box.height - 2;\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n HIDDEN_WHEN_NULL: 1,\n LIST_NAME: 8,\n CONTENTS: 9,\n TARGET: 10\n}));\n\nvar AlignmentData = /*#__PURE__*/function (_FieldObject$define1) {\n function AlignmentData() {\n _classCallCheck(this, AlignmentData);\n return _callSuper(this, AlignmentData, arguments);\n }\n _inherits(AlignmentData, _FieldObject$define1);\n return _createClass(AlignmentData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n PARENT: 1,\n FRAMES: 2,\n COLOR: 3,\n DIRECTION: 8,\n ALIGNMENT: 9\n}));\n\nvar MorphData = /*#__PURE__*/function (_FieldObject$define10) {\n function MorphData() {\n _classCallCheck(this, MorphData);\n return _callSuper(this, MorphData, arguments);\n }\n _inherits(MorphData, _FieldObject$define10);\n return _createClass(MorphData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n PARENT: 1,\n COLOR: 3\n}));\n\nvar StaticStringData = /*#__PURE__*/function (_FieldObject$define11) {\n function StaticStringData() {\n _classCallCheck(this, StaticStringData);\n return _callSuper(this, StaticStringData, arguments);\n }\n _inherits(StaticStringData, _FieldObject$define11);\n return _createClass(StaticStringData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n COLOR: 3,\n VALUE: 8\n}));\n\nvar UpdatingStringData = /*#__PURE__*/function (_FieldObject$define12) {\n function UpdatingStringData() {\n _classCallCheck(this, UpdatingStringData);\n return _callSuper(this, UpdatingStringData, arguments);\n }\n _inherits(UpdatingStringData, _FieldObject$define12);\n return _createClass(UpdatingStringData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n READOUT_FRAME: 1,\n COLOR: 3,\n FONT: 6,\n VALUE: 8,\n TARGET: 10,\n CMD: 11,\n PARAM: 13\n}));\n\nvar WatcherReadoutFrameData = /*#__PURE__*/function (_FieldObject$define13) {\n function WatcherReadoutFrameData() {\n _classCallCheck(this, WatcherReadoutFrameData);\n return _callSuper(this, WatcherReadoutFrameData, arguments);\n }\n _inherits(WatcherReadoutFrameData, _FieldObject$define13);\n return _createClass(WatcherReadoutFrameData);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0\n}));\n\nvar WATCHER_MODES = {\n NORMAL: 1,\n LARGE: 2,\n SLIDER: 3,\n TEXT: 4\n};\n\nvar WatcherData = /*#__PURE__*/function (_FieldObject$define14) {\n function WatcherData() {\n _classCallCheck(this, WatcherData);\n return _callSuper(this, WatcherData, arguments);\n }\n _inherits(WatcherData, _FieldObject$define14);\n return _createClass(WatcherData, [{\n key: \"x\",\n get: function get() {\n return this.box.x;\n }\n }, {\n key: \"y\",\n get: function get() {\n return this.box.y;\n }\n }, {\n key: \"mode\",\n get: function get() {\n if (Object(_fields__WEBPACK_IMPORTED_MODULE_5__[\"value\"])(this.slider) === null) {\n if (this.readoutFrame.box.height <= 14) {\n return WATCHER_MODES.NORMAL;\n }\n return WATCHER_MODES.LARGE;\n }\n return WATCHER_MODES.SLIDER;\n }\n }, {\n key: \"isDiscrete\",\n get: function get() {\n return Math.floor(this.sliderMin) === this.sliderMin && Math.floor(this.sliderMax) === this.sliderMax && Math.floor(this.readout.value) === this.readout.value;\n }\n }]);\n}(_field_object__WEBPACK_IMPORTED_MODULE_4__[\"FieldObject\"].define({\n BOX: 0,\n TARGET: 1,\n SHAPE: 2,\n READOUT: 14,\n READOUT_FRAME: 15,\n SLIDER: 16,\n ALIGNMENT: 17,\n SLIDER_MIN: 20,\n SLIDER_MAX: 21\n}));\n\nvar FIELD_OBJECT_CONTRUCTOR_PROTOS = (_FIELD_OBJECT_CONTRUC = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_FIELD_OBJECT_CONTRUC, _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].POINT, PointData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].RECTANGLE, RectangleData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].FORM, ImageData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SQUEAK, ImageData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SAMPLED_SOUND, UncompressedData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SPRITE, SpriteData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].STAGE, StageData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].IMAGE_MEDIA, ImageMediaData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].SOUND_MEDIA, SoundMediaData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].ALIGNMENT, AlignmentData), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_FIELD_OBJECT_CONTRUC, _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].MORPH, MorphData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].WATCHER_READOUT_FRAME, WatcherReadoutFrameData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].STATIC_STRING, StaticStringData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].UPDATING_STRING, UpdatingStringData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].WATCHER, WatcherData), _ids__WEBPACK_IMPORTED_MODULE_6__[\"TYPES\"].LIST_WATCHER, ListWatcherData));\nvar FIELD_OBJECT_CONTRUCTORS = Array.from({\n length: 256\n}, function (_, i) {\n return FIELD_OBJECT_CONTRUCTOR_PROTOS[i] || null;\n});\n\n\n//# sourceURL=webpack:///./src/squeak/types.js?");
|
|
455
455
|
|
|
456
456
|
/***/ }),
|
|
457
457
|
|
|
@@ -463,7 +463,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
463
463
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
464
464
|
|
|
465
465
|
"use strict";
|
|
466
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FakeZipFile\", function() { return FakeZipFile; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FakeZip\", function() { return FakeZip; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"toSb2FakeZipApi\", function() { return toSb2FakeZipApi; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _coders_png_file__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coders/png-file */ \"./src/coders/png-file.js\");\nfunction _createForOfIteratorHelper(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
466
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FakeZipFile\", function() { return FakeZipFile; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FakeZip\", function() { return FakeZip; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"toSb2FakeZipApi\", function() { return toSb2FakeZipApi; });\n/* harmony import */ var _util_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/assert */ \"./src/util/assert.js\");\n/* harmony import */ var _coders_png_file__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coders/png-file */ \"./src/coders/png-file.js\");\nfunction _createForOfIteratorHelper(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _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); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\n\n\nvar FakeZipFile = /*#__PURE__*/function () {\n function FakeZipFile(file) {\n _classCallCheck(this, FakeZipFile);\n this.file = file;\n }\n return _createClass(FakeZipFile, [{\n key: \"async\",\n value: function async(outputType) {\n Object(_util_assert__WEBPACK_IMPORTED_MODULE_0__[\"assert\"])(outputType === 'uint8array', 'SB1FakeZipFile only supports uint8array');\n return Promise.resolve(this.file.bytes);\n }\n }]);\n}();\n\nvar FakeZip = /*#__PURE__*/function () {\n function FakeZip(files) {\n _classCallCheck(this, FakeZip);\n this.files = files;\n }\n return _createClass(FakeZip, [{\n key: \"file\",\n value: function file(_file) {\n if (_file in this.files) {\n return new FakeZipFile(this.files[_file]);\n }\n }\n }]);\n}();\n\nvar toSb2ImageExtension = function toSb2ImageExtension(imageMedia) {\n if (imageMedia.extension === 'uncompressed') {\n return 'png';\n }\n return 'jpg';\n};\nvar toSb2ImageMedia = function toSb2ImageMedia(imageMedia) {\n if (imageMedia.extension === 'uncompressed') {\n return new Uint8Array(_coders_png_file__WEBPACK_IMPORTED_MODULE_1__[\"PNGFile\"].encode(imageMedia.width, imageMedia.height, imageMedia.decoded));\n }\n return imageMedia.decoded;\n};\nvar toSb2SoundMedia = function toSb2SoundMedia(soundMedia) {\n return soundMedia.wavEncodedData;\n};\nvar toSb2FakeZipApi = function toSb2FakeZipApi(_ref) {\n var images = _ref.images,\n sounds = _ref.sounds;\n var files = {};\n var index = 0;\n var _iterator = _createForOfIteratorHelper(images),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var image = _step.value;\n files[\"\".concat(index++, \".\").concat(toSb2ImageExtension(image))] = {\n bytes: toSb2ImageMedia(image)\n };\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n index = 0;\n var _iterator2 = _createForOfIteratorHelper(sounds),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var sound = _step2.value;\n files[\"\".concat(index++, \".wav\")] = {\n bytes: toSb2SoundMedia(sound)\n };\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return new FakeZip(files);\n};\n\n\n//# sourceURL=webpack:///./src/to-sb2/fake-zip.js?");
|
|
467
467
|
|
|
468
468
|
/***/ }),
|
|
469
469
|
|
|
@@ -487,7 +487,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
487
487
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
488
488
|
|
|
489
489
|
"use strict";
|
|
490
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"assert\", function() { return assert; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssertionError\", function() { return AssertionError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ValidationError\", function() { return ValidationError; });\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t,
|
|
490
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"assert\", function() { return assert; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssertionError\", function() { return AssertionError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ValidationError\", function() { return ValidationError; });\nfunction _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); }\nfunction _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); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, e) { if (\"object\" != _typeof(t) || !t) return t; var r; if (\"undefined\" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === e ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _wrapNativeSuper(t) { var r = \"function\" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if (\"function\" != typeof t) throw new TypeError(\"Super expression must either be null or a function\"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }\nfunction _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf(\"[native code]\"); } catch (n) { return \"function\" == typeof t; } }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\n/**\n * A `scratch-sb1-converter` assertion.\n */\nvar AssertionError = /*#__PURE__*/function (_Error) {\n function AssertionError() {\n _classCallCheck(this, AssertionError);\n return _callSuper(this, AssertionError, arguments);\n }\n _inherits(AssertionError, _Error);\n return _createClass(AssertionError);\n}(/*#__PURE__*/_wrapNativeSuper(Error));\n/**\n * A `scratch-sb1-converter` validation error.\n */\nvar ValidationError = /*#__PURE__*/function (_AssertionError) {\n function ValidationError() {\n _classCallCheck(this, ValidationError);\n return _callSuper(this, ValidationError, arguments);\n }\n _inherits(ValidationError, _AssertionError);\n return _createClass(ValidationError);\n}(AssertionError);\nvar assert = function assert(test, message) {\n if (!test) throw new AssertionError(message);\n};\nassert.validate = function (test, message) {\n if (!test) throw new ValidationError(message);\n};\n\n\n//# sourceURL=webpack:///./src/util/assert.js?");
|
|
491
491
|
|
|
492
492
|
/***/ }),
|
|
493
493
|
|