decord/source/223__isNativeReflectConstruct.js

273 lines
7.3 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 223
2026-07-29 08:29:29 +00:00
// Function ID: 224
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-29 08:29:29 +00:00
// Dependencies: [41, 42, 93, 95, 98, 133, 224, 206, 205, 132]
2026-07-20 16:05:17 +00:00
// Module 223 (_isNativeReflectConstruct)
2026-08-24 06:08:38 +00:00
import _inheritsDefault from "_inherits" /* 98 */;
import dispatchDefault from "dispatch" /* 132 */;
import EventDefault from "Event" /* 133 */;
import FileReaderModuleDefault from "FileReaderModule" /* 224 */;
import closure_3 from "_classCallCheck" /* 41 */;
import closure_4 from "_possibleConstructorReturn" /* 93 */;
import closure_5 from "_getPrototypeOf" /* 95 */;
import importDefaultResult from "_createClass" /* 42 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
const FileReader = arg1;
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
2026-07-29 08:29:29 +00:00
try {
const _Boolean = Boolean;
const call = valueOf.call;
const _Reflect = Reflect;
const _Boolean2 = Boolean;
if (typeof call === "unknown") {
let callResult = valueOf();
} else {
callResult = call(constructResult);
}
2026-08-24 06:08:38 +00:00
closure_0 = !callResult;
_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2026-07-29 08:29:29 +00:00
return closure_0;
2026-08-24 06:08:38 +00:00
};
2026-07-29 08:29:29 +00:00
return _isNativeReflectConstruct();
} catch (err) {
}
}
class FileReader {
constructor() {
self = this;
2026-08-24 06:08:38 +00:00
tmp = closure_3(this, FileReader);
tmp2 = closure_5;
obj = closure_5(FileReader);
tmp3 = closure_4;
2026-07-29 08:29:29 +00:00
if (_isNativeReflectConstruct()) {
tmp5 = globalThis;
_Reflect = Reflect;
constructResult = Reflect.construct(obj, [], tmp2(self).constructor);
} else {
constructResult = obj.apply(self, undefined);
}
tmp3Result = tmp3(self, constructResult);
tmp3Result.EMPTY = 0;
tmp3Result.LOADING = 1;
tmp3Result.DONE = 2;
tmp3Result._aborted = false;
_resetResult = tmp3Result._reset();
return tmp3Result;
2026-07-20 16:05:17 +00:00
}
}
2026-08-24 06:08:38 +00:00
_inheritsDefault(FileReader, dispatchDefault);
2026-07-29 08:29:29 +00:00
const items = [
{
key: "_reset",
value: function _reset() {
}
},
{
key: "_setReadyState",
value: function _setReadyState(_readyState) {
const self = this;
this._readyState = _readyState;
let tmp = importDefault;
2026-08-24 06:08:38 +00:00
this.dispatchEvent(new EventDefault("readystatechange"));
2026-07-29 08:29:29 +00:00
if (2 === _readyState) {
if (self._aborted) {
2026-08-24 06:08:38 +00:00
let tmpResult = EventDefault;
2026-07-29 08:29:29 +00:00
let tmp6 = new.target;
tmpResult = new tmpResult("abort");
self.dispatchEvent(tmpResult);
2026-08-24 06:08:38 +00:00
dispatchEvent = EventDefault;
2026-07-29 08:29:29 +00:00
tmp = new.target;
dispatchEvent = new dispatchEvent("loadend");
self.dispatchEvent(dispatchEvent);
} else {
({ dispatchEvent, _error } = self);
2026-08-24 06:08:38 +00:00
tmpResult = EventDefault;
2026-07-29 08:29:29 +00:00
tmp6 = new.target;
if (!_error) {
const tmpResult1 = new tmpResult("load");
dispatchEvent(tmpResult1);
}
}
const tmpResult2 = new tmpResult("error");
dispatchEvent(tmpResult2);
}
}
},
{
key: "readAsArrayBuffer",
value: function readAsArrayBuffer(closure_0) {
const self = this;
this._aborted = false;
if (null == closure_0) {
const _TypeError = TypeError;
const typeError = new TypeError("Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'");
throw typeError;
} else {
2026-08-24 06:08:38 +00:00
const asDataURL = FileReaderModuleDefault.readAsDataURL(closure_0.data);
2026-07-29 08:29:29 +00:00
asDataURL.then((arg0) => {
if (!self._aborted) {
2026-08-24 06:08:38 +00:00
obj._result = self(closure_1_2[7]).toByteArray(arg0.split(",")[1]).buffer;
2026-07-29 08:29:29 +00:00
obj._setReadyState(2);
2026-08-24 06:08:38 +00:00
const obj2 = self(closure_1_2[7]);
2026-07-29 08:29:29 +00:00
}
}, (_error) => {
if (!self._aborted) {
obj._error = _error;
obj._setReadyState(2);
}
});
}
}
},
{
key: "readAsDataURL",
value: function readAsDataURL(closure_0) {
const self = this;
this._aborted = false;
if (null == closure_0) {
const _TypeError = TypeError;
const typeError = new TypeError("Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'");
throw typeError;
} else {
2026-08-24 06:08:38 +00:00
const asDataURL = FileReaderModuleDefault.readAsDataURL(closure_0.data);
2026-07-29 08:29:29 +00:00
asDataURL.then((_result) => {
if (!self._aborted) {
obj._result = _result;
obj._setReadyState(2);
}
}, (_error) => {
if (!self._aborted) {
obj._error = _error;
obj._setReadyState(2);
}
});
}
}
},
{
key: "readAsText",
value: function readAsText(_bodyBlob, arg1) {
const self = this;
let str = arg1;
if (arg1 === undefined) {
str = "UTF-8";
}
this._aborted = false;
if (null == _bodyBlob) {
const _TypeError = TypeError;
const typeError = new TypeError("Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'");
throw typeError;
} else {
2026-08-24 06:08:38 +00:00
const asText = FileReaderModuleDefault.readAsText(_bodyBlob.data, str);
2026-07-29 08:29:29 +00:00
asText.then((_result) => {
if (!self._aborted) {
obj._result = _result;
obj._setReadyState(2);
}
}, (_error) => {
if (!self._aborted) {
obj._error = _error;
obj._setReadyState(2);
}
});
}
}
},
{
key: "abort",
value: function abort() {
const self = this;
this._aborted = true;
let tmp = 0 !== this._readyState;
if (tmp) {
tmp = 2 !== self._readyState;
}
if (tmp) {
self._reset();
self._setReadyState(2);
}
self._reset();
}
},
{
key: "readyState",
get() {
return this._readyState;
}
},
{
key: "error",
get() {
return this._error;
}
},
{
key: "result",
get() {
return this._result;
}
},
{
key: "onabort",
get() {
return FileReader(205).getEventHandlerAttribute(this, "abort");
},
2026-08-04 21:03:28 +00:00
set(fn) {
const result = FileReader(205).setEventHandlerAttribute(this, "abort", fn);
2026-07-29 08:29:29 +00:00
}
},
{
key: "onerror",
get() {
return FileReader(205).getEventHandlerAttribute(this, "error");
},
2026-08-04 21:03:28 +00:00
set(fn) {
const result = FileReader(205).setEventHandlerAttribute(this, "error", fn);
2026-07-29 08:29:29 +00:00
}
},
{
key: "onload",
get() {
return FileReader(205).getEventHandlerAttribute(this, "load");
},
2026-08-04 21:03:28 +00:00
set(fn) {
const result = FileReader(205).setEventHandlerAttribute(this, "load", fn);
2026-07-29 08:29:29 +00:00
}
},
{
key: "onloadstart",
get() {
return FileReader(205).getEventHandlerAttribute(this, "loadstart");
},
2026-08-04 21:03:28 +00:00
set(fn) {
const result = FileReader(205).setEventHandlerAttribute(this, "loadstart", fn);
2026-07-29 08:29:29 +00:00
}
},
{
key: "onloadend",
get() {
return FileReader(205).getEventHandlerAttribute(this, "loadend");
},
2026-08-04 21:03:28 +00:00
set(fn) {
const result = FileReader(205).setEventHandlerAttribute(this, "loadend", fn);
2026-07-29 08:29:29 +00:00
}
},
{
key: "onprogress",
get() {
return FileReader(205).getEventHandlerAttribute(this, "progress");
},
2026-08-04 21:03:28 +00:00
set(fn) {
const result = FileReader(205).setEventHandlerAttribute(this, "progress", fn);
2026-07-29 08:29:29 +00:00
}
}
];
const importDefaultResultResult = importDefaultResult(FileReader, items);
importDefaultResultResult.EMPTY = 0;
importDefaultResultResult.LOADING = 1;
importDefaultResultResult.DONE = 2;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default importDefaultResultResult;