tslib.es6.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. /******************************************************************************
  2. Copyright (c) Microsoft Corporation.
  3. Permission to use, copy, modify, and/or distribute this software for any
  4. purpose with or without fee is hereby granted.
  5. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  6. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  7. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  8. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  9. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  10. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  11. PERFORMANCE OF THIS SOFTWARE.
  12. ***************************************************************************** */
  13. /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
  14. var extendStatics = function(d, b) {
  15. extendStatics = Object.setPrototypeOf ||
  16. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  18. return extendStatics(d, b);
  19. };
  20. export function __extends(d, b) {
  21. if (typeof b !== "function" && b !== null)
  22. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  23. extendStatics(d, b);
  24. function __() { this.constructor = d; }
  25. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  26. }
  27. export var __assign = function() {
  28. __assign = Object.assign || function __assign(t) {
  29. for (var s, i = 1, n = arguments.length; i < n; i++) {
  30. s = arguments[i];
  31. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  32. }
  33. return t;
  34. }
  35. return __assign.apply(this, arguments);
  36. }
  37. export function __rest(s, e) {
  38. var t = {};
  39. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  40. t[p] = s[p];
  41. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  42. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  43. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  44. t[p[i]] = s[p[i]];
  45. }
  46. return t;
  47. }
  48. export function __decorate(decorators, target, key, desc) {
  49. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  50. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  51. 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;
  52. return c > 3 && r && Object.defineProperty(target, key, r), r;
  53. }
  54. export function __param(paramIndex, decorator) {
  55. return function (target, key) { decorator(target, key, paramIndex); }
  56. }
  57. export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
  58. function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
  59. var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
  60. var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
  61. var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
  62. var _, done = false;
  63. for (var i = decorators.length - 1; i >= 0; i--) {
  64. var context = {};
  65. for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
  66. for (var p in contextIn.access) context.access[p] = contextIn.access[p];
  67. context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
  68. var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
  69. if (kind === "accessor") {
  70. if (result === void 0) continue;
  71. if (result === null || typeof result !== "object") throw new TypeError("Object expected");
  72. if (_ = accept(result.get)) descriptor.get = _;
  73. if (_ = accept(result.set)) descriptor.set = _;
  74. if (_ = accept(result.init)) initializers.unshift(_);
  75. }
  76. else if (_ = accept(result)) {
  77. if (kind === "field") initializers.unshift(_);
  78. else descriptor[key] = _;
  79. }
  80. }
  81. if (target) Object.defineProperty(target, contextIn.name, descriptor);
  82. done = true;
  83. };
  84. export function __runInitializers(thisArg, initializers, value) {
  85. var useValue = arguments.length > 2;
  86. for (var i = 0; i < initializers.length; i++) {
  87. value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
  88. }
  89. return useValue ? value : void 0;
  90. };
  91. export function __propKey(x) {
  92. return typeof x === "symbol" ? x : "".concat(x);
  93. };
  94. export function __setFunctionName(f, name, prefix) {
  95. if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
  96. return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
  97. };
  98. export function __metadata(metadataKey, metadataValue) {
  99. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  100. }
  101. export function __awaiter(thisArg, _arguments, P, generator) {
  102. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  103. return new (P || (P = Promise))(function (resolve, reject) {
  104. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  105. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  106. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  107. step((generator = generator.apply(thisArg, _arguments || [])).next());
  108. });
  109. }
  110. export function __generator(thisArg, body) {
  111. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
  112. return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  113. function verb(n) { return function (v) { return step([n, v]); }; }
  114. function step(op) {
  115. if (f) throw new TypeError("Generator is already executing.");
  116. while (g && (g = 0, op[0] && (_ = 0)), _) try {
  117. 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;
  118. if (y = 0, t) op = [op[0] & 2, t.value];
  119. switch (op[0]) {
  120. case 0: case 1: t = op; break;
  121. case 4: _.label++; return { value: op[1], done: false };
  122. case 5: _.label++; y = op[1]; op = [0]; continue;
  123. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  124. default:
  125. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  126. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  127. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  128. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  129. if (t[2]) _.ops.pop();
  130. _.trys.pop(); continue;
  131. }
  132. op = body.call(thisArg, _);
  133. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  134. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  135. }
  136. }
  137. export var __createBinding = Object.create ? (function(o, m, k, k2) {
  138. if (k2 === undefined) k2 = k;
  139. var desc = Object.getOwnPropertyDescriptor(m, k);
  140. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  141. desc = { enumerable: true, get: function() { return m[k]; } };
  142. }
  143. Object.defineProperty(o, k2, desc);
  144. }) : (function(o, m, k, k2) {
  145. if (k2 === undefined) k2 = k;
  146. o[k2] = m[k];
  147. });
  148. export function __exportStar(m, o) {
  149. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
  150. }
  151. export function __values(o) {
  152. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  153. if (m) return m.call(o);
  154. if (o && typeof o.length === "number") return {
  155. next: function () {
  156. if (o && i >= o.length) o = void 0;
  157. return { value: o && o[i++], done: !o };
  158. }
  159. };
  160. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  161. }
  162. export function __read(o, n) {
  163. var m = typeof Symbol === "function" && o[Symbol.iterator];
  164. if (!m) return o;
  165. var i = m.call(o), r, ar = [], e;
  166. try {
  167. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  168. }
  169. catch (error) { e = { error: error }; }
  170. finally {
  171. try {
  172. if (r && !r.done && (m = i["return"])) m.call(i);
  173. }
  174. finally { if (e) throw e.error; }
  175. }
  176. return ar;
  177. }
  178. /** @deprecated */
  179. export function __spread() {
  180. for (var ar = [], i = 0; i < arguments.length; i++)
  181. ar = ar.concat(__read(arguments[i]));
  182. return ar;
  183. }
  184. /** @deprecated */
  185. export function __spreadArrays() {
  186. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  187. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  188. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  189. r[k] = a[j];
  190. return r;
  191. }
  192. export function __spreadArray(to, from, pack) {
  193. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  194. if (ar || !(i in from)) {
  195. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  196. ar[i] = from[i];
  197. }
  198. }
  199. return to.concat(ar || Array.prototype.slice.call(from));
  200. }
  201. export function __await(v) {
  202. return this instanceof __await ? (this.v = v, this) : new __await(v);
  203. }
  204. export function __asyncGenerator(thisArg, _arguments, generator) {
  205. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  206. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  207. return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
  208. function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
  209. function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
  210. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  211. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  212. function fulfill(value) { resume("next", value); }
  213. function reject(value) { resume("throw", value); }
  214. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  215. }
  216. export function __asyncDelegator(o) {
  217. var i, p;
  218. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  219. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
  220. }
  221. export function __asyncValues(o) {
  222. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  223. var m = o[Symbol.asyncIterator], i;
  224. 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);
  225. 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); }); }; }
  226. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  227. }
  228. export function __makeTemplateObject(cooked, raw) {
  229. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  230. return cooked;
  231. };
  232. var __setModuleDefault = Object.create ? (function(o, v) {
  233. Object.defineProperty(o, "default", { enumerable: true, value: v });
  234. }) : function(o, v) {
  235. o["default"] = v;
  236. };
  237. var ownKeys = function(o) {
  238. ownKeys = Object.getOwnPropertyNames || function (o) {
  239. var ar = [];
  240. for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
  241. return ar;
  242. };
  243. return ownKeys(o);
  244. };
  245. export function __importStar(mod) {
  246. if (mod && mod.__esModule) return mod;
  247. var result = {};
  248. if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
  249. __setModuleDefault(result, mod);
  250. return result;
  251. }
  252. export function __importDefault(mod) {
  253. return (mod && mod.__esModule) ? mod : { default: mod };
  254. }
  255. export function __classPrivateFieldGet(receiver, state, kind, f) {
  256. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  257. if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  258. return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
  259. }
  260. export function __classPrivateFieldSet(receiver, state, value, kind, f) {
  261. if (kind === "m") throw new TypeError("Private method is not writable");
  262. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
  263. if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  264. return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
  265. }
  266. export function __classPrivateFieldIn(state, receiver) {
  267. if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
  268. return typeof state === "function" ? receiver === state : state.has(receiver);
  269. }
  270. export function __addDisposableResource(env, value, async) {
  271. if (value !== null && value !== void 0) {
  272. if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
  273. var dispose, inner;
  274. if (async) {
  275. if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
  276. dispose = value[Symbol.asyncDispose];
  277. }
  278. if (dispose === void 0) {
  279. if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
  280. dispose = value[Symbol.dispose];
  281. if (async) inner = dispose;
  282. }
  283. if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
  284. if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
  285. env.stack.push({ value: value, dispose: dispose, async: async });
  286. }
  287. else if (async) {
  288. env.stack.push({ async: true });
  289. }
  290. return value;
  291. }
  292. var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
  293. var e = new Error(message);
  294. return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
  295. };
  296. export function __disposeResources(env) {
  297. function fail(e) {
  298. env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
  299. env.hasError = true;
  300. }
  301. var r, s = 0;
  302. function next() {
  303. while (r = env.stack.pop()) {
  304. try {
  305. if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
  306. if (r.dispose) {
  307. var result = r.dispose.call(r.value);
  308. if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
  309. }
  310. else s |= 1;
  311. }
  312. catch (e) {
  313. fail(e);
  314. }
  315. }
  316. if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
  317. if (env.hasError) throw env.error;
  318. }
  319. return next();
  320. }
  321. export function __rewriteRelativeImportExtension(path, preserveJsx) {
  322. if (typeof path === "string" && /^\.\.?\//.test(path)) {
  323. return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
  324. return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
  325. });
  326. }
  327. return path;
  328. }
  329. export default {
  330. __extends: __extends,
  331. __assign: __assign,
  332. __rest: __rest,
  333. __decorate: __decorate,
  334. __param: __param,
  335. __esDecorate: __esDecorate,
  336. __runInitializers: __runInitializers,
  337. __propKey: __propKey,
  338. __setFunctionName: __setFunctionName,
  339. __metadata: __metadata,
  340. __awaiter: __awaiter,
  341. __generator: __generator,
  342. __createBinding: __createBinding,
  343. __exportStar: __exportStar,
  344. __values: __values,
  345. __read: __read,
  346. __spread: __spread,
  347. __spreadArrays: __spreadArrays,
  348. __spreadArray: __spreadArray,
  349. __await: __await,
  350. __asyncGenerator: __asyncGenerator,
  351. __asyncDelegator: __asyncDelegator,
  352. __asyncValues: __asyncValues,
  353. __makeTemplateObject: __makeTemplateObject,
  354. __importStar: __importStar,
  355. __importDefault: __importDefault,
  356. __classPrivateFieldGet: __classPrivateFieldGet,
  357. __classPrivateFieldSet: __classPrivateFieldSet,
  358. __classPrivateFieldIn: __classPrivateFieldIn,
  359. __addDisposableResource: __addDisposableResource,
  360. __disposeResources: __disposeResources,
  361. __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
  362. };