// Metro module 223 (f224). import _classCallCheck from "./_classCallCheck"; import _createClass from "./_createClass"; import _possibleConstructorReturn from "./_possibleConstructorReturn"; import _getPrototypeOf from "./_getPrototypeOf"; import _inherits from "./_inherits"; import Event2 from "./Event"; import Module224 from "./Module224"; import { toByteArray } from "./Module206"; import { getEventHandlerAttribute, setEventHandlerAttribute } from "./getEventHandlerAttributeMap"; import dispatch from "./dispatch"; let FileReader2; let env243 = {}; env243[6] = function _isNativeReflectConstruct() { let c12211_0; try { c12211_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); } catch ($e) {} const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() { return !!c12211_0; }; env243[6] = _isNativeReflectConstruct2; return _isNativeReflectConstruct2(); }; FileReader2 = function() { _classCallCheck(this, FileReader2); const r9 = _getPrototypeOf(FileReader2); const r21 = _possibleConstructorReturn(this, (0, env243[6])() ? Reflect.construct(r9, [], _getPrototypeOf(this).constructor) : r9.apply(this, void 0)); r21.EMPTY = 0; r21.LOADING = 1; r21.DONE = 2; r21._aborted = false; r21._reset(); return r21; }; _inherits(FileReader2, dispatch); const r66 = _createClass(FileReader2, [{ key: "_reset", value: function _reset() { this._readyState = 0; this._error = null; this._result = null; } }, { key: "_setReadyState", value: function _setReadyState(a0) { this._readyState = a0; this.dispatchEvent(new Event2("readystatechange")); if (a0 === 2) { if (this._aborted) { this.dispatchEvent(new Event2("abort")); } else { const _error = this._error; const dispatchEvent = this.dispatchEvent; const r21 = Object.create(Event2.prototype); if (_error) { dispatchEvent.call(this, new Event2("error")); } else { dispatchEvent.call(this, new Event2("load")); } } this.dispatchEvent(new Event2("loadend")); } } }, { key: "readAsArrayBuffer", value: function readAsArrayBuffer(a0) { this._aborted = false; if (a0 == null) { throw new TypeError("Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'"); } Module224.readAsDataURL(a0.data).then((result) => { if (!this._aborted) { this._result = toByteArray(result.split(",")[1]).buffer; this._setReadyState(2); } }, (a0) => { if (!this._aborted) { this._error = a0; this._setReadyState(2); } }); } }, { key: "readAsDataURL", value: function readAsDataURL(a0) { this._aborted = false; if (a0 == null) { throw new TypeError("Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'"); } Module224.readAsDataURL(a0.data).then((result) => { if (!this._aborted) { this._result = result; this._setReadyState(2); } }, (a0) => { if (!this._aborted) { this._error = a0; this._setReadyState(2); } }); } }, { key: "readAsText", value: function readAsText(a0, r6 = "UTF-8") { this._aborted = false; if (a0 == null) { throw new TypeError("Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'"); } Module224.readAsText(a0.data, r6).then((result) => { if (!this._aborted) { this._result = result; this._setReadyState(2); } }, (a0) => { if (!this._aborted) { this._error = a0; this._setReadyState(2); } }); } }, { key: "abort", value: function abort() { this._aborted = true; if (this._readyState !== 0 && this._readyState !== 2) { this._reset(); this._setReadyState(2); } this._reset(); } }, { key: "readyState", get: function get() { return this._readyState; } }, { key: "error", get: function get() { return this._error; } }, { key: "result", get: function get() { return this._result; } }, { key: "onabort", get: function get() { return getEventHandlerAttribute(this, "abort"); }, set: function set(a0) { setEventHandlerAttribute(this, "abort", a0); } }, { key: "onerror", get: function get() { return getEventHandlerAttribute(this, "error"); }, set: function set(a0) { setEventHandlerAttribute(this, "error", a0); } }, { key: "onload", get: function get() { return getEventHandlerAttribute(this, "load"); }, set: function set(a0) { setEventHandlerAttribute(this, "load", a0); } }, { key: "onloadstart", get: function get() { return getEventHandlerAttribute(this, "loadstart"); }, set: function set(a0) { setEventHandlerAttribute(this, "loadstart", a0); } }, { key: "onloadend", get: function get() { return getEventHandlerAttribute(this, "loadend"); }, set: function set(a0) { setEventHandlerAttribute(this, "loadend", a0); } }, { key: "onprogress", get: function get() { return getEventHandlerAttribute(this, "progress"); }, set: function set(a0) { setEventHandlerAttribute(this, "progress", a0); } }]); r66.EMPTY = 0; r66.LOADING = 1; r66.DONE = 2; export default r66;