UNPKG

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