mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-11-05 12:43:23 +01:00
417 lines
14 KiB
JavaScript
417 lines
14 KiB
JavaScript
/* */
|
|
(function(process) {
|
|
"use strict";
|
|
var _Symbol = require("../core-js/symbol")["default"];
|
|
var _Symbol$iterator = require("../core-js/symbol/iterator")["default"];
|
|
var _Object$create = require("../core-js/object/create")["default"];
|
|
var _Promise = require("../core-js/promise")["default"];
|
|
!(function(global) {
|
|
"use strict";
|
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
var undefined;
|
|
var iteratorSymbol = typeof _Symbol === "function" && _Symbol$iterator || "@@iterator";
|
|
var inModule = typeof module === "object";
|
|
var runtime = global.regeneratorRuntime;
|
|
if (runtime) {
|
|
if (inModule) {
|
|
module.exports = runtime;
|
|
}
|
|
return ;
|
|
}
|
|
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
|
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
var generator = _Object$create((outerFn || Generator).prototype);
|
|
generator._invoke = makeInvokeMethod(innerFn, self || null, new Context(tryLocsList || []));
|
|
return generator;
|
|
}
|
|
runtime.wrap = wrap;
|
|
function tryCatch(fn, obj, arg) {
|
|
try {
|
|
return {
|
|
type: "normal",
|
|
arg: fn.call(obj, arg)
|
|
};
|
|
} catch (err) {
|
|
return {
|
|
type: "throw",
|
|
arg: err
|
|
};
|
|
}
|
|
}
|
|
var GenStateSuspendedStart = "suspendedStart";
|
|
var GenStateSuspendedYield = "suspendedYield";
|
|
var GenStateExecuting = "executing";
|
|
var GenStateCompleted = "completed";
|
|
var ContinueSentinel = {};
|
|
function Generator() {}
|
|
function GeneratorFunction() {}
|
|
function GeneratorFunctionPrototype() {}
|
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
|
|
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
GeneratorFunction.displayName = "GeneratorFunction";
|
|
function defineIteratorMethods(prototype) {
|
|
["next", "throw", "return"].forEach(function(method) {
|
|
prototype[method] = function(arg) {
|
|
return this._invoke(method, arg);
|
|
};
|
|
});
|
|
}
|
|
runtime.isGeneratorFunction = function(genFun) {
|
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
};
|
|
runtime.mark = function(genFun) {
|
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
genFun.prototype = _Object$create(Gp);
|
|
return genFun;
|
|
};
|
|
runtime.awrap = function(arg) {
|
|
return new AwaitArgument(arg);
|
|
};
|
|
function AwaitArgument(arg) {
|
|
this.arg = arg;
|
|
}
|
|
function AsyncIterator(generator) {
|
|
function invoke(method, arg) {
|
|
var result = generator[method](arg);
|
|
var value = result.value;
|
|
return value instanceof AwaitArgument ? _Promise.resolve(value.arg).then(invokeNext, invokeThrow) : _Promise.resolve(value).then(function(unwrapped) {
|
|
result.value = unwrapped;
|
|
return result;
|
|
});
|
|
}
|
|
if (typeof process === "object" && process.domain) {
|
|
invoke = process.domain.bind(invoke);
|
|
}
|
|
var invokeNext = invoke.bind(generator, "next");
|
|
var invokeThrow = invoke.bind(generator, "throw");
|
|
var invokeReturn = invoke.bind(generator, "return");
|
|
var previousPromise;
|
|
function enqueue(method, arg) {
|
|
var enqueueResult = previousPromise ? previousPromise.then(function() {
|
|
return invoke(method, arg);
|
|
}) : new _Promise(function(resolve) {
|
|
resolve(invoke(method, arg));
|
|
});
|
|
previousPromise = enqueueResult["catch"](function(ignored) {});
|
|
return enqueueResult;
|
|
}
|
|
this._invoke = enqueue;
|
|
}
|
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
runtime.async = function(innerFn, outerFn, self, tryLocsList) {
|
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));
|
|
return runtime.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
|
|
return result.done ? result.value : iter.next();
|
|
});
|
|
};
|
|
function makeInvokeMethod(innerFn, self, context) {
|
|
var state = GenStateSuspendedStart;
|
|
return function invoke(method, arg) {
|
|
if (state === GenStateExecuting) {
|
|
throw new Error("Generator is already running");
|
|
}
|
|
if (state === GenStateCompleted) {
|
|
if (method === "throw") {
|
|
throw arg;
|
|
}
|
|
return doneResult();
|
|
}
|
|
while (true) {
|
|
var delegate = context.delegate;
|
|
if (delegate) {
|
|
if (method === "return" || method === "throw" && delegate.iterator[method] === undefined) {
|
|
context.delegate = null;
|
|
var returnMethod = delegate.iterator["return"];
|
|
if (returnMethod) {
|
|
var record = tryCatch(returnMethod, delegate.iterator, arg);
|
|
if (record.type === "throw") {
|
|
method = "throw";
|
|
arg = record.arg;
|
|
continue;
|
|
}
|
|
}
|
|
if (method === "return") {
|
|
continue;
|
|
}
|
|
}
|
|
var record = tryCatch(delegate.iterator[method], delegate.iterator, arg);
|
|
if (record.type === "throw") {
|
|
context.delegate = null;
|
|
method = "throw";
|
|
arg = record.arg;
|
|
continue;
|
|
}
|
|
method = "next";
|
|
arg = undefined;
|
|
var info = record.arg;
|
|
if (info.done) {
|
|
context[delegate.resultName] = info.value;
|
|
context.next = delegate.nextLoc;
|
|
} else {
|
|
state = GenStateSuspendedYield;
|
|
return info;
|
|
}
|
|
context.delegate = null;
|
|
}
|
|
if (method === "next") {
|
|
if (state === GenStateSuspendedYield) {
|
|
context.sent = arg;
|
|
} else {
|
|
context.sent = undefined;
|
|
}
|
|
} else if (method === "throw") {
|
|
if (state === GenStateSuspendedStart) {
|
|
state = GenStateCompleted;
|
|
throw arg;
|
|
}
|
|
if (context.dispatchException(arg)) {
|
|
method = "next";
|
|
arg = undefined;
|
|
}
|
|
} else if (method === "return") {
|
|
context.abrupt("return", arg);
|
|
}
|
|
state = GenStateExecuting;
|
|
var record = tryCatch(innerFn, self, context);
|
|
if (record.type === "normal") {
|
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
var info = {
|
|
value: record.arg,
|
|
done: context.done
|
|
};
|
|
if (record.arg === ContinueSentinel) {
|
|
if (context.delegate && method === "next") {
|
|
arg = undefined;
|
|
}
|
|
} else {
|
|
return info;
|
|
}
|
|
} else if (record.type === "throw") {
|
|
state = GenStateCompleted;
|
|
method = "throw";
|
|
arg = record.arg;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
defineIteratorMethods(Gp);
|
|
Gp[iteratorSymbol] = function() {
|
|
return this;
|
|
};
|
|
Gp.toString = function() {
|
|
return "[object Generator]";
|
|
};
|
|
function pushTryEntry(locs) {
|
|
var entry = {tryLoc: locs[0]};
|
|
if (1 in locs) {
|
|
entry.catchLoc = locs[1];
|
|
}
|
|
if (2 in locs) {
|
|
entry.finallyLoc = locs[2];
|
|
entry.afterLoc = locs[3];
|
|
}
|
|
this.tryEntries.push(entry);
|
|
}
|
|
function resetTryEntry(entry) {
|
|
var record = entry.completion || {};
|
|
record.type = "normal";
|
|
delete record.arg;
|
|
entry.completion = record;
|
|
}
|
|
function Context(tryLocsList) {
|
|
this.tryEntries = [{tryLoc: "root"}];
|
|
tryLocsList.forEach(pushTryEntry, this);
|
|
this.reset(true);
|
|
}
|
|
runtime.keys = function(object) {
|
|
var keys = [];
|
|
for (var key in object) {
|
|
keys.push(key);
|
|
}
|
|
keys.reverse();
|
|
return function next() {
|
|
while (keys.length) {
|
|
var key = keys.pop();
|
|
if (key in object) {
|
|
next.value = key;
|
|
next.done = false;
|
|
return next;
|
|
}
|
|
}
|
|
next.done = true;
|
|
return next;
|
|
};
|
|
};
|
|
function values(iterable) {
|
|
if (iterable) {
|
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
if (iteratorMethod) {
|
|
return iteratorMethod.call(iterable);
|
|
}
|
|
if (typeof iterable.next === "function") {
|
|
return iterable;
|
|
}
|
|
if (!isNaN(iterable.length)) {
|
|
var i = -1,
|
|
next = function next() {
|
|
while (++i < iterable.length) {
|
|
if (hasOwn.call(iterable, i)) {
|
|
next.value = iterable[i];
|
|
next.done = false;
|
|
return next;
|
|
}
|
|
}
|
|
next.value = undefined;
|
|
next.done = true;
|
|
return next;
|
|
};
|
|
return next.next = next;
|
|
}
|
|
}
|
|
return {next: doneResult};
|
|
}
|
|
runtime.values = values;
|
|
function doneResult() {
|
|
return {
|
|
value: undefined,
|
|
done: true
|
|
};
|
|
}
|
|
Context.prototype = {
|
|
constructor: Context,
|
|
reset: function reset(skipTempReset) {
|
|
this.prev = 0;
|
|
this.next = 0;
|
|
this.sent = undefined;
|
|
this.done = false;
|
|
this.delegate = null;
|
|
this.tryEntries.forEach(resetTryEntry);
|
|
if (!skipTempReset) {
|
|
for (var name in this) {
|
|
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
this[name] = undefined;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
stop: function stop() {
|
|
this.done = true;
|
|
var rootEntry = this.tryEntries[0];
|
|
var rootRecord = rootEntry.completion;
|
|
if (rootRecord.type === "throw") {
|
|
throw rootRecord.arg;
|
|
}
|
|
return this.rval;
|
|
},
|
|
dispatchException: function dispatchException(exception) {
|
|
if (this.done) {
|
|
throw exception;
|
|
}
|
|
var context = this;
|
|
function handle(loc, caught) {
|
|
record.type = "throw";
|
|
record.arg = exception;
|
|
context.next = loc;
|
|
return !!caught;
|
|
}
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
var record = entry.completion;
|
|
if (entry.tryLoc === "root") {
|
|
return handle("end");
|
|
}
|
|
if (entry.tryLoc <= this.prev) {
|
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
if (hasCatch && hasFinally) {
|
|
if (this.prev < entry.catchLoc) {
|
|
return handle(entry.catchLoc, true);
|
|
} else if (this.prev < entry.finallyLoc) {
|
|
return handle(entry.finallyLoc);
|
|
}
|
|
} else if (hasCatch) {
|
|
if (this.prev < entry.catchLoc) {
|
|
return handle(entry.catchLoc, true);
|
|
}
|
|
} else if (hasFinally) {
|
|
if (this.prev < entry.finallyLoc) {
|
|
return handle(entry.finallyLoc);
|
|
}
|
|
} else {
|
|
throw new Error("try statement without catch or finally");
|
|
}
|
|
}
|
|
}
|
|
},
|
|
abrupt: function abrupt(type, arg) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
var finallyEntry = entry;
|
|
break;
|
|
}
|
|
}
|
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
finallyEntry = null;
|
|
}
|
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
record.type = type;
|
|
record.arg = arg;
|
|
if (finallyEntry) {
|
|
this.next = finallyEntry.finallyLoc;
|
|
} else {
|
|
this.complete(record);
|
|
}
|
|
return ContinueSentinel;
|
|
},
|
|
complete: function complete(record, afterLoc) {
|
|
if (record.type === "throw") {
|
|
throw record.arg;
|
|
}
|
|
if (record.type === "break" || record.type === "continue") {
|
|
this.next = record.arg;
|
|
} else if (record.type === "return") {
|
|
this.rval = record.arg;
|
|
this.next = "end";
|
|
} else if (record.type === "normal" && afterLoc) {
|
|
this.next = afterLoc;
|
|
}
|
|
},
|
|
finish: function finish(finallyLoc) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.finallyLoc === finallyLoc) {
|
|
this.complete(entry.completion, entry.afterLoc);
|
|
resetTryEntry(entry);
|
|
return ContinueSentinel;
|
|
}
|
|
}
|
|
},
|
|
"catch": function _catch(tryLoc) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.tryLoc === tryLoc) {
|
|
var record = entry.completion;
|
|
if (record.type === "throw") {
|
|
var thrown = record.arg;
|
|
resetTryEntry(entry);
|
|
}
|
|
return thrown;
|
|
}
|
|
}
|
|
throw new Error("illegal catch attempt");
|
|
},
|
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
this.delegate = {
|
|
iterator: values(iterable),
|
|
resultName: resultName,
|
|
nextLoc: nextLoc
|
|
};
|
|
return ContinueSentinel;
|
|
}
|
|
};
|
|
})(typeof global === "object" ? global : typeof window === "object" ? window : typeof self === "object" ? self : undefined);
|
|
})(require("process"));
|