tslib/tslib.js

277 строки
13 KiB
TypeScript
Исходник Обычный вид История

2015-05-14 22:10:16 +03:00
/*! *****************************************************************************
2016-05-18 23:25:21 +03:00
Copyright (c) Microsoft Corporation. All rights reserved.
2020-04-17 01:24:59 +03:00
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
2016-05-18 23:25:21 +03:00
2020-04-17 01:24:59 +03:00
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
2015-05-14 22:10:16 +03:00
***************************************************************************** */
/* global global, define, System, Reflect, Promise */
2016-06-11 09:14:18 +03:00
var __extends;
var __assign;
2016-11-10 21:08:31 +03:00
var __rest;
2016-06-11 09:14:18 +03:00
var __decorate;
var __param;
var __metadata;
var __awaiter;
2016-09-09 23:27:19 +03:00
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
2019-06-04 04:08:40 +03:00
var __spreadArrays;
var __await;
2017-01-01 05:11:04 +03:00
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
2017-09-19 00:44:49 +03:00
var __makeTemplateObject;
2017-11-18 02:55:43 +03:00
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
2016-05-18 23:25:21 +03:00
(function (factory) {
2016-06-11 09:14:18 +03:00
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
2016-12-22 04:20:43 +03:00
if (typeof define === "function" && define.amd) {
2016-06-11 09:14:18 +03:00
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
2015-05-14 22:10:16 +03:00
}
2016-06-11 09:14:18 +03:00
else if (typeof module === "object" && typeof module.exports === "object") {
factory(createExporter(root, createExporter(module.exports)));
2015-05-14 22:10:16 +03:00
}
else {
2016-06-11 09:14:18 +03:00
factory(createExporter(root));
}
function createExporter(exports, previous) {
if (exports !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports, "__esModule", { value: true });
}
else {
exports.__esModule = true;
}
}
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
2015-05-14 22:10:16 +03:00
}
})
(function (exporter) {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2016-06-11 09:14:18 +03:00
__extends = function (d, b) {
extendStatics(d, b);
2015-05-14 22:10:16 +03:00
function __() { this.constructor = d; }
2015-06-16 23:24:57 +03:00
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2016-05-18 23:25:21 +03:00
};
2016-06-11 09:14:18 +03:00
__assign = Object.assign || function (t) {
2016-05-18 23:25:21 +03:00
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
__rest = function (s, e) {
2016-11-10 21:08:31 +03:00
var t = {};
2016-11-16 20:59:59 +03:00
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2016-11-10 21:08:31 +03:00
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
2016-11-10 21:08:31 +03:00
return t;
};
2016-11-10 21:08:31 +03:00
2016-06-11 09:14:18 +03:00
__decorate = function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
2016-05-18 23:25:21 +03:00
};
2015-05-14 22:10:16 +03:00
2016-06-11 09:14:18 +03:00
__param = function (paramIndex, decorator) {
2015-05-14 22:10:16 +03:00
return function (target, key) { decorator(target, key, paramIndex); }
2016-05-18 23:25:21 +03:00
};
2016-06-11 09:14:18 +03:00
__metadata = function (metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
2016-05-18 23:25:21 +03:00
};
2016-06-11 09:14:18 +03:00
__awaiter = function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2016-05-18 23:25:21 +03:00
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2016-12-15 03:03:02 +03:00
step((generator = generator.apply(thisArg, _arguments || [])).next());
2015-06-16 23:24:29 +03:00
});
2016-05-18 23:25:21 +03:00
};
2015-05-14 22:10:16 +03:00
2016-09-09 23:27:19 +03:00
__generator = function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
2016-09-13 23:05:29 +03:00
function verb(n) { return function (v) { return step([n, v]); }; }
2016-09-09 23:27:19 +03:00
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
2016-09-13 23:05:29 +03:00
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
2016-09-13 23:05:29 +03:00
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
2016-09-09 23:27:19 +03:00
}
2016-09-13 23:05:29 +03:00
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2016-09-09 23:27:19 +03:00
}
};
__exportStar = function (m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
};
__values = function (o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
2017-01-01 05:11:04 +03:00
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
2017-01-01 05:11:04 +03:00
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
2019-08-06 20:53:00 +03:00
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read = function (o, n) {
2017-01-01 05:11:04 +03:00
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
2017-01-01 05:11:04 +03:00
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
2017-01-01 05:11:04 +03:00
if (r && !r.done && (m = i["return"])) m.call(i);
}
2017-01-01 05:11:04 +03:00
finally { if (e) throw e.error; }
}
return ar;
};
__spread = function () {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
};
2019-06-04 04:08:40 +03:00
__spreadArrays = function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__await = function (v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
};
2017-01-01 05:11:04 +03:00
__asyncGenerator = function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
2017-01-01 05:11:04 +03:00
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
2017-01-01 05:11:04 +03:00
};
__asyncDelegator = function (o) {
var i, p;
2017-05-16 01:32:33 +03:00
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
2017-01-01 05:11:04 +03:00
};
__asyncValues = function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
2017-01-01 05:11:04 +03:00
};
2017-09-19 00:44:49 +03:00
__makeTemplateObject = function (cooked, raw) {
2017-10-07 11:16:07 +03:00
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
2017-09-19 00:44:49 +03:00
return cooked;
};
2017-11-18 02:55:43 +03:00
__importStar = function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
2017-11-18 02:55:43 +03:00
result["default"] = mod;
return result;
};
__importDefault = function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
__classPrivateFieldGet = function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
};
__classPrivateFieldSet = function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
2016-06-11 09:14:18 +03:00
exporter("__extends", __extends);
exporter("__assign", __assign);
2016-11-10 21:08:31 +03:00
exporter("__rest", __rest);
2016-06-11 09:14:18 +03:00
exporter("__decorate", __decorate);
exporter("__param", __param);
exporter("__metadata", __metadata);
exporter("__awaiter", __awaiter);
2016-09-09 23:27:19 +03:00
exporter("__generator", __generator);
exporter("__exportStar", __exportStar);
exporter("__values", __values);
exporter("__read", __read);
exporter("__spread", __spread);
2019-06-04 04:08:40 +03:00
exporter("__spreadArrays", __spreadArrays);
exporter("__await", __await);
2017-01-01 05:11:04 +03:00
exporter("__asyncGenerator", __asyncGenerator);
exporter("__asyncDelegator", __asyncDelegator);
exporter("__asyncValues", __asyncValues);
2017-09-19 00:44:49 +03:00
exporter("__makeTemplateObject", __makeTemplateObject);
2017-11-18 02:55:43 +03:00
exporter("__importStar", __importStar);
exporter("__importDefault", __importDefault);
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
});