799b821b854f9e81019f0ced3769d1f0c4938cad
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-clangd / lib / index.js
1 (function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
2 /******/ (() => { // webpackBootstrap
3 /******/        var __webpack_modules__ = ([
4 /* 0 */
5 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6
7 "use strict";
8
9 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10     if (k2 === undefined) k2 = k;
11     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12 }) : (function(o, m, k, k2) {
13     if (k2 === undefined) k2 = k;
14     o[k2] = m[k];
15 }));
16 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17     Object.defineProperty(o, "default", { enumerable: true, value: v });
18 }) : function(o, v) {
19     o["default"] = v;
20 });
21 var __importStar = (this && this.__importStar) || function (mod) {
22     if (mod && mod.__esModule) return mod;
23     var result = {};
24     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25     __setModuleDefault(result, mod);
26     return result;
27 };
28 Object.defineProperty(exports, "__esModule", ({ value: true }));
29 exports.activate = void 0;
30 const coc_nvim_1 = __webpack_require__(1);
31 const path_1 = __webpack_require__(2);
32 const cmds = __importStar(__webpack_require__(3));
33 const ctx_1 = __webpack_require__(33);
34 const file_status_1 = __webpack_require__(36);
35 const install = __importStar(__webpack_require__(37));
36 async function activate(context) {
37     var _a;
38     const ctx = new ctx_1.Ctx(context);
39     if (!ctx.config.enabled) {
40         return;
41     }
42     for (const service of coc_nvim_1.services.getServiceStats()) {
43         if (service.id.includes('clangd')) {
44             coc_nvim_1.workspace.showMessage(`Looks like you've configured clangd in coc-settings.json, you should remove it to use coc-clangd`, 'warning');
45             return;
46         }
47     }
48     const clangdPath = await install.activate(context);
49     if (!clangdPath) {
50         return;
51     }
52     try {
53         await ctx.startServer(clangdPath);
54     }
55     catch (e) {
56         return;
57     }
58     const fileStatus = new file_status_1.FileStatus();
59     const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher('**/{compile_commands.json,compile_flags.txt}');
60     fileWatcher.onDidChange((e) => reload(e.fsPath, ctx, context));
61     fileWatcher.onDidCreate((e) => reload(e.fsPath, ctx, context));
62     context.subscriptions.push(fileWatcher, fileStatus, coc_nvim_1.commands.registerCommand('clangd.switchSourceHeader', cmds.switchSourceHeader(ctx)), coc_nvim_1.commands.registerCommand('clangd.symbolInfo', cmds.symbolInfo(ctx)), ctx.client.onDidChangeState((e) => {
63         var _a;
64         if (e.newState === coc_nvim_1.State.Running) {
65             (_a = ctx.client) === null || _a === void 0 ? void 0 : _a.onNotification('textDocument/clangd.fileStatus', (status) => {
66                 fileStatus.onFileUpdated(status);
67             });
68         }
69         else if (e.newState === coc_nvim_1.State.Stopped) {
70             fileStatus.clear();
71         }
72     }), coc_nvim_1.workspace.onDidOpenTextDocument(() => {
73         fileStatus.updateStatus();
74     }));
75     (_a = ctx.client) === null || _a === void 0 ? void 0 : _a.onNotification('textDocument/clangd.fileStatus', (status) => {
76         fileStatus.onFileUpdated(status);
77     });
78 }
79 exports.activate = activate;
80 async function reload(url, ctx, context) {
81     const notification = ctx.config.showDBChangedNotification;
82     if (notification) {
83         const msg = `${path_1.basename(url)} has changed, clangd is reloading...`;
84         coc_nvim_1.workspace.showMessage(msg);
85     }
86     for (const sub of ctx.subscriptions) {
87         try {
88             sub.dispose();
89         }
90         catch (e) {
91             console.error(e);
92         }
93     }
94     await activate(context);
95     if (notification)
96         coc_nvim_1.workspace.showMessage(`clangd has reloaded`);
97 }
98
99
100 /***/ }),
101 /* 1 */
102 /***/ ((module) => {
103
104 "use strict";
105 module.exports = require("coc.nvim");;
106
107 /***/ }),
108 /* 2 */
109 /***/ ((module) => {
110
111 "use strict";
112 module.exports = require("path");;
113
114 /***/ }),
115 /* 3 */
116 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
117
118 "use strict";
119
120 Object.defineProperty(exports, "__esModule", ({ value: true }));
121 exports.symbolInfo = exports.switchSourceHeader = void 0;
122 const coc_nvim_1 = __webpack_require__(1);
123 const vscode_languageserver_protocol_1 = __webpack_require__(4);
124 var SwitchSourceHeaderRequest;
125 (function (SwitchSourceHeaderRequest) {
126     SwitchSourceHeaderRequest.type = new vscode_languageserver_protocol_1.RequestType('textDocument/switchSourceHeader');
127 })(SwitchSourceHeaderRequest || (SwitchSourceHeaderRequest = {}));
128 var SymbolInfoRequest;
129 (function (SymbolInfoRequest) {
130     SymbolInfoRequest.type = new vscode_languageserver_protocol_1.RequestType('textDocument/symbolInfo');
131 })(SymbolInfoRequest || (SymbolInfoRequest = {}));
132 function switchSourceHeader(ctx) {
133     return async () => {
134         if (!ctx.client) {
135             return;
136         }
137         const doc = await coc_nvim_1.workspace.document;
138         if (!doc) {
139             return;
140         }
141         const params = {
142             uri: doc.uri,
143         };
144         const dest = await ctx.client.sendRequest(SwitchSourceHeaderRequest.type.method, params);
145         if (!dest) {
146             coc_nvim_1.workspace.showMessage(`Didn't find a corresponding file.`);
147             return;
148         }
149         await coc_nvim_1.workspace.jumpTo(dest);
150     };
151 }
152 exports.switchSourceHeader = switchSourceHeader;
153 function symbolInfo(ctx) {
154     return async () => {
155         if (!ctx.client) {
156             return;
157         }
158         const doc = await coc_nvim_1.workspace.document;
159         if (!doc) {
160             return;
161         }
162         const position = await coc_nvim_1.workspace.getCursorPosition();
163         const params = {
164             textDocument: { uri: doc.uri },
165             position,
166         };
167         const details = await ctx.client.sendRequest(SymbolInfoRequest.type.method, params);
168         if (!details.length) {
169             return;
170         }
171         // TODO
172         const detail = details[0];
173         coc_nvim_1.workspace.showMessage(`name: ${detail.name}, containerName: ${detail.containerName}, usr: ${detail.usr}`);
174     };
175 }
176 exports.symbolInfo = symbolInfo;
177
178
179 /***/ }),
180 /* 4 */
181 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
182
183 "use strict";
184 /* --------------------------------------------------------------------------------------------\r
185  * Copyright (c) Microsoft Corporation. All rights reserved.\r
186  * Licensed under the MIT License. See License.txt in the project root for license information.\r
187  * ------------------------------------------------------------------------------------------ */\r
188 \r
189 function __export(m) {\r
190     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
191 }\r
192 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
193 const vscode_jsonrpc_1 = __webpack_require__(5);\r
194 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
195 exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
196 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
197 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
198 exports.Disposable = vscode_jsonrpc_1.Disposable;\r
199 exports.Event = vscode_jsonrpc_1.Event;\r
200 exports.Emitter = vscode_jsonrpc_1.Emitter;\r
201 exports.Trace = vscode_jsonrpc_1.Trace;\r
202 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
203 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
204 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
205 exports.RequestType = vscode_jsonrpc_1.RequestType;\r
206 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
207 exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
208 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
209 exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
210 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
211 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
212 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
213 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
214 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
215 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
216 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
217 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
218 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
219 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
220 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
221 exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
222 __export(__webpack_require__(18));\r
223 __export(__webpack_require__(19));\r
224 const callHierarchy = __webpack_require__(31);\r
225 const st = __webpack_require__(32);\r
226 var Proposed;\r
227 (function (Proposed) {\r
228     let CallHierarchyPrepareRequest;\r
229     (function (CallHierarchyPrepareRequest) {\r
230         CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
231         CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
232     })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
233     let CallHierarchyIncomingCallsRequest;\r
234     (function (CallHierarchyIncomingCallsRequest) {\r
235         CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
236         CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;\r
237     })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
238     let CallHierarchyOutgoingCallsRequest;\r
239     (function (CallHierarchyOutgoingCallsRequest) {\r
240         CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
241         CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;\r
242     })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
243     Proposed.SemanticTokenTypes = st.SemanticTokenTypes;\r
244     Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;\r
245     Proposed.SemanticTokens = st.SemanticTokens;\r
246     let SemanticTokensRequest;\r
247     (function (SemanticTokensRequest) {\r
248         SemanticTokensRequest.method = st.SemanticTokensRequest.method;\r
249         SemanticTokensRequest.type = st.SemanticTokensRequest.type;\r
250     })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));\r
251     let SemanticTokensEditsRequest;\r
252     (function (SemanticTokensEditsRequest) {\r
253         SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;\r
254         SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;\r
255     })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));\r
256     let SemanticTokensRangeRequest;\r
257     (function (SemanticTokensRangeRequest) {\r
258         SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;\r
259         SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;\r
260     })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));\r
261 })(Proposed = exports.Proposed || (exports.Proposed = {}));\r
262 function createProtocolConnection(reader, writer, logger, strategy) {\r
263     return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
264 }\r
265 exports.createProtocolConnection = createProtocolConnection;\r
266
267
268 /***/ }),
269 /* 5 */
270 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
271
272 "use strict";
273 /* --------------------------------------------------------------------------------------------\r
274  * Copyright (c) Microsoft Corporation. All rights reserved.\r
275  * Licensed under the MIT License. See License.txt in the project root for license information.\r
276  * ------------------------------------------------------------------------------------------ */\r
277 /// <reference path="../typings/thenable.d.ts" />\r
278 \r
279 function __export(m) {\r
280     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
281 }\r
282 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
283 const Is = __webpack_require__(6);\r
284 const messages_1 = __webpack_require__(7);\r
285 exports.RequestType = messages_1.RequestType;\r
286 exports.RequestType0 = messages_1.RequestType0;\r
287 exports.RequestType1 = messages_1.RequestType1;\r
288 exports.RequestType2 = messages_1.RequestType2;\r
289 exports.RequestType3 = messages_1.RequestType3;\r
290 exports.RequestType4 = messages_1.RequestType4;\r
291 exports.RequestType5 = messages_1.RequestType5;\r
292 exports.RequestType6 = messages_1.RequestType6;\r
293 exports.RequestType7 = messages_1.RequestType7;\r
294 exports.RequestType8 = messages_1.RequestType8;\r
295 exports.RequestType9 = messages_1.RequestType9;\r
296 exports.ResponseError = messages_1.ResponseError;\r
297 exports.ErrorCodes = messages_1.ErrorCodes;\r
298 exports.NotificationType = messages_1.NotificationType;\r
299 exports.NotificationType0 = messages_1.NotificationType0;\r
300 exports.NotificationType1 = messages_1.NotificationType1;\r
301 exports.NotificationType2 = messages_1.NotificationType2;\r
302 exports.NotificationType3 = messages_1.NotificationType3;\r
303 exports.NotificationType4 = messages_1.NotificationType4;\r
304 exports.NotificationType5 = messages_1.NotificationType5;\r
305 exports.NotificationType6 = messages_1.NotificationType6;\r
306 exports.NotificationType7 = messages_1.NotificationType7;\r
307 exports.NotificationType8 = messages_1.NotificationType8;\r
308 exports.NotificationType9 = messages_1.NotificationType9;\r
309 const messageReader_1 = __webpack_require__(8);\r
310 exports.MessageReader = messageReader_1.MessageReader;\r
311 exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
312 exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
313 exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
314 const messageWriter_1 = __webpack_require__(10);\r
315 exports.MessageWriter = messageWriter_1.MessageWriter;\r
316 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
317 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
318 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
319 const events_1 = __webpack_require__(9);\r
320 exports.Disposable = events_1.Disposable;\r
321 exports.Event = events_1.Event;\r
322 exports.Emitter = events_1.Emitter;\r
323 const cancellation_1 = __webpack_require__(11);\r
324 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
325 exports.CancellationToken = cancellation_1.CancellationToken;\r
326 const linkedMap_1 = __webpack_require__(12);\r
327 __export(__webpack_require__(13));\r
328 __export(__webpack_require__(17));\r
329 var CancelNotification;\r
330 (function (CancelNotification) {\r
331     CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
332 })(CancelNotification || (CancelNotification = {}));\r
333 var ProgressNotification;\r
334 (function (ProgressNotification) {\r
335     ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
336 })(ProgressNotification || (ProgressNotification = {}));\r
337 class ProgressType {\r
338     constructor() {\r
339     }\r
340 }\r
341 exports.ProgressType = ProgressType;\r
342 exports.NullLogger = Object.freeze({\r
343     error: () => { },\r
344     warn: () => { },\r
345     info: () => { },\r
346     log: () => { }\r
347 });\r
348 var Trace;\r
349 (function (Trace) {\r
350     Trace[Trace["Off"] = 0] = "Off";\r
351     Trace[Trace["Messages"] = 1] = "Messages";\r
352     Trace[Trace["Verbose"] = 2] = "Verbose";\r
353 })(Trace = exports.Trace || (exports.Trace = {}));\r
354 (function (Trace) {\r
355     function fromString(value) {\r
356         if (!Is.string(value)) {\r
357             return Trace.Off;\r
358         }\r
359         value = value.toLowerCase();\r
360         switch (value) {\r
361             case 'off':\r
362                 return Trace.Off;\r
363             case 'messages':\r
364                 return Trace.Messages;\r
365             case 'verbose':\r
366                 return Trace.Verbose;\r
367             default:\r
368                 return Trace.Off;\r
369         }\r
370     }\r
371     Trace.fromString = fromString;\r
372     function toString(value) {\r
373         switch (value) {\r
374             case Trace.Off:\r
375                 return 'off';\r
376             case Trace.Messages:\r
377                 return 'messages';\r
378             case Trace.Verbose:\r
379                 return 'verbose';\r
380             default:\r
381                 return 'off';\r
382         }\r
383     }\r
384     Trace.toString = toString;\r
385 })(Trace = exports.Trace || (exports.Trace = {}));\r
386 var TraceFormat;\r
387 (function (TraceFormat) {\r
388     TraceFormat["Text"] = "text";\r
389     TraceFormat["JSON"] = "json";\r
390 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
391 (function (TraceFormat) {\r
392     function fromString(value) {\r
393         value = value.toLowerCase();\r
394         if (value === 'json') {\r
395             return TraceFormat.JSON;\r
396         }\r
397         else {\r
398             return TraceFormat.Text;\r
399         }\r
400     }\r
401     TraceFormat.fromString = fromString;\r
402 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
403 var SetTraceNotification;\r
404 (function (SetTraceNotification) {\r
405     SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
406 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
407 var LogTraceNotification;\r
408 (function (LogTraceNotification) {\r
409     LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
410 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
411 var ConnectionErrors;\r
412 (function (ConnectionErrors) {\r
413     /**\r
414      * The connection is closed.\r
415      */\r
416     ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
417     /**\r
418      * The connection got disposed.\r
419      */\r
420     ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
421     /**\r
422      * The connection is already in listening mode.\r
423      */\r
424     ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
425 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
426 class ConnectionError extends Error {\r
427     constructor(code, message) {\r
428         super(message);\r
429         this.code = code;\r
430         Object.setPrototypeOf(this, ConnectionError.prototype);\r
431     }\r
432 }\r
433 exports.ConnectionError = ConnectionError;\r
434 var ConnectionStrategy;\r
435 (function (ConnectionStrategy) {\r
436     function is(value) {\r
437         let candidate = value;\r
438         return candidate && Is.func(candidate.cancelUndispatched);\r
439     }\r
440     ConnectionStrategy.is = is;\r
441 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
442 var ConnectionState;\r
443 (function (ConnectionState) {\r
444     ConnectionState[ConnectionState["New"] = 1] = "New";\r
445     ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
446     ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
447     ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
448 })(ConnectionState || (ConnectionState = {}));\r
449 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
450     let sequenceNumber = 0;\r
451     let notificationSquenceNumber = 0;\r
452     let unknownResponseSquenceNumber = 0;\r
453     const version = '2.0';\r
454     let starRequestHandler = undefined;\r
455     let requestHandlers = Object.create(null);\r
456     let starNotificationHandler = undefined;\r
457     let notificationHandlers = Object.create(null);\r
458     let progressHandlers = new Map();\r
459     let timer;\r
460     let messageQueue = new linkedMap_1.LinkedMap();\r
461     let responsePromises = Object.create(null);\r
462     let requestTokens = Object.create(null);\r
463     let trace = Trace.Off;\r
464     let traceFormat = TraceFormat.Text;\r
465     let tracer;\r
466     let state = ConnectionState.New;\r
467     let errorEmitter = new events_1.Emitter();\r
468     let closeEmitter = new events_1.Emitter();\r
469     let unhandledNotificationEmitter = new events_1.Emitter();\r
470     let unhandledProgressEmitter = new events_1.Emitter();\r
471     let disposeEmitter = new events_1.Emitter();\r
472     function createRequestQueueKey(id) {\r
473         return 'req-' + id.toString();\r
474     }\r
475     function createResponseQueueKey(id) {\r
476         if (id === null) {\r
477             return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
478         }\r
479         else {\r
480             return 'res-' + id.toString();\r
481         }\r
482     }\r
483     function createNotificationQueueKey() {\r
484         return 'not-' + (++notificationSquenceNumber).toString();\r
485     }\r
486     function addMessageToQueue(queue, message) {\r
487         if (messages_1.isRequestMessage(message)) {\r
488             queue.set(createRequestQueueKey(message.id), message);\r
489         }\r
490         else if (messages_1.isResponseMessage(message)) {\r
491             queue.set(createResponseQueueKey(message.id), message);\r
492         }\r
493         else {\r
494             queue.set(createNotificationQueueKey(), message);\r
495         }\r
496     }\r
497     function cancelUndispatched(_message) {\r
498         return undefined;\r
499     }\r
500     function isListening() {\r
501         return state === ConnectionState.Listening;\r
502     }\r
503     function isClosed() {\r
504         return state === ConnectionState.Closed;\r
505     }\r
506     function isDisposed() {\r
507         return state === ConnectionState.Disposed;\r
508     }\r
509     function closeHandler() {\r
510         if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
511             state = ConnectionState.Closed;\r
512             closeEmitter.fire(undefined);\r
513         }\r
514         // If the connection is disposed don't sent close events.\r
515     }\r
516     function readErrorHandler(error) {\r
517         errorEmitter.fire([error, undefined, undefined]);\r
518     }\r
519     function writeErrorHandler(data) {\r
520         errorEmitter.fire(data);\r
521     }\r
522     messageReader.onClose(closeHandler);\r
523     messageReader.onError(readErrorHandler);\r
524     messageWriter.onClose(closeHandler);\r
525     messageWriter.onError(writeErrorHandler);\r
526     function triggerMessageQueue() {\r
527         if (timer || messageQueue.size === 0) {\r
528             return;\r
529         }\r
530         timer = setImmediate(() => {\r
531             timer = undefined;\r
532             processMessageQueue();\r
533         });\r
534     }\r
535     function processMessageQueue() {\r
536         if (messageQueue.size === 0) {\r
537             return;\r
538         }\r
539         let message = messageQueue.shift();\r
540         try {\r
541             if (messages_1.isRequestMessage(message)) {\r
542                 handleRequest(message);\r
543             }\r
544             else if (messages_1.isNotificationMessage(message)) {\r
545                 handleNotification(message);\r
546             }\r
547             else if (messages_1.isResponseMessage(message)) {\r
548                 handleResponse(message);\r
549             }\r
550             else {\r
551                 handleInvalidMessage(message);\r
552             }\r
553         }\r
554         finally {\r
555             triggerMessageQueue();\r
556         }\r
557     }\r
558     let callback = (message) => {\r
559         try {\r
560             // We have received a cancellation message. Check if the message is still in the queue\r
561             // and cancel it if allowed to do so.\r
562             if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
563                 let key = createRequestQueueKey(message.params.id);\r
564                 let toCancel = messageQueue.get(key);\r
565                 if (messages_1.isRequestMessage(toCancel)) {\r
566                     let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
567                     if (response && (response.error !== void 0 || response.result !== void 0)) {\r
568                         messageQueue.delete(key);\r
569                         response.id = toCancel.id;\r
570                         traceSendingResponse(response, message.method, Date.now());\r
571                         messageWriter.write(response);\r
572                         return;\r
573                     }\r
574                 }\r
575             }\r
576             addMessageToQueue(messageQueue, message);\r
577         }\r
578         finally {\r
579             triggerMessageQueue();\r
580         }\r
581     };\r
582     function handleRequest(requestMessage) {\r
583         if (isDisposed()) {\r
584             // we return here silently since we fired an event when the\r
585             // connection got disposed.\r
586             return;\r
587         }\r
588         function reply(resultOrError, method, startTime) {\r
589             let message = {\r
590                 jsonrpc: version,\r
591                 id: requestMessage.id\r
592             };\r
593             if (resultOrError instanceof messages_1.ResponseError) {\r
594                 message.error = resultOrError.toJson();\r
595             }\r
596             else {\r
597                 message.result = resultOrError === void 0 ? null : resultOrError;\r
598             }\r
599             traceSendingResponse(message, method, startTime);\r
600             messageWriter.write(message);\r
601         }\r
602         function replyError(error, method, startTime) {\r
603             let message = {\r
604                 jsonrpc: version,\r
605                 id: requestMessage.id,\r
606                 error: error.toJson()\r
607             };\r
608             traceSendingResponse(message, method, startTime);\r
609             messageWriter.write(message);\r
610         }\r
611         function replySuccess(result, method, startTime) {\r
612             // The JSON RPC defines that a response must either have a result or an error\r
613             // So we can't treat undefined as a valid response result.\r
614             if (result === void 0) {\r
615                 result = null;\r
616             }\r
617             let message = {\r
618                 jsonrpc: version,\r
619                 id: requestMessage.id,\r
620                 result: result\r
621             };\r
622             traceSendingResponse(message, method, startTime);\r
623             messageWriter.write(message);\r
624         }\r
625         traceReceivedRequest(requestMessage);\r
626         let element = requestHandlers[requestMessage.method];\r
627         let type;\r
628         let requestHandler;\r
629         if (element) {\r
630             type = element.type;\r
631             requestHandler = element.handler;\r
632         }\r
633         let startTime = Date.now();\r
634         if (requestHandler || starRequestHandler) {\r
635             let cancellationSource = new cancellation_1.CancellationTokenSource();\r
636             let tokenKey = String(requestMessage.id);\r
637             requestTokens[tokenKey] = cancellationSource;\r
638             try {\r
639                 let handlerResult;\r
640                 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
641                     handlerResult = requestHandler\r
642                         ? requestHandler(cancellationSource.token)\r
643                         : starRequestHandler(requestMessage.method, cancellationSource.token);\r
644                 }\r
645                 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
646                     handlerResult = requestHandler\r
647                         ? requestHandler(...requestMessage.params, cancellationSource.token)\r
648                         : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
649                 }\r
650                 else {\r
651                     handlerResult = requestHandler\r
652                         ? requestHandler(requestMessage.params, cancellationSource.token)\r
653                         : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
654                 }\r
655                 let promise = handlerResult;\r
656                 if (!handlerResult) {\r
657                     delete requestTokens[tokenKey];\r
658                     replySuccess(handlerResult, requestMessage.method, startTime);\r
659                 }\r
660                 else if (promise.then) {\r
661                     promise.then((resultOrError) => {\r
662                         delete requestTokens[tokenKey];\r
663                         reply(resultOrError, requestMessage.method, startTime);\r
664                     }, error => {\r
665                         delete requestTokens[tokenKey];\r
666                         if (error instanceof messages_1.ResponseError) {\r
667                             replyError(error, requestMessage.method, startTime);\r
668                         }\r
669                         else if (error && Is.string(error.message)) {\r
670                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
671                         }\r
672                         else {\r
673                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
674                         }\r
675                     });\r
676                 }\r
677                 else {\r
678                     delete requestTokens[tokenKey];\r
679                     reply(handlerResult, requestMessage.method, startTime);\r
680                 }\r
681             }\r
682             catch (error) {\r
683                 delete requestTokens[tokenKey];\r
684                 if (error instanceof messages_1.ResponseError) {\r
685                     reply(error, requestMessage.method, startTime);\r
686                 }\r
687                 else if (error && Is.string(error.message)) {\r
688                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
689                 }\r
690                 else {\r
691                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
692                 }\r
693             }\r
694         }\r
695         else {\r
696             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
697         }\r
698     }\r
699     function handleResponse(responseMessage) {\r
700         if (isDisposed()) {\r
701             // See handle request.\r
702             return;\r
703         }\r
704         if (responseMessage.id === null) {\r
705             if (responseMessage.error) {\r
706                 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
707             }\r
708             else {\r
709                 logger.error(`Received response message without id. No further error information provided.`);\r
710             }\r
711         }\r
712         else {\r
713             let key = String(responseMessage.id);\r
714             let responsePromise = responsePromises[key];\r
715             traceReceivedResponse(responseMessage, responsePromise);\r
716             if (responsePromise) {\r
717                 delete responsePromises[key];\r
718                 try {\r
719                     if (responseMessage.error) {\r
720                         let error = responseMessage.error;\r
721                         responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
722                     }\r
723                     else if (responseMessage.result !== void 0) {\r
724                         responsePromise.resolve(responseMessage.result);\r
725                     }\r
726                     else {\r
727                         throw new Error('Should never happen.');\r
728                     }\r
729                 }\r
730                 catch (error) {\r
731                     if (error.message) {\r
732                         logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
733                     }\r
734                     else {\r
735                         logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
736                     }\r
737                 }\r
738             }\r
739         }\r
740     }\r
741     function handleNotification(message) {\r
742         if (isDisposed()) {\r
743             // See handle request.\r
744             return;\r
745         }\r
746         let type = undefined;\r
747         let notificationHandler;\r
748         if (message.method === CancelNotification.type.method) {\r
749             notificationHandler = (params) => {\r
750                 let id = params.id;\r
751                 let source = requestTokens[String(id)];\r
752                 if (source) {\r
753                     source.cancel();\r
754                 }\r
755             };\r
756         }\r
757         else {\r
758             let element = notificationHandlers[message.method];\r
759             if (element) {\r
760                 notificationHandler = element.handler;\r
761                 type = element.type;\r
762             }\r
763         }\r
764         if (notificationHandler || starNotificationHandler) {\r
765             try {\r
766                 traceReceivedNotification(message);\r
767                 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
768                     notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
769                 }\r
770                 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
771                     notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
772                 }\r
773                 else {\r
774                     notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
775                 }\r
776             }\r
777             catch (error) {\r
778                 if (error.message) {\r
779                     logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
780                 }\r
781                 else {\r
782                     logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
783                 }\r
784             }\r
785         }\r
786         else {\r
787             unhandledNotificationEmitter.fire(message);\r
788         }\r
789     }\r
790     function handleInvalidMessage(message) {\r
791         if (!message) {\r
792             logger.error('Received empty message.');\r
793             return;\r
794         }\r
795         logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
796         // Test whether we find an id to reject the promise\r
797         let responseMessage = message;\r
798         if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
799             let key = String(responseMessage.id);\r
800             let responseHandler = responsePromises[key];\r
801             if (responseHandler) {\r
802                 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
803             }\r
804         }\r
805     }\r
806     function traceSendingRequest(message) {\r
807         if (trace === Trace.Off || !tracer) {\r
808             return;\r
809         }\r
810         if (traceFormat === TraceFormat.Text) {\r
811             let data = undefined;\r
812             if (trace === Trace.Verbose && message.params) {\r
813                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
814             }\r
815             tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
816         }\r
817         else {\r
818             logLSPMessage('send-request', message);\r
819         }\r
820     }\r
821     function traceSendingNotification(message) {\r
822         if (trace === Trace.Off || !tracer) {\r
823             return;\r
824         }\r
825         if (traceFormat === TraceFormat.Text) {\r
826             let data = undefined;\r
827             if (trace === Trace.Verbose) {\r
828                 if (message.params) {\r
829                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
830                 }\r
831                 else {\r
832                     data = 'No parameters provided.\n\n';\r
833                 }\r
834             }\r
835             tracer.log(`Sending notification '${message.method}'.`, data);\r
836         }\r
837         else {\r
838             logLSPMessage('send-notification', message);\r
839         }\r
840     }\r
841     function traceSendingResponse(message, method, startTime) {\r
842         if (trace === Trace.Off || !tracer) {\r
843             return;\r
844         }\r
845         if (traceFormat === TraceFormat.Text) {\r
846             let data = undefined;\r
847             if (trace === Trace.Verbose) {\r
848                 if (message.error && message.error.data) {\r
849                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
850                 }\r
851                 else {\r
852                     if (message.result) {\r
853                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
854                     }\r
855                     else if (message.error === void 0) {\r
856                         data = 'No result returned.\n\n';\r
857                     }\r
858                 }\r
859             }\r
860             tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
861         }\r
862         else {\r
863             logLSPMessage('send-response', message);\r
864         }\r
865     }\r
866     function traceReceivedRequest(message) {\r
867         if (trace === Trace.Off || !tracer) {\r
868             return;\r
869         }\r
870         if (traceFormat === TraceFormat.Text) {\r
871             let data = undefined;\r
872             if (trace === Trace.Verbose && message.params) {\r
873                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
874             }\r
875             tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
876         }\r
877         else {\r
878             logLSPMessage('receive-request', message);\r
879         }\r
880     }\r
881     function traceReceivedNotification(message) {\r
882         if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
883             return;\r
884         }\r
885         if (traceFormat === TraceFormat.Text) {\r
886             let data = undefined;\r
887             if (trace === Trace.Verbose) {\r
888                 if (message.params) {\r
889                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
890                 }\r
891                 else {\r
892                     data = 'No parameters provided.\n\n';\r
893                 }\r
894             }\r
895             tracer.log(`Received notification '${message.method}'.`, data);\r
896         }\r
897         else {\r
898             logLSPMessage('receive-notification', message);\r
899         }\r
900     }\r
901     function traceReceivedResponse(message, responsePromise) {\r
902         if (trace === Trace.Off || !tracer) {\r
903             return;\r
904         }\r
905         if (traceFormat === TraceFormat.Text) {\r
906             let data = undefined;\r
907             if (trace === Trace.Verbose) {\r
908                 if (message.error && message.error.data) {\r
909                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
910                 }\r
911                 else {\r
912                     if (message.result) {\r
913                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
914                     }\r
915                     else if (message.error === void 0) {\r
916                         data = 'No result returned.\n\n';\r
917                     }\r
918                 }\r
919             }\r
920             if (responsePromise) {\r
921                 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
922                 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
923             }\r
924             else {\r
925                 tracer.log(`Received response ${message.id} without active response promise.`, data);\r
926             }\r
927         }\r
928         else {\r
929             logLSPMessage('receive-response', message);\r
930         }\r
931     }\r
932     function logLSPMessage(type, message) {\r
933         if (!tracer || trace === Trace.Off) {\r
934             return;\r
935         }\r
936         const lspMessage = {\r
937             isLSPMessage: true,\r
938             type,\r
939             message,\r
940             timestamp: Date.now()\r
941         };\r
942         tracer.log(lspMessage);\r
943     }\r
944     function throwIfClosedOrDisposed() {\r
945         if (isClosed()) {\r
946             throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
947         }\r
948         if (isDisposed()) {\r
949             throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
950         }\r
951     }\r
952     function throwIfListening() {\r
953         if (isListening()) {\r
954             throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
955         }\r
956     }\r
957     function throwIfNotListening() {\r
958         if (!isListening()) {\r
959             throw new Error('Call listen() first.');\r
960         }\r
961     }\r
962     function undefinedToNull(param) {\r
963         if (param === void 0) {\r
964             return null;\r
965         }\r
966         else {\r
967             return param;\r
968         }\r
969     }\r
970     function computeMessageParams(type, params) {\r
971         let result;\r
972         let numberOfParams = type.numberOfParams;\r
973         switch (numberOfParams) {\r
974             case 0:\r
975                 result = null;\r
976                 break;\r
977             case 1:\r
978                 result = undefinedToNull(params[0]);\r
979                 break;\r
980             default:\r
981                 result = [];\r
982                 for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
983                     result.push(undefinedToNull(params[i]));\r
984                 }\r
985                 if (params.length < numberOfParams) {\r
986                     for (let i = params.length; i < numberOfParams; i++) {\r
987                         result.push(null);\r
988                     }\r
989                 }\r
990                 break;\r
991         }\r
992         return result;\r
993     }\r
994     let connection = {\r
995         sendNotification: (type, ...params) => {\r
996             throwIfClosedOrDisposed();\r
997             let method;\r
998             let messageParams;\r
999             if (Is.string(type)) {\r
1000                 method = type;\r
1001                 switch (params.length) {\r
1002                     case 0:\r
1003                         messageParams = null;\r
1004                         break;\r
1005                     case 1:\r
1006                         messageParams = params[0];\r
1007                         break;\r
1008                     default:\r
1009                         messageParams = params;\r
1010                         break;\r
1011                 }\r
1012             }\r
1013             else {\r
1014                 method = type.method;\r
1015                 messageParams = computeMessageParams(type, params);\r
1016             }\r
1017             let notificationMessage = {\r
1018                 jsonrpc: version,\r
1019                 method: method,\r
1020                 params: messageParams\r
1021             };\r
1022             traceSendingNotification(notificationMessage);\r
1023             messageWriter.write(notificationMessage);\r
1024         },\r
1025         onNotification: (type, handler) => {\r
1026             throwIfClosedOrDisposed();\r
1027             if (Is.func(type)) {\r
1028                 starNotificationHandler = type;\r
1029             }\r
1030             else if (handler) {\r
1031                 if (Is.string(type)) {\r
1032                     notificationHandlers[type] = { type: undefined, handler };\r
1033                 }\r
1034                 else {\r
1035                     notificationHandlers[type.method] = { type, handler };\r
1036                 }\r
1037             }\r
1038         },\r
1039         onProgress: (_type, token, handler) => {\r
1040             if (progressHandlers.has(token)) {\r
1041                 throw new Error(`Progress handler for token ${token} already registered`);\r
1042             }\r
1043             progressHandlers.set(token, handler);\r
1044             return {\r
1045                 dispose: () => {\r
1046                     progressHandlers.delete(token);\r
1047                 }\r
1048             };\r
1049         },\r
1050         sendProgress: (_type, token, value) => {\r
1051             connection.sendNotification(ProgressNotification.type, { token, value });\r
1052         },\r
1053         onUnhandledProgress: unhandledProgressEmitter.event,\r
1054         sendRequest: (type, ...params) => {\r
1055             throwIfClosedOrDisposed();\r
1056             throwIfNotListening();\r
1057             let method;\r
1058             let messageParams;\r
1059             let token = undefined;\r
1060             if (Is.string(type)) {\r
1061                 method = type;\r
1062                 switch (params.length) {\r
1063                     case 0:\r
1064                         messageParams = null;\r
1065                         break;\r
1066                     case 1:\r
1067                         // The cancellation token is optional so it can also be undefined.\r
1068                         if (cancellation_1.CancellationToken.is(params[0])) {\r
1069                             messageParams = null;\r
1070                             token = params[0];\r
1071                         }\r
1072                         else {\r
1073                             messageParams = undefinedToNull(params[0]);\r
1074                         }\r
1075                         break;\r
1076                     default:\r
1077                         const last = params.length - 1;\r
1078                         if (cancellation_1.CancellationToken.is(params[last])) {\r
1079                             token = params[last];\r
1080                             if (params.length === 2) {\r
1081                                 messageParams = undefinedToNull(params[0]);\r
1082                             }\r
1083                             else {\r
1084                                 messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
1085                             }\r
1086                         }\r
1087                         else {\r
1088                             messageParams = params.map(value => undefinedToNull(value));\r
1089                         }\r
1090                         break;\r
1091                 }\r
1092             }\r
1093             else {\r
1094                 method = type.method;\r
1095                 messageParams = computeMessageParams(type, params);\r
1096                 let numberOfParams = type.numberOfParams;\r
1097                 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
1098             }\r
1099             let id = sequenceNumber++;\r
1100             let result = new Promise((resolve, reject) => {\r
1101                 let requestMessage = {\r
1102                     jsonrpc: version,\r
1103                     id: id,\r
1104                     method: method,\r
1105                     params: messageParams\r
1106                 };\r
1107                 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
1108                 traceSendingRequest(requestMessage);\r
1109                 try {\r
1110                     messageWriter.write(requestMessage);\r
1111                 }\r
1112                 catch (e) {\r
1113                     // Writing the message failed. So we need to reject the promise.\r
1114                     responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
1115                     responsePromise = null;\r
1116                 }\r
1117                 if (responsePromise) {\r
1118                     responsePromises[String(id)] = responsePromise;\r
1119                 }\r
1120             });\r
1121             if (token) {\r
1122                 token.onCancellationRequested(() => {\r
1123                     connection.sendNotification(CancelNotification.type, { id });\r
1124                 });\r
1125             }\r
1126             return result;\r
1127         },\r
1128         onRequest: (type, handler) => {\r
1129             throwIfClosedOrDisposed();\r
1130             if (Is.func(type)) {\r
1131                 starRequestHandler = type;\r
1132             }\r
1133             else if (handler) {\r
1134                 if (Is.string(type)) {\r
1135                     requestHandlers[type] = { type: undefined, handler };\r
1136                 }\r
1137                 else {\r
1138                     requestHandlers[type.method] = { type, handler };\r
1139                 }\r
1140             }\r
1141         },\r
1142         trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
1143             let _sendNotification = false;\r
1144             let _traceFormat = TraceFormat.Text;\r
1145             if (sendNotificationOrTraceOptions !== void 0) {\r
1146                 if (Is.boolean(sendNotificationOrTraceOptions)) {\r
1147                     _sendNotification = sendNotificationOrTraceOptions;\r
1148                 }\r
1149                 else {\r
1150                     _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
1151                     _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
1152                 }\r
1153             }\r
1154             trace = _value;\r
1155             traceFormat = _traceFormat;\r
1156             if (trace === Trace.Off) {\r
1157                 tracer = undefined;\r
1158             }\r
1159             else {\r
1160                 tracer = _tracer;\r
1161             }\r
1162             if (_sendNotification && !isClosed() && !isDisposed()) {\r
1163                 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
1164             }\r
1165         },\r
1166         onError: errorEmitter.event,\r
1167         onClose: closeEmitter.event,\r
1168         onUnhandledNotification: unhandledNotificationEmitter.event,\r
1169         onDispose: disposeEmitter.event,\r
1170         dispose: () => {\r
1171             if (isDisposed()) {\r
1172                 return;\r
1173             }\r
1174             state = ConnectionState.Disposed;\r
1175             disposeEmitter.fire(undefined);\r
1176             let error = new Error('Connection got disposed.');\r
1177             Object.keys(responsePromises).forEach((key) => {\r
1178                 responsePromises[key].reject(error);\r
1179             });\r
1180             responsePromises = Object.create(null);\r
1181             requestTokens = Object.create(null);\r
1182             messageQueue = new linkedMap_1.LinkedMap();\r
1183             // Test for backwards compatibility\r
1184             if (Is.func(messageWriter.dispose)) {\r
1185                 messageWriter.dispose();\r
1186             }\r
1187             if (Is.func(messageReader.dispose)) {\r
1188                 messageReader.dispose();\r
1189             }\r
1190         },\r
1191         listen: () => {\r
1192             throwIfClosedOrDisposed();\r
1193             throwIfListening();\r
1194             state = ConnectionState.Listening;\r
1195             messageReader.listen(callback);\r
1196         },\r
1197         inspect: () => {\r
1198             // eslint-disable-next-line no-console\r
1199             console.log('inspect');\r
1200         }\r
1201     };\r
1202     connection.onNotification(LogTraceNotification.type, (params) => {\r
1203         if (trace === Trace.Off || !tracer) {\r
1204             return;\r
1205         }\r
1206         tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
1207     });\r
1208     connection.onNotification(ProgressNotification.type, (params) => {\r
1209         const handler = progressHandlers.get(params.token);\r
1210         if (handler) {\r
1211             handler(params.value);\r
1212         }\r
1213         else {\r
1214             unhandledProgressEmitter.fire(params);\r
1215         }\r
1216     });\r
1217     return connection;\r
1218 }\r
1219 function isMessageReader(value) {\r
1220     return value.listen !== void 0 && value.read === void 0;\r
1221 }\r
1222 function isMessageWriter(value) {\r
1223     return value.write !== void 0 && value.end === void 0;\r
1224 }\r
1225 function createMessageConnection(input, output, logger, strategy) {\r
1226     if (!logger) {\r
1227         logger = exports.NullLogger;\r
1228     }\r
1229     let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
1230     let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
1231     return _createMessageConnection(reader, writer, logger, strategy);\r
1232 }\r
1233 exports.createMessageConnection = createMessageConnection;\r
1234
1235
1236 /***/ }),
1237 /* 6 */
1238 /***/ ((__unused_webpack_module, exports) => {
1239
1240 "use strict";
1241 /* --------------------------------------------------------------------------------------------\r
1242  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1243  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1244  * ------------------------------------------------------------------------------------------ */\r
1245 \r
1246 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1247 function boolean(value) {\r
1248     return value === true || value === false;\r
1249 }\r
1250 exports.boolean = boolean;\r
1251 function string(value) {\r
1252     return typeof value === 'string' || value instanceof String;\r
1253 }\r
1254 exports.string = string;\r
1255 function number(value) {\r
1256     return typeof value === 'number' || value instanceof Number;\r
1257 }\r
1258 exports.number = number;\r
1259 function error(value) {\r
1260     return value instanceof Error;\r
1261 }\r
1262 exports.error = error;\r
1263 function func(value) {\r
1264     return typeof value === 'function';\r
1265 }\r
1266 exports.func = func;\r
1267 function array(value) {\r
1268     return Array.isArray(value);\r
1269 }\r
1270 exports.array = array;\r
1271 function stringArray(value) {\r
1272     return array(value) && value.every(elem => string(elem));\r
1273 }\r
1274 exports.stringArray = stringArray;\r
1275
1276
1277 /***/ }),
1278 /* 7 */
1279 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1280
1281 "use strict";
1282 /* --------------------------------------------------------------------------------------------\r
1283  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1284  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1285  * ------------------------------------------------------------------------------------------ */\r
1286 \r
1287 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1288 const is = __webpack_require__(6);\r
1289 /**\r
1290  * Predefined error codes.\r
1291  */\r
1292 var ErrorCodes;\r
1293 (function (ErrorCodes) {\r
1294     // Defined by JSON RPC\r
1295     ErrorCodes.ParseError = -32700;\r
1296     ErrorCodes.InvalidRequest = -32600;\r
1297     ErrorCodes.MethodNotFound = -32601;\r
1298     ErrorCodes.InvalidParams = -32602;\r
1299     ErrorCodes.InternalError = -32603;\r
1300     ErrorCodes.serverErrorStart = -32099;\r
1301     ErrorCodes.serverErrorEnd = -32000;\r
1302     ErrorCodes.ServerNotInitialized = -32002;\r
1303     ErrorCodes.UnknownErrorCode = -32001;\r
1304     // Defined by the protocol.\r
1305     ErrorCodes.RequestCancelled = -32800;\r
1306     ErrorCodes.ContentModified = -32801;\r
1307     // Defined by VSCode library.\r
1308     ErrorCodes.MessageWriteError = 1;\r
1309     ErrorCodes.MessageReadError = 2;\r
1310 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
1311 /**\r
1312  * An error object return in a response in case a request\r
1313  * has failed.\r
1314  */\r
1315 class ResponseError extends Error {\r
1316     constructor(code, message, data) {\r
1317         super(message);\r
1318         this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
1319         this.data = data;\r
1320         Object.setPrototypeOf(this, ResponseError.prototype);\r
1321     }\r
1322     toJson() {\r
1323         return {\r
1324             code: this.code,\r
1325             message: this.message,\r
1326             data: this.data,\r
1327         };\r
1328     }\r
1329 }\r
1330 exports.ResponseError = ResponseError;\r
1331 /**\r
1332  * An abstract implementation of a MessageType.\r
1333  */\r
1334 class AbstractMessageType {\r
1335     constructor(_method, _numberOfParams) {\r
1336         this._method = _method;\r
1337         this._numberOfParams = _numberOfParams;\r
1338     }\r
1339     get method() {\r
1340         return this._method;\r
1341     }\r
1342     get numberOfParams() {\r
1343         return this._numberOfParams;\r
1344     }\r
1345 }\r
1346 exports.AbstractMessageType = AbstractMessageType;\r
1347 /**\r
1348  * Classes to type request response pairs\r
1349  *\r
1350  * The type parameter RO will be removed in the next major version\r
1351  * of the JSON RPC library since it is a LSP concept and doesn't\r
1352  * belong here. For now it is tagged as default never.\r
1353  */\r
1354 class RequestType0 extends AbstractMessageType {\r
1355     constructor(method) {\r
1356         super(method, 0);\r
1357     }\r
1358 }\r
1359 exports.RequestType0 = RequestType0;\r
1360 class RequestType extends AbstractMessageType {\r
1361     constructor(method) {\r
1362         super(method, 1);\r
1363     }\r
1364 }\r
1365 exports.RequestType = RequestType;\r
1366 class RequestType1 extends AbstractMessageType {\r
1367     constructor(method) {\r
1368         super(method, 1);\r
1369     }\r
1370 }\r
1371 exports.RequestType1 = RequestType1;\r
1372 class RequestType2 extends AbstractMessageType {\r
1373     constructor(method) {\r
1374         super(method, 2);\r
1375     }\r
1376 }\r
1377 exports.RequestType2 = RequestType2;\r
1378 class RequestType3 extends AbstractMessageType {\r
1379     constructor(method) {\r
1380         super(method, 3);\r
1381     }\r
1382 }\r
1383 exports.RequestType3 = RequestType3;\r
1384 class RequestType4 extends AbstractMessageType {\r
1385     constructor(method) {\r
1386         super(method, 4);\r
1387     }\r
1388 }\r
1389 exports.RequestType4 = RequestType4;\r
1390 class RequestType5 extends AbstractMessageType {\r
1391     constructor(method) {\r
1392         super(method, 5);\r
1393     }\r
1394 }\r
1395 exports.RequestType5 = RequestType5;\r
1396 class RequestType6 extends AbstractMessageType {\r
1397     constructor(method) {\r
1398         super(method, 6);\r
1399     }\r
1400 }\r
1401 exports.RequestType6 = RequestType6;\r
1402 class RequestType7 extends AbstractMessageType {\r
1403     constructor(method) {\r
1404         super(method, 7);\r
1405     }\r
1406 }\r
1407 exports.RequestType7 = RequestType7;\r
1408 class RequestType8 extends AbstractMessageType {\r
1409     constructor(method) {\r
1410         super(method, 8);\r
1411     }\r
1412 }\r
1413 exports.RequestType8 = RequestType8;\r
1414 class RequestType9 extends AbstractMessageType {\r
1415     constructor(method) {\r
1416         super(method, 9);\r
1417     }\r
1418 }\r
1419 exports.RequestType9 = RequestType9;\r
1420 /**\r
1421  * The type parameter RO will be removed in the next major version\r
1422  * of the JSON RPC library since it is a LSP concept and doesn't\r
1423  * belong here. For now it is tagged as default never.\r
1424  */\r
1425 class NotificationType extends AbstractMessageType {\r
1426     constructor(method) {\r
1427         super(method, 1);\r
1428         this._ = undefined;\r
1429     }\r
1430 }\r
1431 exports.NotificationType = NotificationType;\r
1432 class NotificationType0 extends AbstractMessageType {\r
1433     constructor(method) {\r
1434         super(method, 0);\r
1435     }\r
1436 }\r
1437 exports.NotificationType0 = NotificationType0;\r
1438 class NotificationType1 extends AbstractMessageType {\r
1439     constructor(method) {\r
1440         super(method, 1);\r
1441     }\r
1442 }\r
1443 exports.NotificationType1 = NotificationType1;\r
1444 class NotificationType2 extends AbstractMessageType {\r
1445     constructor(method) {\r
1446         super(method, 2);\r
1447     }\r
1448 }\r
1449 exports.NotificationType2 = NotificationType2;\r
1450 class NotificationType3 extends AbstractMessageType {\r
1451     constructor(method) {\r
1452         super(method, 3);\r
1453     }\r
1454 }\r
1455 exports.NotificationType3 = NotificationType3;\r
1456 class NotificationType4 extends AbstractMessageType {\r
1457     constructor(method) {\r
1458         super(method, 4);\r
1459     }\r
1460 }\r
1461 exports.NotificationType4 = NotificationType4;\r
1462 class NotificationType5 extends AbstractMessageType {\r
1463     constructor(method) {\r
1464         super(method, 5);\r
1465     }\r
1466 }\r
1467 exports.NotificationType5 = NotificationType5;\r
1468 class NotificationType6 extends AbstractMessageType {\r
1469     constructor(method) {\r
1470         super(method, 6);\r
1471     }\r
1472 }\r
1473 exports.NotificationType6 = NotificationType6;\r
1474 class NotificationType7 extends AbstractMessageType {\r
1475     constructor(method) {\r
1476         super(method, 7);\r
1477     }\r
1478 }\r
1479 exports.NotificationType7 = NotificationType7;\r
1480 class NotificationType8 extends AbstractMessageType {\r
1481     constructor(method) {\r
1482         super(method, 8);\r
1483     }\r
1484 }\r
1485 exports.NotificationType8 = NotificationType8;\r
1486 class NotificationType9 extends AbstractMessageType {\r
1487     constructor(method) {\r
1488         super(method, 9);\r
1489     }\r
1490 }\r
1491 exports.NotificationType9 = NotificationType9;\r
1492 /**\r
1493  * Tests if the given message is a request message\r
1494  */\r
1495 function isRequestMessage(message) {\r
1496     let candidate = message;\r
1497     return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
1498 }\r
1499 exports.isRequestMessage = isRequestMessage;\r
1500 /**\r
1501  * Tests if the given message is a notification message\r
1502  */\r
1503 function isNotificationMessage(message) {\r
1504     let candidate = message;\r
1505     return candidate && is.string(candidate.method) && message.id === void 0;\r
1506 }\r
1507 exports.isNotificationMessage = isNotificationMessage;\r
1508 /**\r
1509  * Tests if the given message is a response message\r
1510  */\r
1511 function isResponseMessage(message) {\r
1512     let candidate = message;\r
1513     return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
1514 }\r
1515 exports.isResponseMessage = isResponseMessage;\r
1516
1517
1518 /***/ }),
1519 /* 8 */
1520 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1521
1522 "use strict";
1523 /* --------------------------------------------------------------------------------------------\r
1524  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1525  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1526  * ------------------------------------------------------------------------------------------ */\r
1527 \r
1528 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1529 const events_1 = __webpack_require__(9);\r
1530 const Is = __webpack_require__(6);\r
1531 let DefaultSize = 8192;\r
1532 let CR = Buffer.from('\r', 'ascii')[0];\r
1533 let LF = Buffer.from('\n', 'ascii')[0];\r
1534 let CRLF = '\r\n';\r
1535 class MessageBuffer {\r
1536     constructor(encoding = 'utf8') {\r
1537         this.encoding = encoding;\r
1538         this.index = 0;\r
1539         this.buffer = Buffer.allocUnsafe(DefaultSize);\r
1540     }\r
1541     append(chunk) {\r
1542         var toAppend = chunk;\r
1543         if (typeof (chunk) === 'string') {\r
1544             var str = chunk;\r
1545             var bufferLen = Buffer.byteLength(str, this.encoding);\r
1546             toAppend = Buffer.allocUnsafe(bufferLen);\r
1547             toAppend.write(str, 0, bufferLen, this.encoding);\r
1548         }\r
1549         if (this.buffer.length - this.index >= toAppend.length) {\r
1550             toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
1551         }\r
1552         else {\r
1553             var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
1554             if (this.index === 0) {\r
1555                 this.buffer = Buffer.allocUnsafe(newSize);\r
1556                 toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
1557             }\r
1558             else {\r
1559                 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
1560             }\r
1561         }\r
1562         this.index += toAppend.length;\r
1563     }\r
1564     tryReadHeaders() {\r
1565         let result = undefined;\r
1566         let current = 0;\r
1567         while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {\r
1568             current++;\r
1569         }\r
1570         // No header / body separator found (e.g CRLFCRLF)\r
1571         if (current + 3 >= this.index) {\r
1572             return result;\r
1573         }\r
1574         result = Object.create(null);\r
1575         let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
1576         headers.forEach((header) => {\r
1577             let index = header.indexOf(':');\r
1578             if (index === -1) {\r
1579                 throw new Error('Message header must separate key and value using :');\r
1580             }\r
1581             let key = header.substr(0, index);\r
1582             let value = header.substr(index + 1).trim();\r
1583             result[key] = value;\r
1584         });\r
1585         let nextStart = current + 4;\r
1586         this.buffer = this.buffer.slice(nextStart);\r
1587         this.index = this.index - nextStart;\r
1588         return result;\r
1589     }\r
1590     tryReadContent(length) {\r
1591         if (this.index < length) {\r
1592             return null;\r
1593         }\r
1594         let result = this.buffer.toString(this.encoding, 0, length);\r
1595         let nextStart = length;\r
1596         this.buffer.copy(this.buffer, 0, nextStart);\r
1597         this.index = this.index - nextStart;\r
1598         return result;\r
1599     }\r
1600     get numberOfBytes() {\r
1601         return this.index;\r
1602     }\r
1603 }\r
1604 var MessageReader;\r
1605 (function (MessageReader) {\r
1606     function is(value) {\r
1607         let candidate = value;\r
1608         return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
1609             Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
1610     }\r
1611     MessageReader.is = is;\r
1612 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
1613 class AbstractMessageReader {\r
1614     constructor() {\r
1615         this.errorEmitter = new events_1.Emitter();\r
1616         this.closeEmitter = new events_1.Emitter();\r
1617         this.partialMessageEmitter = new events_1.Emitter();\r
1618     }\r
1619     dispose() {\r
1620         this.errorEmitter.dispose();\r
1621         this.closeEmitter.dispose();\r
1622     }\r
1623     get onError() {\r
1624         return this.errorEmitter.event;\r
1625     }\r
1626     fireError(error) {\r
1627         this.errorEmitter.fire(this.asError(error));\r
1628     }\r
1629     get onClose() {\r
1630         return this.closeEmitter.event;\r
1631     }\r
1632     fireClose() {\r
1633         this.closeEmitter.fire(undefined);\r
1634     }\r
1635     get onPartialMessage() {\r
1636         return this.partialMessageEmitter.event;\r
1637     }\r
1638     firePartialMessage(info) {\r
1639         this.partialMessageEmitter.fire(info);\r
1640     }\r
1641     asError(error) {\r
1642         if (error instanceof Error) {\r
1643             return error;\r
1644         }\r
1645         else {\r
1646             return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1647         }\r
1648     }\r
1649 }\r
1650 exports.AbstractMessageReader = AbstractMessageReader;\r
1651 class StreamMessageReader extends AbstractMessageReader {\r
1652     constructor(readable, encoding = 'utf8') {\r
1653         super();\r
1654         this.readable = readable;\r
1655         this.buffer = new MessageBuffer(encoding);\r
1656         this._partialMessageTimeout = 10000;\r
1657     }\r
1658     set partialMessageTimeout(timeout) {\r
1659         this._partialMessageTimeout = timeout;\r
1660     }\r
1661     get partialMessageTimeout() {\r
1662         return this._partialMessageTimeout;\r
1663     }\r
1664     listen(callback) {\r
1665         this.nextMessageLength = -1;\r
1666         this.messageToken = 0;\r
1667         this.partialMessageTimer = undefined;\r
1668         this.callback = callback;\r
1669         this.readable.on('data', (data) => {\r
1670             this.onData(data);\r
1671         });\r
1672         this.readable.on('error', (error) => this.fireError(error));\r
1673         this.readable.on('close', () => this.fireClose());\r
1674     }\r
1675     onData(data) {\r
1676         this.buffer.append(data);\r
1677         while (true) {\r
1678             if (this.nextMessageLength === -1) {\r
1679                 let headers = this.buffer.tryReadHeaders();\r
1680                 if (!headers) {\r
1681                     return;\r
1682                 }\r
1683                 let contentLength = headers['Content-Length'];\r
1684                 if (!contentLength) {\r
1685                     throw new Error('Header must provide a Content-Length property.');\r
1686                 }\r
1687                 let length = parseInt(contentLength);\r
1688                 if (isNaN(length)) {\r
1689                     throw new Error('Content-Length value must be a number.');\r
1690                 }\r
1691                 this.nextMessageLength = length;\r
1692                 // Take the encoding form the header. For compatibility\r
1693                 // treat both utf-8 and utf8 as node utf8\r
1694             }\r
1695             var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
1696             if (msg === null) {\r
1697                 /** We haven't received the full message yet. */\r
1698                 this.setPartialMessageTimer();\r
1699                 return;\r
1700             }\r
1701             this.clearPartialMessageTimer();\r
1702             this.nextMessageLength = -1;\r
1703             this.messageToken++;\r
1704             var json = JSON.parse(msg);\r
1705             this.callback(json);\r
1706         }\r
1707     }\r
1708     clearPartialMessageTimer() {\r
1709         if (this.partialMessageTimer) {\r
1710             clearTimeout(this.partialMessageTimer);\r
1711             this.partialMessageTimer = undefined;\r
1712         }\r
1713     }\r
1714     setPartialMessageTimer() {\r
1715         this.clearPartialMessageTimer();\r
1716         if (this._partialMessageTimeout <= 0) {\r
1717             return;\r
1718         }\r
1719         this.partialMessageTimer = setTimeout((token, timeout) => {\r
1720             this.partialMessageTimer = undefined;\r
1721             if (token === this.messageToken) {\r
1722                 this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
1723                 this.setPartialMessageTimer();\r
1724             }\r
1725         }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
1726     }\r
1727 }\r
1728 exports.StreamMessageReader = StreamMessageReader;\r
1729 class IPCMessageReader extends AbstractMessageReader {\r
1730     constructor(process) {\r
1731         super();\r
1732         this.process = process;\r
1733         let eventEmitter = this.process;\r
1734         eventEmitter.on('error', (error) => this.fireError(error));\r
1735         eventEmitter.on('close', () => this.fireClose());\r
1736     }\r
1737     listen(callback) {\r
1738         this.process.on('message', callback);\r
1739     }\r
1740 }\r
1741 exports.IPCMessageReader = IPCMessageReader;\r
1742 class SocketMessageReader extends StreamMessageReader {\r
1743     constructor(socket, encoding = 'utf-8') {\r
1744         super(socket, encoding);\r
1745     }\r
1746 }\r
1747 exports.SocketMessageReader = SocketMessageReader;\r
1748
1749
1750 /***/ }),
1751 /* 9 */
1752 /***/ ((__unused_webpack_module, exports) => {
1753
1754 "use strict";
1755 /* --------------------------------------------------------------------------------------------\r
1756  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1757  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1758  * ------------------------------------------------------------------------------------------ */\r
1759 \r
1760 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1761 var Disposable;\r
1762 (function (Disposable) {\r
1763     function create(func) {\r
1764         return {\r
1765             dispose: func\r
1766         };\r
1767     }\r
1768     Disposable.create = create;\r
1769 })(Disposable = exports.Disposable || (exports.Disposable = {}));\r
1770 var Event;\r
1771 (function (Event) {\r
1772     const _disposable = { dispose() { } };\r
1773     Event.None = function () { return _disposable; };\r
1774 })(Event = exports.Event || (exports.Event = {}));\r
1775 class CallbackList {\r
1776     add(callback, context = null, bucket) {\r
1777         if (!this._callbacks) {\r
1778             this._callbacks = [];\r
1779             this._contexts = [];\r
1780         }\r
1781         this._callbacks.push(callback);\r
1782         this._contexts.push(context);\r
1783         if (Array.isArray(bucket)) {\r
1784             bucket.push({ dispose: () => this.remove(callback, context) });\r
1785         }\r
1786     }\r
1787     remove(callback, context = null) {\r
1788         if (!this._callbacks) {\r
1789             return;\r
1790         }\r
1791         var foundCallbackWithDifferentContext = false;\r
1792         for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
1793             if (this._callbacks[i] === callback) {\r
1794                 if (this._contexts[i] === context) {\r
1795                     // callback & context match => remove it\r
1796                     this._callbacks.splice(i, 1);\r
1797                     this._contexts.splice(i, 1);\r
1798                     return;\r
1799                 }\r
1800                 else {\r
1801                     foundCallbackWithDifferentContext = true;\r
1802                 }\r
1803             }\r
1804         }\r
1805         if (foundCallbackWithDifferentContext) {\r
1806             throw new Error('When adding a listener with a context, you should remove it with the same context');\r
1807         }\r
1808     }\r
1809     invoke(...args) {\r
1810         if (!this._callbacks) {\r
1811             return [];\r
1812         }\r
1813         var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
1814         for (var i = 0, len = callbacks.length; i < len; i++) {\r
1815             try {\r
1816                 ret.push(callbacks[i].apply(contexts[i], args));\r
1817             }\r
1818             catch (e) {\r
1819                 // eslint-disable-next-line no-console\r
1820                 console.error(e);\r
1821             }\r
1822         }\r
1823         return ret;\r
1824     }\r
1825     isEmpty() {\r
1826         return !this._callbacks || this._callbacks.length === 0;\r
1827     }\r
1828     dispose() {\r
1829         this._callbacks = undefined;\r
1830         this._contexts = undefined;\r
1831     }\r
1832 }\r
1833 class Emitter {\r
1834     constructor(_options) {\r
1835         this._options = _options;\r
1836     }\r
1837     /**\r
1838      * For the public to allow to subscribe\r
1839      * to events from this Emitter\r
1840      */\r
1841     get event() {\r
1842         if (!this._event) {\r
1843             this._event = (listener, thisArgs, disposables) => {\r
1844                 if (!this._callbacks) {\r
1845                     this._callbacks = new CallbackList();\r
1846                 }\r
1847                 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
1848                     this._options.onFirstListenerAdd(this);\r
1849                 }\r
1850                 this._callbacks.add(listener, thisArgs);\r
1851                 let result;\r
1852                 result = {\r
1853                     dispose: () => {\r
1854                         this._callbacks.remove(listener, thisArgs);\r
1855                         result.dispose = Emitter._noop;\r
1856                         if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
1857                             this._options.onLastListenerRemove(this);\r
1858                         }\r
1859                     }\r
1860                 };\r
1861                 if (Array.isArray(disposables)) {\r
1862                     disposables.push(result);\r
1863                 }\r
1864                 return result;\r
1865             };\r
1866         }\r
1867         return this._event;\r
1868     }\r
1869     /**\r
1870      * To be kept private to fire an event to\r
1871      * subscribers\r
1872      */\r
1873     fire(event) {\r
1874         if (this._callbacks) {\r
1875             this._callbacks.invoke.call(this._callbacks, event);\r
1876         }\r
1877     }\r
1878     dispose() {\r
1879         if (this._callbacks) {\r
1880             this._callbacks.dispose();\r
1881             this._callbacks = undefined;\r
1882         }\r
1883     }\r
1884 }\r
1885 exports.Emitter = Emitter;\r
1886 Emitter._noop = function () { };\r
1887
1888
1889 /***/ }),
1890 /* 10 */
1891 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1892
1893 "use strict";
1894 /* --------------------------------------------------------------------------------------------\r
1895  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1896  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1897  * ------------------------------------------------------------------------------------------ */\r
1898 \r
1899 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1900 const events_1 = __webpack_require__(9);\r
1901 const Is = __webpack_require__(6);\r
1902 let ContentLength = 'Content-Length: ';\r
1903 let CRLF = '\r\n';\r
1904 var MessageWriter;\r
1905 (function (MessageWriter) {\r
1906     function is(value) {\r
1907         let candidate = value;\r
1908         return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
1909             Is.func(candidate.onError) && Is.func(candidate.write);\r
1910     }\r
1911     MessageWriter.is = is;\r
1912 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
1913 class AbstractMessageWriter {\r
1914     constructor() {\r
1915         this.errorEmitter = new events_1.Emitter();\r
1916         this.closeEmitter = new events_1.Emitter();\r
1917     }\r
1918     dispose() {\r
1919         this.errorEmitter.dispose();\r
1920         this.closeEmitter.dispose();\r
1921     }\r
1922     get onError() {\r
1923         return this.errorEmitter.event;\r
1924     }\r
1925     fireError(error, message, count) {\r
1926         this.errorEmitter.fire([this.asError(error), message, count]);\r
1927     }\r
1928     get onClose() {\r
1929         return this.closeEmitter.event;\r
1930     }\r
1931     fireClose() {\r
1932         this.closeEmitter.fire(undefined);\r
1933     }\r
1934     asError(error) {\r
1935         if (error instanceof Error) {\r
1936             return error;\r
1937         }\r
1938         else {\r
1939             return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1940         }\r
1941     }\r
1942 }\r
1943 exports.AbstractMessageWriter = AbstractMessageWriter;\r
1944 class StreamMessageWriter extends AbstractMessageWriter {\r
1945     constructor(writable, encoding = 'utf8') {\r
1946         super();\r
1947         this.writable = writable;\r
1948         this.encoding = encoding;\r
1949         this.errorCount = 0;\r
1950         this.writable.on('error', (error) => this.fireError(error));\r
1951         this.writable.on('close', () => this.fireClose());\r
1952     }\r
1953     write(msg) {\r
1954         let json = JSON.stringify(msg);\r
1955         let contentLength = Buffer.byteLength(json, this.encoding);\r
1956         let headers = [\r
1957             ContentLength, contentLength.toString(), CRLF,\r
1958             CRLF\r
1959         ];\r
1960         try {\r
1961             // Header must be written in ASCII encoding\r
1962             this.writable.write(headers.join(''), 'ascii');\r
1963             // Now write the content. This can be written in any encoding\r
1964             this.writable.write(json, this.encoding);\r
1965             this.errorCount = 0;\r
1966         }\r
1967         catch (error) {\r
1968             this.errorCount++;\r
1969             this.fireError(error, msg, this.errorCount);\r
1970         }\r
1971     }\r
1972 }\r
1973 exports.StreamMessageWriter = StreamMessageWriter;\r
1974 class IPCMessageWriter extends AbstractMessageWriter {\r
1975     constructor(process) {\r
1976         super();\r
1977         this.process = process;\r
1978         this.errorCount = 0;\r
1979         this.queue = [];\r
1980         this.sending = false;\r
1981         let eventEmitter = this.process;\r
1982         eventEmitter.on('error', (error) => this.fireError(error));\r
1983         eventEmitter.on('close', () => this.fireClose);\r
1984     }\r
1985     write(msg) {\r
1986         if (!this.sending && this.queue.length === 0) {\r
1987             // See https://github.com/nodejs/node/issues/7657\r
1988             this.doWriteMessage(msg);\r
1989         }\r
1990         else {\r
1991             this.queue.push(msg);\r
1992         }\r
1993     }\r
1994     doWriteMessage(msg) {\r
1995         try {\r
1996             if (this.process.send) {\r
1997                 this.sending = true;\r
1998                 this.process.send(msg, undefined, undefined, (error) => {\r
1999                     this.sending = false;\r
2000                     if (error) {\r
2001                         this.errorCount++;\r
2002                         this.fireError(error, msg, this.errorCount);\r
2003                     }\r
2004                     else {\r
2005                         this.errorCount = 0;\r
2006                     }\r
2007                     if (this.queue.length > 0) {\r
2008                         this.doWriteMessage(this.queue.shift());\r
2009                     }\r
2010                 });\r
2011             }\r
2012         }\r
2013         catch (error) {\r
2014             this.errorCount++;\r
2015             this.fireError(error, msg, this.errorCount);\r
2016         }\r
2017     }\r
2018 }\r
2019 exports.IPCMessageWriter = IPCMessageWriter;\r
2020 class SocketMessageWriter extends AbstractMessageWriter {\r
2021     constructor(socket, encoding = 'utf8') {\r
2022         super();\r
2023         this.socket = socket;\r
2024         this.queue = [];\r
2025         this.sending = false;\r
2026         this.encoding = encoding;\r
2027         this.errorCount = 0;\r
2028         this.socket.on('error', (error) => this.fireError(error));\r
2029         this.socket.on('close', () => this.fireClose());\r
2030     }\r
2031     dispose() {\r
2032         super.dispose();\r
2033         this.socket.destroy();\r
2034     }\r
2035     write(msg) {\r
2036         if (!this.sending && this.queue.length === 0) {\r
2037             // See https://github.com/nodejs/node/issues/7657\r
2038             this.doWriteMessage(msg);\r
2039         }\r
2040         else {\r
2041             this.queue.push(msg);\r
2042         }\r
2043     }\r
2044     doWriteMessage(msg) {\r
2045         let json = JSON.stringify(msg);\r
2046         let contentLength = Buffer.byteLength(json, this.encoding);\r
2047         let headers = [\r
2048             ContentLength, contentLength.toString(), CRLF,\r
2049             CRLF\r
2050         ];\r
2051         try {\r
2052             // Header must be written in ASCII encoding\r
2053             this.sending = true;\r
2054             this.socket.write(headers.join(''), 'ascii', (error) => {\r
2055                 if (error) {\r
2056                     this.handleError(error, msg);\r
2057                 }\r
2058                 try {\r
2059                     // Now write the content. This can be written in any encoding\r
2060                     this.socket.write(json, this.encoding, (error) => {\r
2061                         this.sending = false;\r
2062                         if (error) {\r
2063                             this.handleError(error, msg);\r
2064                         }\r
2065                         else {\r
2066                             this.errorCount = 0;\r
2067                         }\r
2068                         if (this.queue.length > 0) {\r
2069                             this.doWriteMessage(this.queue.shift());\r
2070                         }\r
2071                     });\r
2072                 }\r
2073                 catch (error) {\r
2074                     this.handleError(error, msg);\r
2075                 }\r
2076             });\r
2077         }\r
2078         catch (error) {\r
2079             this.handleError(error, msg);\r
2080         }\r
2081     }\r
2082     handleError(error, msg) {\r
2083         this.errorCount++;\r
2084         this.fireError(error, msg, this.errorCount);\r
2085     }\r
2086 }\r
2087 exports.SocketMessageWriter = SocketMessageWriter;\r
2088
2089
2090 /***/ }),
2091 /* 11 */
2092 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2093
2094 "use strict";
2095 /*---------------------------------------------------------------------------------------------\r
2096  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2097  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2098  *--------------------------------------------------------------------------------------------*/\r
2099 \r
2100 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2101 const events_1 = __webpack_require__(9);\r
2102 const Is = __webpack_require__(6);\r
2103 var CancellationToken;\r
2104 (function (CancellationToken) {\r
2105     CancellationToken.None = Object.freeze({\r
2106         isCancellationRequested: false,\r
2107         onCancellationRequested: events_1.Event.None\r
2108     });\r
2109     CancellationToken.Cancelled = Object.freeze({\r
2110         isCancellationRequested: true,\r
2111         onCancellationRequested: events_1.Event.None\r
2112     });\r
2113     function is(value) {\r
2114         let candidate = value;\r
2115         return candidate && (candidate === CancellationToken.None\r
2116             || candidate === CancellationToken.Cancelled\r
2117             || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
2118     }\r
2119     CancellationToken.is = is;\r
2120 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
2121 const shortcutEvent = Object.freeze(function (callback, context) {\r
2122     let handle = setTimeout(callback.bind(context), 0);\r
2123     return { dispose() { clearTimeout(handle); } };\r
2124 });\r
2125 class MutableToken {\r
2126     constructor() {\r
2127         this._isCancelled = false;\r
2128     }\r
2129     cancel() {\r
2130         if (!this._isCancelled) {\r
2131             this._isCancelled = true;\r
2132             if (this._emitter) {\r
2133                 this._emitter.fire(undefined);\r
2134                 this.dispose();\r
2135             }\r
2136         }\r
2137     }\r
2138     get isCancellationRequested() {\r
2139         return this._isCancelled;\r
2140     }\r
2141     get onCancellationRequested() {\r
2142         if (this._isCancelled) {\r
2143             return shortcutEvent;\r
2144         }\r
2145         if (!this._emitter) {\r
2146             this._emitter = new events_1.Emitter();\r
2147         }\r
2148         return this._emitter.event;\r
2149     }\r
2150     dispose() {\r
2151         if (this._emitter) {\r
2152             this._emitter.dispose();\r
2153             this._emitter = undefined;\r
2154         }\r
2155     }\r
2156 }\r
2157 class CancellationTokenSource {\r
2158     get token() {\r
2159         if (!this._token) {\r
2160             // be lazy and create the token only when\r
2161             // actually needed\r
2162             this._token = new MutableToken();\r
2163         }\r
2164         return this._token;\r
2165     }\r
2166     cancel() {\r
2167         if (!this._token) {\r
2168             // save an object by returning the default\r
2169             // cancelled token when cancellation happens\r
2170             // before someone asks for the token\r
2171             this._token = CancellationToken.Cancelled;\r
2172         }\r
2173         else {\r
2174             this._token.cancel();\r
2175         }\r
2176     }\r
2177     dispose() {\r
2178         if (!this._token) {\r
2179             // ensure to initialize with an empty token if we had none\r
2180             this._token = CancellationToken.None;\r
2181         }\r
2182         else if (this._token instanceof MutableToken) {\r
2183             // actually dispose\r
2184             this._token.dispose();\r
2185         }\r
2186     }\r
2187 }\r
2188 exports.CancellationTokenSource = CancellationTokenSource;\r
2189
2190
2191 /***/ }),
2192 /* 12 */
2193 /***/ ((__unused_webpack_module, exports) => {
2194
2195 "use strict";
2196 \r
2197 /*---------------------------------------------------------------------------------------------\r
2198  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2199  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2200  *--------------------------------------------------------------------------------------------*/\r
2201 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2202 var Touch;\r
2203 (function (Touch) {\r
2204     Touch.None = 0;\r
2205     Touch.First = 1;\r
2206     Touch.Last = 2;\r
2207 })(Touch = exports.Touch || (exports.Touch = {}));\r
2208 class LinkedMap {\r
2209     constructor() {\r
2210         this._map = new Map();\r
2211         this._head = undefined;\r
2212         this._tail = undefined;\r
2213         this._size = 0;\r
2214     }\r
2215     clear() {\r
2216         this._map.clear();\r
2217         this._head = undefined;\r
2218         this._tail = undefined;\r
2219         this._size = 0;\r
2220     }\r
2221     isEmpty() {\r
2222         return !this._head && !this._tail;\r
2223     }\r
2224     get size() {\r
2225         return this._size;\r
2226     }\r
2227     has(key) {\r
2228         return this._map.has(key);\r
2229     }\r
2230     get(key) {\r
2231         const item = this._map.get(key);\r
2232         if (!item) {\r
2233             return undefined;\r
2234         }\r
2235         return item.value;\r
2236     }\r
2237     set(key, value, touch = Touch.None) {\r
2238         let item = this._map.get(key);\r
2239         if (item) {\r
2240             item.value = value;\r
2241             if (touch !== Touch.None) {\r
2242                 this.touch(item, touch);\r
2243             }\r
2244         }\r
2245         else {\r
2246             item = { key, value, next: undefined, previous: undefined };\r
2247             switch (touch) {\r
2248                 case Touch.None:\r
2249                     this.addItemLast(item);\r
2250                     break;\r
2251                 case Touch.First:\r
2252                     this.addItemFirst(item);\r
2253                     break;\r
2254                 case Touch.Last:\r
2255                     this.addItemLast(item);\r
2256                     break;\r
2257                 default:\r
2258                     this.addItemLast(item);\r
2259                     break;\r
2260             }\r
2261             this._map.set(key, item);\r
2262             this._size++;\r
2263         }\r
2264     }\r
2265     delete(key) {\r
2266         const item = this._map.get(key);\r
2267         if (!item) {\r
2268             return false;\r
2269         }\r
2270         this._map.delete(key);\r
2271         this.removeItem(item);\r
2272         this._size--;\r
2273         return true;\r
2274     }\r
2275     shift() {\r
2276         if (!this._head && !this._tail) {\r
2277             return undefined;\r
2278         }\r
2279         if (!this._head || !this._tail) {\r
2280             throw new Error('Invalid list');\r
2281         }\r
2282         const item = this._head;\r
2283         this._map.delete(item.key);\r
2284         this.removeItem(item);\r
2285         this._size--;\r
2286         return item.value;\r
2287     }\r
2288     forEach(callbackfn, thisArg) {\r
2289         let current = this._head;\r
2290         while (current) {\r
2291             if (thisArg) {\r
2292                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2293             }\r
2294             else {\r
2295                 callbackfn(current.value, current.key, this);\r
2296             }\r
2297             current = current.next;\r
2298         }\r
2299     }\r
2300     forEachReverse(callbackfn, thisArg) {\r
2301         let current = this._tail;\r
2302         while (current) {\r
2303             if (thisArg) {\r
2304                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2305             }\r
2306             else {\r
2307                 callbackfn(current.value, current.key, this);\r
2308             }\r
2309             current = current.previous;\r
2310         }\r
2311     }\r
2312     values() {\r
2313         let result = [];\r
2314         let current = this._head;\r
2315         while (current) {\r
2316             result.push(current.value);\r
2317             current = current.next;\r
2318         }\r
2319         return result;\r
2320     }\r
2321     keys() {\r
2322         let result = [];\r
2323         let current = this._head;\r
2324         while (current) {\r
2325             result.push(current.key);\r
2326             current = current.next;\r
2327         }\r
2328         return result;\r
2329     }\r
2330     /* JSON RPC run on es5 which has no Symbol.iterator\r
2331     public keys(): IterableIterator<K> {\r
2332         let current = this._head;\r
2333         let iterator: IterableIterator<K> = {\r
2334             [Symbol.iterator]() {\r
2335                 return iterator;\r
2336             },\r
2337             next():IteratorResult<K> {\r
2338                 if (current) {\r
2339                     let result = { value: current.key, done: false };\r
2340                     current = current.next;\r
2341                     return result;\r
2342                 } else {\r
2343                     return { value: undefined, done: true };\r
2344                 }\r
2345             }\r
2346         };\r
2347         return iterator;\r
2348     }\r
2349 \r
2350     public values(): IterableIterator<V> {\r
2351         let current = this._head;\r
2352         let iterator: IterableIterator<V> = {\r
2353             [Symbol.iterator]() {\r
2354                 return iterator;\r
2355             },\r
2356             next():IteratorResult<V> {\r
2357                 if (current) {\r
2358                     let result = { value: current.value, done: false };\r
2359                     current = current.next;\r
2360                     return result;\r
2361                 } else {\r
2362                     return { value: undefined, done: true };\r
2363                 }\r
2364             }\r
2365         };\r
2366         return iterator;\r
2367     }\r
2368     */\r
2369     addItemFirst(item) {\r
2370         // First time Insert\r
2371         if (!this._head && !this._tail) {\r
2372             this._tail = item;\r
2373         }\r
2374         else if (!this._head) {\r
2375             throw new Error('Invalid list');\r
2376         }\r
2377         else {\r
2378             item.next = this._head;\r
2379             this._head.previous = item;\r
2380         }\r
2381         this._head = item;\r
2382     }\r
2383     addItemLast(item) {\r
2384         // First time Insert\r
2385         if (!this._head && !this._tail) {\r
2386             this._head = item;\r
2387         }\r
2388         else if (!this._tail) {\r
2389             throw new Error('Invalid list');\r
2390         }\r
2391         else {\r
2392             item.previous = this._tail;\r
2393             this._tail.next = item;\r
2394         }\r
2395         this._tail = item;\r
2396     }\r
2397     removeItem(item) {\r
2398         if (item === this._head && item === this._tail) {\r
2399             this._head = undefined;\r
2400             this._tail = undefined;\r
2401         }\r
2402         else if (item === this._head) {\r
2403             this._head = item.next;\r
2404         }\r
2405         else if (item === this._tail) {\r
2406             this._tail = item.previous;\r
2407         }\r
2408         else {\r
2409             const next = item.next;\r
2410             const previous = item.previous;\r
2411             if (!next || !previous) {\r
2412                 throw new Error('Invalid list');\r
2413             }\r
2414             next.previous = previous;\r
2415             previous.next = next;\r
2416         }\r
2417     }\r
2418     touch(item, touch) {\r
2419         if (!this._head || !this._tail) {\r
2420             throw new Error('Invalid list');\r
2421         }\r
2422         if ((touch !== Touch.First && touch !== Touch.Last)) {\r
2423             return;\r
2424         }\r
2425         if (touch === Touch.First) {\r
2426             if (item === this._head) {\r
2427                 return;\r
2428             }\r
2429             const next = item.next;\r
2430             const previous = item.previous;\r
2431             // Unlink the item\r
2432             if (item === this._tail) {\r
2433                 // previous must be defined since item was not head but is tail\r
2434                 // So there are more than on item in the map\r
2435                 previous.next = undefined;\r
2436                 this._tail = previous;\r
2437             }\r
2438             else {\r
2439                 // Both next and previous are not undefined since item was neither head nor tail.\r
2440                 next.previous = previous;\r
2441                 previous.next = next;\r
2442             }\r
2443             // Insert the node at head\r
2444             item.previous = undefined;\r
2445             item.next = this._head;\r
2446             this._head.previous = item;\r
2447             this._head = item;\r
2448         }\r
2449         else if (touch === Touch.Last) {\r
2450             if (item === this._tail) {\r
2451                 return;\r
2452             }\r
2453             const next = item.next;\r
2454             const previous = item.previous;\r
2455             // Unlink the item.\r
2456             if (item === this._head) {\r
2457                 // next must be defined since item was not tail but is head\r
2458                 // So there are more than on item in the map\r
2459                 next.previous = undefined;\r
2460                 this._head = next;\r
2461             }\r
2462             else {\r
2463                 // Both next and previous are not undefined since item was neither head nor tail.\r
2464                 next.previous = previous;\r
2465                 previous.next = next;\r
2466             }\r
2467             item.next = undefined;\r
2468             item.previous = this._tail;\r
2469             this._tail.next = item;\r
2470             this._tail = item;\r
2471         }\r
2472     }\r
2473 }\r
2474 exports.LinkedMap = LinkedMap;\r
2475
2476
2477 /***/ }),
2478 /* 13 */
2479 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2480
2481 "use strict";
2482 /* --------------------------------------------------------------------------------------------\r
2483  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2484  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2485  * ------------------------------------------------------------------------------------------ */\r
2486 \r
2487 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2488 const path_1 = __webpack_require__(2);\r
2489 const os_1 = __webpack_require__(14);\r
2490 const crypto_1 = __webpack_require__(15);\r
2491 const net_1 = __webpack_require__(16);\r
2492 const messageReader_1 = __webpack_require__(8);\r
2493 const messageWriter_1 = __webpack_require__(10);\r
2494 function generateRandomPipeName() {\r
2495     const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
2496     if (process.platform === 'win32') {\r
2497         return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
2498     }\r
2499     else {\r
2500         // Mac/Unix: use socket file\r
2501         return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
2502     }\r
2503 }\r
2504 exports.generateRandomPipeName = generateRandomPipeName;\r
2505 function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
2506     let connectResolve;\r
2507     let connected = new Promise((resolve, _reject) => {\r
2508         connectResolve = resolve;\r
2509     });\r
2510     return new Promise((resolve, reject) => {\r
2511         let server = net_1.createServer((socket) => {\r
2512             server.close();\r
2513             connectResolve([\r
2514                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2515                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2516             ]);\r
2517         });\r
2518         server.on('error', reject);\r
2519         server.listen(pipeName, () => {\r
2520             server.removeListener('error', reject);\r
2521             resolve({\r
2522                 onConnected: () => { return connected; }\r
2523             });\r
2524         });\r
2525     });\r
2526 }\r
2527 exports.createClientPipeTransport = createClientPipeTransport;\r
2528 function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
2529     const socket = net_1.createConnection(pipeName);\r
2530     return [\r
2531         new messageReader_1.SocketMessageReader(socket, encoding),\r
2532         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2533     ];\r
2534 }\r
2535 exports.createServerPipeTransport = createServerPipeTransport;\r
2536
2537
2538 /***/ }),
2539 /* 14 */
2540 /***/ ((module) => {
2541
2542 "use strict";
2543 module.exports = require("os");;
2544
2545 /***/ }),
2546 /* 15 */
2547 /***/ ((module) => {
2548
2549 "use strict";
2550 module.exports = require("crypto");;
2551
2552 /***/ }),
2553 /* 16 */
2554 /***/ ((module) => {
2555
2556 "use strict";
2557 module.exports = require("net");;
2558
2559 /***/ }),
2560 /* 17 */
2561 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2562
2563 "use strict";
2564 /* --------------------------------------------------------------------------------------------\r
2565  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2566  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2567  * ------------------------------------------------------------------------------------------ */\r
2568 \r
2569 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2570 const net_1 = __webpack_require__(16);\r
2571 const messageReader_1 = __webpack_require__(8);\r
2572 const messageWriter_1 = __webpack_require__(10);\r
2573 function createClientSocketTransport(port, encoding = 'utf-8') {\r
2574     let connectResolve;\r
2575     let connected = new Promise((resolve, _reject) => {\r
2576         connectResolve = resolve;\r
2577     });\r
2578     return new Promise((resolve, reject) => {\r
2579         let server = net_1.createServer((socket) => {\r
2580             server.close();\r
2581             connectResolve([\r
2582                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2583                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2584             ]);\r
2585         });\r
2586         server.on('error', reject);\r
2587         server.listen(port, '127.0.0.1', () => {\r
2588             server.removeListener('error', reject);\r
2589             resolve({\r
2590                 onConnected: () => { return connected; }\r
2591             });\r
2592         });\r
2593     });\r
2594 }\r
2595 exports.createClientSocketTransport = createClientSocketTransport;\r
2596 function createServerSocketTransport(port, encoding = 'utf-8') {\r
2597     const socket = net_1.createConnection(port, '127.0.0.1');\r
2598     return [\r
2599         new messageReader_1.SocketMessageReader(socket, encoding),\r
2600         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2601     ];\r
2602 }\r
2603 exports.createServerSocketTransport = createServerSocketTransport;\r
2604
2605
2606 /***/ }),
2607 /* 18 */
2608 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2609
2610 "use strict";
2611 __webpack_require__.r(__webpack_exports__);
2612 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2613 /* harmony export */   "Position": () => /* binding */ Position,
2614 /* harmony export */   "Range": () => /* binding */ Range,
2615 /* harmony export */   "Location": () => /* binding */ Location,
2616 /* harmony export */   "LocationLink": () => /* binding */ LocationLink,
2617 /* harmony export */   "Color": () => /* binding */ Color,
2618 /* harmony export */   "ColorInformation": () => /* binding */ ColorInformation,
2619 /* harmony export */   "ColorPresentation": () => /* binding */ ColorPresentation,
2620 /* harmony export */   "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
2621 /* harmony export */   "FoldingRange": () => /* binding */ FoldingRange,
2622 /* harmony export */   "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
2623 /* harmony export */   "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
2624 /* harmony export */   "DiagnosticTag": () => /* binding */ DiagnosticTag,
2625 /* harmony export */   "Diagnostic": () => /* binding */ Diagnostic,
2626 /* harmony export */   "Command": () => /* binding */ Command,
2627 /* harmony export */   "TextEdit": () => /* binding */ TextEdit,
2628 /* harmony export */   "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
2629 /* harmony export */   "CreateFile": () => /* binding */ CreateFile,
2630 /* harmony export */   "RenameFile": () => /* binding */ RenameFile,
2631 /* harmony export */   "DeleteFile": () => /* binding */ DeleteFile,
2632 /* harmony export */   "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
2633 /* harmony export */   "WorkspaceChange": () => /* binding */ WorkspaceChange,
2634 /* harmony export */   "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
2635 /* harmony export */   "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
2636 /* harmony export */   "TextDocumentItem": () => /* binding */ TextDocumentItem,
2637 /* harmony export */   "MarkupKind": () => /* binding */ MarkupKind,
2638 /* harmony export */   "MarkupContent": () => /* binding */ MarkupContent,
2639 /* harmony export */   "CompletionItemKind": () => /* binding */ CompletionItemKind,
2640 /* harmony export */   "InsertTextFormat": () => /* binding */ InsertTextFormat,
2641 /* harmony export */   "CompletionItemTag": () => /* binding */ CompletionItemTag,
2642 /* harmony export */   "CompletionItem": () => /* binding */ CompletionItem,
2643 /* harmony export */   "CompletionList": () => /* binding */ CompletionList,
2644 /* harmony export */   "MarkedString": () => /* binding */ MarkedString,
2645 /* harmony export */   "Hover": () => /* binding */ Hover,
2646 /* harmony export */   "ParameterInformation": () => /* binding */ ParameterInformation,
2647 /* harmony export */   "SignatureInformation": () => /* binding */ SignatureInformation,
2648 /* harmony export */   "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
2649 /* harmony export */   "DocumentHighlight": () => /* binding */ DocumentHighlight,
2650 /* harmony export */   "SymbolKind": () => /* binding */ SymbolKind,
2651 /* harmony export */   "SymbolTag": () => /* binding */ SymbolTag,
2652 /* harmony export */   "SymbolInformation": () => /* binding */ SymbolInformation,
2653 /* harmony export */   "DocumentSymbol": () => /* binding */ DocumentSymbol,
2654 /* harmony export */   "CodeActionKind": () => /* binding */ CodeActionKind,
2655 /* harmony export */   "CodeActionContext": () => /* binding */ CodeActionContext,
2656 /* harmony export */   "CodeAction": () => /* binding */ CodeAction,
2657 /* harmony export */   "CodeLens": () => /* binding */ CodeLens,
2658 /* harmony export */   "FormattingOptions": () => /* binding */ FormattingOptions,
2659 /* harmony export */   "DocumentLink": () => /* binding */ DocumentLink,
2660 /* harmony export */   "SelectionRange": () => /* binding */ SelectionRange,
2661 /* harmony export */   "EOL": () => /* binding */ EOL,
2662 /* harmony export */   "TextDocument": () => /* binding */ TextDocument
2663 /* harmony export */ });
2664 /* --------------------------------------------------------------------------------------------\r
2665  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2666  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2667  * ------------------------------------------------------------------------------------------ */\r
2668 \r
2669 /**\r
2670  * The Position namespace provides helper functions to work with\r
2671  * [Position](#Position) literals.\r
2672  */\r
2673 var Position;\r
2674 (function (Position) {\r
2675     /**\r
2676      * Creates a new Position literal from the given line and character.\r
2677      * @param line The position's line.\r
2678      * @param character The position's character.\r
2679      */\r
2680     function create(line, character) {\r
2681         return { line: line, character: character };\r
2682     }\r
2683     Position.create = create;\r
2684     /**\r
2685      * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
2686      */\r
2687     function is(value) {\r
2688         var candidate = value;\r
2689         return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
2690     }\r
2691     Position.is = is;\r
2692 })(Position || (Position = {}));\r
2693 /**\r
2694  * The Range namespace provides helper functions to work with\r
2695  * [Range](#Range) literals.\r
2696  */\r
2697 var Range;\r
2698 (function (Range) {\r
2699     function create(one, two, three, four) {\r
2700         if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
2701             return { start: Position.create(one, two), end: Position.create(three, four) };\r
2702         }\r
2703         else if (Position.is(one) && Position.is(two)) {\r
2704             return { start: one, end: two };\r
2705         }\r
2706         else {\r
2707             throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
2708         }\r
2709     }\r
2710     Range.create = create;\r
2711     /**\r
2712      * Checks whether the given literal conforms to the [Range](#Range) interface.\r
2713      */\r
2714     function is(value) {\r
2715         var candidate = value;\r
2716         return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
2717     }\r
2718     Range.is = is;\r
2719 })(Range || (Range = {}));\r
2720 /**\r
2721  * The Location namespace provides helper functions to work with\r
2722  * [Location](#Location) literals.\r
2723  */\r
2724 var Location;\r
2725 (function (Location) {\r
2726     /**\r
2727      * Creates a Location literal.\r
2728      * @param uri The location's uri.\r
2729      * @param range The location's range.\r
2730      */\r
2731     function create(uri, range) {\r
2732         return { uri: uri, range: range };\r
2733     }\r
2734     Location.create = create;\r
2735     /**\r
2736      * Checks whether the given literal conforms to the [Location](#Location) interface.\r
2737      */\r
2738     function is(value) {\r
2739         var candidate = value;\r
2740         return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
2741     }\r
2742     Location.is = is;\r
2743 })(Location || (Location = {}));\r
2744 /**\r
2745  * The LocationLink namespace provides helper functions to work with\r
2746  * [LocationLink](#LocationLink) literals.\r
2747  */\r
2748 var LocationLink;\r
2749 (function (LocationLink) {\r
2750     /**\r
2751      * Creates a LocationLink literal.\r
2752      * @param targetUri The definition's uri.\r
2753      * @param targetRange The full range of the definition.\r
2754      * @param targetSelectionRange The span of the symbol definition at the target.\r
2755      * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
2756      */\r
2757     function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
2758         return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
2759     }\r
2760     LocationLink.create = create;\r
2761     /**\r
2762      * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
2763      */\r
2764     function is(value) {\r
2765         var candidate = value;\r
2766         return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
2767             && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
2768             && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
2769     }\r
2770     LocationLink.is = is;\r
2771 })(LocationLink || (LocationLink = {}));\r
2772 /**\r
2773  * The Color namespace provides helper functions to work with\r
2774  * [Color](#Color) literals.\r
2775  */\r
2776 var Color;\r
2777 (function (Color) {\r
2778     /**\r
2779      * Creates a new Color literal.\r
2780      */\r
2781     function create(red, green, blue, alpha) {\r
2782         return {\r
2783             red: red,\r
2784             green: green,\r
2785             blue: blue,\r
2786             alpha: alpha,\r
2787         };\r
2788     }\r
2789     Color.create = create;\r
2790     /**\r
2791      * Checks whether the given literal conforms to the [Color](#Color) interface.\r
2792      */\r
2793     function is(value) {\r
2794         var candidate = value;\r
2795         return Is.number(candidate.red)\r
2796             && Is.number(candidate.green)\r
2797             && Is.number(candidate.blue)\r
2798             && Is.number(candidate.alpha);\r
2799     }\r
2800     Color.is = is;\r
2801 })(Color || (Color = {}));\r
2802 /**\r
2803  * The ColorInformation namespace provides helper functions to work with\r
2804  * [ColorInformation](#ColorInformation) literals.\r
2805  */\r
2806 var ColorInformation;\r
2807 (function (ColorInformation) {\r
2808     /**\r
2809      * Creates a new ColorInformation literal.\r
2810      */\r
2811     function create(range, color) {\r
2812         return {\r
2813             range: range,\r
2814             color: color,\r
2815         };\r
2816     }\r
2817     ColorInformation.create = create;\r
2818     /**\r
2819      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2820      */\r
2821     function is(value) {\r
2822         var candidate = value;\r
2823         return Range.is(candidate.range) && Color.is(candidate.color);\r
2824     }\r
2825     ColorInformation.is = is;\r
2826 })(ColorInformation || (ColorInformation = {}));\r
2827 /**\r
2828  * The Color namespace provides helper functions to work with\r
2829  * [ColorPresentation](#ColorPresentation) literals.\r
2830  */\r
2831 var ColorPresentation;\r
2832 (function (ColorPresentation) {\r
2833     /**\r
2834      * Creates a new ColorInformation literal.\r
2835      */\r
2836     function create(label, textEdit, additionalTextEdits) {\r
2837         return {\r
2838             label: label,\r
2839             textEdit: textEdit,\r
2840             additionalTextEdits: additionalTextEdits,\r
2841         };\r
2842     }\r
2843     ColorPresentation.create = create;\r
2844     /**\r
2845      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2846      */\r
2847     function is(value) {\r
2848         var candidate = value;\r
2849         return Is.string(candidate.label)\r
2850             && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
2851             && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
2852     }\r
2853     ColorPresentation.is = is;\r
2854 })(ColorPresentation || (ColorPresentation = {}));\r
2855 /**\r
2856  * Enum of known range kinds\r
2857  */\r
2858 var FoldingRangeKind;\r
2859 (function (FoldingRangeKind) {\r
2860     /**\r
2861      * Folding range for a comment\r
2862      */\r
2863     FoldingRangeKind["Comment"] = "comment";\r
2864     /**\r
2865      * Folding range for a imports or includes\r
2866      */\r
2867     FoldingRangeKind["Imports"] = "imports";\r
2868     /**\r
2869      * Folding range for a region (e.g. `#region`)\r
2870      */\r
2871     FoldingRangeKind["Region"] = "region";\r
2872 })(FoldingRangeKind || (FoldingRangeKind = {}));\r
2873 /**\r
2874  * The folding range namespace provides helper functions to work with\r
2875  * [FoldingRange](#FoldingRange) literals.\r
2876  */\r
2877 var FoldingRange;\r
2878 (function (FoldingRange) {\r
2879     /**\r
2880      * Creates a new FoldingRange literal.\r
2881      */\r
2882     function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
2883         var result = {\r
2884             startLine: startLine,\r
2885             endLine: endLine\r
2886         };\r
2887         if (Is.defined(startCharacter)) {\r
2888             result.startCharacter = startCharacter;\r
2889         }\r
2890         if (Is.defined(endCharacter)) {\r
2891             result.endCharacter = endCharacter;\r
2892         }\r
2893         if (Is.defined(kind)) {\r
2894             result.kind = kind;\r
2895         }\r
2896         return result;\r
2897     }\r
2898     FoldingRange.create = create;\r
2899     /**\r
2900      * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
2901      */\r
2902     function is(value) {\r
2903         var candidate = value;\r
2904         return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
2905             && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
2906             && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
2907             && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
2908     }\r
2909     FoldingRange.is = is;\r
2910 })(FoldingRange || (FoldingRange = {}));\r
2911 /**\r
2912  * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
2913  * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
2914  */\r
2915 var DiagnosticRelatedInformation;\r
2916 (function (DiagnosticRelatedInformation) {\r
2917     /**\r
2918      * Creates a new DiagnosticRelatedInformation literal.\r
2919      */\r
2920     function create(location, message) {\r
2921         return {\r
2922             location: location,\r
2923             message: message\r
2924         };\r
2925     }\r
2926     DiagnosticRelatedInformation.create = create;\r
2927     /**\r
2928      * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
2929      */\r
2930     function is(value) {\r
2931         var candidate = value;\r
2932         return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
2933     }\r
2934     DiagnosticRelatedInformation.is = is;\r
2935 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
2936 /**\r
2937  * The diagnostic's severity.\r
2938  */\r
2939 var DiagnosticSeverity;\r
2940 (function (DiagnosticSeverity) {\r
2941     /**\r
2942      * Reports an error.\r
2943      */\r
2944     DiagnosticSeverity.Error = 1;\r
2945     /**\r
2946      * Reports a warning.\r
2947      */\r
2948     DiagnosticSeverity.Warning = 2;\r
2949     /**\r
2950      * Reports an information.\r
2951      */\r
2952     DiagnosticSeverity.Information = 3;\r
2953     /**\r
2954      * Reports a hint.\r
2955      */\r
2956     DiagnosticSeverity.Hint = 4;\r
2957 })(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
2958 /**\r
2959  * The diagnostic tags.\r
2960  *\r
2961  * @since 3.15.0\r
2962  */\r
2963 var DiagnosticTag;\r
2964 (function (DiagnosticTag) {\r
2965     /**\r
2966      * Unused or unnecessary code.\r
2967      *\r
2968      * Clients are allowed to render diagnostics with this tag faded out instead of having\r
2969      * an error squiggle.\r
2970      */\r
2971     DiagnosticTag.Unnecessary = 1;\r
2972     /**\r
2973      * Deprecated or obsolete code.\r
2974      *\r
2975      * Clients are allowed to rendered diagnostics with this tag strike through.\r
2976      */\r
2977     DiagnosticTag.Deprecated = 2;\r
2978 })(DiagnosticTag || (DiagnosticTag = {}));\r
2979 /**\r
2980  * The Diagnostic namespace provides helper functions to work with\r
2981  * [Diagnostic](#Diagnostic) literals.\r
2982  */\r
2983 var Diagnostic;\r
2984 (function (Diagnostic) {\r
2985     /**\r
2986      * Creates a new Diagnostic literal.\r
2987      */\r
2988     function create(range, message, severity, code, source, relatedInformation) {\r
2989         var result = { range: range, message: message };\r
2990         if (Is.defined(severity)) {\r
2991             result.severity = severity;\r
2992         }\r
2993         if (Is.defined(code)) {\r
2994             result.code = code;\r
2995         }\r
2996         if (Is.defined(source)) {\r
2997             result.source = source;\r
2998         }\r
2999         if (Is.defined(relatedInformation)) {\r
3000             result.relatedInformation = relatedInformation;\r
3001         }\r
3002         return result;\r
3003     }\r
3004     Diagnostic.create = create;\r
3005     /**\r
3006      * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
3007      */\r
3008     function is(value) {\r
3009         var candidate = value;\r
3010         return Is.defined(candidate)\r
3011             && Range.is(candidate.range)\r
3012             && Is.string(candidate.message)\r
3013             && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
3014             && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
3015             && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
3016             && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
3017     }\r
3018     Diagnostic.is = is;\r
3019 })(Diagnostic || (Diagnostic = {}));\r
3020 /**\r
3021  * The Command namespace provides helper functions to work with\r
3022  * [Command](#Command) literals.\r
3023  */\r
3024 var Command;\r
3025 (function (Command) {\r
3026     /**\r
3027      * Creates a new Command literal.\r
3028      */\r
3029     function create(title, command) {\r
3030         var args = [];\r
3031         for (var _i = 2; _i < arguments.length; _i++) {\r
3032             args[_i - 2] = arguments[_i];\r
3033         }\r
3034         var result = { title: title, command: command };\r
3035         if (Is.defined(args) && args.length > 0) {\r
3036             result.arguments = args;\r
3037         }\r
3038         return result;\r
3039     }\r
3040     Command.create = create;\r
3041     /**\r
3042      * Checks whether the given literal conforms to the [Command](#Command) interface.\r
3043      */\r
3044     function is(value) {\r
3045         var candidate = value;\r
3046         return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
3047     }\r
3048     Command.is = is;\r
3049 })(Command || (Command = {}));\r
3050 /**\r
3051  * The TextEdit namespace provides helper function to create replace,\r
3052  * insert and delete edits more easily.\r
3053  */\r
3054 var TextEdit;\r
3055 (function (TextEdit) {\r
3056     /**\r
3057      * Creates a replace text edit.\r
3058      * @param range The range of text to be replaced.\r
3059      * @param newText The new text.\r
3060      */\r
3061     function replace(range, newText) {\r
3062         return { range: range, newText: newText };\r
3063     }\r
3064     TextEdit.replace = replace;\r
3065     /**\r
3066      * Creates a insert text edit.\r
3067      * @param position The position to insert the text at.\r
3068      * @param newText The text to be inserted.\r
3069      */\r
3070     function insert(position, newText) {\r
3071         return { range: { start: position, end: position }, newText: newText };\r
3072     }\r
3073     TextEdit.insert = insert;\r
3074     /**\r
3075      * Creates a delete text edit.\r
3076      * @param range The range of text to be deleted.\r
3077      */\r
3078     function del(range) {\r
3079         return { range: range, newText: '' };\r
3080     }\r
3081     TextEdit.del = del;\r
3082     function is(value) {\r
3083         var candidate = value;\r
3084         return Is.objectLiteral(candidate)\r
3085             && Is.string(candidate.newText)\r
3086             && Range.is(candidate.range);\r
3087     }\r
3088     TextEdit.is = is;\r
3089 })(TextEdit || (TextEdit = {}));\r
3090 /**\r
3091  * The TextDocumentEdit namespace provides helper function to create\r
3092  * an edit that manipulates a text document.\r
3093  */\r
3094 var TextDocumentEdit;\r
3095 (function (TextDocumentEdit) {\r
3096     /**\r
3097      * Creates a new `TextDocumentEdit`\r
3098      */\r
3099     function create(textDocument, edits) {\r
3100         return { textDocument: textDocument, edits: edits };\r
3101     }\r
3102     TextDocumentEdit.create = create;\r
3103     function is(value) {\r
3104         var candidate = value;\r
3105         return Is.defined(candidate)\r
3106             && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
3107             && Array.isArray(candidate.edits);\r
3108     }\r
3109     TextDocumentEdit.is = is;\r
3110 })(TextDocumentEdit || (TextDocumentEdit = {}));\r
3111 var CreateFile;\r
3112 (function (CreateFile) {\r
3113     function create(uri, options) {\r
3114         var result = {\r
3115             kind: 'create',\r
3116             uri: uri\r
3117         };\r
3118         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3119             result.options = options;\r
3120         }\r
3121         return result;\r
3122     }\r
3123     CreateFile.create = create;\r
3124     function is(value) {\r
3125         var candidate = value;\r
3126         return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
3127             (candidate.options === void 0 ||\r
3128                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3129     }\r
3130     CreateFile.is = is;\r
3131 })(CreateFile || (CreateFile = {}));\r
3132 var RenameFile;\r
3133 (function (RenameFile) {\r
3134     function create(oldUri, newUri, options) {\r
3135         var result = {\r
3136             kind: 'rename',\r
3137             oldUri: oldUri,\r
3138             newUri: newUri\r
3139         };\r
3140         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3141             result.options = options;\r
3142         }\r
3143         return result;\r
3144     }\r
3145     RenameFile.create = create;\r
3146     function is(value) {\r
3147         var candidate = value;\r
3148         return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
3149             (candidate.options === void 0 ||\r
3150                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3151     }\r
3152     RenameFile.is = is;\r
3153 })(RenameFile || (RenameFile = {}));\r
3154 var DeleteFile;\r
3155 (function (DeleteFile) {\r
3156     function create(uri, options) {\r
3157         var result = {\r
3158             kind: 'delete',\r
3159             uri: uri\r
3160         };\r
3161         if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
3162             result.options = options;\r
3163         }\r
3164         return result;\r
3165     }\r
3166     DeleteFile.create = create;\r
3167     function is(value) {\r
3168         var candidate = value;\r
3169         return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
3170             (candidate.options === void 0 ||\r
3171                 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
3172     }\r
3173     DeleteFile.is = is;\r
3174 })(DeleteFile || (DeleteFile = {}));\r
3175 var WorkspaceEdit;\r
3176 (function (WorkspaceEdit) {\r
3177     function is(value) {\r
3178         var candidate = value;\r
3179         return candidate &&\r
3180             (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
3181             (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
3182                 if (Is.string(change.kind)) {\r
3183                     return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
3184                 }\r
3185                 else {\r
3186                     return TextDocumentEdit.is(change);\r
3187                 }\r
3188             }));\r
3189     }\r
3190     WorkspaceEdit.is = is;\r
3191 })(WorkspaceEdit || (WorkspaceEdit = {}));\r
3192 var TextEditChangeImpl = /** @class */ (function () {\r
3193     function TextEditChangeImpl(edits) {\r
3194         this.edits = edits;\r
3195     }\r
3196     TextEditChangeImpl.prototype.insert = function (position, newText) {\r
3197         this.edits.push(TextEdit.insert(position, newText));\r
3198     };\r
3199     TextEditChangeImpl.prototype.replace = function (range, newText) {\r
3200         this.edits.push(TextEdit.replace(range, newText));\r
3201     };\r
3202     TextEditChangeImpl.prototype.delete = function (range) {\r
3203         this.edits.push(TextEdit.del(range));\r
3204     };\r
3205     TextEditChangeImpl.prototype.add = function (edit) {\r
3206         this.edits.push(edit);\r
3207     };\r
3208     TextEditChangeImpl.prototype.all = function () {\r
3209         return this.edits;\r
3210     };\r
3211     TextEditChangeImpl.prototype.clear = function () {\r
3212         this.edits.splice(0, this.edits.length);\r
3213     };\r
3214     return TextEditChangeImpl;\r
3215 }());\r
3216 /**\r
3217  * A workspace change helps constructing changes to a workspace.\r
3218  */\r
3219 var WorkspaceChange = /** @class */ (function () {\r
3220     function WorkspaceChange(workspaceEdit) {\r
3221         var _this = this;\r
3222         this._textEditChanges = Object.create(null);\r
3223         if (workspaceEdit) {\r
3224             this._workspaceEdit = workspaceEdit;\r
3225             if (workspaceEdit.documentChanges) {\r
3226                 workspaceEdit.documentChanges.forEach(function (change) {\r
3227                     if (TextDocumentEdit.is(change)) {\r
3228                         var textEditChange = new TextEditChangeImpl(change.edits);\r
3229                         _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
3230                     }\r
3231                 });\r
3232             }\r
3233             else if (workspaceEdit.changes) {\r
3234                 Object.keys(workspaceEdit.changes).forEach(function (key) {\r
3235                     var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
3236                     _this._textEditChanges[key] = textEditChange;\r
3237                 });\r
3238             }\r
3239         }\r
3240     }\r
3241     Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
3242         /**\r
3243          * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
3244          * use to be returned from a workspace edit operation like rename.\r
3245          */\r
3246         get: function () {\r
3247             return this._workspaceEdit;\r
3248         },\r
3249         enumerable: true,\r
3250         configurable: true\r
3251     });\r
3252     WorkspaceChange.prototype.getTextEditChange = function (key) {\r
3253         if (VersionedTextDocumentIdentifier.is(key)) {\r
3254             if (!this._workspaceEdit) {\r
3255                 this._workspaceEdit = {\r
3256                     documentChanges: []\r
3257                 };\r
3258             }\r
3259             if (!this._workspaceEdit.documentChanges) {\r
3260                 throw new Error('Workspace edit is not configured for document changes.');\r
3261             }\r
3262             var textDocument = key;\r
3263             var result = this._textEditChanges[textDocument.uri];\r
3264             if (!result) {\r
3265                 var edits = [];\r
3266                 var textDocumentEdit = {\r
3267                     textDocument: textDocument,\r
3268                     edits: edits\r
3269                 };\r
3270                 this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
3271                 result = new TextEditChangeImpl(edits);\r
3272                 this._textEditChanges[textDocument.uri] = result;\r
3273             }\r
3274             return result;\r
3275         }\r
3276         else {\r
3277             if (!this._workspaceEdit) {\r
3278                 this._workspaceEdit = {\r
3279                     changes: Object.create(null)\r
3280                 };\r
3281             }\r
3282             if (!this._workspaceEdit.changes) {\r
3283                 throw new Error('Workspace edit is not configured for normal text edit changes.');\r
3284             }\r
3285             var result = this._textEditChanges[key];\r
3286             if (!result) {\r
3287                 var edits = [];\r
3288                 this._workspaceEdit.changes[key] = edits;\r
3289                 result = new TextEditChangeImpl(edits);\r
3290                 this._textEditChanges[key] = result;\r
3291             }\r
3292             return result;\r
3293         }\r
3294     };\r
3295     WorkspaceChange.prototype.createFile = function (uri, options) {\r
3296         this.checkDocumentChanges();\r
3297         this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
3298     };\r
3299     WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
3300         this.checkDocumentChanges();\r
3301         this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
3302     };\r
3303     WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
3304         this.checkDocumentChanges();\r
3305         this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
3306     };\r
3307     WorkspaceChange.prototype.checkDocumentChanges = function () {\r
3308         if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
3309             throw new Error('Workspace edit is not configured for document changes.');\r
3310         }\r
3311     };\r
3312     return WorkspaceChange;\r
3313 }());\r
3314 \r
3315 /**\r
3316  * The TextDocumentIdentifier namespace provides helper functions to work with\r
3317  * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
3318  */\r
3319 var TextDocumentIdentifier;\r
3320 (function (TextDocumentIdentifier) {\r
3321     /**\r
3322      * Creates a new TextDocumentIdentifier literal.\r
3323      * @param uri The document's uri.\r
3324      */\r
3325     function create(uri) {\r
3326         return { uri: uri };\r
3327     }\r
3328     TextDocumentIdentifier.create = create;\r
3329     /**\r
3330      * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
3331      */\r
3332     function is(value) {\r
3333         var candidate = value;\r
3334         return Is.defined(candidate) && Is.string(candidate.uri);\r
3335     }\r
3336     TextDocumentIdentifier.is = is;\r
3337 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
3338 /**\r
3339  * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
3340  * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
3341  */\r
3342 var VersionedTextDocumentIdentifier;\r
3343 (function (VersionedTextDocumentIdentifier) {\r
3344     /**\r
3345      * Creates a new VersionedTextDocumentIdentifier literal.\r
3346      * @param uri The document's uri.\r
3347      * @param uri The document's text.\r
3348      */\r
3349     function create(uri, version) {\r
3350         return { uri: uri, version: version };\r
3351     }\r
3352     VersionedTextDocumentIdentifier.create = create;\r
3353     /**\r
3354      * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
3355      */\r
3356     function is(value) {\r
3357         var candidate = value;\r
3358         return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
3359     }\r
3360     VersionedTextDocumentIdentifier.is = is;\r
3361 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
3362 /**\r
3363  * The TextDocumentItem namespace provides helper functions to work with\r
3364  * [TextDocumentItem](#TextDocumentItem) literals.\r
3365  */\r
3366 var TextDocumentItem;\r
3367 (function (TextDocumentItem) {\r
3368     /**\r
3369      * Creates a new TextDocumentItem literal.\r
3370      * @param uri The document's uri.\r
3371      * @param languageId The document's language identifier.\r
3372      * @param version The document's version number.\r
3373      * @param text The document's text.\r
3374      */\r
3375     function create(uri, languageId, version, text) {\r
3376         return { uri: uri, languageId: languageId, version: version, text: text };\r
3377     }\r
3378     TextDocumentItem.create = create;\r
3379     /**\r
3380      * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
3381      */\r
3382     function is(value) {\r
3383         var candidate = value;\r
3384         return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
3385     }\r
3386     TextDocumentItem.is = is;\r
3387 })(TextDocumentItem || (TextDocumentItem = {}));\r
3388 /**\r
3389  * Describes the content type that a client supports in various\r
3390  * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
3391  *\r
3392  * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
3393  * are reserved for internal usage.\r
3394  */\r
3395 var MarkupKind;\r
3396 (function (MarkupKind) {\r
3397     /**\r
3398      * Plain text is supported as a content format\r
3399      */\r
3400     MarkupKind.PlainText = 'plaintext';\r
3401     /**\r
3402      * Markdown is supported as a content format\r
3403      */\r
3404     MarkupKind.Markdown = 'markdown';\r
3405 })(MarkupKind || (MarkupKind = {}));\r
3406 (function (MarkupKind) {\r
3407     /**\r
3408      * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
3409      */\r
3410     function is(value) {\r
3411         var candidate = value;\r
3412         return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
3413     }\r
3414     MarkupKind.is = is;\r
3415 })(MarkupKind || (MarkupKind = {}));\r
3416 var MarkupContent;\r
3417 (function (MarkupContent) {\r
3418     /**\r
3419      * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
3420      */\r
3421     function is(value) {\r
3422         var candidate = value;\r
3423         return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
3424     }\r
3425     MarkupContent.is = is;\r
3426 })(MarkupContent || (MarkupContent = {}));\r
3427 /**\r
3428  * The kind of a completion entry.\r
3429  */\r
3430 var CompletionItemKind;\r
3431 (function (CompletionItemKind) {\r
3432     CompletionItemKind.Text = 1;\r
3433     CompletionItemKind.Method = 2;\r
3434     CompletionItemKind.Function = 3;\r
3435     CompletionItemKind.Constructor = 4;\r
3436     CompletionItemKind.Field = 5;\r
3437     CompletionItemKind.Variable = 6;\r
3438     CompletionItemKind.Class = 7;\r
3439     CompletionItemKind.Interface = 8;\r
3440     CompletionItemKind.Module = 9;\r
3441     CompletionItemKind.Property = 10;\r
3442     CompletionItemKind.Unit = 11;\r
3443     CompletionItemKind.Value = 12;\r
3444     CompletionItemKind.Enum = 13;\r
3445     CompletionItemKind.Keyword = 14;\r
3446     CompletionItemKind.Snippet = 15;\r
3447     CompletionItemKind.Color = 16;\r
3448     CompletionItemKind.File = 17;\r
3449     CompletionItemKind.Reference = 18;\r
3450     CompletionItemKind.Folder = 19;\r
3451     CompletionItemKind.EnumMember = 20;\r
3452     CompletionItemKind.Constant = 21;\r
3453     CompletionItemKind.Struct = 22;\r
3454     CompletionItemKind.Event = 23;\r
3455     CompletionItemKind.Operator = 24;\r
3456     CompletionItemKind.TypeParameter = 25;\r
3457 })(CompletionItemKind || (CompletionItemKind = {}));\r
3458 /**\r
3459  * Defines whether the insert text in a completion item should be interpreted as\r
3460  * plain text or a snippet.\r
3461  */\r
3462 var InsertTextFormat;\r
3463 (function (InsertTextFormat) {\r
3464     /**\r
3465      * The primary text to be inserted is treated as a plain string.\r
3466      */\r
3467     InsertTextFormat.PlainText = 1;\r
3468     /**\r
3469      * The primary text to be inserted is treated as a snippet.\r
3470      *\r
3471      * A snippet can define tab stops and placeholders with `$1`, `$2`\r
3472      * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
3473      * the end of the snippet. Placeholders with equal identifiers are linked,\r
3474      * that is typing in one will update others too.\r
3475      *\r
3476      * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
3477      */\r
3478     InsertTextFormat.Snippet = 2;\r
3479 })(InsertTextFormat || (InsertTextFormat = {}));\r
3480 /**\r
3481  * Completion item tags are extra annotations that tweak the rendering of a completion\r
3482  * item.\r
3483  *\r
3484  * @since 3.15.0\r
3485  */\r
3486 var CompletionItemTag;\r
3487 (function (CompletionItemTag) {\r
3488     /**\r
3489      * Render a completion as obsolete, usually using a strike-out.\r
3490      */\r
3491     CompletionItemTag.Deprecated = 1;\r
3492 })(CompletionItemTag || (CompletionItemTag = {}));\r
3493 /**\r
3494  * The CompletionItem namespace provides functions to deal with\r
3495  * completion items.\r
3496  */\r
3497 var CompletionItem;\r
3498 (function (CompletionItem) {\r
3499     /**\r
3500      * Create a completion item and seed it with a label.\r
3501      * @param label The completion item's label\r
3502      */\r
3503     function create(label) {\r
3504         return { label: label };\r
3505     }\r
3506     CompletionItem.create = create;\r
3507 })(CompletionItem || (CompletionItem = {}));\r
3508 /**\r
3509  * The CompletionList namespace provides functions to deal with\r
3510  * completion lists.\r
3511  */\r
3512 var CompletionList;\r
3513 (function (CompletionList) {\r
3514     /**\r
3515      * Creates a new completion list.\r
3516      *\r
3517      * @param items The completion items.\r
3518      * @param isIncomplete The list is not complete.\r
3519      */\r
3520     function create(items, isIncomplete) {\r
3521         return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
3522     }\r
3523     CompletionList.create = create;\r
3524 })(CompletionList || (CompletionList = {}));\r
3525 var MarkedString;\r
3526 (function (MarkedString) {\r
3527     /**\r
3528      * Creates a marked string from plain text.\r
3529      *\r
3530      * @param plainText The plain text.\r
3531      */\r
3532     function fromPlainText(plainText) {\r
3533         return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
3534     }\r
3535     MarkedString.fromPlainText = fromPlainText;\r
3536     /**\r
3537      * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
3538      */\r
3539     function is(value) {\r
3540         var candidate = value;\r
3541         return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
3542     }\r
3543     MarkedString.is = is;\r
3544 })(MarkedString || (MarkedString = {}));\r
3545 var Hover;\r
3546 (function (Hover) {\r
3547     /**\r
3548      * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
3549      */\r
3550     function is(value) {\r
3551         var candidate = value;\r
3552         return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
3553             MarkedString.is(candidate.contents) ||\r
3554             Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
3555     }\r
3556     Hover.is = is;\r
3557 })(Hover || (Hover = {}));\r
3558 /**\r
3559  * The ParameterInformation namespace provides helper functions to work with\r
3560  * [ParameterInformation](#ParameterInformation) literals.\r
3561  */\r
3562 var ParameterInformation;\r
3563 (function (ParameterInformation) {\r
3564     /**\r
3565      * Creates a new parameter information literal.\r
3566      *\r
3567      * @param label A label string.\r
3568      * @param documentation A doc string.\r
3569      */\r
3570     function create(label, documentation) {\r
3571         return documentation ? { label: label, documentation: documentation } : { label: label };\r
3572     }\r
3573     ParameterInformation.create = create;\r
3574 })(ParameterInformation || (ParameterInformation = {}));\r
3575 /**\r
3576  * The SignatureInformation namespace provides helper functions to work with\r
3577  * [SignatureInformation](#SignatureInformation) literals.\r
3578  */\r
3579 var SignatureInformation;\r
3580 (function (SignatureInformation) {\r
3581     function create(label, documentation) {\r
3582         var parameters = [];\r
3583         for (var _i = 2; _i < arguments.length; _i++) {\r
3584             parameters[_i - 2] = arguments[_i];\r
3585         }\r
3586         var result = { label: label };\r
3587         if (Is.defined(documentation)) {\r
3588             result.documentation = documentation;\r
3589         }\r
3590         if (Is.defined(parameters)) {\r
3591             result.parameters = parameters;\r
3592         }\r
3593         else {\r
3594             result.parameters = [];\r
3595         }\r
3596         return result;\r
3597     }\r
3598     SignatureInformation.create = create;\r
3599 })(SignatureInformation || (SignatureInformation = {}));\r
3600 /**\r
3601  * A document highlight kind.\r
3602  */\r
3603 var DocumentHighlightKind;\r
3604 (function (DocumentHighlightKind) {\r
3605     /**\r
3606      * A textual occurrence.\r
3607      */\r
3608     DocumentHighlightKind.Text = 1;\r
3609     /**\r
3610      * Read-access of a symbol, like reading a variable.\r
3611      */\r
3612     DocumentHighlightKind.Read = 2;\r
3613     /**\r
3614      * Write-access of a symbol, like writing to a variable.\r
3615      */\r
3616     DocumentHighlightKind.Write = 3;\r
3617 })(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
3618 /**\r
3619  * DocumentHighlight namespace to provide helper functions to work with\r
3620  * [DocumentHighlight](#DocumentHighlight) literals.\r
3621  */\r
3622 var DocumentHighlight;\r
3623 (function (DocumentHighlight) {\r
3624     /**\r
3625      * Create a DocumentHighlight object.\r
3626      * @param range The range the highlight applies to.\r
3627      */\r
3628     function create(range, kind) {\r
3629         var result = { range: range };\r
3630         if (Is.number(kind)) {\r
3631             result.kind = kind;\r
3632         }\r
3633         return result;\r
3634     }\r
3635     DocumentHighlight.create = create;\r
3636 })(DocumentHighlight || (DocumentHighlight = {}));\r
3637 /**\r
3638  * A symbol kind.\r
3639  */\r
3640 var SymbolKind;\r
3641 (function (SymbolKind) {\r
3642     SymbolKind.File = 1;\r
3643     SymbolKind.Module = 2;\r
3644     SymbolKind.Namespace = 3;\r
3645     SymbolKind.Package = 4;\r
3646     SymbolKind.Class = 5;\r
3647     SymbolKind.Method = 6;\r
3648     SymbolKind.Property = 7;\r
3649     SymbolKind.Field = 8;\r
3650     SymbolKind.Constructor = 9;\r
3651     SymbolKind.Enum = 10;\r
3652     SymbolKind.Interface = 11;\r
3653     SymbolKind.Function = 12;\r
3654     SymbolKind.Variable = 13;\r
3655     SymbolKind.Constant = 14;\r
3656     SymbolKind.String = 15;\r
3657     SymbolKind.Number = 16;\r
3658     SymbolKind.Boolean = 17;\r
3659     SymbolKind.Array = 18;\r
3660     SymbolKind.Object = 19;\r
3661     SymbolKind.Key = 20;\r
3662     SymbolKind.Null = 21;\r
3663     SymbolKind.EnumMember = 22;\r
3664     SymbolKind.Struct = 23;\r
3665     SymbolKind.Event = 24;\r
3666     SymbolKind.Operator = 25;\r
3667     SymbolKind.TypeParameter = 26;\r
3668 })(SymbolKind || (SymbolKind = {}));\r
3669 /**\r
3670  * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
3671  * @since 3.15\r
3672  */\r
3673 var SymbolTag;\r
3674 (function (SymbolTag) {\r
3675     /**\r
3676      * Render a symbol as obsolete, usually using a strike-out.\r
3677      */\r
3678     SymbolTag.Deprecated = 1;\r
3679 })(SymbolTag || (SymbolTag = {}));\r
3680 var SymbolInformation;\r
3681 (function (SymbolInformation) {\r
3682     /**\r
3683      * Creates a new symbol information literal.\r
3684      *\r
3685      * @param name The name of the symbol.\r
3686      * @param kind The kind of the symbol.\r
3687      * @param range The range of the location of the symbol.\r
3688      * @param uri The resource of the location of symbol, defaults to the current document.\r
3689      * @param containerName The name of the symbol containing the symbol.\r
3690      */\r
3691     function create(name, kind, range, uri, containerName) {\r
3692         var result = {\r
3693             name: name,\r
3694             kind: kind,\r
3695             location: { uri: uri, range: range }\r
3696         };\r
3697         if (containerName) {\r
3698             result.containerName = containerName;\r
3699         }\r
3700         return result;\r
3701     }\r
3702     SymbolInformation.create = create;\r
3703 })(SymbolInformation || (SymbolInformation = {}));\r
3704 var DocumentSymbol;\r
3705 (function (DocumentSymbol) {\r
3706     /**\r
3707      * Creates a new symbol information literal.\r
3708      *\r
3709      * @param name The name of the symbol.\r
3710      * @param detail The detail of the symbol.\r
3711      * @param kind The kind of the symbol.\r
3712      * @param range The range of the symbol.\r
3713      * @param selectionRange The selectionRange of the symbol.\r
3714      * @param children Children of the symbol.\r
3715      */\r
3716     function create(name, detail, kind, range, selectionRange, children) {\r
3717         var result = {\r
3718             name: name,\r
3719             detail: detail,\r
3720             kind: kind,\r
3721             range: range,\r
3722             selectionRange: selectionRange\r
3723         };\r
3724         if (children !== void 0) {\r
3725             result.children = children;\r
3726         }\r
3727         return result;\r
3728     }\r
3729     DocumentSymbol.create = create;\r
3730     /**\r
3731      * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
3732      */\r
3733     function is(value) {\r
3734         var candidate = value;\r
3735         return candidate &&\r
3736             Is.string(candidate.name) && Is.number(candidate.kind) &&\r
3737             Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
3738             (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
3739             (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
3740             (candidate.children === void 0 || Array.isArray(candidate.children));\r
3741     }\r
3742     DocumentSymbol.is = is;\r
3743 })(DocumentSymbol || (DocumentSymbol = {}));\r
3744 /**\r
3745  * A set of predefined code action kinds\r
3746  */\r
3747 var CodeActionKind;\r
3748 (function (CodeActionKind) {\r
3749     /**\r
3750      * Empty kind.\r
3751      */\r
3752     CodeActionKind.Empty = '';\r
3753     /**\r
3754      * Base kind for quickfix actions: 'quickfix'\r
3755      */\r
3756     CodeActionKind.QuickFix = 'quickfix';\r
3757     /**\r
3758      * Base kind for refactoring actions: 'refactor'\r
3759      */\r
3760     CodeActionKind.Refactor = 'refactor';\r
3761     /**\r
3762      * Base kind for refactoring extraction actions: 'refactor.extract'\r
3763      *\r
3764      * Example extract actions:\r
3765      *\r
3766      * - Extract method\r
3767      * - Extract function\r
3768      * - Extract variable\r
3769      * - Extract interface from class\r
3770      * - ...\r
3771      */\r
3772     CodeActionKind.RefactorExtract = 'refactor.extract';\r
3773     /**\r
3774      * Base kind for refactoring inline actions: 'refactor.inline'\r
3775      *\r
3776      * Example inline actions:\r
3777      *\r
3778      * - Inline function\r
3779      * - Inline variable\r
3780      * - Inline constant\r
3781      * - ...\r
3782      */\r
3783     CodeActionKind.RefactorInline = 'refactor.inline';\r
3784     /**\r
3785      * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
3786      *\r
3787      * Example rewrite actions:\r
3788      *\r
3789      * - Convert JavaScript function to class\r
3790      * - Add or remove parameter\r
3791      * - Encapsulate field\r
3792      * - Make method static\r
3793      * - Move method to base class\r
3794      * - ...\r
3795      */\r
3796     CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
3797     /**\r
3798      * Base kind for source actions: `source`\r
3799      *\r
3800      * Source code actions apply to the entire file.\r
3801      */\r
3802     CodeActionKind.Source = 'source';\r
3803     /**\r
3804      * Base kind for an organize imports source action: `source.organizeImports`\r
3805      */\r
3806     CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
3807     /**\r
3808      * Base kind for auto-fix source actions: `source.fixAll`.\r
3809      *\r
3810      * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
3811      * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
3812      *\r
3813      * @since 3.15.0\r
3814      */\r
3815     CodeActionKind.SourceFixAll = 'source.fixAll';\r
3816 })(CodeActionKind || (CodeActionKind = {}));\r
3817 /**\r
3818  * The CodeActionContext namespace provides helper functions to work with\r
3819  * [CodeActionContext](#CodeActionContext) literals.\r
3820  */\r
3821 var CodeActionContext;\r
3822 (function (CodeActionContext) {\r
3823     /**\r
3824      * Creates a new CodeActionContext literal.\r
3825      */\r
3826     function create(diagnostics, only) {\r
3827         var result = { diagnostics: diagnostics };\r
3828         if (only !== void 0 && only !== null) {\r
3829             result.only = only;\r
3830         }\r
3831         return result;\r
3832     }\r
3833     CodeActionContext.create = create;\r
3834     /**\r
3835      * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
3836      */\r
3837     function is(value) {\r
3838         var candidate = value;\r
3839         return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
3840     }\r
3841     CodeActionContext.is = is;\r
3842 })(CodeActionContext || (CodeActionContext = {}));\r
3843 var CodeAction;\r
3844 (function (CodeAction) {\r
3845     function create(title, commandOrEdit, kind) {\r
3846         var result = { title: title };\r
3847         if (Command.is(commandOrEdit)) {\r
3848             result.command = commandOrEdit;\r
3849         }\r
3850         else {\r
3851             result.edit = commandOrEdit;\r
3852         }\r
3853         if (kind !== void 0) {\r
3854             result.kind = kind;\r
3855         }\r
3856         return result;\r
3857     }\r
3858     CodeAction.create = create;\r
3859     function is(value) {\r
3860         var candidate = value;\r
3861         return candidate && Is.string(candidate.title) &&\r
3862             (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
3863             (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
3864             (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
3865             (candidate.command === void 0 || Command.is(candidate.command)) &&\r
3866             (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
3867             (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
3868     }\r
3869     CodeAction.is = is;\r
3870 })(CodeAction || (CodeAction = {}));\r
3871 /**\r
3872  * The CodeLens namespace provides helper functions to work with\r
3873  * [CodeLens](#CodeLens) literals.\r
3874  */\r
3875 var CodeLens;\r
3876 (function (CodeLens) {\r
3877     /**\r
3878      * Creates a new CodeLens literal.\r
3879      */\r
3880     function create(range, data) {\r
3881         var result = { range: range };\r
3882         if (Is.defined(data)) {\r
3883             result.data = data;\r
3884         }\r
3885         return result;\r
3886     }\r
3887     CodeLens.create = create;\r
3888     /**\r
3889      * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
3890      */\r
3891     function is(value) {\r
3892         var candidate = value;\r
3893         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
3894     }\r
3895     CodeLens.is = is;\r
3896 })(CodeLens || (CodeLens = {}));\r
3897 /**\r
3898  * The FormattingOptions namespace provides helper functions to work with\r
3899  * [FormattingOptions](#FormattingOptions) literals.\r
3900  */\r
3901 var FormattingOptions;\r
3902 (function (FormattingOptions) {\r
3903     /**\r
3904      * Creates a new FormattingOptions literal.\r
3905      */\r
3906     function create(tabSize, insertSpaces) {\r
3907         return { tabSize: tabSize, insertSpaces: insertSpaces };\r
3908     }\r
3909     FormattingOptions.create = create;\r
3910     /**\r
3911      * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
3912      */\r
3913     function is(value) {\r
3914         var candidate = value;\r
3915         return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
3916     }\r
3917     FormattingOptions.is = is;\r
3918 })(FormattingOptions || (FormattingOptions = {}));\r
3919 /**\r
3920  * The DocumentLink namespace provides helper functions to work with\r
3921  * [DocumentLink](#DocumentLink) literals.\r
3922  */\r
3923 var DocumentLink;\r
3924 (function (DocumentLink) {\r
3925     /**\r
3926      * Creates a new DocumentLink literal.\r
3927      */\r
3928     function create(range, target, data) {\r
3929         return { range: range, target: target, data: data };\r
3930     }\r
3931     DocumentLink.create = create;\r
3932     /**\r
3933      * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
3934      */\r
3935     function is(value) {\r
3936         var candidate = value;\r
3937         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
3938     }\r
3939     DocumentLink.is = is;\r
3940 })(DocumentLink || (DocumentLink = {}));\r
3941 /**\r
3942  * The SelectionRange namespace provides helper function to work with\r
3943  * SelectionRange literals.\r
3944  */\r
3945 var SelectionRange;\r
3946 (function (SelectionRange) {\r
3947     /**\r
3948      * Creates a new SelectionRange\r
3949      * @param range the range.\r
3950      * @param parent an optional parent.\r
3951      */\r
3952     function create(range, parent) {\r
3953         return { range: range, parent: parent };\r
3954     }\r
3955     SelectionRange.create = create;\r
3956     function is(value) {\r
3957         var candidate = value;\r
3958         return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
3959     }\r
3960     SelectionRange.is = is;\r
3961 })(SelectionRange || (SelectionRange = {}));\r
3962 var EOL = ['\n', '\r\n', '\r'];\r
3963 /**\r
3964  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
3965  */\r
3966 var TextDocument;\r
3967 (function (TextDocument) {\r
3968     /**\r
3969      * Creates a new ITextDocument literal from the given uri and content.\r
3970      * @param uri The document's uri.\r
3971      * @param languageId  The document's language Id.\r
3972      * @param content The document's content.\r
3973      */\r
3974     function create(uri, languageId, version, content) {\r
3975         return new FullTextDocument(uri, languageId, version, content);\r
3976     }\r
3977     TextDocument.create = create;\r
3978     /**\r
3979      * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
3980      */\r
3981     function is(value) {\r
3982         var candidate = value;\r
3983         return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
3984             && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
3985     }\r
3986     TextDocument.is = is;\r
3987     function applyEdits(document, edits) {\r
3988         var text = document.getText();\r
3989         var sortedEdits = mergeSort(edits, function (a, b) {\r
3990             var diff = a.range.start.line - b.range.start.line;\r
3991             if (diff === 0) {\r
3992                 return a.range.start.character - b.range.start.character;\r
3993             }\r
3994             return diff;\r
3995         });\r
3996         var lastModifiedOffset = text.length;\r
3997         for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
3998             var e = sortedEdits[i];\r
3999             var startOffset = document.offsetAt(e.range.start);\r
4000             var endOffset = document.offsetAt(e.range.end);\r
4001             if (endOffset <= lastModifiedOffset) {\r
4002                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
4003             }\r
4004             else {\r
4005                 throw new Error('Overlapping edit');\r
4006             }\r
4007             lastModifiedOffset = startOffset;\r
4008         }\r
4009         return text;\r
4010     }\r
4011     TextDocument.applyEdits = applyEdits;\r
4012     function mergeSort(data, compare) {\r
4013         if (data.length <= 1) {\r
4014             // sorted\r
4015             return data;\r
4016         }\r
4017         var p = (data.length / 2) | 0;\r
4018         var left = data.slice(0, p);\r
4019         var right = data.slice(p);\r
4020         mergeSort(left, compare);\r
4021         mergeSort(right, compare);\r
4022         var leftIdx = 0;\r
4023         var rightIdx = 0;\r
4024         var i = 0;\r
4025         while (leftIdx < left.length && rightIdx < right.length) {\r
4026             var ret = compare(left[leftIdx], right[rightIdx]);\r
4027             if (ret <= 0) {\r
4028                 // smaller_equal -> take left to preserve order\r
4029                 data[i++] = left[leftIdx++];\r
4030             }\r
4031             else {\r
4032                 // greater -> take right\r
4033                 data[i++] = right[rightIdx++];\r
4034             }\r
4035         }\r
4036         while (leftIdx < left.length) {\r
4037             data[i++] = left[leftIdx++];\r
4038         }\r
4039         while (rightIdx < right.length) {\r
4040             data[i++] = right[rightIdx++];\r
4041         }\r
4042         return data;\r
4043     }\r
4044 })(TextDocument || (TextDocument = {}));\r
4045 var FullTextDocument = /** @class */ (function () {\r
4046     function FullTextDocument(uri, languageId, version, content) {\r
4047         this._uri = uri;\r
4048         this._languageId = languageId;\r
4049         this._version = version;\r
4050         this._content = content;\r
4051         this._lineOffsets = undefined;\r
4052     }\r
4053     Object.defineProperty(FullTextDocument.prototype, "uri", {\r
4054         get: function () {\r
4055             return this._uri;\r
4056         },\r
4057         enumerable: true,\r
4058         configurable: true\r
4059     });\r
4060     Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
4061         get: function () {\r
4062             return this._languageId;\r
4063         },\r
4064         enumerable: true,\r
4065         configurable: true\r
4066     });\r
4067     Object.defineProperty(FullTextDocument.prototype, "version", {\r
4068         get: function () {\r
4069             return this._version;\r
4070         },\r
4071         enumerable: true,\r
4072         configurable: true\r
4073     });\r
4074     FullTextDocument.prototype.getText = function (range) {\r
4075         if (range) {\r
4076             var start = this.offsetAt(range.start);\r
4077             var end = this.offsetAt(range.end);\r
4078             return this._content.substring(start, end);\r
4079         }\r
4080         return this._content;\r
4081     };\r
4082     FullTextDocument.prototype.update = function (event, version) {\r
4083         this._content = event.text;\r
4084         this._version = version;\r
4085         this._lineOffsets = undefined;\r
4086     };\r
4087     FullTextDocument.prototype.getLineOffsets = function () {\r
4088         if (this._lineOffsets === undefined) {\r
4089             var lineOffsets = [];\r
4090             var text = this._content;\r
4091             var isLineStart = true;\r
4092             for (var i = 0; i < text.length; i++) {\r
4093                 if (isLineStart) {\r
4094                     lineOffsets.push(i);\r
4095                     isLineStart = false;\r
4096                 }\r
4097                 var ch = text.charAt(i);\r
4098                 isLineStart = (ch === '\r' || ch === '\n');\r
4099                 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
4100                     i++;\r
4101                 }\r
4102             }\r
4103             if (isLineStart && text.length > 0) {\r
4104                 lineOffsets.push(text.length);\r
4105             }\r
4106             this._lineOffsets = lineOffsets;\r
4107         }\r
4108         return this._lineOffsets;\r
4109     };\r
4110     FullTextDocument.prototype.positionAt = function (offset) {\r
4111         offset = Math.max(Math.min(offset, this._content.length), 0);\r
4112         var lineOffsets = this.getLineOffsets();\r
4113         var low = 0, high = lineOffsets.length;\r
4114         if (high === 0) {\r
4115             return Position.create(0, offset);\r
4116         }\r
4117         while (low < high) {\r
4118             var mid = Math.floor((low + high) / 2);\r
4119             if (lineOffsets[mid] > offset) {\r
4120                 high = mid;\r
4121             }\r
4122             else {\r
4123                 low = mid + 1;\r
4124             }\r
4125         }\r
4126         // low is the least x for which the line offset is larger than the current offset\r
4127         // or array.length if no line offset is larger than the current offset\r
4128         var line = low - 1;\r
4129         return Position.create(line, offset - lineOffsets[line]);\r
4130     };\r
4131     FullTextDocument.prototype.offsetAt = function (position) {\r
4132         var lineOffsets = this.getLineOffsets();\r
4133         if (position.line >= lineOffsets.length) {\r
4134             return this._content.length;\r
4135         }\r
4136         else if (position.line < 0) {\r
4137             return 0;\r
4138         }\r
4139         var lineOffset = lineOffsets[position.line];\r
4140         var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
4141         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
4142     };\r
4143     Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
4144         get: function () {\r
4145             return this.getLineOffsets().length;\r
4146         },\r
4147         enumerable: true,\r
4148         configurable: true\r
4149     });\r
4150     return FullTextDocument;\r
4151 }());\r
4152 var Is;\r
4153 (function (Is) {\r
4154     var toString = Object.prototype.toString;\r
4155     function defined(value) {\r
4156         return typeof value !== 'undefined';\r
4157     }\r
4158     Is.defined = defined;\r
4159     function undefined(value) {\r
4160         return typeof value === 'undefined';\r
4161     }\r
4162     Is.undefined = undefined;\r
4163     function boolean(value) {\r
4164         return value === true || value === false;\r
4165     }\r
4166     Is.boolean = boolean;\r
4167     function string(value) {\r
4168         return toString.call(value) === '[object String]';\r
4169     }\r
4170     Is.string = string;\r
4171     function number(value) {\r
4172         return toString.call(value) === '[object Number]';\r
4173     }\r
4174     Is.number = number;\r
4175     function func(value) {\r
4176         return toString.call(value) === '[object Function]';\r
4177     }\r
4178     Is.func = func;\r
4179     function objectLiteral(value) {\r
4180         // Strictly speaking class instances pass this check as well. Since the LSP\r
4181         // doesn't use classes we ignore this for now. If we do we need to add something\r
4182         // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4183         return value !== null && typeof value === 'object';\r
4184     }\r
4185     Is.objectLiteral = objectLiteral;\r
4186     function typedArray(value, check) {\r
4187         return Array.isArray(value) && value.every(check);\r
4188     }\r
4189     Is.typedArray = typedArray;\r
4190 })(Is || (Is = {}));\r
4191
4192
4193 /***/ }),
4194 /* 19 */
4195 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4196
4197 "use strict";
4198 /* --------------------------------------------------------------------------------------------\r
4199  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4200  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4201  * ------------------------------------------------------------------------------------------ */\r
4202 \r
4203 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4204 const Is = __webpack_require__(20);\r
4205 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4206 const messages_1 = __webpack_require__(21);\r
4207 const protocol_implementation_1 = __webpack_require__(22);\r
4208 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
4209 const protocol_typeDefinition_1 = __webpack_require__(23);\r
4210 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
4211 const protocol_workspaceFolders_1 = __webpack_require__(24);\r
4212 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
4213 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
4214 const protocol_configuration_1 = __webpack_require__(25);\r
4215 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
4216 const protocol_colorProvider_1 = __webpack_require__(26);\r
4217 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
4218 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
4219 const protocol_foldingRange_1 = __webpack_require__(27);\r
4220 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
4221 const protocol_declaration_1 = __webpack_require__(28);\r
4222 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
4223 const protocol_selectionRange_1 = __webpack_require__(29);\r
4224 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
4225 const protocol_progress_1 = __webpack_require__(30);\r
4226 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
4227 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
4228 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
4229 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4230 let __noDynamicImport;\r
4231 /**\r
4232  * The DocumentFilter namespace provides helper functions to work with\r
4233  * [DocumentFilter](#DocumentFilter) literals.\r
4234  */\r
4235 var DocumentFilter;\r
4236 (function (DocumentFilter) {\r
4237     function is(value) {\r
4238         const candidate = value;\r
4239         return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
4240     }\r
4241     DocumentFilter.is = is;\r
4242 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
4243 /**\r
4244  * The DocumentSelector namespace provides helper functions to work with\r
4245  * [DocumentSelector](#DocumentSelector)s.\r
4246  */\r
4247 var DocumentSelector;\r
4248 (function (DocumentSelector) {\r
4249     function is(value) {\r
4250         if (!Array.isArray(value)) {\r
4251             return false;\r
4252         }\r
4253         for (let elem of value) {\r
4254             if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
4255                 return false;\r
4256             }\r
4257         }\r
4258         return true;\r
4259     }\r
4260     DocumentSelector.is = is;\r
4261 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
4262 /**\r
4263  * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
4264  * handler on the client side.\r
4265  */\r
4266 var RegistrationRequest;\r
4267 (function (RegistrationRequest) {\r
4268     RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');\r
4269 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
4270 /**\r
4271  * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
4272  * handler on the client side.\r
4273  */\r
4274 var UnregistrationRequest;\r
4275 (function (UnregistrationRequest) {\r
4276     UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');\r
4277 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
4278 var ResourceOperationKind;\r
4279 (function (ResourceOperationKind) {\r
4280     /**\r
4281      * Supports creating new files and folders.\r
4282      */\r
4283     ResourceOperationKind.Create = 'create';\r
4284     /**\r
4285      * Supports renaming existing files and folders.\r
4286      */\r
4287     ResourceOperationKind.Rename = 'rename';\r
4288     /**\r
4289      * Supports deleting existing files and folders.\r
4290      */\r
4291     ResourceOperationKind.Delete = 'delete';\r
4292 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
4293 var FailureHandlingKind;\r
4294 (function (FailureHandlingKind) {\r
4295     /**\r
4296      * Applying the workspace change is simply aborted if one of the changes provided\r
4297      * fails. All operations executed before the failing operation stay executed.\r
4298      */\r
4299     FailureHandlingKind.Abort = 'abort';\r
4300     /**\r
4301      * All operations are executed transactional. That means they either all\r
4302      * succeed or no changes at all are applied to the workspace.\r
4303      */\r
4304     FailureHandlingKind.Transactional = 'transactional';\r
4305     /**\r
4306      * If the workspace edit contains only textual file changes they are executed transactional.\r
4307      * If resource changes (create, rename or delete file) are part of the change the failure\r
4308      * handling startegy is abort.\r
4309      */\r
4310     FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
4311     /**\r
4312      * The client tries to undo the operations already executed. But there is no\r
4313      * guarantee that this is succeeding.\r
4314      */\r
4315     FailureHandlingKind.Undo = 'undo';\r
4316 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
4317 /**\r
4318  * The StaticRegistrationOptions namespace provides helper functions to work with\r
4319  * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
4320  */\r
4321 var StaticRegistrationOptions;\r
4322 (function (StaticRegistrationOptions) {\r
4323     function hasId(value) {\r
4324         const candidate = value;\r
4325         return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
4326     }\r
4327     StaticRegistrationOptions.hasId = hasId;\r
4328 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
4329 /**\r
4330  * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
4331  * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
4332  */\r
4333 var TextDocumentRegistrationOptions;\r
4334 (function (TextDocumentRegistrationOptions) {\r
4335     function is(value) {\r
4336         const candidate = value;\r
4337         return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
4338     }\r
4339     TextDocumentRegistrationOptions.is = is;\r
4340 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
4341 /**\r
4342  * The WorkDoneProgressOptions namespace provides helper functions to work with\r
4343  * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
4344  */\r
4345 var WorkDoneProgressOptions;\r
4346 (function (WorkDoneProgressOptions) {\r
4347     function is(value) {\r
4348         const candidate = value;\r
4349         return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
4350     }\r
4351     WorkDoneProgressOptions.is = is;\r
4352     function hasWorkDoneProgress(value) {\r
4353         const candidate = value;\r
4354         return candidate && Is.boolean(candidate.workDoneProgress);\r
4355     }\r
4356     WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
4357 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
4358 /**\r
4359  * The initialize request is sent from the client to the server.\r
4360  * It is sent once as the request after starting up the server.\r
4361  * The requests parameter is of type [InitializeParams](#InitializeParams)\r
4362  * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
4363  * resolves to such.\r
4364  */\r
4365 var InitializeRequest;\r
4366 (function (InitializeRequest) {\r
4367     InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');\r
4368 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
4369 /**\r
4370  * Known error codes for an `InitializeError`;\r
4371  */\r
4372 var InitializeError;\r
4373 (function (InitializeError) {\r
4374     /**\r
4375      * If the protocol version provided by the client can't be handled by the server.\r
4376      * @deprecated This initialize error got replaced by client capabilities. There is\r
4377      * no version handshake in version 3.0x\r
4378      */\r
4379     InitializeError.unknownProtocolVersion = 1;\r
4380 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
4381 /**\r
4382  * The intialized notification is sent from the client to the\r
4383  * server after the client is fully initialized and the server\r
4384  * is allowed to send requests from the server to the client.\r
4385  */\r
4386 var InitializedNotification;\r
4387 (function (InitializedNotification) {\r
4388     InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');\r
4389 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
4390 //---- Shutdown Method ----\r
4391 /**\r
4392  * A shutdown request is sent from the client to the server.\r
4393  * It is sent once when the client decides to shutdown the\r
4394  * server. The only notification that is sent after a shutdown request\r
4395  * is the exit event.\r
4396  */\r
4397 var ShutdownRequest;\r
4398 (function (ShutdownRequest) {\r
4399     ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');\r
4400 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
4401 //---- Exit Notification ----\r
4402 /**\r
4403  * The exit event is sent from the client to the server to\r
4404  * ask the server to exit its process.\r
4405  */\r
4406 var ExitNotification;\r
4407 (function (ExitNotification) {\r
4408     ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');\r
4409 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
4410 /**\r
4411  * The configuration change notification is sent from the client to the server\r
4412  * when the client's configuration has changed. The notification contains\r
4413  * the changed configuration as defined by the language client.\r
4414  */\r
4415 var DidChangeConfigurationNotification;\r
4416 (function (DidChangeConfigurationNotification) {\r
4417     DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');\r
4418 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
4419 //---- Message show and log notifications ----\r
4420 /**\r
4421  * The message type\r
4422  */\r
4423 var MessageType;\r
4424 (function (MessageType) {\r
4425     /**\r
4426      * An error message.\r
4427      */\r
4428     MessageType.Error = 1;\r
4429     /**\r
4430      * A warning message.\r
4431      */\r
4432     MessageType.Warning = 2;\r
4433     /**\r
4434      * An information message.\r
4435      */\r
4436     MessageType.Info = 3;\r
4437     /**\r
4438      * A log message.\r
4439      */\r
4440     MessageType.Log = 4;\r
4441 })(MessageType = exports.MessageType || (exports.MessageType = {}));\r
4442 /**\r
4443  * The show message notification is sent from a server to a client to ask\r
4444  * the client to display a particular message in the user interface.\r
4445  */\r
4446 var ShowMessageNotification;\r
4447 (function (ShowMessageNotification) {\r
4448     ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');\r
4449 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
4450 /**\r
4451  * The show message request is sent from the server to the client to show a message\r
4452  * and a set of options actions to the user.\r
4453  */\r
4454 var ShowMessageRequest;\r
4455 (function (ShowMessageRequest) {\r
4456     ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');\r
4457 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
4458 /**\r
4459  * The log message notification is sent from the server to the client to ask\r
4460  * the client to log a particular message.\r
4461  */\r
4462 var LogMessageNotification;\r
4463 (function (LogMessageNotification) {\r
4464     LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');\r
4465 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
4466 //---- Telemetry notification\r
4467 /**\r
4468  * The telemetry event notification is sent from the server to the client to ask\r
4469  * the client to log telemetry data.\r
4470  */\r
4471 var TelemetryEventNotification;\r
4472 (function (TelemetryEventNotification) {\r
4473     TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');\r
4474 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
4475 /**\r
4476  * Defines how the host (editor) should sync\r
4477  * document changes to the language server.\r
4478  */\r
4479 var TextDocumentSyncKind;\r
4480 (function (TextDocumentSyncKind) {\r
4481     /**\r
4482      * Documents should not be synced at all.\r
4483      */\r
4484     TextDocumentSyncKind.None = 0;\r
4485     /**\r
4486      * Documents are synced by always sending the full content\r
4487      * of the document.\r
4488      */\r
4489     TextDocumentSyncKind.Full = 1;\r
4490     /**\r
4491      * Documents are synced by sending the full content on open.\r
4492      * After that only incremental updates to the document are\r
4493      * send.\r
4494      */\r
4495     TextDocumentSyncKind.Incremental = 2;\r
4496 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
4497 /**\r
4498  * The document open notification is sent from the client to the server to signal\r
4499  * newly opened text documents. The document's truth is now managed by the client\r
4500  * and the server must not try to read the document's truth using the document's\r
4501  * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
4502  * mean that its content is presented in an editor. An open notification must not\r
4503  * be sent more than once without a corresponding close notification send before.\r
4504  * This means open and close notification must be balanced and the max open count\r
4505  * is one.\r
4506  */\r
4507 var DidOpenTextDocumentNotification;\r
4508 (function (DidOpenTextDocumentNotification) {\r
4509     DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
4510     DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\r
4511 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
4512 /**\r
4513  * The document change notification is sent from the client to the server to signal\r
4514  * changes to a text document.\r
4515  */\r
4516 var DidChangeTextDocumentNotification;\r
4517 (function (DidChangeTextDocumentNotification) {\r
4518     DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
4519     DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\r
4520 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
4521 /**\r
4522  * The document close notification is sent from the client to the server when\r
4523  * the document got closed in the client. The document's truth now exists where\r
4524  * the document's uri points to (e.g. if the document's uri is a file uri the\r
4525  * truth now exists on disk). As with the open notification the close notification\r
4526  * is about managing the document's content. Receiving a close notification\r
4527  * doesn't mean that the document was open in an editor before. A close\r
4528  * notification requires a previous open notification to be sent.\r
4529  */\r
4530 var DidCloseTextDocumentNotification;\r
4531 (function (DidCloseTextDocumentNotification) {\r
4532     DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
4533     DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\r
4534 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
4535 /**\r
4536  * The document save notification is sent from the client to the server when\r
4537  * the document got saved in the client.\r
4538  */\r
4539 var DidSaveTextDocumentNotification;\r
4540 (function (DidSaveTextDocumentNotification) {\r
4541     DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
4542     DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\r
4543 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
4544 /**\r
4545  * Represents reasons why a text document is saved.\r
4546  */\r
4547 var TextDocumentSaveReason;\r
4548 (function (TextDocumentSaveReason) {\r
4549     /**\r
4550      * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
4551      * or by an API call.\r
4552      */\r
4553     TextDocumentSaveReason.Manual = 1;\r
4554     /**\r
4555      * Automatic after a delay.\r
4556      */\r
4557     TextDocumentSaveReason.AfterDelay = 2;\r
4558     /**\r
4559      * When the editor lost focus.\r
4560      */\r
4561     TextDocumentSaveReason.FocusOut = 3;\r
4562 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
4563 /**\r
4564  * A document will save notification is sent from the client to the server before\r
4565  * the document is actually saved.\r
4566  */\r
4567 var WillSaveTextDocumentNotification;\r
4568 (function (WillSaveTextDocumentNotification) {\r
4569     WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
4570     WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\r
4571 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
4572 /**\r
4573  * A document will save request is sent from the client to the server before\r
4574  * the document is actually saved. The request can return an array of TextEdits\r
4575  * which will be applied to the text document before it is saved. Please note that\r
4576  * clients might drop results if computing the text edits took too long or if a\r
4577  * server constantly fails on this request. This is done to keep the save fast and\r
4578  * reliable.\r
4579  */\r
4580 var WillSaveTextDocumentWaitUntilRequest;\r
4581 (function (WillSaveTextDocumentWaitUntilRequest) {\r
4582     WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
4583     WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
4584 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
4585 /**\r
4586  * The watched files notification is sent from the client to the server when\r
4587  * the client detects changes to file watched by the language client.\r
4588  */\r
4589 var DidChangeWatchedFilesNotification;\r
4590 (function (DidChangeWatchedFilesNotification) {\r
4591     DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');\r
4592 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
4593 /**\r
4594  * The file event type\r
4595  */\r
4596 var FileChangeType;\r
4597 (function (FileChangeType) {\r
4598     /**\r
4599      * The file got created.\r
4600      */\r
4601     FileChangeType.Created = 1;\r
4602     /**\r
4603      * The file got changed.\r
4604      */\r
4605     FileChangeType.Changed = 2;\r
4606     /**\r
4607      * The file got deleted.\r
4608      */\r
4609     FileChangeType.Deleted = 3;\r
4610 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
4611 var WatchKind;\r
4612 (function (WatchKind) {\r
4613     /**\r
4614      * Interested in create events.\r
4615      */\r
4616     WatchKind.Create = 1;\r
4617     /**\r
4618      * Interested in change events\r
4619      */\r
4620     WatchKind.Change = 2;\r
4621     /**\r
4622      * Interested in delete events\r
4623      */\r
4624     WatchKind.Delete = 4;\r
4625 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
4626 /**\r
4627  * Diagnostics notification are sent from the server to the client to signal\r
4628  * results of validation runs.\r
4629  */\r
4630 var PublishDiagnosticsNotification;\r
4631 (function (PublishDiagnosticsNotification) {\r
4632     PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');\r
4633 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
4634 /**\r
4635  * How a completion was triggered\r
4636  */\r
4637 var CompletionTriggerKind;\r
4638 (function (CompletionTriggerKind) {\r
4639     /**\r
4640      * Completion was triggered by typing an identifier (24x7 code\r
4641      * complete), manual invocation (e.g Ctrl+Space) or via API.\r
4642      */\r
4643     CompletionTriggerKind.Invoked = 1;\r
4644     /**\r
4645      * Completion was triggered by a trigger character specified by\r
4646      * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
4647      */\r
4648     CompletionTriggerKind.TriggerCharacter = 2;\r
4649     /**\r
4650      * Completion was re-triggered as current completion list is incomplete\r
4651      */\r
4652     CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
4653 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
4654 /**\r
4655  * Request to request completion at a given text document position. The request's\r
4656  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
4657  * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
4658  * or a Thenable that resolves to such.\r
4659  *\r
4660  * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
4661  * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
4662  * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
4663  * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
4664  */\r
4665 var CompletionRequest;\r
4666 (function (CompletionRequest) {\r
4667     CompletionRequest.method = 'textDocument/completion';\r
4668     CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\r
4669     /** @deprecated Use CompletionRequest.type */\r
4670     CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4671 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
4672 /**\r
4673  * Request to resolve additional information for a given completion item.The request's\r
4674  * parameter is of type [CompletionItem](#CompletionItem) the response\r
4675  * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
4676  */\r
4677 var CompletionResolveRequest;\r
4678 (function (CompletionResolveRequest) {\r
4679     CompletionResolveRequest.method = 'completionItem/resolve';\r
4680     CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\r
4681 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
4682 /**\r
4683  * Request to request hover information at a given text document position. The request's\r
4684  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
4685  * type [Hover](#Hover) or a Thenable that resolves to such.\r
4686  */\r
4687 var HoverRequest;\r
4688 (function (HoverRequest) {\r
4689     HoverRequest.method = 'textDocument/hover';\r
4690     HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\r
4691 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
4692 /**\r
4693  * How a signature help was triggered.\r
4694  *\r
4695  * @since 3.15.0\r
4696  */\r
4697 var SignatureHelpTriggerKind;\r
4698 (function (SignatureHelpTriggerKind) {\r
4699     /**\r
4700      * Signature help was invoked manually by the user or by a command.\r
4701      */\r
4702     SignatureHelpTriggerKind.Invoked = 1;\r
4703     /**\r
4704      * Signature help was triggered by a trigger character.\r
4705      */\r
4706     SignatureHelpTriggerKind.TriggerCharacter = 2;\r
4707     /**\r
4708      * Signature help was triggered by the cursor moving or by the document content changing.\r
4709      */\r
4710     SignatureHelpTriggerKind.ContentChange = 3;\r
4711 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
4712 var SignatureHelpRequest;\r
4713 (function (SignatureHelpRequest) {\r
4714     SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
4715     SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\r
4716 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
4717 /**\r
4718  * A request to resolve the definition location of a symbol at a given text\r
4719  * document position. The request's parameter is of type [TextDocumentPosition]\r
4720  * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
4721  * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
4722  * to such.\r
4723  */\r
4724 var DefinitionRequest;\r
4725 (function (DefinitionRequest) {\r
4726     DefinitionRequest.method = 'textDocument/definition';\r
4727     DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\r
4728     /** @deprecated Use DefinitionRequest.type */\r
4729     DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4730 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
4731 /**\r
4732  * A request to resolve project-wide references for the symbol denoted\r
4733  * by the given text document position. The request's parameter is of\r
4734  * type [ReferenceParams](#ReferenceParams) the response is of type\r
4735  * [Location[]](#Location) or a Thenable that resolves to such.\r
4736  */\r
4737 var ReferencesRequest;\r
4738 (function (ReferencesRequest) {\r
4739     ReferencesRequest.method = 'textDocument/references';\r
4740     ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\r
4741     /** @deprecated Use ReferencesRequest.type */\r
4742     ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4743 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
4744 /**\r
4745  * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
4746  * text document position. The request's parameter is of type [TextDocumentPosition]\r
4747  * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
4748  * (#DocumentHighlight) or a Thenable that resolves to such.\r
4749  */\r
4750 var DocumentHighlightRequest;\r
4751 (function (DocumentHighlightRequest) {\r
4752     DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
4753     DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\r
4754     /** @deprecated Use DocumentHighlightRequest.type */\r
4755     DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4756 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
4757 /**\r
4758  * A request to list all symbols found in a given text document. The request's\r
4759  * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
4760  * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
4761  * that resolves to such.\r
4762  */\r
4763 var DocumentSymbolRequest;\r
4764 (function (DocumentSymbolRequest) {\r
4765     DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
4766     DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\r
4767     /** @deprecated Use DocumentSymbolRequest.type */\r
4768     DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4769 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
4770 /**\r
4771  * A request to provide commands for the given text document and range.\r
4772  */\r
4773 var CodeActionRequest;\r
4774 (function (CodeActionRequest) {\r
4775     CodeActionRequest.method = 'textDocument/codeAction';\r
4776     CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\r
4777     /** @deprecated Use CodeActionRequest.type */\r
4778     CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4779 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
4780 /**\r
4781  * A request to list project-wide symbols matching the query string given\r
4782  * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
4783  * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
4784  * resolves to such.\r
4785  */\r
4786 var WorkspaceSymbolRequest;\r
4787 (function (WorkspaceSymbolRequest) {\r
4788     WorkspaceSymbolRequest.method = 'workspace/symbol';\r
4789     WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\r
4790     /** @deprecated Use WorkspaceSymbolRequest.type */\r
4791     WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4792 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
4793 /**\r
4794  * A request to provide code lens for the given text document.\r
4795  */\r
4796 var CodeLensRequest;\r
4797 (function (CodeLensRequest) {\r
4798     CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');\r
4799     /** @deprecated Use CodeLensRequest.type */\r
4800     CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4801 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
4802 /**\r
4803  * A request to resolve a command for a given code lens.\r
4804  */\r
4805 var CodeLensResolveRequest;\r
4806 (function (CodeLensResolveRequest) {\r
4807     CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');\r
4808 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
4809 /**\r
4810  * A request to provide document links\r
4811  */\r
4812 var DocumentLinkRequest;\r
4813 (function (DocumentLinkRequest) {\r
4814     DocumentLinkRequest.method = 'textDocument/documentLink';\r
4815     DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\r
4816     /** @deprecated Use DocumentLinkRequest.type */\r
4817     DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4818 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
4819 /**\r
4820  * Request to resolve additional information for a given document link. The request's\r
4821  * parameter is of type [DocumentLink](#DocumentLink) the response\r
4822  * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
4823  */\r
4824 var DocumentLinkResolveRequest;\r
4825 (function (DocumentLinkResolveRequest) {\r
4826     DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');\r
4827 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
4828 /**\r
4829  * A request to to format a whole document.\r
4830  */\r
4831 var DocumentFormattingRequest;\r
4832 (function (DocumentFormattingRequest) {\r
4833     DocumentFormattingRequest.method = 'textDocument/formatting';\r
4834     DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\r
4835 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
4836 /**\r
4837  * A request to to format a range in a document.\r
4838  */\r
4839 var DocumentRangeFormattingRequest;\r
4840 (function (DocumentRangeFormattingRequest) {\r
4841     DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
4842     DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\r
4843 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
4844 /**\r
4845  * A request to format a document on type.\r
4846  */\r
4847 var DocumentOnTypeFormattingRequest;\r
4848 (function (DocumentOnTypeFormattingRequest) {\r
4849     DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
4850     DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\r
4851 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
4852 /**\r
4853  * A request to rename a symbol.\r
4854  */\r
4855 var RenameRequest;\r
4856 (function (RenameRequest) {\r
4857     RenameRequest.method = 'textDocument/rename';\r
4858     RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\r
4859 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
4860 /**\r
4861  * A request to test and perform the setup necessary for a rename.\r
4862  */\r
4863 var PrepareRenameRequest;\r
4864 (function (PrepareRenameRequest) {\r
4865     PrepareRenameRequest.method = 'textDocument/prepareRename';\r
4866     PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\r
4867 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
4868 /**\r
4869  * A request send from the client to the server to execute a command. The request might return\r
4870  * a workspace edit which the client will apply to the workspace.\r
4871  */\r
4872 var ExecuteCommandRequest;\r
4873 (function (ExecuteCommandRequest) {\r
4874     ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');\r
4875 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
4876 /**\r
4877  * A request sent from the server to the client to modified certain resources.\r
4878  */\r
4879 var ApplyWorkspaceEditRequest;\r
4880 (function (ApplyWorkspaceEditRequest) {\r
4881     ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\r
4882 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
4883
4884
4885 /***/ }),
4886 /* 20 */
4887 /***/ ((__unused_webpack_module, exports) => {
4888
4889 "use strict";
4890 /* --------------------------------------------------------------------------------------------\r
4891  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4892  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4893  * ------------------------------------------------------------------------------------------ */\r
4894 \r
4895 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4896 function boolean(value) {\r
4897     return value === true || value === false;\r
4898 }\r
4899 exports.boolean = boolean;\r
4900 function string(value) {\r
4901     return typeof value === 'string' || value instanceof String;\r
4902 }\r
4903 exports.string = string;\r
4904 function number(value) {\r
4905     return typeof value === 'number' || value instanceof Number;\r
4906 }\r
4907 exports.number = number;\r
4908 function error(value) {\r
4909     return value instanceof Error;\r
4910 }\r
4911 exports.error = error;\r
4912 function func(value) {\r
4913     return typeof value === 'function';\r
4914 }\r
4915 exports.func = func;\r
4916 function array(value) {\r
4917     return Array.isArray(value);\r
4918 }\r
4919 exports.array = array;\r
4920 function stringArray(value) {\r
4921     return array(value) && value.every(elem => string(elem));\r
4922 }\r
4923 exports.stringArray = stringArray;\r
4924 function typedArray(value, check) {\r
4925     return Array.isArray(value) && value.every(check);\r
4926 }\r
4927 exports.typedArray = typedArray;\r
4928 function objectLiteral(value) {\r
4929     // Strictly speaking class instances pass this check as well. Since the LSP\r
4930     // doesn't use classes we ignore this for now. If we do we need to add something\r
4931     // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4932     return value !== null && typeof value === 'object';\r
4933 }\r
4934 exports.objectLiteral = objectLiteral;\r
4935
4936
4937 /***/ }),
4938 /* 21 */
4939 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4940
4941 "use strict";
4942 /* --------------------------------------------------------------------------------------------\r
4943  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4944  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4945  * ------------------------------------------------------------------------------------------ */\r
4946 \r
4947 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4948 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4949 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\r
4950     constructor(method) {\r
4951         super(method);\r
4952     }\r
4953 }\r
4954 exports.ProtocolRequestType0 = ProtocolRequestType0;\r
4955 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\r
4956     constructor(method) {\r
4957         super(method);\r
4958     }\r
4959 }\r
4960 exports.ProtocolRequestType = ProtocolRequestType;\r
4961 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\r
4962     constructor(method) {\r
4963         super(method);\r
4964     }\r
4965 }\r
4966 exports.ProtocolNotificationType = ProtocolNotificationType;\r
4967 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\r
4968     constructor(method) {\r
4969         super(method);\r
4970     }\r
4971 }\r
4972 exports.ProtocolNotificationType0 = ProtocolNotificationType0;\r
4973
4974
4975 /***/ }),
4976 /* 22 */
4977 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4978
4979 "use strict";
4980 /* --------------------------------------------------------------------------------------------\r
4981  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4982  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4983  * ------------------------------------------------------------------------------------------ */\r
4984 \r
4985 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4986 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4987 const messages_1 = __webpack_require__(21);\r
4988 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4989 let __noDynamicImport;\r
4990 /**\r
4991  * A request to resolve the implementation locations of a symbol at a given text\r
4992  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
4993  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
4994  * Thenable that resolves to such.\r
4995  */\r
4996 var ImplementationRequest;\r
4997 (function (ImplementationRequest) {\r
4998     ImplementationRequest.method = 'textDocument/implementation';\r
4999     ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\r
5000     /** @deprecated Use ImplementationRequest.type */\r
5001     ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5002 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
5003
5004
5005 /***/ }),
5006 /* 23 */
5007 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5008
5009 "use strict";
5010 /* --------------------------------------------------------------------------------------------\r
5011  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5012  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5013  * ------------------------------------------------------------------------------------------ */\r
5014 \r
5015 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5016 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5017 const messages_1 = __webpack_require__(21);\r
5018 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5019 let __noDynamicImport;\r
5020 /**\r
5021  * A request to resolve the type definition locations of a symbol at a given text\r
5022  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5023  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
5024  * Thenable that resolves to such.\r
5025  */\r
5026 var TypeDefinitionRequest;\r
5027 (function (TypeDefinitionRequest) {\r
5028     TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
5029     TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\r
5030     /** @deprecated Use TypeDefinitionRequest.type */\r
5031     TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5032 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
5033
5034
5035 /***/ }),
5036 /* 24 */
5037 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5038
5039 "use strict";
5040 /* --------------------------------------------------------------------------------------------\r
5041  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5042  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5043  * ------------------------------------------------------------------------------------------ */\r
5044 \r
5045 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5046 const messages_1 = __webpack_require__(21);\r
5047 /**\r
5048  * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
5049  */\r
5050 var WorkspaceFoldersRequest;\r
5051 (function (WorkspaceFoldersRequest) {\r
5052     WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');\r
5053 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
5054 /**\r
5055  * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
5056  * folder configuration changes.\r
5057  */\r
5058 var DidChangeWorkspaceFoldersNotification;\r
5059 (function (DidChangeWorkspaceFoldersNotification) {\r
5060     DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');\r
5061 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
5062
5063
5064 /***/ }),
5065 /* 25 */
5066 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5067
5068 "use strict";
5069 /* --------------------------------------------------------------------------------------------\r
5070  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5071  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5072  * ------------------------------------------------------------------------------------------ */\r
5073 \r
5074 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5075 const messages_1 = __webpack_require__(21);\r
5076 /**\r
5077  * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
5078  * configuration setting.\r
5079  *\r
5080  * This pull model replaces the old push model were the client signaled configuration change via an\r
5081  * event. If the server still needs to react to configuration changes (since the server caches the\r
5082  * result of `workspace/configuration` requests) the server should register for an empty configuration\r
5083  * change event and empty the cache if such an event is received.\r
5084  */\r
5085 var ConfigurationRequest;\r
5086 (function (ConfigurationRequest) {\r
5087     ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');\r
5088 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
5089
5090
5091 /***/ }),
5092 /* 26 */
5093 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5094
5095 "use strict";
5096 /* --------------------------------------------------------------------------------------------\r
5097  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5098  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5099  * ------------------------------------------------------------------------------------------ */\r
5100 \r
5101 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5102 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5103 const messages_1 = __webpack_require__(21);\r
5104 /**\r
5105  * A request to list all color symbols found in a given text document. The request's\r
5106  * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
5107  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5108  * that resolves to such.\r
5109  */\r
5110 var DocumentColorRequest;\r
5111 (function (DocumentColorRequest) {\r
5112     DocumentColorRequest.method = 'textDocument/documentColor';\r
5113     DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\r
5114     /** @deprecated Use DocumentColorRequest.type */\r
5115     DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5116 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
5117 /**\r
5118  * A request to list all presentation for a color. The request's\r
5119  * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
5120  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5121  * that resolves to such.\r
5122  */\r
5123 var ColorPresentationRequest;\r
5124 (function (ColorPresentationRequest) {\r
5125     ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');\r
5126 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
5127
5128
5129 /***/ }),
5130 /* 27 */
5131 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5132
5133 "use strict";
5134 \r
5135 /*---------------------------------------------------------------------------------------------\r
5136  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5137  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5138  *--------------------------------------------------------------------------------------------*/\r
5139 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5140 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5141 const messages_1 = __webpack_require__(21);\r
5142 /**\r
5143  * Enum of known range kinds\r
5144  */\r
5145 var FoldingRangeKind;\r
5146 (function (FoldingRangeKind) {\r
5147     /**\r
5148      * Folding range for a comment\r
5149      */\r
5150     FoldingRangeKind["Comment"] = "comment";\r
5151     /**\r
5152      * Folding range for a imports or includes\r
5153      */\r
5154     FoldingRangeKind["Imports"] = "imports";\r
5155     /**\r
5156      * Folding range for a region (e.g. `#region`)\r
5157      */\r
5158     FoldingRangeKind["Region"] = "region";\r
5159 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
5160 /**\r
5161  * A request to provide folding ranges in a document. The request's\r
5162  * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
5163  * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
5164  * that resolves to such.\r
5165  */\r
5166 var FoldingRangeRequest;\r
5167 (function (FoldingRangeRequest) {\r
5168     FoldingRangeRequest.method = 'textDocument/foldingRange';\r
5169     FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\r
5170     /** @deprecated Use FoldingRangeRequest.type */\r
5171     FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5172 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
5173
5174
5175 /***/ }),
5176 /* 28 */
5177 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5178
5179 "use strict";
5180 /* --------------------------------------------------------------------------------------------\r
5181  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5182  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5183  * ------------------------------------------------------------------------------------------ */\r
5184 \r
5185 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5186 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5187 const messages_1 = __webpack_require__(21);\r
5188 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5189 let __noDynamicImport;\r
5190 /**\r
5191  * A request to resolve the type definition locations of a symbol at a given text\r
5192  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5193  * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
5194  * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
5195  * to such.\r
5196  */\r
5197 var DeclarationRequest;\r
5198 (function (DeclarationRequest) {\r
5199     DeclarationRequest.method = 'textDocument/declaration';\r
5200     DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\r
5201     /** @deprecated Use DeclarationRequest.type */\r
5202     DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5203 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
5204
5205
5206 /***/ }),
5207 /* 29 */
5208 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5209
5210 "use strict";
5211 \r
5212 /*---------------------------------------------------------------------------------------------\r
5213  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5214  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5215  *--------------------------------------------------------------------------------------------*/\r
5216 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5217 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5218 const messages_1 = __webpack_require__(21);\r
5219 /**\r
5220  * A request to provide selection ranges in a document. The request's\r
5221  * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
5222  * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
5223  * that resolves to such.\r
5224  */\r
5225 var SelectionRangeRequest;\r
5226 (function (SelectionRangeRequest) {\r
5227     SelectionRangeRequest.method = 'textDocument/selectionRange';\r
5228     SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\r
5229     /** @deprecated  Use SelectionRangeRequest.type */\r
5230     SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5231 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
5232
5233
5234 /***/ }),
5235 /* 30 */
5236 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5237
5238 "use strict";
5239 /* --------------------------------------------------------------------------------------------\r
5240  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5241  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5242  * ------------------------------------------------------------------------------------------ */\r
5243 \r
5244 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5245 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5246 const messages_1 = __webpack_require__(21);\r
5247 var WorkDoneProgress;\r
5248 (function (WorkDoneProgress) {\r
5249     WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
5250 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
5251 /**\r
5252  * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
5253  * reporting from the server.\r
5254  */\r
5255 var WorkDoneProgressCreateRequest;\r
5256 (function (WorkDoneProgressCreateRequest) {\r
5257     WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');\r
5258 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
5259 /**\r
5260  * The `window/workDoneProgress/cancel` notification is sent from  the client to the server to cancel a progress\r
5261  * initiated on the server side.\r
5262  */\r
5263 var WorkDoneProgressCancelNotification;\r
5264 (function (WorkDoneProgressCancelNotification) {\r
5265     WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');\r
5266 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
5267
5268
5269 /***/ }),
5270 /* 31 */
5271 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5272
5273 "use strict";
5274 /* --------------------------------------------------------------------------------------------\r
5275  * Copyright (c) TypeFox and others. All rights reserved.\r
5276  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5277  * ------------------------------------------------------------------------------------------ */\r
5278 \r
5279 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5280 const messages_1 = __webpack_require__(21);\r
5281 /**\r
5282  * A request to result a `CallHierarchyItem` in a document at a given position.\r
5283  * Can be used as an input to a incoming or outgoing call hierarchy.\r
5284  *\r
5285  * @since 3.16.0 - Proposed state\r
5286  */\r
5287 var CallHierarchyPrepareRequest;\r
5288 (function (CallHierarchyPrepareRequest) {\r
5289     CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
5290     CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\r
5291 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
5292 /**\r
5293  * A request to resolve the incoming calls for a given `CallHierarchyItem`.\r
5294  *\r
5295  * @since 3.16.0 - Proposed state\r
5296  */\r
5297 var CallHierarchyIncomingCallsRequest;\r
5298 (function (CallHierarchyIncomingCallsRequest) {\r
5299     CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
5300     CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\r
5301 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
5302 /**\r
5303  * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\r
5304  *\r
5305  * @since 3.16.0 - Proposed state\r
5306  */\r
5307 var CallHierarchyOutgoingCallsRequest;\r
5308 (function (CallHierarchyOutgoingCallsRequest) {\r
5309     CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
5310     CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\r
5311 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
5312
5313
5314 /***/ }),
5315 /* 32 */
5316 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5317
5318 "use strict";
5319 /* --------------------------------------------------------------------------------------------\r
5320  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5321  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5322  * ------------------------------------------------------------------------------------------ */\r
5323 \r
5324 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5325 const messages_1 = __webpack_require__(21);\r
5326 /**\r
5327  * A set of predefined token types. This set is not fixed\r
5328  * an clients can specify additional token types via the\r
5329  * corresponding client capabilities.\r
5330  *\r
5331  * @since 3.16.0 - Proposed state\r
5332  */\r
5333 var SemanticTokenTypes;\r
5334 (function (SemanticTokenTypes) {\r
5335     SemanticTokenTypes["comment"] = "comment";\r
5336     SemanticTokenTypes["keyword"] = "keyword";\r
5337     SemanticTokenTypes["string"] = "string";\r
5338     SemanticTokenTypes["number"] = "number";\r
5339     SemanticTokenTypes["regexp"] = "regexp";\r
5340     SemanticTokenTypes["operator"] = "operator";\r
5341     SemanticTokenTypes["namespace"] = "namespace";\r
5342     SemanticTokenTypes["type"] = "type";\r
5343     SemanticTokenTypes["struct"] = "struct";\r
5344     SemanticTokenTypes["class"] = "class";\r
5345     SemanticTokenTypes["interface"] = "interface";\r
5346     SemanticTokenTypes["enum"] = "enum";\r
5347     SemanticTokenTypes["typeParameter"] = "typeParameter";\r
5348     SemanticTokenTypes["function"] = "function";\r
5349     SemanticTokenTypes["member"] = "member";\r
5350     SemanticTokenTypes["property"] = "property";\r
5351     SemanticTokenTypes["macro"] = "macro";\r
5352     SemanticTokenTypes["variable"] = "variable";\r
5353     SemanticTokenTypes["parameter"] = "parameter";\r
5354     SemanticTokenTypes["label"] = "label";\r
5355 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));\r
5356 /**\r
5357  * A set of predefined token modifiers. This set is not fixed\r
5358  * an clients can specify additional token types via the\r
5359  * corresponding client capabilities.\r
5360  *\r
5361  * @since 3.16.0 - Proposed state\r
5362  */\r
5363 var SemanticTokenModifiers;\r
5364 (function (SemanticTokenModifiers) {\r
5365     SemanticTokenModifiers["documentation"] = "documentation";\r
5366     SemanticTokenModifiers["declaration"] = "declaration";\r
5367     SemanticTokenModifiers["definition"] = "definition";\r
5368     SemanticTokenModifiers["reference"] = "reference";\r
5369     SemanticTokenModifiers["static"] = "static";\r
5370     SemanticTokenModifiers["abstract"] = "abstract";\r
5371     SemanticTokenModifiers["deprecated"] = "deprecated";\r
5372     SemanticTokenModifiers["async"] = "async";\r
5373     SemanticTokenModifiers["volatile"] = "volatile";\r
5374     SemanticTokenModifiers["readonly"] = "readonly";\r
5375 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));\r
5376 /**\r
5377  * @since 3.16.0 - Proposed state\r
5378  */\r
5379 var SemanticTokens;\r
5380 (function (SemanticTokens) {\r
5381     function is(value) {\r
5382         const candidate = value;\r
5383         return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\r
5384             Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\r
5385     }\r
5386     SemanticTokens.is = is;\r
5387 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));\r
5388 /**\r
5389  * @since 3.16.0 - Proposed state\r
5390  */\r
5391 var SemanticTokensRequest;\r
5392 (function (SemanticTokensRequest) {\r
5393     SemanticTokensRequest.method = 'textDocument/semanticTokens';\r
5394     SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\r
5395 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));\r
5396 /**\r
5397  * @since 3.16.0 - Proposed state\r
5398  */\r
5399 var SemanticTokensEditsRequest;\r
5400 (function (SemanticTokensEditsRequest) {\r
5401     SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';\r
5402     SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);\r
5403 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));\r
5404 /**\r
5405  * @since 3.16.0 - Proposed state\r
5406  */\r
5407 var SemanticTokensRangeRequest;\r
5408 (function (SemanticTokensRangeRequest) {\r
5409     SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\r
5410     SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\r
5411 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));\r
5412
5413
5414 /***/ }),
5415 /* 33 */
5416 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5417
5418 "use strict";
5419
5420 Object.defineProperty(exports, "__esModule", ({ value: true }));
5421 exports.Ctx = void 0;
5422 const coc_nvim_1 = __webpack_require__(1);
5423 const vscode_languageserver_protocol_1 = __webpack_require__(4);
5424 const config_1 = __webpack_require__(34);
5425 const semantic_highlighting_1 = __webpack_require__(35);
5426 class ClangdExtensionFeature {
5427     constructor() { }
5428     initialize() { }
5429     fillClientCapabilities(capabilities) {
5430         var _a;
5431         const textDocument = capabilities.textDocument;
5432         // @ts-ignore: clangd extension
5433         (_a = textDocument.completion) === null || _a === void 0 ? void 0 : _a.editsNearCursor = true;
5434     }
5435 }
5436 class Ctx {
5437     constructor(context) {
5438         this.context = context;
5439         this.client = null;
5440         this.config = new config_1.Config();
5441     }
5442     async startServer(bin) {
5443         const old = this.client;
5444         if (old) {
5445             await old.stop();
5446         }
5447         const exec = {
5448             command: bin,
5449             args: this.config.arguments,
5450         };
5451         if (!!this.config.trace) {
5452             exec.options = { env: { CLANGD_TRACE: this.config.trace } };
5453         }
5454         const serverOptions = exec;
5455         const outputChannel = coc_nvim_1.workspace.createOutputChannel('clangd');
5456         const initializationOptions = { clangdFileStatus: true, fallbackFlags: this.config.fallbackFlags };
5457         if (this.config.compilationDatabasePath) {
5458             initializationOptions.compilationDatabasePath = this.config.compilationDatabasePath;
5459         }
5460         const clientOptions = {
5461             documentSelector: [
5462                 { scheme: 'file', language: 'c' },
5463                 { scheme: 'file', language: 'cpp' },
5464                 { scheme: 'file', language: 'objc' },
5465                 { scheme: 'file', language: 'objcpp' },
5466                 { scheme: 'file', language: 'objective-c' },
5467                 { scheme: 'file', language: 'objective-cpp' },
5468                 { scheme: 'file', language: 'cuda' },
5469                 { scheme: 'file', language: 'arduino' },
5470             ],
5471             initializationOptions,
5472             disableDiagnostics: this.config.disableDiagnostics,
5473             // @ts-ignore
5474             disableSnippetCompletion: this.config.disableSnippetCompletion,
5475             outputChannel,
5476             middleware: {
5477                 provideOnTypeFormattingEdits: (document, position, ch, options, token, next) => {
5478                     // coc sends "\n" when exiting insert mode, when there is no newline added to the doc.
5479                     if (ch === '\n')
5480                         ch = '';
5481                     return next(document, position, ch, options, token);
5482                 },
5483                 provideCompletionItem: async (document, position, context, token, next) => {
5484                     const list = await next(document, position, context, token);
5485                     if (!list)
5486                         return [];
5487                     if (!this.config.serverCompletionRanking)
5488                         return list;
5489                     const items = (Array.isArray(list) ? list : list.items).map((item) => {
5490                         var _a;
5491                         const start = (_a = item.textEdit) === null || _a === void 0 ? void 0 : _a.range.start;
5492                         if (start) {
5493                             const prefix = document.getText(vscode_languageserver_protocol_1.Range.create(start, position));
5494                             if (prefix)
5495                                 item.filterText = prefix + '_' + item.filterText;
5496                         }
5497                         return item;
5498                     });
5499                     return vscode_languageserver_protocol_1.CompletionList.create(items, true);
5500                 },
5501                 provideWorkspaceSymbols: async (query, token, next) => {
5502                     const symbols = await next(query, token);
5503                     if (!symbols)
5504                         return;
5505                     return symbols.map((symbol) => {
5506                         if (symbol.containerName) {
5507                             symbol.name = `${symbol.containerName}::${symbol.name}`;
5508                         }
5509                         symbol.containerName = '';
5510                         return symbol;
5511                     });
5512                 },
5513             },
5514         };
5515         const client = new coc_nvim_1.LanguageClient('clangd', serverOptions, clientOptions);
5516         client.registerFeature(new ClangdExtensionFeature());
5517         if (this.config.semanticHighlighting) {
5518             const lspCxx = await coc_nvim_1.workspace.nvim.call('exists', 'g:lsp_cxx_hl_loaded');
5519             if (lspCxx === 1) {
5520                 client.registerFeature(new semantic_highlighting_1.SemanticHighlightingFeature(client, this.context));
5521             }
5522         }
5523         this.context.subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
5524         await client.onReady();
5525         this.client = client;
5526     }
5527     get subscriptions() {
5528         return this.context.subscriptions;
5529     }
5530 }
5531 exports.Ctx = Ctx;
5532
5533
5534 /***/ }),
5535 /* 34 */
5536 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5537
5538 "use strict";
5539
5540 Object.defineProperty(exports, "__esModule", ({ value: true }));
5541 exports.Config = void 0;
5542 const coc_nvim_1 = __webpack_require__(1);
5543 class Config {
5544     constructor() {
5545         this.cfg = coc_nvim_1.workspace.getConfiguration('clangd');
5546     }
5547     get enabled() {
5548         return this.cfg.get('enabled');
5549     }
5550     get disableDiagnostics() {
5551         return this.cfg.get('disableDiagnostics');
5552     }
5553     get disableSnippetCompletion() {
5554         return this.cfg.get('disableSnippetCompletion');
5555     }
5556     get arguments() {
5557         return this.cfg.get('arguments', []);
5558     }
5559     get trace() {
5560         return this.cfg.get('trace', '');
5561     }
5562     get fallbackFlags() {
5563         return this.cfg.get('fallbackFlags', []);
5564     }
5565     get semanticHighlighting() {
5566         return this.cfg.get('semanticHighlighting');
5567     }
5568     get showDBChangedNotification() {
5569         return this.cfg.get('showDBChangedNotification');
5570     }
5571     get compilationDatabasePath() {
5572         return this.cfg.get('compilationDatabasePath');
5573     }
5574     get serverCompletionRanking() {
5575         return this.cfg.get('serverCompletionRanking');
5576     }
5577 }
5578 exports.Config = Config;
5579
5580
5581 /***/ }),
5582 /* 35 */
5583 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5584
5585 "use strict";
5586
5587 Object.defineProperty(exports, "__esModule", ({ value: true }));
5588 exports.SemanticHighlightingFeature = void 0;
5589 const coc_nvim_1 = __webpack_require__(1);
5590 const vscode_languageserver_protocol_1 = __webpack_require__(4);
5591 class SemanticHighlightingFeature {
5592     constructor(client, context) {
5593         this.scopeTable = [];
5594         // Last tokens seen: bufTokens[bufnr][linenr] = [tokens...]
5595         this.bufTokens = {};
5596         context.subscriptions.push(client.onDidChangeState(({ newState }) => {
5597             if (newState === coc_nvim_1.State.Running) {
5598                 const notification = new vscode_languageserver_protocol_1.NotificationType('textDocument/semanticHighlighting');
5599                 client.onNotification(notification, this.handleNotification.bind(this));
5600             }
5601         }));
5602     }
5603     initialize(capabilities) {
5604         const serverCapabilities = capabilities;
5605         if (!serverCapabilities.semanticHighlighting)
5606             return;
5607         this.scopeTable = serverCapabilities.semanticHighlighting.scopes;
5608     }
5609     fillClientCapabilities(capabilities) {
5610         const textDocumentCapabilities = capabilities.textDocument;
5611         textDocumentCapabilities.semanticHighlightingCapabilities = {
5612             semanticHighlighting: true,
5613         };
5614     }
5615     async handleNotification(params) {
5616         // use https://github.com/jackguo380/vim-lsp-cxx-highlight to do highlighting
5617         // first, assemble the full list of tokens.
5618         const doc = coc_nvim_1.workspace.getDocument(params.textDocument.uri);
5619         // Create implicit previous state if it doesn't exist.
5620         if (!(doc.bufnr in this.bufTokens))
5621             this.bufTokens[doc.bufnr] = [];
5622         const lines = this.bufTokens[doc.bufnr];
5623         // Update changed lines in place.
5624         for (const line of params.lines) {
5625             while (line.line >= lines.length)
5626                 lines.push([]);
5627             lines[line.line] = this.decodeTokens(line.tokens);
5628         }
5629         const symbols = [];
5630         const skipped = [];
5631         for (const [line, tokens] of lines.entries()) {
5632             for (const token of tokens) {
5633                 if (token.kind === 'InactiveCode') {
5634                     skipped.push(vscode_languageserver_protocol_1.Range.create(line, token.character, line, token.character + token.length));
5635                 }
5636                 else {
5637                     symbols.push({
5638                         id: 0,
5639                         kind: token.kind,
5640                         ranges: [vscode_languageserver_protocol_1.Range.create(line, token.character, line, token.character + token.length)],
5641                         parentKind: 'Unknown',
5642                         storage: 'None',
5643                     });
5644                 }
5645             }
5646         }
5647         await coc_nvim_1.workspace.nvim.call('lsp_cxx_hl#hl#notify_symbols', [doc.bufnr, symbols]);
5648         if (skipped.length) {
5649             await coc_nvim_1.workspace.nvim.call('lsp_cxx_hl#hl#notify_skipped', [doc.bufnr, skipped]);
5650         }
5651     }
5652     // Converts a string of base64 encoded tokens into the corresponding array of SemanticHighlightingToken.
5653     decodeTokens(tokens) {
5654         const scopeMask = 0xffff;
5655         const lenShift = 0x10;
5656         const uint32Size = 4;
5657         const buf = Buffer.from(tokens, 'base64');
5658         const retTokens = [];
5659         for (let i = 0, end = buf.length / uint32Size; i < end; i += 2) {
5660             const start = buf.readUInt32BE(i * uint32Size);
5661             const lenKind = buf.readUInt32BE((i + 1) * uint32Size);
5662             const scopeIndex = lenKind & scopeMask;
5663             const len = lenKind >>> lenShift;
5664             const kind = this.scopeTable[scopeIndex][0];
5665             retTokens.push({ character: start, scopeIndex: scopeIndex, length: len, kind: this.decodeKind(kind) });
5666         }
5667         return retTokens;
5668     }
5669     decodeKind(kind) {
5670         // https://github.com/llvm/llvm-project/blob/9adc7fc3cdf571bd70d5f8bda4e2e9c233c5fd63/clang-tools-extra/clangd/SemanticHighlighting.cpp#L477
5671         switch (kind) {
5672             case 'entity.name.function.cpp':
5673                 return 'Function';
5674             case 'entity.name.function.method.cpp':
5675                 return 'Method';
5676             case 'entity.name.function.method.static.cpp':
5677                 return 'StaticMethod';
5678             case 'variable.other.cpp':
5679                 return 'Variable';
5680             case 'variable.other.local.cpp':
5681                 return 'LocalVariable';
5682             case 'variable.parameter.cpp':
5683                 return 'Parameter';
5684             case 'variable.other.field.cpp':
5685                 return 'Field';
5686             case 'variable.other.field.static.cpp':
5687                 return 'StaticField';
5688             case 'entity.name.type.class.cpp':
5689                 return 'Class';
5690             case 'entity.name.type.enum.cpp':
5691                 return 'Enum';
5692             case 'variable.other.enummember.cpp':
5693                 return 'EnumConstant';
5694             case 'entity.name.type.typedef.cpp':
5695                 return 'Typedef';
5696             case 'entity.name.type.dependent.cpp':
5697                 return 'DependentType';
5698             case 'entity.name.other.dependent.cpp':
5699                 return 'DependentName';
5700             case 'entity.name.namespace.cpp':
5701                 return 'Namespace';
5702             case 'entity.name.type.template.cpp':
5703                 return 'TemplateParameter';
5704             case 'entity.name.type.concept.cpp':
5705                 return 'Concept';
5706             case 'storage.type.primitive.cpp':
5707                 return 'Primitive';
5708             case 'entity.name.function.preprocessor.cpp':
5709                 return 'Macro';
5710             case 'meta.disabled':
5711                 return 'InactiveCode';
5712             default:
5713                 return 'Unknown';
5714         }
5715     }
5716 }
5717 exports.SemanticHighlightingFeature = SemanticHighlightingFeature;
5718
5719
5720 /***/ }),
5721 /* 36 */
5722 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5723
5724 "use strict";
5725
5726 Object.defineProperty(exports, "__esModule", ({ value: true }));
5727 exports.FileStatus = void 0;
5728 const coc_nvim_1 = __webpack_require__(1);
5729 class FileStatus {
5730     constructor() {
5731         this.statuses = new Map();
5732         this.statusBarItem = coc_nvim_1.workspace.createStatusBarItem(0);
5733     }
5734     onFileUpdated(status) {
5735         this.statuses.set(status.uri, status);
5736         this.updateStatus();
5737     }
5738     async updateStatus() {
5739         const doc = await coc_nvim_1.workspace.document;
5740         if (!doc) {
5741             return;
5742         }
5743         const status = this.statuses.get(doc.uri);
5744         if (!status) {
5745             this.statusBarItem.hide();
5746             return;
5747         }
5748         this.statusBarItem.text = `clangd: ` + status.state;
5749         this.statusBarItem.show();
5750     }
5751     clear() {
5752         this.statuses.clear();
5753         this.statusBarItem.hide();
5754     }
5755     dispose() {
5756         this.statusBarItem.dispose();
5757     }
5758 }
5759 exports.FileStatus = FileStatus;
5760
5761
5762 /***/ }),
5763 /* 37 */
5764 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5765
5766 "use strict";
5767
5768 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5769     if (k2 === undefined) k2 = k;
5770     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5771 }) : (function(o, m, k, k2) {
5772     if (k2 === undefined) k2 = k;
5773     o[k2] = m[k];
5774 }));
5775 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5776     Object.defineProperty(o, "default", { enumerable: true, value: v });
5777 }) : function(o, v) {
5778     o["default"] = v;
5779 });
5780 var __importStar = (this && this.__importStar) || function (mod) {
5781     if (mod && mod.__esModule) return mod;
5782     var result = {};
5783     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5784     __setModuleDefault(result, mod);
5785     return result;
5786 };
5787 Object.defineProperty(exports, "__esModule", ({ value: true }));
5788 exports.activate = void 0;
5789 const coc = __importStar(__webpack_require__(1));
5790 const common = __importStar(__webpack_require__(38));
5791 class UI {
5792     constructor(context, config) {
5793         this.context = context;
5794         this.config = config;
5795     }
5796     get storagePath() {
5797         return this.context.storagePath;
5798     }
5799     slow(title, result) {
5800         coc.workspace.showMessage(title + '...');
5801         return result;
5802     }
5803     error(s) {
5804         coc.workspace.showMessage(s, 'error');
5805     }
5806     info(s) {
5807         coc.workspace.showMessage(s);
5808     }
5809     progress(title, _cancel, body) {
5810         return this.slow(title, body(() => { }));
5811     }
5812     async shouldReuse(release) {
5813         coc.workspace.showMessage(`Reusing existing ${release} installation in ${this.storagePath}`);
5814         return true;
5815     }
5816     async promptReload() {
5817         await coc.commands.executeCommand('editor.action.restart');
5818     }
5819     showHelp(message, url) {
5820         message += ` See ${url}.`;
5821         coc.workspace.showMessage(message);
5822     }
5823     async promptUpdate(oldVersion, newVersion) {
5824         const message = `clangd ${newVersion} is available (you have ${oldVersion}). :CocCommand clangd.install, or :CocSettings to disable clangd.checkUpdates.`;
5825         coc.workspace.showMessage(message);
5826     }
5827     async promptInstall(version) {
5828         const message = `clangd was not found on your PATH. :CocCommand clangd.install will install ${version}.`;
5829         coc.workspace.showMessage(message);
5830     }
5831     get clangdPath() {
5832         return this.config.get('path');
5833     }
5834     set clangdPath(p) {
5835         this.config.update('path', p, /*isUser=*/ true);
5836     }
5837 }
5838 // Returns the clangd path to use, or null if clangd is not installed.
5839 async function activate(context) {
5840     const cfg = coc.workspace.getConfiguration('clangd');
5841     const ui = new UI(context, cfg);
5842     context.subscriptions.push(coc.commands.registerCommand('clangd.install', async () => common.installLatest(ui)));
5843     context.subscriptions.push(coc.commands.registerCommand('clangd.update', async () => common.checkUpdates(true, ui)));
5844     const status = await common.prepare(ui, cfg.get('checkUpdates', false));
5845     return status.clangdPath;
5846 }
5847 exports.activate = activate;
5848
5849
5850 /***/ }),
5851 /* 38 */
5852 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5853
5854 "use strict";
5855
5856 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5857     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5858     return new (P || (P = Promise))(function (resolve, reject) {
5859         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5860         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5861         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5862         step((generator = generator.apply(thisArg, _arguments || [])).next());
5863     });
5864 };
5865 var __asyncValues = (this && this.__asyncValues) || function (o) {
5866     if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5867     var m = o[Symbol.asyncIterator], i;
5868     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);
5869     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); }); }; }
5870     function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
5871 };
5872 Object.defineProperty(exports, "__esModule", ({ value: true }));
5873 // Automatically install clangd binary releases from GitHub.
5874 //
5875 // We don't bundle them with the package because they're big; we'd have to
5876 // include all OS versions, and download them again with every extension update.
5877 //
5878 // There are several entry points:
5879 //  - installation explicitly requested
5880 //  - checking for updates (manual or automatic)
5881 //  - no usable clangd found, try to recover
5882 // These have different flows, but the same underlying mechanisms.
5883 const abort_controller_1 = __webpack_require__(39);
5884 const child_process = __webpack_require__(41);
5885 const fs = __webpack_require__(42);
5886 const node_fetch_1 = __webpack_require__(43);
5887 const os = __webpack_require__(14);
5888 const path = __webpack_require__(2);
5889 const readdirp = __webpack_require__(49);
5890 const rimraf = __webpack_require__(57);
5891 const semver = __webpack_require__(75);
5892 const stream = __webpack_require__(44);
5893 const unzipper = __webpack_require__(118);
5894 const util_1 = __webpack_require__(50);
5895 const which = __webpack_require__(216);
5896 // Main startup workflow: check whether the configured clangd binary us usable.
5897 // If not, offer to install one. If so, check for updates.
5898 function prepare(ui, checkUpdate) {
5899     return __awaiter(this, void 0, void 0, function* () {
5900         try {
5901             var absPath = yield util_1.promisify(which)(ui.clangdPath);
5902         }
5903         catch (e) {
5904             // Couldn't find clangd - start recovery flow and stop extension
5905             // loading.
5906             return { clangdPath: null, background: recover(ui) };
5907         }
5908         // Allow extension to load, asynchronously check for updates.
5909         return {
5910             clangdPath: absPath,
5911             background: checkUpdate ? checkUpdates(/*requested=*/ false, ui)
5912                 : Promise.resolve()
5913         };
5914     });
5915 }
5916 exports.prepare = prepare;
5917 // The user has explicitly asked to install the latest clangd.
5918 // Do so without further prompting, or report an error.
5919 function installLatest(ui) {
5920     return __awaiter(this, void 0, void 0, function* () {
5921         const abort = new abort_controller_1.AbortController();
5922         try {
5923             const release = yield Github.latestRelease();
5924             const asset = yield Github.chooseAsset(release);
5925             ui.clangdPath = yield Install.install(release, asset, abort, ui);
5926             ui.promptReload(`clangd ${release.name} is now installed.`);
5927         }
5928         catch (e) {
5929             if (!abort.signal.aborted) {
5930                 console.error('Failed to install clangd: ', e);
5931                 const message = `Failed to install clangd language server: ${e}\n` +
5932                     'You may want to install it manually.';
5933                 ui.showHelp(message, installURL);
5934             }
5935         }
5936     });
5937 }
5938 exports.installLatest = installLatest;
5939 // We have an apparently-valid clangd (`clangdPath`), check for updates.
5940 function checkUpdates(requested, ui) {
5941     return __awaiter(this, void 0, void 0, function* () {
5942         // Gather all the version information to see if there's an upgrade.
5943         try {
5944             var release = yield Github.latestRelease();
5945             yield Github.chooseAsset(release); // Ensure a binary for this platform.
5946             var upgrade = yield Version.upgrade(release, ui.clangdPath);
5947         }
5948         catch (e) {
5949             console.log('Failed to check for clangd update: ', e);
5950             // We're not sure whether there's an upgrade: stay quiet unless asked.
5951             if (requested)
5952                 ui.error(`Failed to check for clangd update: ${e}`);
5953             return;
5954         }
5955         console.log('Checking for clangd update: available=', upgrade.new, ' installed=', upgrade.old);
5956         // Bail out if the new version is better or comparable.
5957         if (!upgrade.upgrade) {
5958             if (requested)
5959                 ui.info(`clangd is up-to-date (you have ${upgrade.old}, latest is ${upgrade.new})`);
5960             return;
5961         }
5962         ui.promptUpdate(upgrade.old, upgrade.new);
5963     });
5964 }
5965 exports.checkUpdates = checkUpdates;
5966 // The extension has detected clangd isn't available.
5967 // Inform the user, and if possible offer to install or adjust the path.
5968 // Unlike installLatest(), we've had no explicit user request or consent yet.
5969 function recover(ui) {
5970     return __awaiter(this, void 0, void 0, function* () {
5971         try {
5972             const release = yield Github.latestRelease();
5973             yield Github.chooseAsset(release); // Ensure a binary for this platform.
5974             ui.promptInstall(release.name);
5975         }
5976         catch (e) {
5977             console.error('Auto-install failed: ', e);
5978             ui.showHelp('The clangd language server is not installed.', installURL);
5979         }
5980     });
5981 }
5982 const installURL = 'https://clangd.llvm.org/installation.html';
5983 // The GitHub API endpoint for the latest binary clangd release.
5984 let githubReleaseURL = 'https://api.github.com/repos/clangd/clangd/releases/latest';
5985 // Set a fake URL for testing.
5986 function fakeGitHubReleaseURL(u) { githubReleaseURL = u; }
5987 exports.fakeGitHubReleaseURL = fakeGitHubReleaseURL;
5988 let lddCommand = 'ldd';
5989 function fakeLddCommand(l) { lddCommand = l; }
5990 exports.fakeLddCommand = fakeLddCommand;
5991 // Bits for talking to github's release API
5992 var Github;
5993 (function (Github) {
5994     // Fetch the metadata for the latest stable clangd release.
5995     function latestRelease() {
5996         return __awaiter(this, void 0, void 0, function* () {
5997             const response = yield node_fetch_1.default(githubReleaseURL);
5998             if (!response.ok) {
5999                 console.log(response.url, response.status, response.statusText);
6000                 throw new Error(`Can't fetch release: ${response.statusText}`);
6001             }
6002             return yield response.json();
6003         });
6004     }
6005     Github.latestRelease = latestRelease;
6006     // Determine which release asset should be installed for this machine.
6007     function chooseAsset(release) {
6008         return __awaiter(this, void 0, void 0, function* () {
6009             const variants = {
6010                 'win32': 'windows',
6011                 'linux': 'linux',
6012                 'darwin': 'mac',
6013             };
6014             const variant = variants[os.platform()];
6015             if (variant == 'linux') {
6016                 // Hardcoding this here is sad, but we'd like to offer a nice error message
6017                 // without making the user download the package first.
6018                 const minGlibc = new semver.Range('2.18');
6019                 const oldGlibc = yield Version.oldGlibc(minGlibc);
6020                 if (oldGlibc) {
6021                     throw new Error('The clangd release is not compatible with your system ' +
6022                         `(glibc ${oldGlibc.raw} < ${minGlibc.raw}). ` +
6023                         'Try to install it using your package manager instead.');
6024                 }
6025             }
6026             // 32-bit vscode is still common on 64-bit windows, so don't reject that.
6027             if (variant && (os.arch() == 'x64' || variant == 'windows')) {
6028                 const asset = release.assets.find(a => a.name.indexOf(variant) >= 0);
6029                 if (asset)
6030                     return asset;
6031             }
6032             throw new Error(`No clangd ${release.name} binary available for ${os.platform()}/${os.arch()}`);
6033         });
6034     }
6035     Github.chooseAsset = chooseAsset;
6036 })(Github || (Github = {}));
6037 // Functions to download and install the releases, and manage the files on disk.
6038 //
6039 // File layout:
6040 //  <ui.storagePath>/
6041 //    install/
6042 //      <version>/
6043 //        clangd_<version>/            (outer director from zip file)
6044 //          bin/clangd
6045 //          lib/clang/...
6046 //    download/
6047 //      clangd-platform-<version>.zip  (deleted after extraction)
6048 var Install;
6049 (function (Install) {
6050     // Download the binary archive `asset` from a github `release` and extract it
6051     // to the extension's global storage location.
6052     // The `abort` controller is signaled if the user cancels the installation.
6053     // Returns the absolute path to the installed clangd executable.
6054     function install(release, asset, abort, ui) {
6055         return __awaiter(this, void 0, void 0, function* () {
6056             const dirs = yield createDirs(ui);
6057             const extractRoot = path.join(dirs.install, release.tag_name);
6058             if (yield util_1.promisify(fs.exists)(extractRoot)) {
6059                 const reuse = yield ui.shouldReuse(release.name);
6060                 if (reuse === undefined) {
6061                     // User dismissed prompt, bail out.
6062                     abort.abort();
6063                     throw new Error(`clangd ${release.name} already installed!`);
6064                 }
6065                 if (reuse) {
6066                     // Find clangd within the existing directory.
6067                     let files = (yield readdirp.promise(extractRoot)).map(e => e.fullPath);
6068                     return findExecutable(files);
6069                 }
6070                 else {
6071                     // Delete the old version.
6072                     yield util_1.promisify(rimraf)(extractRoot);
6073                     // continue with installation.
6074                 }
6075             }
6076             const zipFile = path.join(dirs.download, asset.name);
6077             yield download(asset.browser_download_url, zipFile, abort, ui);
6078             const archive = yield unzipper.Open.file(zipFile);
6079             const executable = findExecutable(archive.files.map(f => f.path));
6080             yield ui.slow(`Extracting ${asset.name}`, archive.extract({ path: extractRoot }));
6081             const clangdPath = path.join(extractRoot, executable);
6082             yield fs.promises.chmod(clangdPath, 0o755);
6083             yield fs.promises.unlink(zipFile);
6084             return clangdPath;
6085         });
6086     }
6087     Install.install = install;
6088     // Create the 'install' and 'download' directories, and return absolute paths.
6089     function createDirs(ui) {
6090         return __awaiter(this, void 0, void 0, function* () {
6091             const install = path.join(ui.storagePath, 'install');
6092             const download = path.join(ui.storagePath, 'download');
6093             for (const dir of [install, download])
6094                 yield fs.promises.mkdir(dir, { 'recursive': true });
6095             return { install: install, download: download };
6096         });
6097     }
6098     // Find the clangd executable within a set of files.
6099     function findExecutable(paths) {
6100         const filename = os.platform() == 'win32' ? 'clangd.exe' : 'clangd';
6101         const entry = paths.find(f => path.posix.basename(f) == filename ||
6102             path.win32.basename(f) == filename);
6103         if (entry == null)
6104             throw new Error('Didn\'t find a clangd executable!');
6105         return entry;
6106     }
6107     // Downloads `url` to a local file `dest` (whose parent should exist).
6108     // A progress dialog is shown, if it is cancelled then `abort` is signaled.
6109     function download(url, dest, abort, ui) {
6110         return __awaiter(this, void 0, void 0, function* () {
6111             console.log('Downloading ', url, ' to ', dest);
6112             return ui.progress(`Downloading ${path.basename(dest)}`, abort, (progress) => __awaiter(this, void 0, void 0, function* () {
6113                 const response = yield node_fetch_1.default(url, { signal: abort.signal });
6114                 if (!response.ok)
6115                     throw new Error(`Failed to download $url`);
6116                 const size = Number(response.headers.get('content-length'));
6117                 let read = 0;
6118                 response.body.on('data', (chunk) => {
6119                     read += chunk.length;
6120                     progress(read / size);
6121                 });
6122                 const out = fs.createWriteStream(dest);
6123                 yield util_1.promisify(stream.pipeline)(response.body, out).catch(e => {
6124                     // Clean up the partial file if the download failed.
6125                     fs.unlink(dest, (_) => null); // Don't wait, and ignore error.
6126                     throw e;
6127                 });
6128             }));
6129         });
6130     }
6131 })(Install || (Install = {}));
6132 // Functions dealing with clangd versions.
6133 //
6134 // We parse both github release numbers and installed `clangd --version` output
6135 // by treating them as SemVer ranges, and offer an upgrade if the version
6136 // is unambiguously newer.
6137 //
6138 // These functions throw if versions can't be parsed (e.g. installed clangd
6139 // is a vendor-modified version).
6140 var Version;
6141 (function (Version) {
6142     function upgrade(release, clangdPath) {
6143         return __awaiter(this, void 0, void 0, function* () {
6144             const releasedVer = released(release);
6145             const installedVer = yield installed(clangdPath);
6146             return {
6147                 old: installedVer.raw,
6148                 new: releasedVer.raw,
6149                 upgrade: rangeGreater(releasedVer, installedVer)
6150             };
6151         });
6152     }
6153     Version.upgrade = upgrade;
6154     const loose = {
6155         'loose': true
6156     };
6157     // Get the version of an installed clangd binary using `clangd --version`.
6158     function installed(clangdPath) {
6159         return __awaiter(this, void 0, void 0, function* () {
6160             const output = yield run(clangdPath, ['--version']);
6161             console.log(clangdPath, ' --version output: ', output);
6162             const prefix = 'clangd version ';
6163             if (!output.startsWith(prefix))
6164                 throw new Error(`Couldn't parse clangd --version output: ${output}`);
6165             const rawVersion = output.substr(prefix.length).split(' ', 1)[0];
6166             return new semver.Range(rawVersion, loose);
6167         });
6168     }
6169     // Get the version of a github release, by parsing the tag or name.
6170     function released(release) {
6171         // Prefer the tag name, but fall back to the release name.
6172         return (!semver.validRange(release.tag_name, loose) &&
6173             semver.validRange(release.name, loose))
6174             ? new semver.Range(release.name, loose)
6175             : new semver.Range(release.tag_name, loose);
6176     }
6177     // Detect the (linux) system's glibc version. If older than `min`, return it.
6178     function oldGlibc(min) {
6179         return __awaiter(this, void 0, void 0, function* () {
6180             // ldd is distributed with glibc, so ldd --version should be a good proxy.
6181             const output = yield run(lddCommand, ['--version']);
6182             // The first line is e.g. "ldd (Debian GLIBC 2.29-9) 2.29".
6183             const line = output.split('\n', 1)[0];
6184             // Require some confirmation this is [e]glibc, and a plausible
6185             // version number.
6186             const match = line.match(/^ldd .*glibc.* (\d+(?:\.\d+)+)[^ ]*$/i);
6187             if (!match || !semver.validRange(match[1], loose)) {
6188                 console.error(`Can't glibc version from ldd --version output: ${line}`);
6189                 return null;
6190             }
6191             const version = new semver.Range(match[1], loose);
6192             console.log('glibc is', version.raw, 'min is', min.raw);
6193             return rangeGreater(min, version) ? version : null;
6194         });
6195     }
6196     Version.oldGlibc = oldGlibc;
6197     // Run a system command and capture any stdout produced.
6198     function run(command, flags) {
6199         var e_1, _a;
6200         return __awaiter(this, void 0, void 0, function* () {
6201             const child = child_process.spawn(command, flags, { stdio: ['ignore', 'pipe', 'ignore'] });
6202             let output = '';
6203             try {
6204                 for (var _b = __asyncValues(child.stdout), _c; _c = yield _b.next(), !_c.done;) {
6205                     const chunk = _c.value;
6206                     output += chunk;
6207                 }
6208             }
6209             catch (e_1_1) { e_1 = { error: e_1_1 }; }
6210             finally {
6211                 try {
6212                     if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
6213                 }
6214                 finally { if (e_1) throw e_1.error; }
6215             }
6216             return output;
6217         });
6218     }
6219     function rangeGreater(newVer, oldVer) {
6220         return semver.gtr(semver.minVersion(newVer), oldVer);
6221     }
6222 })(Version || (Version = {}));
6223 //# sourceMappingURL=index.js.map
6224
6225 /***/ }),
6226 /* 39 */
6227 /***/ ((module, exports, __webpack_require__) => {
6228
6229 "use strict";
6230 /**
6231  * @author Toru Nagashima <https://github.com/mysticatea>
6232  * See LICENSE file in root directory for full license.
6233  */
6234
6235
6236 Object.defineProperty(exports, "__esModule", ({ value: true }));
6237
6238 var eventTargetShim = __webpack_require__(40);
6239
6240 /**
6241  * The signal class.
6242  * @see https://dom.spec.whatwg.org/#abortsignal
6243  */
6244 class AbortSignal extends eventTargetShim.EventTarget {
6245     /**
6246      * AbortSignal cannot be constructed directly.
6247      */
6248     constructor() {
6249         super();
6250         throw new TypeError("AbortSignal cannot be constructed directly");
6251     }
6252     /**
6253      * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
6254      */
6255     get aborted() {
6256         const aborted = abortedFlags.get(this);
6257         if (typeof aborted !== "boolean") {
6258             throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
6259         }
6260         return aborted;
6261     }
6262 }
6263 eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
6264 /**
6265  * Create an AbortSignal object.
6266  */
6267 function createAbortSignal() {
6268     const signal = Object.create(AbortSignal.prototype);
6269     eventTargetShim.EventTarget.call(signal);
6270     abortedFlags.set(signal, false);
6271     return signal;
6272 }
6273 /**
6274  * Abort a given signal.
6275  */
6276 function abortSignal(signal) {
6277     if (abortedFlags.get(signal) !== false) {
6278         return;
6279     }
6280     abortedFlags.set(signal, true);
6281     signal.dispatchEvent({ type: "abort" });
6282 }
6283 /**
6284  * Aborted flag for each instances.
6285  */
6286 const abortedFlags = new WeakMap();
6287 // Properties should be enumerable.
6288 Object.defineProperties(AbortSignal.prototype, {
6289     aborted: { enumerable: true },
6290 });
6291 // `toString()` should return `"[object AbortSignal]"`
6292 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
6293     Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
6294         configurable: true,
6295         value: "AbortSignal",
6296     });
6297 }
6298
6299 /**
6300  * The AbortController.
6301  * @see https://dom.spec.whatwg.org/#abortcontroller
6302  */
6303 class AbortController {
6304     /**
6305      * Initialize this controller.
6306      */
6307     constructor() {
6308         signals.set(this, createAbortSignal());
6309     }
6310     /**
6311      * Returns the `AbortSignal` object associated with this object.
6312      */
6313     get signal() {
6314         return getSignal(this);
6315     }
6316     /**
6317      * Abort and signal to any observers that the associated activity is to be aborted.
6318      */
6319     abort() {
6320         abortSignal(getSignal(this));
6321     }
6322 }
6323 /**
6324  * Associated signals.
6325  */
6326 const signals = new WeakMap();
6327 /**
6328  * Get the associated signal of a given controller.
6329  */
6330 function getSignal(controller) {
6331     const signal = signals.get(controller);
6332     if (signal == null) {
6333         throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
6334     }
6335     return signal;
6336 }
6337 // Properties should be enumerable.
6338 Object.defineProperties(AbortController.prototype, {
6339     signal: { enumerable: true },
6340     abort: { enumerable: true },
6341 });
6342 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
6343     Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
6344         configurable: true,
6345         value: "AbortController",
6346     });
6347 }
6348
6349 exports.AbortController = AbortController;
6350 exports.AbortSignal = AbortSignal;
6351 exports.default = AbortController;
6352
6353 module.exports = AbortController
6354 module.exports.AbortController = module.exports.default = AbortController
6355 module.exports.AbortSignal = AbortSignal
6356 //# sourceMappingURL=abort-controller.js.map
6357
6358
6359 /***/ }),
6360 /* 40 */
6361 /***/ ((module, exports) => {
6362
6363 "use strict";
6364 /**
6365  * @author Toru Nagashima <https://github.com/mysticatea>
6366  * @copyright 2015 Toru Nagashima. All rights reserved.
6367  * See LICENSE file in root directory for full license.
6368  */
6369
6370
6371 Object.defineProperty(exports, "__esModule", ({ value: true }));
6372
6373 /**
6374  * @typedef {object} PrivateData
6375  * @property {EventTarget} eventTarget The event target.
6376  * @property {{type:string}} event The original event object.
6377  * @property {number} eventPhase The current event phase.
6378  * @property {EventTarget|null} currentTarget The current event target.
6379  * @property {boolean} canceled The flag to prevent default.
6380  * @property {boolean} stopped The flag to stop propagation.
6381  * @property {boolean} immediateStopped The flag to stop propagation immediately.
6382  * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
6383  * @property {number} timeStamp The unix time.
6384  * @private
6385  */
6386
6387 /**
6388  * Private data for event wrappers.
6389  * @type {WeakMap<Event, PrivateData>}
6390  * @private
6391  */
6392 const privateData = new WeakMap();
6393
6394 /**
6395  * Cache for wrapper classes.
6396  * @type {WeakMap<Object, Function>}
6397  * @private
6398  */
6399 const wrappers = new WeakMap();
6400
6401 /**
6402  * Get private data.
6403  * @param {Event} event The event object to get private data.
6404  * @returns {PrivateData} The private data of the event.
6405  * @private
6406  */
6407 function pd(event) {
6408     const retv = privateData.get(event);
6409     console.assert(
6410         retv != null,
6411         "'this' is expected an Event object, but got",
6412         event
6413     );
6414     return retv
6415 }
6416
6417 /**
6418  * https://dom.spec.whatwg.org/#set-the-canceled-flag
6419  * @param data {PrivateData} private data.
6420  */
6421 function setCancelFlag(data) {
6422     if (data.passiveListener != null) {
6423         if (
6424             typeof console !== "undefined" &&
6425             typeof console.error === "function"
6426         ) {
6427             console.error(
6428                 "Unable to preventDefault inside passive event listener invocation.",
6429                 data.passiveListener
6430             );
6431         }
6432         return
6433     }
6434     if (!data.event.cancelable) {
6435         return
6436     }
6437
6438     data.canceled = true;
6439     if (typeof data.event.preventDefault === "function") {
6440         data.event.preventDefault();
6441     }
6442 }
6443
6444 /**
6445  * @see https://dom.spec.whatwg.org/#interface-event
6446  * @private
6447  */
6448 /**
6449  * The event wrapper.
6450  * @constructor
6451  * @param {EventTarget} eventTarget The event target of this dispatching.
6452  * @param {Event|{type:string}} event The original event to wrap.
6453  */
6454 function Event(eventTarget, event) {
6455     privateData.set(this, {
6456         eventTarget,
6457         event,
6458         eventPhase: 2,
6459         currentTarget: eventTarget,
6460         canceled: false,
6461         stopped: false,
6462         immediateStopped: false,
6463         passiveListener: null,
6464         timeStamp: event.timeStamp || Date.now(),
6465     });
6466
6467     // https://heycam.github.io/webidl/#Unforgeable
6468     Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
6469
6470     // Define accessors
6471     const keys = Object.keys(event);
6472     for (let i = 0; i < keys.length; ++i) {
6473         const key = keys[i];
6474         if (!(key in this)) {
6475             Object.defineProperty(this, key, defineRedirectDescriptor(key));
6476         }
6477     }
6478 }
6479
6480 // Should be enumerable, but class methods are not enumerable.
6481 Event.prototype = {
6482     /**
6483      * The type of this event.
6484      * @type {string}
6485      */
6486     get type() {
6487         return pd(this).event.type
6488     },
6489
6490     /**
6491      * The target of this event.
6492      * @type {EventTarget}
6493      */
6494     get target() {
6495         return pd(this).eventTarget
6496     },
6497
6498     /**
6499      * The target of this event.
6500      * @type {EventTarget}
6501      */
6502     get currentTarget() {
6503         return pd(this).currentTarget
6504     },
6505
6506     /**
6507      * @returns {EventTarget[]} The composed path of this event.
6508      */
6509     composedPath() {
6510         const currentTarget = pd(this).currentTarget;
6511         if (currentTarget == null) {
6512             return []
6513         }
6514         return [currentTarget]
6515     },
6516
6517     /**
6518      * Constant of NONE.
6519      * @type {number}
6520      */
6521     get NONE() {
6522         return 0
6523     },
6524
6525     /**
6526      * Constant of CAPTURING_PHASE.
6527      * @type {number}
6528      */
6529     get CAPTURING_PHASE() {
6530         return 1
6531     },
6532
6533     /**
6534      * Constant of AT_TARGET.
6535      * @type {number}
6536      */
6537     get AT_TARGET() {
6538         return 2
6539     },
6540
6541     /**
6542      * Constant of BUBBLING_PHASE.
6543      * @type {number}
6544      */
6545     get BUBBLING_PHASE() {
6546         return 3
6547     },
6548
6549     /**
6550      * The target of this event.
6551      * @type {number}
6552      */
6553     get eventPhase() {
6554         return pd(this).eventPhase
6555     },
6556
6557     /**
6558      * Stop event bubbling.
6559      * @returns {void}
6560      */
6561     stopPropagation() {
6562         const data = pd(this);
6563
6564         data.stopped = true;
6565         if (typeof data.event.stopPropagation === "function") {
6566             data.event.stopPropagation();
6567         }
6568     },
6569
6570     /**
6571      * Stop event bubbling.
6572      * @returns {void}
6573      */
6574     stopImmediatePropagation() {
6575         const data = pd(this);
6576
6577         data.stopped = true;
6578         data.immediateStopped = true;
6579         if (typeof data.event.stopImmediatePropagation === "function") {
6580             data.event.stopImmediatePropagation();
6581         }
6582     },
6583
6584     /**
6585      * The flag to be bubbling.
6586      * @type {boolean}
6587      */
6588     get bubbles() {
6589         return Boolean(pd(this).event.bubbles)
6590     },
6591
6592     /**
6593      * The flag to be cancelable.
6594      * @type {boolean}
6595      */
6596     get cancelable() {
6597         return Boolean(pd(this).event.cancelable)
6598     },
6599
6600     /**
6601      * Cancel this event.
6602      * @returns {void}
6603      */
6604     preventDefault() {
6605         setCancelFlag(pd(this));
6606     },
6607
6608     /**
6609      * The flag to indicate cancellation state.
6610      * @type {boolean}
6611      */
6612     get defaultPrevented() {
6613         return pd(this).canceled
6614     },
6615
6616     /**
6617      * The flag to be composed.
6618      * @type {boolean}
6619      */
6620     get composed() {
6621         return Boolean(pd(this).event.composed)
6622     },
6623
6624     /**
6625      * The unix time of this event.
6626      * @type {number}
6627      */
6628     get timeStamp() {
6629         return pd(this).timeStamp
6630     },
6631
6632     /**
6633      * The target of this event.
6634      * @type {EventTarget}
6635      * @deprecated
6636      */
6637     get srcElement() {
6638         return pd(this).eventTarget
6639     },
6640
6641     /**
6642      * The flag to stop event bubbling.
6643      * @type {boolean}
6644      * @deprecated
6645      */
6646     get cancelBubble() {
6647         return pd(this).stopped
6648     },
6649     set cancelBubble(value) {
6650         if (!value) {
6651             return
6652         }
6653         const data = pd(this);
6654
6655         data.stopped = true;
6656         if (typeof data.event.cancelBubble === "boolean") {
6657             data.event.cancelBubble = true;
6658         }
6659     },
6660
6661     /**
6662      * The flag to indicate cancellation state.
6663      * @type {boolean}
6664      * @deprecated
6665      */
6666     get returnValue() {
6667         return !pd(this).canceled
6668     },
6669     set returnValue(value) {
6670         if (!value) {
6671             setCancelFlag(pd(this));
6672         }
6673     },
6674
6675     /**
6676      * Initialize this event object. But do nothing under event dispatching.
6677      * @param {string} type The event type.
6678      * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
6679      * @param {boolean} [cancelable=false] The flag to be possible to cancel.
6680      * @deprecated
6681      */
6682     initEvent() {
6683         // Do nothing.
6684     },
6685 };
6686
6687 // `constructor` is not enumerable.
6688 Object.defineProperty(Event.prototype, "constructor", {
6689     value: Event,
6690     configurable: true,
6691     writable: true,
6692 });
6693
6694 // Ensure `event instanceof window.Event` is `true`.
6695 if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
6696     Object.setPrototypeOf(Event.prototype, window.Event.prototype);
6697
6698     // Make association for wrappers.
6699     wrappers.set(window.Event.prototype, Event);
6700 }
6701
6702 /**
6703  * Get the property descriptor to redirect a given property.
6704  * @param {string} key Property name to define property descriptor.
6705  * @returns {PropertyDescriptor} The property descriptor to redirect the property.
6706  * @private
6707  */
6708 function defineRedirectDescriptor(key) {
6709     return {
6710         get() {
6711             return pd(this).event[key]
6712         },
6713         set(value) {
6714             pd(this).event[key] = value;
6715         },
6716         configurable: true,
6717         enumerable: true,
6718     }
6719 }
6720
6721 /**
6722  * Get the property descriptor to call a given method property.
6723  * @param {string} key Property name to define property descriptor.
6724  * @returns {PropertyDescriptor} The property descriptor to call the method property.
6725  * @private
6726  */
6727 function defineCallDescriptor(key) {
6728     return {
6729         value() {
6730             const event = pd(this).event;
6731             return event[key].apply(event, arguments)
6732         },
6733         configurable: true,
6734         enumerable: true,
6735     }
6736 }
6737
6738 /**
6739  * Define new wrapper class.
6740  * @param {Function} BaseEvent The base wrapper class.
6741  * @param {Object} proto The prototype of the original event.
6742  * @returns {Function} The defined wrapper class.
6743  * @private
6744  */
6745 function defineWrapper(BaseEvent, proto) {
6746     const keys = Object.keys(proto);
6747     if (keys.length === 0) {
6748         return BaseEvent
6749     }
6750
6751     /** CustomEvent */
6752     function CustomEvent(eventTarget, event) {
6753         BaseEvent.call(this, eventTarget, event);
6754     }
6755
6756     CustomEvent.prototype = Object.create(BaseEvent.prototype, {
6757         constructor: { value: CustomEvent, configurable: true, writable: true },
6758     });
6759
6760     // Define accessors.
6761     for (let i = 0; i < keys.length; ++i) {
6762         const key = keys[i];
6763         if (!(key in BaseEvent.prototype)) {
6764             const descriptor = Object.getOwnPropertyDescriptor(proto, key);
6765             const isFunc = typeof descriptor.value === "function";
6766             Object.defineProperty(
6767                 CustomEvent.prototype,
6768                 key,
6769                 isFunc
6770                     ? defineCallDescriptor(key)
6771                     : defineRedirectDescriptor(key)
6772             );
6773         }
6774     }
6775
6776     return CustomEvent
6777 }
6778
6779 /**
6780  * Get the wrapper class of a given prototype.
6781  * @param {Object} proto The prototype of the original event to get its wrapper.
6782  * @returns {Function} The wrapper class.
6783  * @private
6784  */
6785 function getWrapper(proto) {
6786     if (proto == null || proto === Object.prototype) {
6787         return Event
6788     }
6789
6790     let wrapper = wrappers.get(proto);
6791     if (wrapper == null) {
6792         wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
6793         wrappers.set(proto, wrapper);
6794     }
6795     return wrapper
6796 }
6797
6798 /**
6799  * Wrap a given event to management a dispatching.
6800  * @param {EventTarget} eventTarget The event target of this dispatching.
6801  * @param {Object} event The event to wrap.
6802  * @returns {Event} The wrapper instance.
6803  * @private
6804  */
6805 function wrapEvent(eventTarget, event) {
6806     const Wrapper = getWrapper(Object.getPrototypeOf(event));
6807     return new Wrapper(eventTarget, event)
6808 }
6809
6810 /**
6811  * Get the immediateStopped flag of a given event.
6812  * @param {Event} event The event to get.
6813  * @returns {boolean} The flag to stop propagation immediately.
6814  * @private
6815  */
6816 function isStopped(event) {
6817     return pd(event).immediateStopped
6818 }
6819
6820 /**
6821  * Set the current event phase of a given event.
6822  * @param {Event} event The event to set current target.
6823  * @param {number} eventPhase New event phase.
6824  * @returns {void}
6825  * @private
6826  */
6827 function setEventPhase(event, eventPhase) {
6828     pd(event).eventPhase = eventPhase;
6829 }
6830
6831 /**
6832  * Set the current target of a given event.
6833  * @param {Event} event The event to set current target.
6834  * @param {EventTarget|null} currentTarget New current target.
6835  * @returns {void}
6836  * @private
6837  */
6838 function setCurrentTarget(event, currentTarget) {
6839     pd(event).currentTarget = currentTarget;
6840 }
6841
6842 /**
6843  * Set a passive listener of a given event.
6844  * @param {Event} event The event to set current target.
6845  * @param {Function|null} passiveListener New passive listener.
6846  * @returns {void}
6847  * @private
6848  */
6849 function setPassiveListener(event, passiveListener) {
6850     pd(event).passiveListener = passiveListener;
6851 }
6852
6853 /**
6854  * @typedef {object} ListenerNode
6855  * @property {Function} listener
6856  * @property {1|2|3} listenerType
6857  * @property {boolean} passive
6858  * @property {boolean} once
6859  * @property {ListenerNode|null} next
6860  * @private
6861  */
6862
6863 /**
6864  * @type {WeakMap<object, Map<string, ListenerNode>>}
6865  * @private
6866  */
6867 const listenersMap = new WeakMap();
6868
6869 // Listener types
6870 const CAPTURE = 1;
6871 const BUBBLE = 2;
6872 const ATTRIBUTE = 3;
6873
6874 /**
6875  * Check whether a given value is an object or not.
6876  * @param {any} x The value to check.
6877  * @returns {boolean} `true` if the value is an object.
6878  */
6879 function isObject(x) {
6880     return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
6881 }
6882
6883 /**
6884  * Get listeners.
6885  * @param {EventTarget} eventTarget The event target to get.
6886  * @returns {Map<string, ListenerNode>} The listeners.
6887  * @private
6888  */
6889 function getListeners(eventTarget) {
6890     const listeners = listenersMap.get(eventTarget);
6891     if (listeners == null) {
6892         throw new TypeError(
6893             "'this' is expected an EventTarget object, but got another value."
6894         )
6895     }
6896     return listeners
6897 }
6898
6899 /**
6900  * Get the property descriptor for the event attribute of a given event.
6901  * @param {string} eventName The event name to get property descriptor.
6902  * @returns {PropertyDescriptor} The property descriptor.
6903  * @private
6904  */
6905 function defineEventAttributeDescriptor(eventName) {
6906     return {
6907         get() {
6908             const listeners = getListeners(this);
6909             let node = listeners.get(eventName);
6910             while (node != null) {
6911                 if (node.listenerType === ATTRIBUTE) {
6912                     return node.listener
6913                 }
6914                 node = node.next;
6915             }
6916             return null
6917         },
6918
6919         set(listener) {
6920             if (typeof listener !== "function" && !isObject(listener)) {
6921                 listener = null; // eslint-disable-line no-param-reassign
6922             }
6923             const listeners = getListeners(this);
6924
6925             // Traverse to the tail while removing old value.
6926             let prev = null;
6927             let node = listeners.get(eventName);
6928             while (node != null) {
6929                 if (node.listenerType === ATTRIBUTE) {
6930                     // Remove old value.
6931                     if (prev !== null) {
6932                         prev.next = node.next;
6933                     } else if (node.next !== null) {
6934                         listeners.set(eventName, node.next);
6935                     } else {
6936                         listeners.delete(eventName);
6937                     }
6938                 } else {
6939                     prev = node;
6940                 }
6941
6942                 node = node.next;
6943             }
6944
6945             // Add new value.
6946             if (listener !== null) {
6947                 const newNode = {
6948                     listener,
6949                     listenerType: ATTRIBUTE,
6950                     passive: false,
6951                     once: false,
6952                     next: null,
6953                 };
6954                 if (prev === null) {
6955                     listeners.set(eventName, newNode);
6956                 } else {
6957                     prev.next = newNode;
6958                 }
6959             }
6960         },
6961         configurable: true,
6962         enumerable: true,
6963     }
6964 }
6965
6966 /**
6967  * Define an event attribute (e.g. `eventTarget.onclick`).
6968  * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
6969  * @param {string} eventName The event name to define.
6970  * @returns {void}
6971  */
6972 function defineEventAttribute(eventTargetPrototype, eventName) {
6973     Object.defineProperty(
6974         eventTargetPrototype,
6975         `on${eventName}`,
6976         defineEventAttributeDescriptor(eventName)
6977     );
6978 }
6979
6980 /**
6981  * Define a custom EventTarget with event attributes.
6982  * @param {string[]} eventNames Event names for event attributes.
6983  * @returns {EventTarget} The custom EventTarget.
6984  * @private
6985  */
6986 function defineCustomEventTarget(eventNames) {
6987     /** CustomEventTarget */
6988     function CustomEventTarget() {
6989         EventTarget.call(this);
6990     }
6991
6992     CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
6993         constructor: {
6994             value: CustomEventTarget,
6995             configurable: true,
6996             writable: true,
6997         },
6998     });
6999
7000     for (let i = 0; i < eventNames.length; ++i) {
7001         defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
7002     }
7003
7004     return CustomEventTarget
7005 }
7006
7007 /**
7008  * EventTarget.
7009  *
7010  * - This is constructor if no arguments.
7011  * - This is a function which returns a CustomEventTarget constructor if there are arguments.
7012  *
7013  * For example:
7014  *
7015  *     class A extends EventTarget {}
7016  *     class B extends EventTarget("message") {}
7017  *     class C extends EventTarget("message", "error") {}
7018  *     class D extends EventTarget(["message", "error"]) {}
7019  */
7020 function EventTarget() {
7021     /*eslint-disable consistent-return */
7022     if (this instanceof EventTarget) {
7023         listenersMap.set(this, new Map());
7024         return
7025     }
7026     if (arguments.length === 1 && Array.isArray(arguments[0])) {
7027         return defineCustomEventTarget(arguments[0])
7028     }
7029     if (arguments.length > 0) {
7030         const types = new Array(arguments.length);
7031         for (let i = 0; i < arguments.length; ++i) {
7032             types[i] = arguments[i];
7033         }
7034         return defineCustomEventTarget(types)
7035     }
7036     throw new TypeError("Cannot call a class as a function")
7037     /*eslint-enable consistent-return */
7038 }
7039
7040 // Should be enumerable, but class methods are not enumerable.
7041 EventTarget.prototype = {
7042     /**
7043      * Add a given listener to this event target.
7044      * @param {string} eventName The event name to add.
7045      * @param {Function} listener The listener to add.
7046      * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
7047      * @returns {void}
7048      */
7049     addEventListener(eventName, listener, options) {
7050         if (listener == null) {
7051             return
7052         }
7053         if (typeof listener !== "function" && !isObject(listener)) {
7054             throw new TypeError("'listener' should be a function or an object.")
7055         }
7056
7057         const listeners = getListeners(this);
7058         const optionsIsObj = isObject(options);
7059         const capture = optionsIsObj
7060             ? Boolean(options.capture)
7061             : Boolean(options);
7062         const listenerType = capture ? CAPTURE : BUBBLE;
7063         const newNode = {
7064             listener,
7065             listenerType,
7066             passive: optionsIsObj && Boolean(options.passive),
7067             once: optionsIsObj && Boolean(options.once),
7068             next: null,
7069         };
7070
7071         // Set it as the first node if the first node is null.
7072         let node = listeners.get(eventName);
7073         if (node === undefined) {
7074             listeners.set(eventName, newNode);
7075             return
7076         }
7077
7078         // Traverse to the tail while checking duplication..
7079         let prev = null;
7080         while (node != null) {
7081             if (
7082                 node.listener === listener &&
7083                 node.listenerType === listenerType
7084             ) {
7085                 // Should ignore duplication.
7086                 return
7087             }
7088             prev = node;
7089             node = node.next;
7090         }
7091
7092         // Add it.
7093         prev.next = newNode;
7094     },
7095
7096     /**
7097      * Remove a given listener from this event target.
7098      * @param {string} eventName The event name to remove.
7099      * @param {Function} listener The listener to remove.
7100      * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
7101      * @returns {void}
7102      */
7103     removeEventListener(eventName, listener, options) {
7104         if (listener == null) {
7105             return
7106         }
7107
7108         const listeners = getListeners(this);
7109         const capture = isObject(options)
7110             ? Boolean(options.capture)
7111             : Boolean(options);
7112         const listenerType = capture ? CAPTURE : BUBBLE;
7113
7114         let prev = null;
7115         let node = listeners.get(eventName);
7116         while (node != null) {
7117             if (
7118                 node.listener === listener &&
7119                 node.listenerType === listenerType
7120             ) {
7121                 if (prev !== null) {
7122                     prev.next = node.next;
7123                 } else if (node.next !== null) {
7124                     listeners.set(eventName, node.next);
7125                 } else {
7126                     listeners.delete(eventName);
7127                 }
7128                 return
7129             }
7130
7131             prev = node;
7132             node = node.next;
7133         }
7134     },
7135
7136     /**
7137      * Dispatch a given event.
7138      * @param {Event|{type:string}} event The event to dispatch.
7139      * @returns {boolean} `false` if canceled.
7140      */
7141     dispatchEvent(event) {
7142         if (event == null || typeof event.type !== "string") {
7143             throw new TypeError('"event.type" should be a string.')
7144         }
7145
7146         // If listeners aren't registered, terminate.
7147         const listeners = getListeners(this);
7148         const eventName = event.type;
7149         let node = listeners.get(eventName);
7150         if (node == null) {
7151             return true
7152         }
7153
7154         // Since we cannot rewrite several properties, so wrap object.
7155         const wrappedEvent = wrapEvent(this, event);
7156
7157         // This doesn't process capturing phase and bubbling phase.
7158         // This isn't participating in a tree.
7159         let prev = null;
7160         while (node != null) {
7161             // Remove this listener if it's once
7162             if (node.once) {
7163                 if (prev !== null) {
7164                     prev.next = node.next;
7165                 } else if (node.next !== null) {
7166                     listeners.set(eventName, node.next);
7167                 } else {
7168                     listeners.delete(eventName);
7169                 }
7170             } else {
7171                 prev = node;
7172             }
7173
7174             // Call this listener
7175             setPassiveListener(
7176                 wrappedEvent,
7177                 node.passive ? node.listener : null
7178             );
7179             if (typeof node.listener === "function") {
7180                 try {
7181                     node.listener.call(this, wrappedEvent);
7182                 } catch (err) {
7183                     if (
7184                         typeof console !== "undefined" &&
7185                         typeof console.error === "function"
7186                     ) {
7187                         console.error(err);
7188                     }
7189                 }
7190             } else if (
7191                 node.listenerType !== ATTRIBUTE &&
7192                 typeof node.listener.handleEvent === "function"
7193             ) {
7194                 node.listener.handleEvent(wrappedEvent);
7195             }
7196
7197             // Break if `event.stopImmediatePropagation` was called.
7198             if (isStopped(wrappedEvent)) {
7199                 break
7200             }
7201
7202             node = node.next;
7203         }
7204         setPassiveListener(wrappedEvent, null);
7205         setEventPhase(wrappedEvent, 0);
7206         setCurrentTarget(wrappedEvent, null);
7207
7208         return !wrappedEvent.defaultPrevented
7209     },
7210 };
7211
7212 // `constructor` is not enumerable.
7213 Object.defineProperty(EventTarget.prototype, "constructor", {
7214     value: EventTarget,
7215     configurable: true,
7216     writable: true,
7217 });
7218
7219 // Ensure `eventTarget instanceof window.EventTarget` is `true`.
7220 if (
7221     typeof window !== "undefined" &&
7222     typeof window.EventTarget !== "undefined"
7223 ) {
7224     Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
7225 }
7226
7227 exports.defineEventAttribute = defineEventAttribute;
7228 exports.EventTarget = EventTarget;
7229 exports.default = EventTarget;
7230
7231 module.exports = EventTarget
7232 module.exports.EventTarget = module.exports.default = EventTarget
7233 module.exports.defineEventAttribute = defineEventAttribute
7234 //# sourceMappingURL=event-target-shim.js.map
7235
7236
7237 /***/ }),
7238 /* 41 */
7239 /***/ ((module) => {
7240
7241 "use strict";
7242 module.exports = require("child_process");;
7243
7244 /***/ }),
7245 /* 42 */
7246 /***/ ((module) => {
7247
7248 "use strict";
7249 module.exports = require("fs");;
7250
7251 /***/ }),
7252 /* 43 */
7253 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7254
7255 "use strict";
7256 __webpack_require__.r(__webpack_exports__);
7257 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7258 /* harmony export */   "default": () => __WEBPACK_DEFAULT_EXPORT__,
7259 /* harmony export */   "Headers": () => /* binding */ Headers,
7260 /* harmony export */   "Request": () => /* binding */ Request,
7261 /* harmony export */   "Response": () => /* binding */ Response,
7262 /* harmony export */   "FetchError": () => /* binding */ FetchError
7263 /* harmony export */ });
7264 /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44);
7265 /* harmony import */ var http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45);
7266 /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46);
7267 /* harmony import */ var https__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47);
7268 /* harmony import */ var zlib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(48);
7269
7270
7271
7272
7273
7274
7275 // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
7276
7277 // fix for "Readable" isn't a named export issue
7278 const Readable = stream__WEBPACK_IMPORTED_MODULE_0__.Readable;
7279
7280 const BUFFER = Symbol('buffer');
7281 const TYPE = Symbol('type');
7282
7283 class Blob {
7284         constructor() {
7285                 this[TYPE] = '';
7286
7287                 const blobParts = arguments[0];
7288                 const options = arguments[1];
7289
7290                 const buffers = [];
7291                 let size = 0;
7292
7293                 if (blobParts) {
7294                         const a = blobParts;
7295                         const length = Number(a.length);
7296                         for (let i = 0; i < length; i++) {
7297                                 const element = a[i];
7298                                 let buffer;
7299                                 if (element instanceof Buffer) {
7300                                         buffer = element;
7301                                 } else if (ArrayBuffer.isView(element)) {
7302                                         buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
7303                                 } else if (element instanceof ArrayBuffer) {
7304                                         buffer = Buffer.from(element);
7305                                 } else if (element instanceof Blob) {
7306                                         buffer = element[BUFFER];
7307                                 } else {
7308                                         buffer = Buffer.from(typeof element === 'string' ? element : String(element));
7309                                 }
7310                                 size += buffer.length;
7311                                 buffers.push(buffer);
7312                         }
7313                 }
7314
7315                 this[BUFFER] = Buffer.concat(buffers);
7316
7317                 let type = options && options.type !== undefined && String(options.type).toLowerCase();
7318                 if (type && !/[^\u0020-\u007E]/.test(type)) {
7319                         this[TYPE] = type;
7320                 }
7321         }
7322         get size() {
7323                 return this[BUFFER].length;
7324         }
7325         get type() {
7326                 return this[TYPE];
7327         }
7328         text() {
7329                 return Promise.resolve(this[BUFFER].toString());
7330         }
7331         arrayBuffer() {
7332                 const buf = this[BUFFER];
7333                 const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
7334                 return Promise.resolve(ab);
7335         }
7336         stream() {
7337                 const readable = new Readable();
7338                 readable._read = function () {};
7339                 readable.push(this[BUFFER]);
7340                 readable.push(null);
7341                 return readable;
7342         }
7343         toString() {
7344                 return '[object Blob]';
7345         }
7346         slice() {
7347                 const size = this.size;
7348
7349                 const start = arguments[0];
7350                 const end = arguments[1];
7351                 let relativeStart, relativeEnd;
7352                 if (start === undefined) {
7353                         relativeStart = 0;
7354                 } else if (start < 0) {
7355                         relativeStart = Math.max(size + start, 0);
7356                 } else {
7357                         relativeStart = Math.min(start, size);
7358                 }
7359                 if (end === undefined) {
7360                         relativeEnd = size;
7361                 } else if (end < 0) {
7362                         relativeEnd = Math.max(size + end, 0);
7363                 } else {
7364                         relativeEnd = Math.min(end, size);
7365                 }
7366                 const span = Math.max(relativeEnd - relativeStart, 0);
7367
7368                 const buffer = this[BUFFER];
7369                 const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
7370                 const blob = new Blob([], { type: arguments[2] });
7371                 blob[BUFFER] = slicedBuffer;
7372                 return blob;
7373         }
7374 }
7375
7376 Object.defineProperties(Blob.prototype, {
7377         size: { enumerable: true },
7378         type: { enumerable: true },
7379         slice: { enumerable: true }
7380 });
7381
7382 Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
7383         value: 'Blob',
7384         writable: false,
7385         enumerable: false,
7386         configurable: true
7387 });
7388
7389 /**
7390  * fetch-error.js
7391  *
7392  * FetchError interface for operational errors
7393  */
7394
7395 /**
7396  * Create FetchError instance
7397  *
7398  * @param   String      message      Error message for human
7399  * @param   String      type         Error type for machine
7400  * @param   String      systemError  For Node.js system error
7401  * @return  FetchError
7402  */
7403 function FetchError(message, type, systemError) {
7404   Error.call(this, message);
7405
7406   this.message = message;
7407   this.type = type;
7408
7409   // when err.type is `system`, err.code contains system error code
7410   if (systemError) {
7411     this.code = this.errno = systemError.code;
7412   }
7413
7414   // hide custom error implementation details from end-users
7415   Error.captureStackTrace(this, this.constructor);
7416 }
7417
7418 FetchError.prototype = Object.create(Error.prototype);
7419 FetchError.prototype.constructor = FetchError;
7420 FetchError.prototype.name = 'FetchError';
7421
7422 let convert;
7423 try {
7424         convert = require('encoding').convert;
7425 } catch (e) {}
7426
7427 const INTERNALS = Symbol('Body internals');
7428
7429 // fix an issue where "PassThrough" isn't a named export for node <10
7430 const PassThrough = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
7431
7432 /**
7433  * Body mixin
7434  *
7435  * Ref: https://fetch.spec.whatwg.org/#body
7436  *
7437  * @param   Stream  body  Readable stream
7438  * @param   Object  opts  Response options
7439  * @return  Void
7440  */
7441 function Body(body) {
7442         var _this = this;
7443
7444         var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
7445             _ref$size = _ref.size;
7446
7447         let size = _ref$size === undefined ? 0 : _ref$size;
7448         var _ref$timeout = _ref.timeout;
7449         let timeout = _ref$timeout === undefined ? 0 : _ref$timeout;
7450
7451         if (body == null) {
7452                 // body is undefined or null
7453                 body = null;
7454         } else if (isURLSearchParams(body)) {
7455                 // body is a URLSearchParams
7456                 body = Buffer.from(body.toString());
7457         } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
7458                 // body is ArrayBuffer
7459                 body = Buffer.from(body);
7460         } else if (ArrayBuffer.isView(body)) {
7461                 // body is ArrayBufferView
7462                 body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
7463         } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) ; else {
7464                 // none of the above
7465                 // coerce to string then buffer
7466                 body = Buffer.from(String(body));
7467         }
7468         this[INTERNALS] = {
7469                 body,
7470                 disturbed: false,
7471                 error: null
7472         };
7473         this.size = size;
7474         this.timeout = timeout;
7475
7476         if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
7477                 body.on('error', function (err) {
7478                         const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);
7479                         _this[INTERNALS].error = error;
7480                 });
7481         }
7482 }
7483
7484 Body.prototype = {
7485         get body() {
7486                 return this[INTERNALS].body;
7487         },
7488
7489         get bodyUsed() {
7490                 return this[INTERNALS].disturbed;
7491         },
7492
7493         /**
7494   * Decode response as ArrayBuffer
7495   *
7496   * @return  Promise
7497   */
7498         arrayBuffer() {
7499                 return consumeBody.call(this).then(function (buf) {
7500                         return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
7501                 });
7502         },
7503
7504         /**
7505   * Return raw response as Blob
7506   *
7507   * @return Promise
7508   */
7509         blob() {
7510                 let ct = this.headers && this.headers.get('content-type') || '';
7511                 return consumeBody.call(this).then(function (buf) {
7512                         return Object.assign(
7513                         // Prevent copying
7514                         new Blob([], {
7515                                 type: ct.toLowerCase()
7516                         }), {
7517                                 [BUFFER]: buf
7518                         });
7519                 });
7520         },
7521
7522         /**
7523   * Decode response as json
7524   *
7525   * @return  Promise
7526   */
7527         json() {
7528                 var _this2 = this;
7529
7530                 return consumeBody.call(this).then(function (buffer) {
7531                         try {
7532                                 return JSON.parse(buffer.toString());
7533                         } catch (err) {
7534                                 return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
7535                         }
7536                 });
7537         },
7538
7539         /**
7540   * Decode response as text
7541   *
7542   * @return  Promise
7543   */
7544         text() {
7545                 return consumeBody.call(this).then(function (buffer) {
7546                         return buffer.toString();
7547                 });
7548         },
7549
7550         /**
7551   * Decode response as buffer (non-spec api)
7552   *
7553   * @return  Promise
7554   */
7555         buffer() {
7556                 return consumeBody.call(this);
7557         },
7558
7559         /**
7560   * Decode response as text, while automatically detecting the encoding and
7561   * trying to decode to UTF-8 (non-spec api)
7562   *
7563   * @return  Promise
7564   */
7565         textConverted() {
7566                 var _this3 = this;
7567
7568                 return consumeBody.call(this).then(function (buffer) {
7569                         return convertBody(buffer, _this3.headers);
7570                 });
7571         }
7572 };
7573
7574 // In browsers, all properties are enumerable.
7575 Object.defineProperties(Body.prototype, {
7576         body: { enumerable: true },
7577         bodyUsed: { enumerable: true },
7578         arrayBuffer: { enumerable: true },
7579         blob: { enumerable: true },
7580         json: { enumerable: true },
7581         text: { enumerable: true }
7582 });
7583
7584 Body.mixIn = function (proto) {
7585         for (const name of Object.getOwnPropertyNames(Body.prototype)) {
7586                 // istanbul ignore else: future proof
7587                 if (!(name in proto)) {
7588                         const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
7589                         Object.defineProperty(proto, name, desc);
7590                 }
7591         }
7592 };
7593
7594 /**
7595  * Consume and convert an entire Body to a Buffer.
7596  *
7597  * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body
7598  *
7599  * @return  Promise
7600  */
7601 function consumeBody() {
7602         var _this4 = this;
7603
7604         if (this[INTERNALS].disturbed) {
7605                 return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
7606         }
7607
7608         this[INTERNALS].disturbed = true;
7609
7610         if (this[INTERNALS].error) {
7611                 return Body.Promise.reject(this[INTERNALS].error);
7612         }
7613
7614         let body = this.body;
7615
7616         // body is null
7617         if (body === null) {
7618                 return Body.Promise.resolve(Buffer.alloc(0));
7619         }
7620
7621         // body is blob
7622         if (isBlob(body)) {
7623                 body = body.stream();
7624         }
7625
7626         // body is buffer
7627         if (Buffer.isBuffer(body)) {
7628                 return Body.Promise.resolve(body);
7629         }
7630
7631         // istanbul ignore if: should never happen
7632         if (!(body instanceof stream__WEBPACK_IMPORTED_MODULE_0__)) {
7633                 return Body.Promise.resolve(Buffer.alloc(0));
7634         }
7635
7636         // body is stream
7637         // get ready to actually consume the body
7638         let accum = [];
7639         let accumBytes = 0;
7640         let abort = false;
7641
7642         return new Body.Promise(function (resolve, reject) {
7643                 let resTimeout;
7644
7645                 // allow timeout on slow response body
7646                 if (_this4.timeout) {
7647                         resTimeout = setTimeout(function () {
7648                                 abort = true;
7649                                 reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));
7650                         }, _this4.timeout);
7651                 }
7652
7653                 // handle stream errors
7654                 body.on('error', function (err) {
7655                         if (err.name === 'AbortError') {
7656                                 // if the request was aborted, reject with this Error
7657                                 abort = true;
7658                                 reject(err);
7659                         } else {
7660                                 // other errors, such as incorrect content-encoding
7661                                 reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));
7662                         }
7663                 });
7664
7665                 body.on('data', function (chunk) {
7666                         if (abort || chunk === null) {
7667                                 return;
7668                         }
7669
7670                         if (_this4.size && accumBytes + chunk.length > _this4.size) {
7671                                 abort = true;
7672                                 reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));
7673                                 return;
7674                         }
7675
7676                         accumBytes += chunk.length;
7677                         accum.push(chunk);
7678                 });
7679
7680                 body.on('end', function () {
7681                         if (abort) {
7682                                 return;
7683                         }
7684
7685                         clearTimeout(resTimeout);
7686
7687                         try {
7688                                 resolve(Buffer.concat(accum, accumBytes));
7689                         } catch (err) {
7690                                 // handle streams that have accumulated too much data (issue #414)
7691                                 reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));
7692                         }
7693                 });
7694         });
7695 }
7696
7697 /**
7698  * Detect buffer encoding and convert to target encoding
7699  * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding
7700  *
7701  * @param   Buffer  buffer    Incoming buffer
7702  * @param   String  encoding  Target encoding
7703  * @return  String
7704  */
7705 function convertBody(buffer, headers) {
7706         if (typeof convert !== 'function') {
7707                 throw new Error('The package `encoding` must be installed to use the textConverted() function');
7708         }
7709
7710         const ct = headers.get('content-type');
7711         let charset = 'utf-8';
7712         let res, str;
7713
7714         // header
7715         if (ct) {
7716                 res = /charset=([^;]*)/i.exec(ct);
7717         }
7718
7719         // no charset in content type, peek at response body for at most 1024 bytes
7720         str = buffer.slice(0, 1024).toString();
7721
7722         // html5
7723         if (!res && str) {
7724                 res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
7725         }
7726
7727         // html4
7728         if (!res && str) {
7729                 res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
7730                 if (!res) {
7731                         res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
7732                         if (res) {
7733                                 res.pop(); // drop last quote
7734                         }
7735                 }
7736
7737                 if (res) {
7738                         res = /charset=(.*)/i.exec(res.pop());
7739                 }
7740         }
7741
7742         // xml
7743         if (!res && str) {
7744                 res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
7745         }
7746
7747         // found charset
7748         if (res) {
7749                 charset = res.pop();
7750
7751                 // prevent decode issues when sites use incorrect encoding
7752                 // ref: https://hsivonen.fi/encoding-menu/
7753                 if (charset === 'gb2312' || charset === 'gbk') {
7754                         charset = 'gb18030';
7755                 }
7756         }
7757
7758         // turn raw buffers into a single utf-8 buffer
7759         return convert(buffer, 'UTF-8', charset).toString();
7760 }
7761
7762 /**
7763  * Detect a URLSearchParams object
7764  * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143
7765  *
7766  * @param   Object  obj     Object to detect by type or brand
7767  * @return  String
7768  */
7769 function isURLSearchParams(obj) {
7770         // Duck-typing as a necessary condition.
7771         if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') {
7772                 return false;
7773         }
7774
7775         // Brand-checking and more duck-typing as optional condition.
7776         return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function';
7777 }
7778
7779 /**
7780  * Check if `obj` is a W3C `Blob` object (which `File` inherits from)
7781  * @param  {*} obj
7782  * @return {boolean}
7783  */
7784 function isBlob(obj) {
7785         return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
7786 }
7787
7788 /**
7789  * Clone body given Res/Req instance
7790  *
7791  * @param   Mixed  instance  Response or Request instance
7792  * @return  Mixed
7793  */
7794 function clone(instance) {
7795         let p1, p2;
7796         let body = instance.body;
7797
7798         // don't allow cloning a used body
7799         if (instance.bodyUsed) {
7800                 throw new Error('cannot clone body after it is used');
7801         }
7802
7803         // check that body is a stream and not form-data object
7804         // note: we can't clone the form-data object without having it as a dependency
7805         if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__ && typeof body.getBoundary !== 'function') {
7806                 // tee instance body
7807                 p1 = new PassThrough();
7808                 p2 = new PassThrough();
7809                 body.pipe(p1);
7810                 body.pipe(p2);
7811                 // set instance body to teed body and return the other teed body
7812                 instance[INTERNALS].body = p1;
7813                 body = p2;
7814         }
7815
7816         return body;
7817 }
7818
7819 /**
7820  * Performs the operation "extract a `Content-Type` value from |object|" as
7821  * specified in the specification:
7822  * https://fetch.spec.whatwg.org/#concept-bodyinit-extract
7823  *
7824  * This function assumes that instance.body is present.
7825  *
7826  * @param   Mixed  instance  Any options.body input
7827  */
7828 function extractContentType(body) {
7829         if (body === null) {
7830                 // body is null
7831                 return null;
7832         } else if (typeof body === 'string') {
7833                 // body is string
7834                 return 'text/plain;charset=UTF-8';
7835         } else if (isURLSearchParams(body)) {
7836                 // body is a URLSearchParams
7837                 return 'application/x-www-form-urlencoded;charset=UTF-8';
7838         } else if (isBlob(body)) {
7839                 // body is blob
7840                 return body.type || null;
7841         } else if (Buffer.isBuffer(body)) {
7842                 // body is buffer
7843                 return null;
7844         } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
7845                 // body is ArrayBuffer
7846                 return null;
7847         } else if (ArrayBuffer.isView(body)) {
7848                 // body is ArrayBufferView
7849                 return null;
7850         } else if (typeof body.getBoundary === 'function') {
7851                 // detect form data input from form-data module
7852                 return `multipart/form-data;boundary=${body.getBoundary()}`;
7853         } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
7854                 // body is stream
7855                 // can't really do much about this
7856                 return null;
7857         } else {
7858                 // Body constructor defaults other things to string
7859                 return 'text/plain;charset=UTF-8';
7860         }
7861 }
7862
7863 /**
7864  * The Fetch Standard treats this as if "total bytes" is a property on the body.
7865  * For us, we have to explicitly get it with a function.
7866  *
7867  * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes
7868  *
7869  * @param   Body    instance   Instance of Body
7870  * @return  Number?            Number of bytes, or null if not possible
7871  */
7872 function getTotalBytes(instance) {
7873         const body = instance.body;
7874
7875
7876         if (body === null) {
7877                 // body is null
7878                 return 0;
7879         } else if (isBlob(body)) {
7880                 return body.size;
7881         } else if (Buffer.isBuffer(body)) {
7882                 // body is buffer
7883                 return body.length;
7884         } else if (body && typeof body.getLengthSync === 'function') {
7885                 // detect form data input from form-data module
7886                 if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x
7887                 body.hasKnownLength && body.hasKnownLength()) {
7888                         // 2.x
7889                         return body.getLengthSync();
7890                 }
7891                 return null;
7892         } else {
7893                 // body is stream
7894                 return null;
7895         }
7896 }
7897
7898 /**
7899  * Write a Body to a Node.js WritableStream (e.g. http.Request) object.
7900  *
7901  * @param   Body    instance   Instance of Body
7902  * @return  Void
7903  */
7904 function writeToStream(dest, instance) {
7905         const body = instance.body;
7906
7907
7908         if (body === null) {
7909                 // body is null
7910                 dest.end();
7911         } else if (isBlob(body)) {
7912                 body.stream().pipe(dest);
7913         } else if (Buffer.isBuffer(body)) {
7914                 // body is buffer
7915                 dest.write(body);
7916                 dest.end();
7917         } else {
7918                 // body is stream
7919                 body.pipe(dest);
7920         }
7921 }
7922
7923 // expose Promise
7924 Body.Promise = global.Promise;
7925
7926 /**
7927  * headers.js
7928  *
7929  * Headers class offers convenient helpers
7930  */
7931
7932 const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
7933 const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
7934
7935 function validateName(name) {
7936         name = `${name}`;
7937         if (invalidTokenRegex.test(name) || name === '') {
7938                 throw new TypeError(`${name} is not a legal HTTP header name`);
7939         }
7940 }
7941
7942 function validateValue(value) {
7943         value = `${value}`;
7944         if (invalidHeaderCharRegex.test(value)) {
7945                 throw new TypeError(`${value} is not a legal HTTP header value`);
7946         }
7947 }
7948
7949 /**
7950  * Find the key in the map object given a header name.
7951  *
7952  * Returns undefined if not found.
7953  *
7954  * @param   String  name  Header name
7955  * @return  String|Undefined
7956  */
7957 function find(map, name) {
7958         name = name.toLowerCase();
7959         for (const key in map) {
7960                 if (key.toLowerCase() === name) {
7961                         return key;
7962                 }
7963         }
7964         return undefined;
7965 }
7966
7967 const MAP = Symbol('map');
7968 class Headers {
7969         /**
7970   * Headers class
7971   *
7972   * @param   Object  headers  Response headers
7973   * @return  Void
7974   */
7975         constructor() {
7976                 let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
7977
7978                 this[MAP] = Object.create(null);
7979
7980                 if (init instanceof Headers) {
7981                         const rawHeaders = init.raw();
7982                         const headerNames = Object.keys(rawHeaders);
7983
7984                         for (const headerName of headerNames) {
7985                                 for (const value of rawHeaders[headerName]) {
7986                                         this.append(headerName, value);
7987                                 }
7988                         }
7989
7990                         return;
7991                 }
7992
7993                 // We don't worry about converting prop to ByteString here as append()
7994                 // will handle it.
7995                 if (init == null) ; else if (typeof init === 'object') {
7996                         const method = init[Symbol.iterator];
7997                         if (method != null) {
7998                                 if (typeof method !== 'function') {
7999                                         throw new TypeError('Header pairs must be iterable');
8000                                 }
8001
8002                                 // sequence<sequence<ByteString>>
8003                                 // Note: per spec we have to first exhaust the lists then process them
8004                                 const pairs = [];
8005                                 for (const pair of init) {
8006                                         if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {
8007                                                 throw new TypeError('Each header pair must be iterable');
8008                                         }
8009                                         pairs.push(Array.from(pair));
8010                                 }
8011
8012                                 for (const pair of pairs) {
8013                                         if (pair.length !== 2) {
8014                                                 throw new TypeError('Each header pair must be a name/value tuple');
8015                                         }
8016                                         this.append(pair[0], pair[1]);
8017                                 }
8018                         } else {
8019                                 // record<ByteString, ByteString>
8020                                 for (const key of Object.keys(init)) {
8021                                         const value = init[key];
8022                                         this.append(key, value);
8023                                 }
8024                         }
8025                 } else {
8026                         throw new TypeError('Provided initializer must be an object');
8027                 }
8028         }
8029
8030         /**
8031   * Return combined header value given name
8032   *
8033   * @param   String  name  Header name
8034   * @return  Mixed
8035   */
8036         get(name) {
8037                 name = `${name}`;
8038                 validateName(name);
8039                 const key = find(this[MAP], name);
8040                 if (key === undefined) {
8041                         return null;
8042                 }
8043
8044                 return this[MAP][key].join(', ');
8045         }
8046
8047         /**
8048   * Iterate over all headers
8049   *
8050   * @param   Function  callback  Executed for each item with parameters (value, name, thisArg)
8051   * @param   Boolean   thisArg   `this` context for callback function
8052   * @return  Void
8053   */
8054         forEach(callback) {
8055                 let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
8056
8057                 let pairs = getHeaders(this);
8058                 let i = 0;
8059                 while (i < pairs.length) {
8060                         var _pairs$i = pairs[i];
8061                         const name = _pairs$i[0],
8062                               value = _pairs$i[1];
8063
8064                         callback.call(thisArg, value, name, this);
8065                         pairs = getHeaders(this);
8066                         i++;
8067                 }
8068         }
8069
8070         /**
8071   * Overwrite header values given name
8072   *
8073   * @param   String  name   Header name
8074   * @param   String  value  Header value
8075   * @return  Void
8076   */
8077         set(name, value) {
8078                 name = `${name}`;
8079                 value = `${value}`;
8080                 validateName(name);
8081                 validateValue(value);
8082                 const key = find(this[MAP], name);
8083                 this[MAP][key !== undefined ? key : name] = [value];
8084         }
8085
8086         /**
8087   * Append a value onto existing header
8088   *
8089   * @param   String  name   Header name
8090   * @param   String  value  Header value
8091   * @return  Void
8092   */
8093         append(name, value) {
8094                 name = `${name}`;
8095                 value = `${value}`;
8096                 validateName(name);
8097                 validateValue(value);
8098                 const key = find(this[MAP], name);
8099                 if (key !== undefined) {
8100                         this[MAP][key].push(value);
8101                 } else {
8102                         this[MAP][name] = [value];
8103                 }
8104         }
8105
8106         /**
8107   * Check for header name existence
8108   *
8109   * @param   String   name  Header name
8110   * @return  Boolean
8111   */
8112         has(name) {
8113                 name = `${name}`;
8114                 validateName(name);
8115                 return find(this[MAP], name) !== undefined;
8116         }
8117
8118         /**
8119   * Delete all header values given name
8120   *
8121   * @param   String  name  Header name
8122   * @return  Void
8123   */
8124         delete(name) {
8125                 name = `${name}`;
8126                 validateName(name);
8127                 const key = find(this[MAP], name);
8128                 if (key !== undefined) {
8129                         delete this[MAP][key];
8130                 }
8131         }
8132
8133         /**
8134   * Return raw headers (non-spec api)
8135   *
8136   * @return  Object
8137   */
8138         raw() {
8139                 return this[MAP];
8140         }
8141
8142         /**
8143   * Get an iterator on keys.
8144   *
8145   * @return  Iterator
8146   */
8147         keys() {
8148                 return createHeadersIterator(this, 'key');
8149         }
8150
8151         /**
8152   * Get an iterator on values.
8153   *
8154   * @return  Iterator
8155   */
8156         values() {
8157                 return createHeadersIterator(this, 'value');
8158         }
8159
8160         /**
8161   * Get an iterator on entries.
8162   *
8163   * This is the default iterator of the Headers object.
8164   *
8165   * @return  Iterator
8166   */
8167         [Symbol.iterator]() {
8168                 return createHeadersIterator(this, 'key+value');
8169         }
8170 }
8171 Headers.prototype.entries = Headers.prototype[Symbol.iterator];
8172
8173 Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
8174         value: 'Headers',
8175         writable: false,
8176         enumerable: false,
8177         configurable: true
8178 });
8179
8180 Object.defineProperties(Headers.prototype, {
8181         get: { enumerable: true },
8182         forEach: { enumerable: true },
8183         set: { enumerable: true },
8184         append: { enumerable: true },
8185         has: { enumerable: true },
8186         delete: { enumerable: true },
8187         keys: { enumerable: true },
8188         values: { enumerable: true },
8189         entries: { enumerable: true }
8190 });
8191
8192 function getHeaders(headers) {
8193         let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';
8194
8195         const keys = Object.keys(headers[MAP]).sort();
8196         return keys.map(kind === 'key' ? function (k) {
8197                 return k.toLowerCase();
8198         } : kind === 'value' ? function (k) {
8199                 return headers[MAP][k].join(', ');
8200         } : function (k) {
8201                 return [k.toLowerCase(), headers[MAP][k].join(', ')];
8202         });
8203 }
8204
8205 const INTERNAL = Symbol('internal');
8206
8207 function createHeadersIterator(target, kind) {
8208         const iterator = Object.create(HeadersIteratorPrototype);
8209         iterator[INTERNAL] = {
8210                 target,
8211                 kind,
8212                 index: 0
8213         };
8214         return iterator;
8215 }
8216
8217 const HeadersIteratorPrototype = Object.setPrototypeOf({
8218         next() {
8219                 // istanbul ignore if
8220                 if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
8221                         throw new TypeError('Value of `this` is not a HeadersIterator');
8222                 }
8223
8224                 var _INTERNAL = this[INTERNAL];
8225                 const target = _INTERNAL.target,
8226                       kind = _INTERNAL.kind,
8227                       index = _INTERNAL.index;
8228
8229                 const values = getHeaders(target, kind);
8230                 const len = values.length;
8231                 if (index >= len) {
8232                         return {
8233                                 value: undefined,
8234                                 done: true
8235                         };
8236                 }
8237
8238                 this[INTERNAL].index = index + 1;
8239
8240                 return {
8241                         value: values[index],
8242                         done: false
8243                 };
8244         }
8245 }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
8246
8247 Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
8248         value: 'HeadersIterator',
8249         writable: false,
8250         enumerable: false,
8251         configurable: true
8252 });
8253
8254 /**
8255  * Export the Headers object in a form that Node.js can consume.
8256  *
8257  * @param   Headers  headers
8258  * @return  Object
8259  */
8260 function exportNodeCompatibleHeaders(headers) {
8261         const obj = Object.assign({ __proto__: null }, headers[MAP]);
8262
8263         // http.request() only supports string as Host header. This hack makes
8264         // specifying custom Host header possible.
8265         const hostHeaderKey = find(headers[MAP], 'Host');
8266         if (hostHeaderKey !== undefined) {
8267                 obj[hostHeaderKey] = obj[hostHeaderKey][0];
8268         }
8269
8270         return obj;
8271 }
8272
8273 /**
8274  * Create a Headers object from an object of headers, ignoring those that do
8275  * not conform to HTTP grammar productions.
8276  *
8277  * @param   Object  obj  Object of headers
8278  * @return  Headers
8279  */
8280 function createHeadersLenient(obj) {
8281         const headers = new Headers();
8282         for (const name of Object.keys(obj)) {
8283                 if (invalidTokenRegex.test(name)) {
8284                         continue;
8285                 }
8286                 if (Array.isArray(obj[name])) {
8287                         for (const val of obj[name]) {
8288                                 if (invalidHeaderCharRegex.test(val)) {
8289                                         continue;
8290                                 }
8291                                 if (headers[MAP][name] === undefined) {
8292                                         headers[MAP][name] = [val];
8293                                 } else {
8294                                         headers[MAP][name].push(val);
8295                                 }
8296                         }
8297                 } else if (!invalidHeaderCharRegex.test(obj[name])) {
8298                         headers[MAP][name] = [obj[name]];
8299                 }
8300         }
8301         return headers;
8302 }
8303
8304 const INTERNALS$1 = Symbol('Response internals');
8305
8306 // fix an issue where "STATUS_CODES" aren't a named export for node <10
8307 const STATUS_CODES = http__WEBPACK_IMPORTED_MODULE_1__.STATUS_CODES;
8308
8309 /**
8310  * Response class
8311  *
8312  * @param   Stream  body  Readable stream
8313  * @param   Object  opts  Response options
8314  * @return  Void
8315  */
8316 class Response {
8317         constructor() {
8318                 let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
8319                 let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8320
8321                 Body.call(this, body, opts);
8322
8323                 const status = opts.status || 200;
8324                 const headers = new Headers(opts.headers);
8325
8326                 if (body != null && !headers.has('Content-Type')) {
8327                         const contentType = extractContentType(body);
8328                         if (contentType) {
8329                                 headers.append('Content-Type', contentType);
8330                         }
8331                 }
8332
8333                 this[INTERNALS$1] = {
8334                         url: opts.url,
8335                         status,
8336                         statusText: opts.statusText || STATUS_CODES[status],
8337                         headers,
8338                         counter: opts.counter
8339                 };
8340         }
8341
8342         get url() {
8343                 return this[INTERNALS$1].url || '';
8344         }
8345
8346         get status() {
8347                 return this[INTERNALS$1].status;
8348         }
8349
8350         /**
8351   * Convenience property representing if the request ended normally
8352   */
8353         get ok() {
8354                 return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
8355         }
8356
8357         get redirected() {
8358                 return this[INTERNALS$1].counter > 0;
8359         }
8360
8361         get statusText() {
8362                 return this[INTERNALS$1].statusText;
8363         }
8364
8365         get headers() {
8366                 return this[INTERNALS$1].headers;
8367         }
8368
8369         /**
8370   * Clone this response
8371   *
8372   * @return  Response
8373   */
8374         clone() {
8375                 return new Response(clone(this), {
8376                         url: this.url,
8377                         status: this.status,
8378                         statusText: this.statusText,
8379                         headers: this.headers,
8380                         ok: this.ok,
8381                         redirected: this.redirected
8382                 });
8383         }
8384 }
8385
8386 Body.mixIn(Response.prototype);
8387
8388 Object.defineProperties(Response.prototype, {
8389         url: { enumerable: true },
8390         status: { enumerable: true },
8391         ok: { enumerable: true },
8392         redirected: { enumerable: true },
8393         statusText: { enumerable: true },
8394         headers: { enumerable: true },
8395         clone: { enumerable: true }
8396 });
8397
8398 Object.defineProperty(Response.prototype, Symbol.toStringTag, {
8399         value: 'Response',
8400         writable: false,
8401         enumerable: false,
8402         configurable: true
8403 });
8404
8405 const INTERNALS$2 = Symbol('Request internals');
8406
8407 // fix an issue where "format", "parse" aren't a named export for node <10
8408 const parse_url = url__WEBPACK_IMPORTED_MODULE_2__.parse;
8409 const format_url = url__WEBPACK_IMPORTED_MODULE_2__.format;
8410
8411 const streamDestructionSupported = 'destroy' in stream__WEBPACK_IMPORTED_MODULE_0__.Readable.prototype;
8412
8413 /**
8414  * Check if a value is an instance of Request.
8415  *
8416  * @param   Mixed   input
8417  * @return  Boolean
8418  */
8419 function isRequest(input) {
8420         return typeof input === 'object' && typeof input[INTERNALS$2] === 'object';
8421 }
8422
8423 function isAbortSignal(signal) {
8424         const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);
8425         return !!(proto && proto.constructor.name === 'AbortSignal');
8426 }
8427
8428 /**
8429  * Request class
8430  *
8431  * @param   Mixed   input  Url or Request instance
8432  * @param   Object  init   Custom options
8433  * @return  Void
8434  */
8435 class Request {
8436         constructor(input) {
8437                 let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8438
8439                 let parsedURL;
8440
8441                 // normalize input
8442                 if (!isRequest(input)) {
8443                         if (input && input.href) {
8444                                 // in order to support Node.js' Url objects; though WHATWG's URL objects
8445                                 // will fall into this branch also (since their `toString()` will return
8446                                 // `href` property anyway)
8447                                 parsedURL = parse_url(input.href);
8448                         } else {
8449                                 // coerce input to a string before attempting to parse
8450                                 parsedURL = parse_url(`${input}`);
8451                         }
8452                         input = {};
8453                 } else {
8454                         parsedURL = parse_url(input.url);
8455                 }
8456
8457                 let method = init.method || input.method || 'GET';
8458                 method = method.toUpperCase();
8459
8460                 if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {
8461                         throw new TypeError('Request with GET/HEAD method cannot have body');
8462                 }
8463
8464                 let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
8465
8466                 Body.call(this, inputBody, {
8467                         timeout: init.timeout || input.timeout || 0,
8468                         size: init.size || input.size || 0
8469                 });
8470
8471                 const headers = new Headers(init.headers || input.headers || {});
8472
8473                 if (inputBody != null && !headers.has('Content-Type')) {
8474                         const contentType = extractContentType(inputBody);
8475                         if (contentType) {
8476                                 headers.append('Content-Type', contentType);
8477                         }
8478                 }
8479
8480                 let signal = isRequest(input) ? input.signal : null;
8481                 if ('signal' in init) signal = init.signal;
8482
8483                 if (signal != null && !isAbortSignal(signal)) {
8484                         throw new TypeError('Expected signal to be an instanceof AbortSignal');
8485                 }
8486
8487                 this[INTERNALS$2] = {
8488                         method,
8489                         redirect: init.redirect || input.redirect || 'follow',
8490                         headers,
8491                         parsedURL,
8492                         signal
8493                 };
8494
8495                 // node-fetch-only options
8496                 this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;
8497                 this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
8498                 this.counter = init.counter || input.counter || 0;
8499                 this.agent = init.agent || input.agent;
8500         }
8501
8502         get method() {
8503                 return this[INTERNALS$2].method;
8504         }
8505
8506         get url() {
8507                 return format_url(this[INTERNALS$2].parsedURL);
8508         }
8509
8510         get headers() {
8511                 return this[INTERNALS$2].headers;
8512         }
8513
8514         get redirect() {
8515                 return this[INTERNALS$2].redirect;
8516         }
8517
8518         get signal() {
8519                 return this[INTERNALS$2].signal;
8520         }
8521
8522         /**
8523   * Clone this request
8524   *
8525   * @return  Request
8526   */
8527         clone() {
8528                 return new Request(this);
8529         }
8530 }
8531
8532 Body.mixIn(Request.prototype);
8533
8534 Object.defineProperty(Request.prototype, Symbol.toStringTag, {
8535         value: 'Request',
8536         writable: false,
8537         enumerable: false,
8538         configurable: true
8539 });
8540
8541 Object.defineProperties(Request.prototype, {
8542         method: { enumerable: true },
8543         url: { enumerable: true },
8544         headers: { enumerable: true },
8545         redirect: { enumerable: true },
8546         clone: { enumerable: true },
8547         signal: { enumerable: true }
8548 });
8549
8550 /**
8551  * Convert a Request to Node.js http request options.
8552  *
8553  * @param   Request  A Request instance
8554  * @return  Object   The options object to be passed to http.request
8555  */
8556 function getNodeRequestOptions(request) {
8557         const parsedURL = request[INTERNALS$2].parsedURL;
8558         const headers = new Headers(request[INTERNALS$2].headers);
8559
8560         // fetch step 1.3
8561         if (!headers.has('Accept')) {
8562                 headers.set('Accept', '*/*');
8563         }
8564
8565         // Basic fetch
8566         if (!parsedURL.protocol || !parsedURL.hostname) {
8567                 throw new TypeError('Only absolute URLs are supported');
8568         }
8569
8570         if (!/^https?:$/.test(parsedURL.protocol)) {
8571                 throw new TypeError('Only HTTP(S) protocols are supported');
8572         }
8573
8574         if (request.signal && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable && !streamDestructionSupported) {
8575                 throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');
8576         }
8577
8578         // HTTP-network-or-cache fetch steps 2.4-2.7
8579         let contentLengthValue = null;
8580         if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
8581                 contentLengthValue = '0';
8582         }
8583         if (request.body != null) {
8584                 const totalBytes = getTotalBytes(request);
8585                 if (typeof totalBytes === 'number') {
8586                         contentLengthValue = String(totalBytes);
8587                 }
8588         }
8589         if (contentLengthValue) {
8590                 headers.set('Content-Length', contentLengthValue);
8591         }
8592
8593         // HTTP-network-or-cache fetch step 2.11
8594         if (!headers.has('User-Agent')) {
8595                 headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');
8596         }
8597
8598         // HTTP-network-or-cache fetch step 2.15
8599         if (request.compress && !headers.has('Accept-Encoding')) {
8600                 headers.set('Accept-Encoding', 'gzip,deflate');
8601         }
8602
8603         let agent = request.agent;
8604         if (typeof agent === 'function') {
8605                 agent = agent(parsedURL);
8606         }
8607
8608         if (!headers.has('Connection') && !agent) {
8609                 headers.set('Connection', 'close');
8610         }
8611
8612         // HTTP-network fetch step 4.2
8613         // chunked encoding is handled by Node.js
8614
8615         return Object.assign({}, parsedURL, {
8616                 method: request.method,
8617                 headers: exportNodeCompatibleHeaders(headers),
8618                 agent
8619         });
8620 }
8621
8622 /**
8623  * abort-error.js
8624  *
8625  * AbortError interface for cancelled requests
8626  */
8627
8628 /**
8629  * Create AbortError instance
8630  *
8631  * @param   String      message      Error message for human
8632  * @return  AbortError
8633  */
8634 function AbortError(message) {
8635   Error.call(this, message);
8636
8637   this.type = 'aborted';
8638   this.message = message;
8639
8640   // hide custom error implementation details from end-users
8641   Error.captureStackTrace(this, this.constructor);
8642 }
8643
8644 AbortError.prototype = Object.create(Error.prototype);
8645 AbortError.prototype.constructor = AbortError;
8646 AbortError.prototype.name = 'AbortError';
8647
8648 // fix an issue where "PassThrough", "resolve" aren't a named export for node <10
8649 const PassThrough$1 = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
8650 const resolve_url = url__WEBPACK_IMPORTED_MODULE_2__.resolve;
8651
8652 /**
8653  * Fetch function
8654  *
8655  * @param   Mixed    url   Absolute url or Request instance
8656  * @param   Object   opts  Fetch options
8657  * @return  Promise
8658  */
8659 function fetch(url, opts) {
8660
8661         // allow custom promise
8662         if (!fetch.Promise) {
8663                 throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
8664         }
8665
8666         Body.Promise = fetch.Promise;
8667
8668         // wrap http.request into fetch
8669         return new fetch.Promise(function (resolve, reject) {
8670                 // build request object
8671                 const request = new Request(url, opts);
8672                 const options = getNodeRequestOptions(request);
8673
8674                 const send = (options.protocol === 'https:' ? https__WEBPACK_IMPORTED_MODULE_3__ : http__WEBPACK_IMPORTED_MODULE_1__).request;
8675                 const signal = request.signal;
8676
8677                 let response = null;
8678
8679                 const abort = function abort() {
8680                         let error = new AbortError('The user aborted a request.');
8681                         reject(error);
8682                         if (request.body && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable) {
8683                                 request.body.destroy(error);
8684                         }
8685                         if (!response || !response.body) return;
8686                         response.body.emit('error', error);
8687                 };
8688
8689                 if (signal && signal.aborted) {
8690                         abort();
8691                         return;
8692                 }
8693
8694                 const abortAndFinalize = function abortAndFinalize() {
8695                         abort();
8696                         finalize();
8697                 };
8698
8699                 // send request
8700                 const req = send(options);
8701                 let reqTimeout;
8702
8703                 if (signal) {
8704                         signal.addEventListener('abort', abortAndFinalize);
8705                 }
8706
8707                 function finalize() {
8708                         req.abort();
8709                         if (signal) signal.removeEventListener('abort', abortAndFinalize);
8710                         clearTimeout(reqTimeout);
8711                 }
8712
8713                 if (request.timeout) {
8714                         req.once('socket', function (socket) {
8715                                 reqTimeout = setTimeout(function () {
8716                                         reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));
8717                                         finalize();
8718                                 }, request.timeout);
8719                         });
8720                 }
8721
8722                 req.on('error', function (err) {
8723                         reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
8724                         finalize();
8725                 });
8726
8727                 req.on('response', function (res) {
8728                         clearTimeout(reqTimeout);
8729
8730                         const headers = createHeadersLenient(res.headers);
8731
8732                         // HTTP fetch step 5
8733                         if (fetch.isRedirect(res.statusCode)) {
8734                                 // HTTP fetch step 5.2
8735                                 const location = headers.get('Location');
8736
8737                                 // HTTP fetch step 5.3
8738                                 const locationURL = location === null ? null : resolve_url(request.url, location);
8739
8740                                 // HTTP fetch step 5.5
8741                                 switch (request.redirect) {
8742                                         case 'error':
8743                                                 reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
8744                                                 finalize();
8745                                                 return;
8746                                         case 'manual':
8747                                                 // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.
8748                                                 if (locationURL !== null) {
8749                                                         // handle corrupted header
8750                                                         try {
8751                                                                 headers.set('Location', locationURL);
8752                                                         } catch (err) {
8753                                                                 // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request
8754                                                                 reject(err);
8755                                                         }
8756                                                 }
8757                                                 break;
8758                                         case 'follow':
8759                                                 // HTTP-redirect fetch step 2
8760                                                 if (locationURL === null) {
8761                                                         break;
8762                                                 }
8763
8764                                                 // HTTP-redirect fetch step 5
8765                                                 if (request.counter >= request.follow) {
8766                                                         reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));
8767                                                         finalize();
8768                                                         return;
8769                                                 }
8770
8771                                                 // HTTP-redirect fetch step 6 (counter increment)
8772                                                 // Create a new Request object.
8773                                                 const requestOpts = {
8774                                                         headers: new Headers(request.headers),
8775                                                         follow: request.follow,
8776                                                         counter: request.counter + 1,
8777                                                         agent: request.agent,
8778                                                         compress: request.compress,
8779                                                         method: request.method,
8780                                                         body: request.body,
8781                                                         signal: request.signal,
8782                                                         timeout: request.timeout,
8783                                                         size: request.size
8784                                                 };
8785
8786                                                 // HTTP-redirect fetch step 9
8787                                                 if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
8788                                                         reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
8789                                                         finalize();
8790                                                         return;
8791                                                 }
8792
8793                                                 // HTTP-redirect fetch step 11
8794                                                 if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {
8795                                                         requestOpts.method = 'GET';
8796                                                         requestOpts.body = undefined;
8797                                                         requestOpts.headers.delete('content-length');
8798                                                 }
8799
8800                                                 // HTTP-redirect fetch step 15
8801                                                 resolve(fetch(new Request(locationURL, requestOpts)));
8802                                                 finalize();
8803                                                 return;
8804                                 }
8805                         }
8806
8807                         // prepare response
8808                         res.once('end', function () {
8809                                 if (signal) signal.removeEventListener('abort', abortAndFinalize);
8810                         });
8811                         let body = res.pipe(new PassThrough$1());
8812
8813                         const response_options = {
8814                                 url: request.url,
8815                                 status: res.statusCode,
8816                                 statusText: res.statusMessage,
8817                                 headers: headers,
8818                                 size: request.size,
8819                                 timeout: request.timeout,
8820                                 counter: request.counter
8821                         };
8822
8823                         // HTTP-network fetch step 12.1.1.3
8824                         const codings = headers.get('Content-Encoding');
8825
8826                         // HTTP-network fetch step 12.1.1.4: handle content codings
8827
8828                         // in following scenarios we ignore compression support
8829                         // 1. compression support is disabled
8830                         // 2. HEAD request
8831                         // 3. no Content-Encoding header
8832                         // 4. no content response (204)
8833                         // 5. content not modified response (304)
8834                         if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {
8835                                 response = new Response(body, response_options);
8836                                 resolve(response);
8837                                 return;
8838                         }
8839
8840                         // For Node v6+
8841                         // Be less strict when decoding compressed responses, since sometimes
8842                         // servers send slightly invalid responses that are still accepted
8843                         // by common browsers.
8844                         // Always using Z_SYNC_FLUSH is what cURL does.
8845                         const zlibOptions = {
8846                                 flush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH,
8847                                 finishFlush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH
8848                         };
8849
8850                         // for gzip
8851                         if (codings == 'gzip' || codings == 'x-gzip') {
8852                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createGunzip(zlibOptions));
8853                                 response = new Response(body, response_options);
8854                                 resolve(response);
8855                                 return;
8856                         }
8857
8858                         // for deflate
8859                         if (codings == 'deflate' || codings == 'x-deflate') {
8860                                 // handle the infamous raw deflate response from old servers
8861                                 // a hack for old IIS and Apache servers
8862                                 const raw = res.pipe(new PassThrough$1());
8863                                 raw.once('data', function (chunk) {
8864                                         // see http://stackoverflow.com/questions/37519828
8865                                         if ((chunk[0] & 0x0F) === 0x08) {
8866                                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflate());
8867                                         } else {
8868                                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflateRaw());
8869                                         }
8870                                         response = new Response(body, response_options);
8871                                         resolve(response);
8872                                 });
8873                                 return;
8874                         }
8875
8876                         // for br
8877                         if (codings == 'br' && typeof zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress === 'function') {
8878                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress());
8879                                 response = new Response(body, response_options);
8880                                 resolve(response);
8881                                 return;
8882                         }
8883
8884                         // otherwise, use response as-is
8885                         response = new Response(body, response_options);
8886                         resolve(response);
8887                 });
8888
8889                 writeToStream(req, request);
8890         });
8891 }
8892 /**
8893  * Redirect code matching
8894  *
8895  * @param   Number   code  Status code
8896  * @return  Boolean
8897  */
8898 fetch.isRedirect = function (code) {
8899         return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
8900 };
8901
8902 // expose Promise
8903 fetch.Promise = global.Promise;
8904
8905 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fetch);
8906
8907
8908
8909 /***/ }),
8910 /* 44 */
8911 /***/ ((module) => {
8912
8913 "use strict";
8914 module.exports = require("stream");;
8915
8916 /***/ }),
8917 /* 45 */
8918 /***/ ((module) => {
8919
8920 "use strict";
8921 module.exports = require("http");;
8922
8923 /***/ }),
8924 /* 46 */
8925 /***/ ((module) => {
8926
8927 "use strict";
8928 module.exports = require("url");;
8929
8930 /***/ }),
8931 /* 47 */
8932 /***/ ((module) => {
8933
8934 "use strict";
8935 module.exports = require("https");;
8936
8937 /***/ }),
8938 /* 48 */
8939 /***/ ((module) => {
8940
8941 "use strict";
8942 module.exports = require("zlib");;
8943
8944 /***/ }),
8945 /* 49 */
8946 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
8947
8948 "use strict";
8949
8950
8951 const fs = __webpack_require__(42);
8952 const { Readable } = __webpack_require__(44);
8953 const sysPath = __webpack_require__(2);
8954 const { promisify } = __webpack_require__(50);
8955 const picomatch = __webpack_require__(51);
8956
8957 const readdir = promisify(fs.readdir);
8958 const stat = promisify(fs.stat);
8959 const lstat = promisify(fs.lstat);
8960 const realpath = promisify(fs.realpath);
8961
8962 /**
8963  * @typedef {Object} EntryInfo
8964  * @property {String} path
8965  * @property {String} fullPath
8966  * @property {fs.Stats=} stats
8967  * @property {fs.Dirent=} dirent
8968  * @property {String} basename
8969  */
8970
8971 const BANG = '!';
8972 const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP']);
8973 const FILE_TYPE = 'files';
8974 const DIR_TYPE = 'directories';
8975 const FILE_DIR_TYPE = 'files_directories';
8976 const EVERYTHING_TYPE = 'all';
8977 const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
8978
8979 const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
8980
8981 const normalizeFilter = filter => {
8982   if (filter === undefined) return;
8983   if (typeof filter === 'function') return filter;
8984
8985   if (typeof filter === 'string') {
8986     const glob = picomatch(filter.trim());
8987     return entry => glob(entry.basename);
8988   }
8989
8990   if (Array.isArray(filter)) {
8991     const positive = [];
8992     const negative = [];
8993     for (const item of filter) {
8994       const trimmed = item.trim();
8995       if (trimmed.charAt(0) === BANG) {
8996         negative.push(picomatch(trimmed.slice(1)));
8997       } else {
8998         positive.push(picomatch(trimmed));
8999       }
9000     }
9001
9002     if (negative.length > 0) {
9003       if (positive.length > 0) {
9004         return entry =>
9005           positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename));
9006       }
9007       return entry => !negative.some(f => f(entry.basename));
9008     }
9009     return entry => positive.some(f => f(entry.basename));
9010   }
9011 };
9012
9013 class ReaddirpStream extends Readable {
9014   static get defaultOptions() {
9015     return {
9016       root: '.',
9017       /* eslint-disable no-unused-vars */
9018       fileFilter: (path) => true,
9019       directoryFilter: (path) => true,
9020       /* eslint-enable no-unused-vars */
9021       type: FILE_TYPE,
9022       lstat: false,
9023       depth: 2147483648,
9024       alwaysStat: false
9025     };
9026   }
9027
9028   constructor(options = {}) {
9029     super({
9030       objectMode: true,
9031       autoDestroy: true,
9032       highWaterMark: options.highWaterMark || 4096
9033     });
9034     const opts = { ...ReaddirpStream.defaultOptions, ...options };
9035     const { root, type } = opts;
9036
9037     this._fileFilter = normalizeFilter(opts.fileFilter);
9038     this._directoryFilter = normalizeFilter(opts.directoryFilter);
9039
9040     const statMethod = opts.lstat ? lstat : stat;
9041     // Use bigint stats if it's windows and stat() supports options (node 10+).
9042     if (process.platform === 'win32' && stat.length === 3) {
9043       this._stat = path => statMethod(path, { bigint: true });
9044     } else {
9045       this._stat = statMethod;
9046     }
9047
9048     this._maxDepth = opts.depth;
9049     this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
9050     this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
9051     this._wantsEverything = type === EVERYTHING_TYPE;
9052     this._root = sysPath.resolve(root);
9053     this._isDirent = ('Dirent' in fs) && !opts.alwaysStat;
9054     this._statsProp = this._isDirent ? 'dirent' : 'stats';
9055     this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };
9056
9057     // Launch stream with one parent, the root dir.
9058     this.parents = [this._exploreDir(root, 1)];
9059     this.reading = false;
9060     this.parent = undefined;
9061   }
9062
9063   async _read(batch) {
9064     if (this.reading) return;
9065     this.reading = true;
9066
9067     try {
9068       while (!this.destroyed && batch > 0) {
9069         const { path, depth, files = [] } = this.parent || {};
9070
9071         if (files.length > 0) {
9072           const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path));
9073           for (const entry of await Promise.all(slice)) {
9074             if (this.destroyed) return;
9075
9076             const entryType = await this._getEntryType(entry);
9077             if (entryType === 'directory' && this._directoryFilter(entry)) {
9078               if (depth <= this._maxDepth) {
9079                 this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
9080               }
9081
9082               if (this._wantsDir) {
9083                 this.push(entry);
9084                 batch--;
9085               }
9086             } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) {
9087               if (this._wantsFile) {
9088                 this.push(entry);
9089                 batch--;
9090               }
9091             }
9092           }
9093         } else {
9094           const parent = this.parents.pop();
9095           if (!parent) {
9096             this.push(null);
9097             break;
9098           }
9099           this.parent = await parent;
9100           if (this.destroyed) return;
9101         }
9102       }
9103     } catch (error) {
9104       this.destroy(error);
9105     } finally {
9106       this.reading = false;
9107     }
9108   }
9109
9110   async _exploreDir(path, depth) {
9111     let files;
9112     try {
9113       files = await readdir(path, this._rdOptions);
9114     } catch (error) {
9115       this._onError(error);
9116     }
9117     return {files, depth, path};
9118   }
9119
9120   async _formatEntry(dirent, path) {
9121     let entry;
9122     try {
9123       const basename = this._isDirent ? dirent.name : dirent;
9124       const fullPath = sysPath.resolve(sysPath.join(path, basename));
9125       entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename};
9126       entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
9127     } catch (err) {
9128       this._onError(err);
9129     }
9130     return entry;
9131   }
9132
9133   _onError(err) {
9134     if (isNormalFlowError(err) && !this.destroyed) {
9135       this.emit('warn', err);
9136     } else {
9137       this.destroy(err);
9138     }
9139   }
9140
9141   async _getEntryType(entry) {
9142     // entry may be undefined, because a warning or an error were emitted
9143     // and the statsProp is undefined
9144     const stats = entry && entry[this._statsProp];
9145     if (!stats) {
9146       return;
9147     }
9148     if (stats.isFile()) {
9149       return 'file';
9150     }
9151     if (stats.isDirectory()) {
9152       return 'directory';
9153     }
9154     if (stats && stats.isSymbolicLink()) {
9155       try {
9156         const entryRealPath = await realpath(entry.fullPath);
9157         const entryRealPathStats = await lstat(entryRealPath);
9158         if (entryRealPathStats.isFile()) {
9159           return 'file';
9160         }
9161         if (entryRealPathStats.isDirectory()) {
9162           return 'directory';
9163         }
9164       } catch (error) {
9165         this._onError(error);
9166       }
9167     }
9168   }
9169
9170   _includeAsFile(entry) {
9171     const stats = entry && entry[this._statsProp];
9172
9173     return stats && this._wantsEverything && !stats.isDirectory();
9174   }
9175 }
9176
9177 /**
9178  * @typedef {Object} ReaddirpArguments
9179  * @property {Function=} fileFilter
9180  * @property {Function=} directoryFilter
9181  * @property {String=} type
9182  * @property {Number=} depth
9183  * @property {String=} root
9184  * @property {Boolean=} lstat
9185  * @property {Boolean=} bigint
9186  */
9187
9188 /**
9189  * Main function which ends up calling readdirRec and reads all files and directories in given root recursively.
9190  * @param {String} root Root directory
9191  * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth
9192  */
9193 const readdirp = (root, options = {}) => {
9194   let type = options.entryType || options.type;
9195   if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility
9196   if (type) options.type = type;
9197   if (!root) {
9198     throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)');
9199   } else if (typeof root !== 'string') {
9200     throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)');
9201   } else if (type && !ALL_TYPES.includes(type)) {
9202     throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`);
9203   }
9204
9205   options.root = root;
9206   return new ReaddirpStream(options);
9207 };
9208
9209 const readdirpPromise = (root, options = {}) => {
9210   return new Promise((resolve, reject) => {
9211     const files = [];
9212     readdirp(root, options)
9213       .on('data', entry => files.push(entry))
9214       .on('end', () => resolve(files))
9215       .on('error', error => reject(error));
9216   });
9217 };
9218
9219 readdirp.promise = readdirpPromise;
9220 readdirp.ReaddirpStream = ReaddirpStream;
9221 readdirp.default = readdirp;
9222
9223 module.exports = readdirp;
9224
9225
9226 /***/ }),
9227 /* 50 */
9228 /***/ ((module) => {
9229
9230 "use strict";
9231 module.exports = require("util");;
9232
9233 /***/ }),
9234 /* 51 */
9235 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9236
9237 "use strict";
9238
9239
9240 module.exports = __webpack_require__(52);
9241
9242
9243 /***/ }),
9244 /* 52 */
9245 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9246
9247 "use strict";
9248
9249
9250 const path = __webpack_require__(2);
9251 const scan = __webpack_require__(53);
9252 const parse = __webpack_require__(56);
9253 const utils = __webpack_require__(54);
9254 const constants = __webpack_require__(55);
9255 const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
9256
9257 /**
9258  * Creates a matcher function from one or more glob patterns. The
9259  * returned function takes a string to match as its first argument,
9260  * and returns true if the string is a match. The returned matcher
9261  * function also takes a boolean as the second argument that, when true,
9262  * returns an object with additional information.
9263  *
9264  * ```js
9265  * const picomatch = require('picomatch');
9266  * // picomatch(glob[, options]);
9267  *
9268  * const isMatch = picomatch('*.!(*a)');
9269  * console.log(isMatch('a.a')); //=> false
9270  * console.log(isMatch('a.b')); //=> true
9271  * ```
9272  * @name picomatch
9273  * @param {String|Array} `globs` One or more glob patterns.
9274  * @param {Object=} `options`
9275  * @return {Function=} Returns a matcher function.
9276  * @api public
9277  */
9278
9279 const picomatch = (glob, options, returnState = false) => {
9280   if (Array.isArray(glob)) {
9281     const fns = glob.map(input => picomatch(input, options, returnState));
9282     const arrayMatcher = str => {
9283       for (const isMatch of fns) {
9284         const state = isMatch(str);
9285         if (state) return state;
9286       }
9287       return false;
9288     };
9289     return arrayMatcher;
9290   }
9291
9292   const isState = isObject(glob) && glob.tokens && glob.input;
9293
9294   if (glob === '' || (typeof glob !== 'string' && !isState)) {
9295     throw new TypeError('Expected pattern to be a non-empty string');
9296   }
9297
9298   const opts = options || {};
9299   const posix = utils.isWindows(options);
9300   const regex = isState
9301     ? picomatch.compileRe(glob, options)
9302     : picomatch.makeRe(glob, options, false, true);
9303
9304   const state = regex.state;
9305   delete regex.state;
9306
9307   let isIgnored = () => false;
9308   if (opts.ignore) {
9309     const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
9310     isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
9311   }
9312
9313   const matcher = (input, returnObject = false) => {
9314     const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
9315     const result = { glob, state, regex, posix, input, output, match, isMatch };
9316
9317     if (typeof opts.onResult === 'function') {
9318       opts.onResult(result);
9319     }
9320
9321     if (isMatch === false) {
9322       result.isMatch = false;
9323       return returnObject ? result : false;
9324     }
9325
9326     if (isIgnored(input)) {
9327       if (typeof opts.onIgnore === 'function') {
9328         opts.onIgnore(result);
9329       }
9330       result.isMatch = false;
9331       return returnObject ? result : false;
9332     }
9333
9334     if (typeof opts.onMatch === 'function') {
9335       opts.onMatch(result);
9336     }
9337     return returnObject ? result : true;
9338   };
9339
9340   if (returnState) {
9341     matcher.state = state;
9342   }
9343
9344   return matcher;
9345 };
9346
9347 /**
9348  * Test `input` with the given `regex`. This is used by the main
9349  * `picomatch()` function to test the input string.
9350  *
9351  * ```js
9352  * const picomatch = require('picomatch');
9353  * // picomatch.test(input, regex[, options]);
9354  *
9355  * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
9356  * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
9357  * ```
9358  * @param {String} `input` String to test.
9359  * @param {RegExp} `regex`
9360  * @return {Object} Returns an object with matching info.
9361  * @api public
9362  */
9363
9364 picomatch.test = (input, regex, options, { glob, posix } = {}) => {
9365   if (typeof input !== 'string') {
9366     throw new TypeError('Expected input to be a string');
9367   }
9368
9369   if (input === '') {
9370     return { isMatch: false, output: '' };
9371   }
9372
9373   const opts = options || {};
9374   const format = opts.format || (posix ? utils.toPosixSlashes : null);
9375   let match = input === glob;
9376   let output = (match && format) ? format(input) : input;
9377
9378   if (match === false) {
9379     output = format ? format(input) : input;
9380     match = output === glob;
9381   }
9382
9383   if (match === false || opts.capture === true) {
9384     if (opts.matchBase === true || opts.basename === true) {
9385       match = picomatch.matchBase(input, regex, options, posix);
9386     } else {
9387       match = regex.exec(output);
9388     }
9389   }
9390
9391   return { isMatch: Boolean(match), match, output };
9392 };
9393
9394 /**
9395  * Match the basename of a filepath.
9396  *
9397  * ```js
9398  * const picomatch = require('picomatch');
9399  * // picomatch.matchBase(input, glob[, options]);
9400  * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
9401  * ```
9402  * @param {String} `input` String to test.
9403  * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
9404  * @return {Boolean}
9405  * @api public
9406  */
9407
9408 picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
9409   const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
9410   return regex.test(path.basename(input));
9411 };
9412
9413 /**
9414  * Returns true if **any** of the given glob `patterns` match the specified `string`.
9415  *
9416  * ```js
9417  * const picomatch = require('picomatch');
9418  * // picomatch.isMatch(string, patterns[, options]);
9419  *
9420  * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
9421  * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
9422  * ```
9423  * @param {String|Array} str The string to test.
9424  * @param {String|Array} patterns One or more glob patterns to use for matching.
9425  * @param {Object} [options] See available [options](#options).
9426  * @return {Boolean} Returns true if any patterns match `str`
9427  * @api public
9428  */
9429
9430 picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
9431
9432 /**
9433  * Parse a glob pattern to create the source string for a regular
9434  * expression.
9435  *
9436  * ```js
9437  * const picomatch = require('picomatch');
9438  * const result = picomatch.parse(pattern[, options]);
9439  * ```
9440  * @param {String} `pattern`
9441  * @param {Object} `options`
9442  * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
9443  * @api public
9444  */
9445
9446 picomatch.parse = (pattern, options) => {
9447   if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
9448   return parse(pattern, { ...options, fastpaths: false });
9449 };
9450
9451 /**
9452  * Scan a glob pattern to separate the pattern into segments.
9453  *
9454  * ```js
9455  * const picomatch = require('picomatch');
9456  * // picomatch.scan(input[, options]);
9457  *
9458  * const result = picomatch.scan('!./foo/*.js');
9459  * console.log(result);
9460  * { prefix: '!./',
9461  *   input: '!./foo/*.js',
9462  *   start: 3,
9463  *   base: 'foo',
9464  *   glob: '*.js',
9465  *   isBrace: false,
9466  *   isBracket: false,
9467  *   isGlob: true,
9468  *   isExtglob: false,
9469  *   isGlobstar: false,
9470  *   negated: true }
9471  * ```
9472  * @param {String} `input` Glob pattern to scan.
9473  * @param {Object} `options`
9474  * @return {Object} Returns an object with
9475  * @api public
9476  */
9477
9478 picomatch.scan = (input, options) => scan(input, options);
9479
9480 /**
9481  * Create a regular expression from a parsed glob pattern.
9482  *
9483  * ```js
9484  * const picomatch = require('picomatch');
9485  * const state = picomatch.parse('*.js');
9486  * // picomatch.compileRe(state[, options]);
9487  *
9488  * console.log(picomatch.compileRe(state));
9489  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
9490  * ```
9491  * @param {String} `state` The object returned from the `.parse` method.
9492  * @param {Object} `options`
9493  * @return {RegExp} Returns a regex created from the given pattern.
9494  * @api public
9495  */
9496
9497 picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => {
9498   if (returnOutput === true) {
9499     return parsed.output;
9500   }
9501
9502   const opts = options || {};
9503   const prepend = opts.contains ? '' : '^';
9504   const append = opts.contains ? '' : '$';
9505
9506   let source = `${prepend}(?:${parsed.output})${append}`;
9507   if (parsed && parsed.negated === true) {
9508     source = `^(?!${source}).*$`;
9509   }
9510
9511   const regex = picomatch.toRegex(source, options);
9512   if (returnState === true) {
9513     regex.state = parsed;
9514   }
9515
9516   return regex;
9517 };
9518
9519 picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => {
9520   if (!input || typeof input !== 'string') {
9521     throw new TypeError('Expected a non-empty string');
9522   }
9523
9524   const opts = options || {};
9525   let parsed = { negated: false, fastpaths: true };
9526   let prefix = '';
9527   let output;
9528
9529   if (input.startsWith('./')) {
9530     input = input.slice(2);
9531     prefix = parsed.prefix = './';
9532   }
9533
9534   if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
9535     output = parse.fastpaths(input, options);
9536   }
9537
9538   if (output === undefined) {
9539     parsed = parse(input, options);
9540     parsed.prefix = prefix + (parsed.prefix || '');
9541   } else {
9542     parsed.output = output;
9543   }
9544
9545   return picomatch.compileRe(parsed, options, returnOutput, returnState);
9546 };
9547
9548 /**
9549  * Create a regular expression from the given regex source string.
9550  *
9551  * ```js
9552  * const picomatch = require('picomatch');
9553  * // picomatch.toRegex(source[, options]);
9554  *
9555  * const { output } = picomatch.parse('*.js');
9556  * console.log(picomatch.toRegex(output));
9557  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
9558  * ```
9559  * @param {String} `source` Regular expression source string.
9560  * @param {Object} `options`
9561  * @return {RegExp}
9562  * @api public
9563  */
9564
9565 picomatch.toRegex = (source, options) => {
9566   try {
9567     const opts = options || {};
9568     return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
9569   } catch (err) {
9570     if (options && options.debug === true) throw err;
9571     return /$^/;
9572   }
9573 };
9574
9575 /**
9576  * Picomatch constants.
9577  * @return {Object}
9578  */
9579
9580 picomatch.constants = constants;
9581
9582 /**
9583  * Expose "picomatch"
9584  */
9585
9586 module.exports = picomatch;
9587
9588
9589 /***/ }),
9590 /* 53 */
9591 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9592
9593 "use strict";
9594
9595
9596 const utils = __webpack_require__(54);
9597 const {
9598   CHAR_ASTERISK,             /* * */
9599   CHAR_AT,                   /* @ */
9600   CHAR_BACKWARD_SLASH,       /* \ */
9601   CHAR_COMMA,                /* , */
9602   CHAR_DOT,                  /* . */
9603   CHAR_EXCLAMATION_MARK,     /* ! */
9604   CHAR_FORWARD_SLASH,        /* / */
9605   CHAR_LEFT_CURLY_BRACE,     /* { */
9606   CHAR_LEFT_PARENTHESES,     /* ( */
9607   CHAR_LEFT_SQUARE_BRACKET,  /* [ */
9608   CHAR_PLUS,                 /* + */
9609   CHAR_QUESTION_MARK,        /* ? */
9610   CHAR_RIGHT_CURLY_BRACE,    /* } */
9611   CHAR_RIGHT_PARENTHESES,    /* ) */
9612   CHAR_RIGHT_SQUARE_BRACKET  /* ] */
9613 } = __webpack_require__(55);
9614
9615 const isPathSeparator = code => {
9616   return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
9617 };
9618
9619 const depth = token => {
9620   if (token.isPrefix !== true) {
9621     token.depth = token.isGlobstar ? Infinity : 1;
9622   }
9623 };
9624
9625 /**
9626  * Quickly scans a glob pattern and returns an object with a handful of
9627  * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
9628  * `glob` (the actual pattern), and `negated` (true if the path starts with `!`).
9629  *
9630  * ```js
9631  * const pm = require('picomatch');
9632  * console.log(pm.scan('foo/bar/*.js'));
9633  * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
9634  * ```
9635  * @param {String} `str`
9636  * @param {Object} `options`
9637  * @return {Object} Returns an object with tokens and regex source string.
9638  * @api public
9639  */
9640
9641 const scan = (input, options) => {
9642   const opts = options || {};
9643
9644   const length = input.length - 1;
9645   const scanToEnd = opts.parts === true || opts.scanToEnd === true;
9646   const slashes = [];
9647   const tokens = [];
9648   const parts = [];
9649
9650   let str = input;
9651   let index = -1;
9652   let start = 0;
9653   let lastIndex = 0;
9654   let isBrace = false;
9655   let isBracket = false;
9656   let isGlob = false;
9657   let isExtglob = false;
9658   let isGlobstar = false;
9659   let braceEscaped = false;
9660   let backslashes = false;
9661   let negated = false;
9662   let finished = false;
9663   let braces = 0;
9664   let prev;
9665   let code;
9666   let token = { value: '', depth: 0, isGlob: false };
9667
9668   const eos = () => index >= length;
9669   const peek = () => str.charCodeAt(index + 1);
9670   const advance = () => {
9671     prev = code;
9672     return str.charCodeAt(++index);
9673   };
9674
9675   while (index < length) {
9676     code = advance();
9677     let next;
9678
9679     if (code === CHAR_BACKWARD_SLASH) {
9680       backslashes = token.backslashes = true;
9681       code = advance();
9682
9683       if (code === CHAR_LEFT_CURLY_BRACE) {
9684         braceEscaped = true;
9685       }
9686       continue;
9687     }
9688
9689     if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
9690       braces++;
9691
9692       while (eos() !== true && (code = advance())) {
9693         if (code === CHAR_BACKWARD_SLASH) {
9694           backslashes = token.backslashes = true;
9695           advance();
9696           continue;
9697         }
9698
9699         if (code === CHAR_LEFT_CURLY_BRACE) {
9700           braces++;
9701           continue;
9702         }
9703
9704         if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
9705           isBrace = token.isBrace = true;
9706           isGlob = token.isGlob = true;
9707           finished = true;
9708
9709           if (scanToEnd === true) {
9710             continue;
9711           }
9712
9713           break;
9714         }
9715
9716         if (braceEscaped !== true && code === CHAR_COMMA) {
9717           isBrace = token.isBrace = true;
9718           isGlob = token.isGlob = true;
9719           finished = true;
9720
9721           if (scanToEnd === true) {
9722             continue;
9723           }
9724
9725           break;
9726         }
9727
9728         if (code === CHAR_RIGHT_CURLY_BRACE) {
9729           braces--;
9730
9731           if (braces === 0) {
9732             braceEscaped = false;
9733             isBrace = token.isBrace = true;
9734             finished = true;
9735             break;
9736           }
9737         }
9738       }
9739
9740       if (scanToEnd === true) {
9741         continue;
9742       }
9743
9744       break;
9745     }
9746
9747     if (code === CHAR_FORWARD_SLASH) {
9748       slashes.push(index);
9749       tokens.push(token);
9750       token = { value: '', depth: 0, isGlob: false };
9751
9752       if (finished === true) continue;
9753       if (prev === CHAR_DOT && index === (start + 1)) {
9754         start += 2;
9755         continue;
9756       }
9757
9758       lastIndex = index + 1;
9759       continue;
9760     }
9761
9762     if (opts.noext !== true) {
9763       const isExtglobChar = code === CHAR_PLUS
9764         || code === CHAR_AT
9765         || code === CHAR_ASTERISK
9766         || code === CHAR_QUESTION_MARK
9767         || code === CHAR_EXCLAMATION_MARK;
9768
9769       if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
9770         isGlob = token.isGlob = true;
9771         isExtglob = token.isExtglob = true;
9772         finished = true;
9773
9774         if (scanToEnd === true) {
9775           while (eos() !== true && (code = advance())) {
9776             if (code === CHAR_BACKWARD_SLASH) {
9777               backslashes = token.backslashes = true;
9778               code = advance();
9779               continue;
9780             }
9781
9782             if (code === CHAR_RIGHT_PARENTHESES) {
9783               isGlob = token.isGlob = true;
9784               finished = true;
9785               break;
9786             }
9787           }
9788           continue;
9789         }
9790         break;
9791       }
9792     }
9793
9794     if (code === CHAR_ASTERISK) {
9795       if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
9796       isGlob = token.isGlob = true;
9797       finished = true;
9798
9799       if (scanToEnd === true) {
9800         continue;
9801       }
9802       break;
9803     }
9804
9805     if (code === CHAR_QUESTION_MARK) {
9806       isGlob = token.isGlob = true;
9807       finished = true;
9808
9809       if (scanToEnd === true) {
9810         continue;
9811       }
9812       break;
9813     }
9814
9815     if (code === CHAR_LEFT_SQUARE_BRACKET) {
9816       while (eos() !== true && (next = advance())) {
9817         if (next === CHAR_BACKWARD_SLASH) {
9818           backslashes = token.backslashes = true;
9819           advance();
9820           continue;
9821         }
9822
9823         if (next === CHAR_RIGHT_SQUARE_BRACKET) {
9824           isBracket = token.isBracket = true;
9825           isGlob = token.isGlob = true;
9826           finished = true;
9827
9828           if (scanToEnd === true) {
9829             continue;
9830           }
9831           break;
9832         }
9833       }
9834     }
9835
9836     if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
9837       negated = token.negated = true;
9838       start++;
9839       continue;
9840     }
9841
9842     if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
9843       isGlob = token.isGlob = true;
9844
9845       if (scanToEnd === true) {
9846         while (eos() !== true && (code = advance())) {
9847           if (code === CHAR_LEFT_PARENTHESES) {
9848             backslashes = token.backslashes = true;
9849             code = advance();
9850             continue;
9851           }
9852
9853           if (code === CHAR_RIGHT_PARENTHESES) {
9854             finished = true;
9855             break;
9856           }
9857         }
9858         continue;
9859       }
9860       break;
9861     }
9862
9863     if (isGlob === true) {
9864       finished = true;
9865
9866       if (scanToEnd === true) {
9867         continue;
9868       }
9869
9870       break;
9871     }
9872   }
9873
9874   if (opts.noext === true) {
9875     isExtglob = false;
9876     isGlob = false;
9877   }
9878
9879   let base = str;
9880   let prefix = '';
9881   let glob = '';
9882
9883   if (start > 0) {
9884     prefix = str.slice(0, start);
9885     str = str.slice(start);
9886     lastIndex -= start;
9887   }
9888
9889   if (base && isGlob === true && lastIndex > 0) {
9890     base = str.slice(0, lastIndex);
9891     glob = str.slice(lastIndex);
9892   } else if (isGlob === true) {
9893     base = '';
9894     glob = str;
9895   } else {
9896     base = str;
9897   }
9898
9899   if (base && base !== '' && base !== '/' && base !== str) {
9900     if (isPathSeparator(base.charCodeAt(base.length - 1))) {
9901       base = base.slice(0, -1);
9902     }
9903   }
9904
9905   if (opts.unescape === true) {
9906     if (glob) glob = utils.removeBackslashes(glob);
9907
9908     if (base && backslashes === true) {
9909       base = utils.removeBackslashes(base);
9910     }
9911   }
9912
9913   const state = {
9914     prefix,
9915     input,
9916     start,
9917     base,
9918     glob,
9919     isBrace,
9920     isBracket,
9921     isGlob,
9922     isExtglob,
9923     isGlobstar,
9924     negated
9925   };
9926
9927   if (opts.tokens === true) {
9928     state.maxDepth = 0;
9929     if (!isPathSeparator(code)) {
9930       tokens.push(token);
9931     }
9932     state.tokens = tokens;
9933   }
9934
9935   if (opts.parts === true || opts.tokens === true) {
9936     let prevIndex;
9937
9938     for (let idx = 0; idx < slashes.length; idx++) {
9939       const n = prevIndex ? prevIndex + 1 : start;
9940       const i = slashes[idx];
9941       const value = input.slice(n, i);
9942       if (opts.tokens) {
9943         if (idx === 0 && start !== 0) {
9944           tokens[idx].isPrefix = true;
9945           tokens[idx].value = prefix;
9946         } else {
9947           tokens[idx].value = value;
9948         }
9949         depth(tokens[idx]);
9950         state.maxDepth += tokens[idx].depth;
9951       }
9952       if (idx !== 0 || value !== '') {
9953         parts.push(value);
9954       }
9955       prevIndex = i;
9956     }
9957
9958     if (prevIndex && prevIndex + 1 < input.length) {
9959       const value = input.slice(prevIndex + 1);
9960       parts.push(value);
9961
9962       if (opts.tokens) {
9963         tokens[tokens.length - 1].value = value;
9964         depth(tokens[tokens.length - 1]);
9965         state.maxDepth += tokens[tokens.length - 1].depth;
9966       }
9967     }
9968
9969     state.slashes = slashes;
9970     state.parts = parts;
9971   }
9972
9973   return state;
9974 };
9975
9976 module.exports = scan;
9977
9978
9979 /***/ }),
9980 /* 54 */
9981 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9982
9983 "use strict";
9984
9985
9986 const path = __webpack_require__(2);
9987 const win32 = process.platform === 'win32';
9988 const {
9989   REGEX_BACKSLASH,
9990   REGEX_REMOVE_BACKSLASH,
9991   REGEX_SPECIAL_CHARS,
9992   REGEX_SPECIAL_CHARS_GLOBAL
9993 } = __webpack_require__(55);
9994
9995 exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
9996 exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
9997 exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
9998 exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
9999 exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
10000
10001 exports.removeBackslashes = str => {
10002   return str.replace(REGEX_REMOVE_BACKSLASH, match => {
10003     return match === '\\' ? '' : match;
10004   });
10005 };
10006
10007 exports.supportsLookbehinds = () => {
10008   const segs = process.version.slice(1).split('.').map(Number);
10009   if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
10010     return true;
10011   }
10012   return false;
10013 };
10014
10015 exports.isWindows = options => {
10016   if (options && typeof options.windows === 'boolean') {
10017     return options.windows;
10018   }
10019   return win32 === true || path.sep === '\\';
10020 };
10021
10022 exports.escapeLast = (input, char, lastIdx) => {
10023   const idx = input.lastIndexOf(char, lastIdx);
10024   if (idx === -1) return input;
10025   if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
10026   return `${input.slice(0, idx)}\\${input.slice(idx)}`;
10027 };
10028
10029 exports.removePrefix = (input, state = {}) => {
10030   let output = input;
10031   if (output.startsWith('./')) {
10032     output = output.slice(2);
10033     state.prefix = './';
10034   }
10035   return output;
10036 };
10037
10038 exports.wrapOutput = (input, state = {}, options = {}) => {
10039   const prepend = options.contains ? '' : '^';
10040   const append = options.contains ? '' : '$';
10041
10042   let output = `${prepend}(?:${input})${append}`;
10043   if (state.negated === true) {
10044     output = `(?:^(?!${output}).*$)`;
10045   }
10046   return output;
10047 };
10048
10049
10050 /***/ }),
10051 /* 55 */
10052 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10053
10054 "use strict";
10055
10056
10057 const path = __webpack_require__(2);
10058 const WIN_SLASH = '\\\\/';
10059 const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
10060
10061 /**
10062  * Posix glob regex
10063  */
10064
10065 const DOT_LITERAL = '\\.';
10066 const PLUS_LITERAL = '\\+';
10067 const QMARK_LITERAL = '\\?';
10068 const SLASH_LITERAL = '\\/';
10069 const ONE_CHAR = '(?=.)';
10070 const QMARK = '[^/]';
10071 const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
10072 const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
10073 const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
10074 const NO_DOT = `(?!${DOT_LITERAL})`;
10075 const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
10076 const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
10077 const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
10078 const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
10079 const STAR = `${QMARK}*?`;
10080
10081 const POSIX_CHARS = {
10082   DOT_LITERAL,
10083   PLUS_LITERAL,
10084   QMARK_LITERAL,
10085   SLASH_LITERAL,
10086   ONE_CHAR,
10087   QMARK,
10088   END_ANCHOR,
10089   DOTS_SLASH,
10090   NO_DOT,
10091   NO_DOTS,
10092   NO_DOT_SLASH,
10093   NO_DOTS_SLASH,
10094   QMARK_NO_DOT,
10095   STAR,
10096   START_ANCHOR
10097 };
10098
10099 /**
10100  * Windows glob regex
10101  */
10102
10103 const WINDOWS_CHARS = {
10104   ...POSIX_CHARS,
10105
10106   SLASH_LITERAL: `[${WIN_SLASH}]`,
10107   QMARK: WIN_NO_SLASH,
10108   STAR: `${WIN_NO_SLASH}*?`,
10109   DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
10110   NO_DOT: `(?!${DOT_LITERAL})`,
10111   NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
10112   NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
10113   NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
10114   QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
10115   START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
10116   END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
10117 };
10118
10119 /**
10120  * POSIX Bracket Regex
10121  */
10122
10123 const POSIX_REGEX_SOURCE = {
10124   alnum: 'a-zA-Z0-9',
10125   alpha: 'a-zA-Z',
10126   ascii: '\\x00-\\x7F',
10127   blank: ' \\t',
10128   cntrl: '\\x00-\\x1F\\x7F',
10129   digit: '0-9',
10130   graph: '\\x21-\\x7E',
10131   lower: 'a-z',
10132   print: '\\x20-\\x7E ',
10133   punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
10134   space: ' \\t\\r\\n\\v\\f',
10135   upper: 'A-Z',
10136   word: 'A-Za-z0-9_',
10137   xdigit: 'A-Fa-f0-9'
10138 };
10139
10140 module.exports = {
10141   MAX_LENGTH: 1024 * 64,
10142   POSIX_REGEX_SOURCE,
10143
10144   // regular expressions
10145   REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
10146   REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
10147   REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
10148   REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
10149   REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
10150   REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
10151
10152   // Replace globs with equivalent patterns to reduce parsing time.
10153   REPLACEMENTS: {
10154     '***': '*',
10155     '**/**': '**',
10156     '**/**/**': '**'
10157   },
10158
10159   // Digits
10160   CHAR_0: 48, /* 0 */
10161   CHAR_9: 57, /* 9 */
10162
10163   // Alphabet chars.
10164   CHAR_UPPERCASE_A: 65, /* A */
10165   CHAR_LOWERCASE_A: 97, /* a */
10166   CHAR_UPPERCASE_Z: 90, /* Z */
10167   CHAR_LOWERCASE_Z: 122, /* z */
10168
10169   CHAR_LEFT_PARENTHESES: 40, /* ( */
10170   CHAR_RIGHT_PARENTHESES: 41, /* ) */
10171
10172   CHAR_ASTERISK: 42, /* * */
10173
10174   // Non-alphabetic chars.
10175   CHAR_AMPERSAND: 38, /* & */
10176   CHAR_AT: 64, /* @ */
10177   CHAR_BACKWARD_SLASH: 92, /* \ */
10178   CHAR_CARRIAGE_RETURN: 13, /* \r */
10179   CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
10180   CHAR_COLON: 58, /* : */
10181   CHAR_COMMA: 44, /* , */
10182   CHAR_DOT: 46, /* . */
10183   CHAR_DOUBLE_QUOTE: 34, /* " */
10184   CHAR_EQUAL: 61, /* = */
10185   CHAR_EXCLAMATION_MARK: 33, /* ! */
10186   CHAR_FORM_FEED: 12, /* \f */
10187   CHAR_FORWARD_SLASH: 47, /* / */
10188   CHAR_GRAVE_ACCENT: 96, /* ` */
10189   CHAR_HASH: 35, /* # */
10190   CHAR_HYPHEN_MINUS: 45, /* - */
10191   CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
10192   CHAR_LEFT_CURLY_BRACE: 123, /* { */
10193   CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
10194   CHAR_LINE_FEED: 10, /* \n */
10195   CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
10196   CHAR_PERCENT: 37, /* % */
10197   CHAR_PLUS: 43, /* + */
10198   CHAR_QUESTION_MARK: 63, /* ? */
10199   CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
10200   CHAR_RIGHT_CURLY_BRACE: 125, /* } */
10201   CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
10202   CHAR_SEMICOLON: 59, /* ; */
10203   CHAR_SINGLE_QUOTE: 39, /* ' */
10204   CHAR_SPACE: 32, /*   */
10205   CHAR_TAB: 9, /* \t */
10206   CHAR_UNDERSCORE: 95, /* _ */
10207   CHAR_VERTICAL_LINE: 124, /* | */
10208   CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
10209
10210   SEP: path.sep,
10211
10212   /**
10213    * Create EXTGLOB_CHARS
10214    */
10215
10216   extglobChars(chars) {
10217     return {
10218       '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
10219       '?': { type: 'qmark', open: '(?:', close: ')?' },
10220       '+': { type: 'plus', open: '(?:', close: ')+' },
10221       '*': { type: 'star', open: '(?:', close: ')*' },
10222       '@': { type: 'at', open: '(?:', close: ')' }
10223     };
10224   },
10225
10226   /**
10227    * Create GLOB_CHARS
10228    */
10229
10230   globChars(win32) {
10231     return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
10232   }
10233 };
10234
10235
10236 /***/ }),
10237 /* 56 */
10238 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10239
10240 "use strict";
10241
10242
10243 const constants = __webpack_require__(55);
10244 const utils = __webpack_require__(54);
10245
10246 /**
10247  * Constants
10248  */
10249
10250 const {
10251   MAX_LENGTH,
10252   POSIX_REGEX_SOURCE,
10253   REGEX_NON_SPECIAL_CHARS,
10254   REGEX_SPECIAL_CHARS_BACKREF,
10255   REPLACEMENTS
10256 } = constants;
10257
10258 /**
10259  * Helpers
10260  */
10261
10262 const expandRange = (args, options) => {
10263   if (typeof options.expandRange === 'function') {
10264     return options.expandRange(...args, options);
10265   }
10266
10267   args.sort();
10268   const value = `[${args.join('-')}]`;
10269
10270   try {
10271     /* eslint-disable-next-line no-new */
10272     new RegExp(value);
10273   } catch (ex) {
10274     return args.map(v => utils.escapeRegex(v)).join('..');
10275   }
10276
10277   return value;
10278 };
10279
10280 /**
10281  * Create the message for a syntax error
10282  */
10283
10284 const syntaxError = (type, char) => {
10285   return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
10286 };
10287
10288 /**
10289  * Parse the given input string.
10290  * @param {String} input
10291  * @param {Object} options
10292  * @return {Object}
10293  */
10294
10295 const parse = (input, options) => {
10296   if (typeof input !== 'string') {
10297     throw new TypeError('Expected a string');
10298   }
10299
10300   input = REPLACEMENTS[input] || input;
10301
10302   const opts = { ...options };
10303   const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
10304
10305   let len = input.length;
10306   if (len > max) {
10307     throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
10308   }
10309
10310   const bos = { type: 'bos', value: '', output: opts.prepend || '' };
10311   const tokens = [bos];
10312
10313   const capture = opts.capture ? '' : '?:';
10314   const win32 = utils.isWindows(options);
10315
10316   // create constants based on platform, for windows or posix
10317   const PLATFORM_CHARS = constants.globChars(win32);
10318   const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
10319
10320   const {
10321     DOT_LITERAL,
10322     PLUS_LITERAL,
10323     SLASH_LITERAL,
10324     ONE_CHAR,
10325     DOTS_SLASH,
10326     NO_DOT,
10327     NO_DOT_SLASH,
10328     NO_DOTS_SLASH,
10329     QMARK,
10330     QMARK_NO_DOT,
10331     STAR,
10332     START_ANCHOR
10333   } = PLATFORM_CHARS;
10334
10335   const globstar = (opts) => {
10336     return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
10337   };
10338
10339   const nodot = opts.dot ? '' : NO_DOT;
10340   const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
10341   let star = opts.bash === true ? globstar(opts) : STAR;
10342
10343   if (opts.capture) {
10344     star = `(${star})`;
10345   }
10346
10347   // minimatch options support
10348   if (typeof opts.noext === 'boolean') {
10349     opts.noextglob = opts.noext;
10350   }
10351
10352   const state = {
10353     input,
10354     index: -1,
10355     start: 0,
10356     dot: opts.dot === true,
10357     consumed: '',
10358     output: '',
10359     prefix: '',
10360     backtrack: false,
10361     negated: false,
10362     brackets: 0,
10363     braces: 0,
10364     parens: 0,
10365     quotes: 0,
10366     globstar: false,
10367     tokens
10368   };
10369
10370   input = utils.removePrefix(input, state);
10371   len = input.length;
10372
10373   const extglobs = [];
10374   const braces = [];
10375   const stack = [];
10376   let prev = bos;
10377   let value;
10378
10379   /**
10380    * Tokenizing helpers
10381    */
10382
10383   const eos = () => state.index === len - 1;
10384   const peek = state.peek = (n = 1) => input[state.index + n];
10385   const advance = state.advance = () => input[++state.index];
10386   const remaining = () => input.slice(state.index + 1);
10387   const consume = (value = '', num = 0) => {
10388     state.consumed += value;
10389     state.index += num;
10390   };
10391   const append = token => {
10392     state.output += token.output != null ? token.output : token.value;
10393     consume(token.value);
10394   };
10395
10396   const negate = () => {
10397     let count = 1;
10398
10399     while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
10400       advance();
10401       state.start++;
10402       count++;
10403     }
10404
10405     if (count % 2 === 0) {
10406       return false;
10407     }
10408
10409     state.negated = true;
10410     state.start++;
10411     return true;
10412   };
10413
10414   const increment = type => {
10415     state[type]++;
10416     stack.push(type);
10417   };
10418
10419   const decrement = type => {
10420     state[type]--;
10421     stack.pop();
10422   };
10423
10424   /**
10425    * Push tokens onto the tokens array. This helper speeds up
10426    * tokenizing by 1) helping us avoid backtracking as much as possible,
10427    * and 2) helping us avoid creating extra tokens when consecutive
10428    * characters are plain text. This improves performance and simplifies
10429    * lookbehinds.
10430    */
10431
10432   const push = tok => {
10433     if (prev.type === 'globstar') {
10434       const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
10435       const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
10436
10437       if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
10438         state.output = state.output.slice(0, -prev.output.length);
10439         prev.type = 'star';
10440         prev.value = '*';
10441         prev.output = star;
10442         state.output += prev.output;
10443       }
10444     }
10445
10446     if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) {
10447       extglobs[extglobs.length - 1].inner += tok.value;
10448     }
10449
10450     if (tok.value || tok.output) append(tok);
10451     if (prev && prev.type === 'text' && tok.type === 'text') {
10452       prev.value += tok.value;
10453       prev.output = (prev.output || '') + tok.value;
10454       return;
10455     }
10456
10457     tok.prev = prev;
10458     tokens.push(tok);
10459     prev = tok;
10460   };
10461
10462   const extglobOpen = (type, value) => {
10463     const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
10464
10465     token.prev = prev;
10466     token.parens = state.parens;
10467     token.output = state.output;
10468     const output = (opts.capture ? '(' : '') + token.open;
10469
10470     increment('parens');
10471     push({ type, value, output: state.output ? '' : ONE_CHAR });
10472     push({ type: 'paren', extglob: true, value: advance(), output });
10473     extglobs.push(token);
10474   };
10475
10476   const extglobClose = token => {
10477     let output = token.close + (opts.capture ? ')' : '');
10478
10479     if (token.type === 'negate') {
10480       let extglobStar = star;
10481
10482       if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
10483         extglobStar = globstar(opts);
10484       }
10485
10486       if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
10487         output = token.close = `)$))${extglobStar}`;
10488       }
10489
10490       if (token.prev.type === 'bos' && eos()) {
10491         state.negatedExtglob = true;
10492       }
10493     }
10494
10495     push({ type: 'paren', extglob: true, value, output });
10496     decrement('parens');
10497   };
10498
10499   /**
10500    * Fast paths
10501    */
10502
10503   if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
10504     let backslashes = false;
10505
10506     let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
10507       if (first === '\\') {
10508         backslashes = true;
10509         return m;
10510       }
10511
10512       if (first === '?') {
10513         if (esc) {
10514           return esc + first + (rest ? QMARK.repeat(rest.length) : '');
10515         }
10516         if (index === 0) {
10517           return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
10518         }
10519         return QMARK.repeat(chars.length);
10520       }
10521
10522       if (first === '.') {
10523         return DOT_LITERAL.repeat(chars.length);
10524       }
10525
10526       if (first === '*') {
10527         if (esc) {
10528           return esc + first + (rest ? star : '');
10529         }
10530         return star;
10531       }
10532       return esc ? m : `\\${m}`;
10533     });
10534
10535     if (backslashes === true) {
10536       if (opts.unescape === true) {
10537         output = output.replace(/\\/g, '');
10538       } else {
10539         output = output.replace(/\\+/g, m => {
10540           return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
10541         });
10542       }
10543     }
10544
10545     if (output === input && opts.contains === true) {
10546       state.output = input;
10547       return state;
10548     }
10549
10550     state.output = utils.wrapOutput(output, state, options);
10551     return state;
10552   }
10553
10554   /**
10555    * Tokenize input until we reach end-of-string
10556    */
10557
10558   while (!eos()) {
10559     value = advance();
10560
10561     if (value === '\u0000') {
10562       continue;
10563     }
10564
10565     /**
10566      * Escaped characters
10567      */
10568
10569     if (value === '\\') {
10570       const next = peek();
10571
10572       if (next === '/' && opts.bash !== true) {
10573         continue;
10574       }
10575
10576       if (next === '.' || next === ';') {
10577         continue;
10578       }
10579
10580       if (!next) {
10581         value += '\\';
10582         push({ type: 'text', value });
10583         continue;
10584       }
10585
10586       // collapse slashes to reduce potential for exploits
10587       const match = /^\\+/.exec(remaining());
10588       let slashes = 0;
10589
10590       if (match && match[0].length > 2) {
10591         slashes = match[0].length;
10592         state.index += slashes;
10593         if (slashes % 2 !== 0) {
10594           value += '\\';
10595         }
10596       }
10597
10598       if (opts.unescape === true) {
10599         value = advance() || '';
10600       } else {
10601         value += advance() || '';
10602       }
10603
10604       if (state.brackets === 0) {
10605         push({ type: 'text', value });
10606         continue;
10607       }
10608     }
10609
10610     /**
10611      * If we're inside a regex character class, continue
10612      * until we reach the closing bracket.
10613      */
10614
10615     if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
10616       if (opts.posix !== false && value === ':') {
10617         const inner = prev.value.slice(1);
10618         if (inner.includes('[')) {
10619           prev.posix = true;
10620
10621           if (inner.includes(':')) {
10622             const idx = prev.value.lastIndexOf('[');
10623             const pre = prev.value.slice(0, idx);
10624             const rest = prev.value.slice(idx + 2);
10625             const posix = POSIX_REGEX_SOURCE[rest];
10626             if (posix) {
10627               prev.value = pre + posix;
10628               state.backtrack = true;
10629               advance();
10630
10631               if (!bos.output && tokens.indexOf(prev) === 1) {
10632                 bos.output = ONE_CHAR;
10633               }
10634               continue;
10635             }
10636           }
10637         }
10638       }
10639
10640       if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
10641         value = `\\${value}`;
10642       }
10643
10644       if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
10645         value = `\\${value}`;
10646       }
10647
10648       if (opts.posix === true && value === '!' && prev.value === '[') {
10649         value = '^';
10650       }
10651
10652       prev.value += value;
10653       append({ value });
10654       continue;
10655     }
10656
10657     /**
10658      * If we're inside a quoted string, continue
10659      * until we reach the closing double quote.
10660      */
10661
10662     if (state.quotes === 1 && value !== '"') {
10663       value = utils.escapeRegex(value);
10664       prev.value += value;
10665       append({ value });
10666       continue;
10667     }
10668
10669     /**
10670      * Double quotes
10671      */
10672
10673     if (value === '"') {
10674       state.quotes = state.quotes === 1 ? 0 : 1;
10675       if (opts.keepQuotes === true) {
10676         push({ type: 'text', value });
10677       }
10678       continue;
10679     }
10680
10681     /**
10682      * Parentheses
10683      */
10684
10685     if (value === '(') {
10686       increment('parens');
10687       push({ type: 'paren', value });
10688       continue;
10689     }
10690
10691     if (value === ')') {
10692       if (state.parens === 0 && opts.strictBrackets === true) {
10693         throw new SyntaxError(syntaxError('opening', '('));
10694       }
10695
10696       const extglob = extglobs[extglobs.length - 1];
10697       if (extglob && state.parens === extglob.parens + 1) {
10698         extglobClose(extglobs.pop());
10699         continue;
10700       }
10701
10702       push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
10703       decrement('parens');
10704       continue;
10705     }
10706
10707     /**
10708      * Square brackets
10709      */
10710
10711     if (value === '[') {
10712       if (opts.nobracket === true || !remaining().includes(']')) {
10713         if (opts.nobracket !== true && opts.strictBrackets === true) {
10714           throw new SyntaxError(syntaxError('closing', ']'));
10715         }
10716
10717         value = `\\${value}`;
10718       } else {
10719         increment('brackets');
10720       }
10721
10722       push({ type: 'bracket', value });
10723       continue;
10724     }
10725
10726     if (value === ']') {
10727       if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
10728         push({ type: 'text', value, output: `\\${value}` });
10729         continue;
10730       }
10731
10732       if (state.brackets === 0) {
10733         if (opts.strictBrackets === true) {
10734           throw new SyntaxError(syntaxError('opening', '['));
10735         }
10736
10737         push({ type: 'text', value, output: `\\${value}` });
10738         continue;
10739       }
10740
10741       decrement('brackets');
10742
10743       const prevValue = prev.value.slice(1);
10744       if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
10745         value = `/${value}`;
10746       }
10747
10748       prev.value += value;
10749       append({ value });
10750
10751       // when literal brackets are explicitly disabled
10752       // assume we should match with a regex character class
10753       if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
10754         continue;
10755       }
10756
10757       const escaped = utils.escapeRegex(prev.value);
10758       state.output = state.output.slice(0, -prev.value.length);
10759
10760       // when literal brackets are explicitly enabled
10761       // assume we should escape the brackets to match literal characters
10762       if (opts.literalBrackets === true) {
10763         state.output += escaped;
10764         prev.value = escaped;
10765         continue;
10766       }
10767
10768       // when the user specifies nothing, try to match both
10769       prev.value = `(${capture}${escaped}|${prev.value})`;
10770       state.output += prev.value;
10771       continue;
10772     }
10773
10774     /**
10775      * Braces
10776      */
10777
10778     if (value === '{' && opts.nobrace !== true) {
10779       increment('braces');
10780
10781       const open = {
10782         type: 'brace',
10783         value,
10784         output: '(',
10785         outputIndex: state.output.length,
10786         tokensIndex: state.tokens.length
10787       };
10788
10789       braces.push(open);
10790       push(open);
10791       continue;
10792     }
10793
10794     if (value === '}') {
10795       const brace = braces[braces.length - 1];
10796
10797       if (opts.nobrace === true || !brace) {
10798         push({ type: 'text', value, output: value });
10799         continue;
10800       }
10801
10802       let output = ')';
10803
10804       if (brace.dots === true) {
10805         const arr = tokens.slice();
10806         const range = [];
10807
10808         for (let i = arr.length - 1; i >= 0; i--) {
10809           tokens.pop();
10810           if (arr[i].type === 'brace') {
10811             break;
10812           }
10813           if (arr[i].type !== 'dots') {
10814             range.unshift(arr[i].value);
10815           }
10816         }
10817
10818         output = expandRange(range, opts);
10819         state.backtrack = true;
10820       }
10821
10822       if (brace.comma !== true && brace.dots !== true) {
10823         const out = state.output.slice(0, brace.outputIndex);
10824         const toks = state.tokens.slice(brace.tokensIndex);
10825         brace.value = brace.output = '\\{';
10826         value = output = '\\}';
10827         state.output = out;
10828         for (const t of toks) {
10829           state.output += (t.output || t.value);
10830         }
10831       }
10832
10833       push({ type: 'brace', value, output });
10834       decrement('braces');
10835       braces.pop();
10836       continue;
10837     }
10838
10839     /**
10840      * Pipes
10841      */
10842
10843     if (value === '|') {
10844       if (extglobs.length > 0) {
10845         extglobs[extglobs.length - 1].conditions++;
10846       }
10847       push({ type: 'text', value });
10848       continue;
10849     }
10850
10851     /**
10852      * Commas
10853      */
10854
10855     if (value === ',') {
10856       let output = value;
10857
10858       const brace = braces[braces.length - 1];
10859       if (brace && stack[stack.length - 1] === 'braces') {
10860         brace.comma = true;
10861         output = '|';
10862       }
10863
10864       push({ type: 'comma', value, output });
10865       continue;
10866     }
10867
10868     /**
10869      * Slashes
10870      */
10871
10872     if (value === '/') {
10873       // if the beginning of the glob is "./", advance the start
10874       // to the current index, and don't add the "./" characters
10875       // to the state. This greatly simplifies lookbehinds when
10876       // checking for BOS characters like "!" and "." (not "./")
10877       if (prev.type === 'dot' && state.index === state.start + 1) {
10878         state.start = state.index + 1;
10879         state.consumed = '';
10880         state.output = '';
10881         tokens.pop();
10882         prev = bos; // reset "prev" to the first token
10883         continue;
10884       }
10885
10886       push({ type: 'slash', value, output: SLASH_LITERAL });
10887       continue;
10888     }
10889
10890     /**
10891      * Dots
10892      */
10893
10894     if (value === '.') {
10895       if (state.braces > 0 && prev.type === 'dot') {
10896         if (prev.value === '.') prev.output = DOT_LITERAL;
10897         const brace = braces[braces.length - 1];
10898         prev.type = 'dots';
10899         prev.output += value;
10900         prev.value += value;
10901         brace.dots = true;
10902         continue;
10903       }
10904
10905       if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
10906         push({ type: 'text', value, output: DOT_LITERAL });
10907         continue;
10908       }
10909
10910       push({ type: 'dot', value, output: DOT_LITERAL });
10911       continue;
10912     }
10913
10914     /**
10915      * Question marks
10916      */
10917
10918     if (value === '?') {
10919       const isGroup = prev && prev.value === '(';
10920       if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10921         extglobOpen('qmark', value);
10922         continue;
10923       }
10924
10925       if (prev && prev.type === 'paren') {
10926         const next = peek();
10927         let output = value;
10928
10929         if (next === '<' && !utils.supportsLookbehinds()) {
10930           throw new Error('Node.js v10 or higher is required for regex lookbehinds');
10931         }
10932
10933         if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
10934           output = `\\${value}`;
10935         }
10936
10937         push({ type: 'text', value, output });
10938         continue;
10939       }
10940
10941       if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
10942         push({ type: 'qmark', value, output: QMARK_NO_DOT });
10943         continue;
10944       }
10945
10946       push({ type: 'qmark', value, output: QMARK });
10947       continue;
10948     }
10949
10950     /**
10951      * Exclamation
10952      */
10953
10954     if (value === '!') {
10955       if (opts.noextglob !== true && peek() === '(') {
10956         if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
10957           extglobOpen('negate', value);
10958           continue;
10959         }
10960       }
10961
10962       if (opts.nonegate !== true && state.index === 0) {
10963         negate();
10964         continue;
10965       }
10966     }
10967
10968     /**
10969      * Plus
10970      */
10971
10972     if (value === '+') {
10973       if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10974         extglobOpen('plus', value);
10975         continue;
10976       }
10977
10978       if ((prev && prev.value === '(') || opts.regex === false) {
10979         push({ type: 'plus', value, output: PLUS_LITERAL });
10980         continue;
10981       }
10982
10983       if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
10984         push({ type: 'plus', value });
10985         continue;
10986       }
10987
10988       push({ type: 'plus', value: PLUS_LITERAL });
10989       continue;
10990     }
10991
10992     /**
10993      * Plain text
10994      */
10995
10996     if (value === '@') {
10997       if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10998         push({ type: 'at', extglob: true, value, output: '' });
10999         continue;
11000       }
11001
11002       push({ type: 'text', value });
11003       continue;
11004     }
11005
11006     /**
11007      * Plain text
11008      */
11009
11010     if (value !== '*') {
11011       if (value === '$' || value === '^') {
11012         value = `\\${value}`;
11013       }
11014
11015       const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
11016       if (match) {
11017         value += match[0];
11018         state.index += match[0].length;
11019       }
11020
11021       push({ type: 'text', value });
11022       continue;
11023     }
11024
11025     /**
11026      * Stars
11027      */
11028
11029     if (prev && (prev.type === 'globstar' || prev.star === true)) {
11030       prev.type = 'star';
11031       prev.star = true;
11032       prev.value += value;
11033       prev.output = star;
11034       state.backtrack = true;
11035       state.globstar = true;
11036       consume(value);
11037       continue;
11038     }
11039
11040     let rest = remaining();
11041     if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
11042       extglobOpen('star', value);
11043       continue;
11044     }
11045
11046     if (prev.type === 'star') {
11047       if (opts.noglobstar === true) {
11048         consume(value);
11049         continue;
11050       }
11051
11052       const prior = prev.prev;
11053       const before = prior.prev;
11054       const isStart = prior.type === 'slash' || prior.type === 'bos';
11055       const afterStar = before && (before.type === 'star' || before.type === 'globstar');
11056
11057       if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
11058         push({ type: 'star', value, output: '' });
11059         continue;
11060       }
11061
11062       const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
11063       const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
11064       if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
11065         push({ type: 'star', value, output: '' });
11066         continue;
11067       }
11068
11069       // strip consecutive `/**/`
11070       while (rest.slice(0, 3) === '/**') {
11071         const after = input[state.index + 4];
11072         if (after && after !== '/') {
11073           break;
11074         }
11075         rest = rest.slice(3);
11076         consume('/**', 3);
11077       }
11078
11079       if (prior.type === 'bos' && eos()) {
11080         prev.type = 'globstar';
11081         prev.value += value;
11082         prev.output = globstar(opts);
11083         state.output = prev.output;
11084         state.globstar = true;
11085         consume(value);
11086         continue;
11087       }
11088
11089       if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
11090         state.output = state.output.slice(0, -(prior.output + prev.output).length);
11091         prior.output = `(?:${prior.output}`;
11092
11093         prev.type = 'globstar';
11094         prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
11095         prev.value += value;
11096         state.globstar = true;
11097         state.output += prior.output + prev.output;
11098         consume(value);
11099         continue;
11100       }
11101
11102       if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
11103         const end = rest[1] !== void 0 ? '|$' : '';
11104
11105         state.output = state.output.slice(0, -(prior.output + prev.output).length);
11106         prior.output = `(?:${prior.output}`;
11107
11108         prev.type = 'globstar';
11109         prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
11110         prev.value += value;
11111
11112         state.output += prior.output + prev.output;
11113         state.globstar = true;
11114
11115         consume(value + advance());
11116
11117         push({ type: 'slash', value: '/', output: '' });
11118         continue;
11119       }
11120
11121       if (prior.type === 'bos' && rest[0] === '/') {
11122         prev.type = 'globstar';
11123         prev.value += value;
11124         prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
11125         state.output = prev.output;
11126         state.globstar = true;
11127         consume(value + advance());
11128         push({ type: 'slash', value: '/', output: '' });
11129         continue;
11130       }
11131
11132       // remove single star from output
11133       state.output = state.output.slice(0, -prev.output.length);
11134
11135       // reset previous token to globstar
11136       prev.type = 'globstar';
11137       prev.output = globstar(opts);
11138       prev.value += value;
11139
11140       // reset output with globstar
11141       state.output += prev.output;
11142       state.globstar = true;
11143       consume(value);
11144       continue;
11145     }
11146
11147     const token = { type: 'star', value, output: star };
11148
11149     if (opts.bash === true) {
11150       token.output = '.*?';
11151       if (prev.type === 'bos' || prev.type === 'slash') {
11152         token.output = nodot + token.output;
11153       }
11154       push(token);
11155       continue;
11156     }
11157
11158     if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
11159       token.output = value;
11160       push(token);
11161       continue;
11162     }
11163
11164     if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
11165       if (prev.type === 'dot') {
11166         state.output += NO_DOT_SLASH;
11167         prev.output += NO_DOT_SLASH;
11168
11169       } else if (opts.dot === true) {
11170         state.output += NO_DOTS_SLASH;
11171         prev.output += NO_DOTS_SLASH;
11172
11173       } else {
11174         state.output += nodot;
11175         prev.output += nodot;
11176       }
11177
11178       if (peek() !== '*') {
11179         state.output += ONE_CHAR;
11180         prev.output += ONE_CHAR;
11181       }
11182     }
11183
11184     push(token);
11185   }
11186
11187   while (state.brackets > 0) {
11188     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
11189     state.output = utils.escapeLast(state.output, '[');
11190     decrement('brackets');
11191   }
11192
11193   while (state.parens > 0) {
11194     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
11195     state.output = utils.escapeLast(state.output, '(');
11196     decrement('parens');
11197   }
11198
11199   while (state.braces > 0) {
11200     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
11201     state.output = utils.escapeLast(state.output, '{');
11202     decrement('braces');
11203   }
11204
11205   if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
11206     push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
11207   }
11208
11209   // rebuild the output if we had to backtrack at any point
11210   if (state.backtrack === true) {
11211     state.output = '';
11212
11213     for (const token of state.tokens) {
11214       state.output += token.output != null ? token.output : token.value;
11215
11216       if (token.suffix) {
11217         state.output += token.suffix;
11218       }
11219     }
11220   }
11221
11222   return state;
11223 };
11224
11225 /**
11226  * Fast paths for creating regular expressions for common glob patterns.
11227  * This can significantly speed up processing and has very little downside
11228  * impact when none of the fast paths match.
11229  */
11230
11231 parse.fastpaths = (input, options) => {
11232   const opts = { ...options };
11233   const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
11234   const len = input.length;
11235   if (len > max) {
11236     throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
11237   }
11238
11239   input = REPLACEMENTS[input] || input;
11240   const win32 = utils.isWindows(options);
11241
11242   // create constants based on platform, for windows or posix
11243   const {
11244     DOT_LITERAL,
11245     SLASH_LITERAL,
11246     ONE_CHAR,
11247     DOTS_SLASH,
11248     NO_DOT,
11249     NO_DOTS,
11250     NO_DOTS_SLASH,
11251     STAR,
11252     START_ANCHOR
11253   } = constants.globChars(win32);
11254
11255   const nodot = opts.dot ? NO_DOTS : NO_DOT;
11256   const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
11257   const capture = opts.capture ? '' : '?:';
11258   const state = { negated: false, prefix: '' };
11259   let star = opts.bash === true ? '.*?' : STAR;
11260
11261   if (opts.capture) {
11262     star = `(${star})`;
11263   }
11264
11265   const globstar = (opts) => {
11266     if (opts.noglobstar === true) return star;
11267     return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
11268   };
11269
11270   const create = str => {
11271     switch (str) {
11272       case '*':
11273         return `${nodot}${ONE_CHAR}${star}`;
11274
11275       case '.*':
11276         return `${DOT_LITERAL}${ONE_CHAR}${star}`;
11277
11278       case '*.*':
11279         return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
11280
11281       case '*/*':
11282         return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
11283
11284       case '**':
11285         return nodot + globstar(opts);
11286
11287       case '**/*':
11288         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
11289
11290       case '**/*.*':
11291         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
11292
11293       case '**/.*':
11294         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
11295
11296       default: {
11297         const match = /^(.*?)\.(\w+)$/.exec(str);
11298         if (!match) return;
11299
11300         const source = create(match[1]);
11301         if (!source) return;
11302
11303         return source + DOT_LITERAL + match[2];
11304       }
11305     }
11306   };
11307
11308   const output = utils.removePrefix(input, state);
11309   let source = create(output);
11310
11311   if (source && opts.strictSlashes !== true) {
11312     source += `${SLASH_LITERAL}?`;
11313   }
11314
11315   return source;
11316 };
11317
11318 module.exports = parse;
11319
11320
11321 /***/ }),
11322 /* 57 */
11323 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
11324
11325 const assert = __webpack_require__(58)
11326 const path = __webpack_require__(2)
11327 const fs = __webpack_require__(42)
11328 let glob = undefined
11329 try {
11330   glob = __webpack_require__(59)
11331 } catch (_err) {
11332   // treat glob as optional.
11333 }
11334
11335 const defaultGlobOpts = {
11336   nosort: true,
11337   silent: true
11338 }
11339
11340 // for EMFILE handling
11341 let timeout = 0
11342
11343 const isWindows = (process.platform === "win32")
11344
11345 const defaults = options => {
11346   const methods = [
11347     'unlink',
11348     'chmod',
11349     'stat',
11350     'lstat',
11351     'rmdir',
11352     'readdir'
11353   ]
11354   methods.forEach(m => {
11355     options[m] = options[m] || fs[m]
11356     m = m + 'Sync'
11357     options[m] = options[m] || fs[m]
11358   })
11359
11360   options.maxBusyTries = options.maxBusyTries || 3
11361   options.emfileWait = options.emfileWait || 1000
11362   if (options.glob === false) {
11363     options.disableGlob = true
11364   }
11365   if (options.disableGlob !== true && glob === undefined) {
11366     throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
11367   }
11368   options.disableGlob = options.disableGlob || false
11369   options.glob = options.glob || defaultGlobOpts
11370 }
11371
11372 const rimraf = (p, options, cb) => {
11373   if (typeof options === 'function') {
11374     cb = options
11375     options = {}
11376   }
11377
11378   assert(p, 'rimraf: missing path')
11379   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
11380   assert.equal(typeof cb, 'function', 'rimraf: callback function required')
11381   assert(options, 'rimraf: invalid options argument provided')
11382   assert.equal(typeof options, 'object', 'rimraf: options should be object')
11383
11384   defaults(options)
11385
11386   let busyTries = 0
11387   let errState = null
11388   let n = 0
11389
11390   const next = (er) => {
11391     errState = errState || er
11392     if (--n === 0)
11393       cb(errState)
11394   }
11395
11396   const afterGlob = (er, results) => {
11397     if (er)
11398       return cb(er)
11399
11400     n = results.length
11401     if (n === 0)
11402       return cb()
11403
11404     results.forEach(p => {
11405       const CB = (er) => {
11406         if (er) {
11407           if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
11408               busyTries < options.maxBusyTries) {
11409             busyTries ++
11410             // try again, with the same exact callback as this one.
11411             return setTimeout(() => rimraf_(p, options, CB), busyTries * 100)
11412           }
11413
11414           // this one won't happen if graceful-fs is used.
11415           if (er.code === "EMFILE" && timeout < options.emfileWait) {
11416             return setTimeout(() => rimraf_(p, options, CB), timeout ++)
11417           }
11418
11419           // already gone
11420           if (er.code === "ENOENT") er = null
11421         }
11422
11423         timeout = 0
11424         next(er)
11425       }
11426       rimraf_(p, options, CB)
11427     })
11428   }
11429
11430   if (options.disableGlob || !glob.hasMagic(p))
11431     return afterGlob(null, [p])
11432
11433   options.lstat(p, (er, stat) => {
11434     if (!er)
11435       return afterGlob(null, [p])
11436
11437     glob(p, options.glob, afterGlob)
11438   })
11439
11440 }
11441
11442 // Two possible strategies.
11443 // 1. Assume it's a file.  unlink it, then do the dir stuff on EPERM or EISDIR
11444 // 2. Assume it's a directory.  readdir, then do the file stuff on ENOTDIR
11445 //
11446 // Both result in an extra syscall when you guess wrong.  However, there
11447 // are likely far more normal files in the world than directories.  This
11448 // is based on the assumption that a the average number of files per
11449 // directory is >= 1.
11450 //
11451 // If anyone ever complains about this, then I guess the strategy could
11452 // be made configurable somehow.  But until then, YAGNI.
11453 const rimraf_ = (p, options, cb) => {
11454   assert(p)
11455   assert(options)
11456   assert(typeof cb === 'function')
11457
11458   // sunos lets the root user unlink directories, which is... weird.
11459   // so we have to lstat here and make sure it's not a dir.
11460   options.lstat(p, (er, st) => {
11461     if (er && er.code === "ENOENT")
11462       return cb(null)
11463
11464     // Windows can EPERM on stat.  Life is suffering.
11465     if (er && er.code === "EPERM" && isWindows)
11466       fixWinEPERM(p, options, er, cb)
11467
11468     if (st && st.isDirectory())
11469       return rmdir(p, options, er, cb)
11470
11471     options.unlink(p, er => {
11472       if (er) {
11473         if (er.code === "ENOENT")
11474           return cb(null)
11475         if (er.code === "EPERM")
11476           return (isWindows)
11477             ? fixWinEPERM(p, options, er, cb)
11478             : rmdir(p, options, er, cb)
11479         if (er.code === "EISDIR")
11480           return rmdir(p, options, er, cb)
11481       }
11482       return cb(er)
11483     })
11484   })
11485 }
11486
11487 const fixWinEPERM = (p, options, er, cb) => {
11488   assert(p)
11489   assert(options)
11490   assert(typeof cb === 'function')
11491
11492   options.chmod(p, 0o666, er2 => {
11493     if (er2)
11494       cb(er2.code === "ENOENT" ? null : er)
11495     else
11496       options.stat(p, (er3, stats) => {
11497         if (er3)
11498           cb(er3.code === "ENOENT" ? null : er)
11499         else if (stats.isDirectory())
11500           rmdir(p, options, er, cb)
11501         else
11502           options.unlink(p, cb)
11503       })
11504   })
11505 }
11506
11507 const fixWinEPERMSync = (p, options, er) => {
11508   assert(p)
11509   assert(options)
11510
11511   try {
11512     options.chmodSync(p, 0o666)
11513   } catch (er2) {
11514     if (er2.code === "ENOENT")
11515       return
11516     else
11517       throw er
11518   }
11519
11520   let stats
11521   try {
11522     stats = options.statSync(p)
11523   } catch (er3) {
11524     if (er3.code === "ENOENT")
11525       return
11526     else
11527       throw er
11528   }
11529
11530   if (stats.isDirectory())
11531     rmdirSync(p, options, er)
11532   else
11533     options.unlinkSync(p)
11534 }
11535
11536 const rmdir = (p, options, originalEr, cb) => {
11537   assert(p)
11538   assert(options)
11539   assert(typeof cb === 'function')
11540
11541   // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
11542   // if we guessed wrong, and it's not a directory, then
11543   // raise the original error.
11544   options.rmdir(p, er => {
11545     if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
11546       rmkids(p, options, cb)
11547     else if (er && er.code === "ENOTDIR")
11548       cb(originalEr)
11549     else
11550       cb(er)
11551   })
11552 }
11553
11554 const rmkids = (p, options, cb) => {
11555   assert(p)
11556   assert(options)
11557   assert(typeof cb === 'function')
11558
11559   options.readdir(p, (er, files) => {
11560     if (er)
11561       return cb(er)
11562     let n = files.length
11563     if (n === 0)
11564       return options.rmdir(p, cb)
11565     let errState
11566     files.forEach(f => {
11567       rimraf(path.join(p, f), options, er => {
11568         if (errState)
11569           return
11570         if (er)
11571           return cb(errState = er)
11572         if (--n === 0)
11573           options.rmdir(p, cb)
11574       })
11575     })
11576   })
11577 }
11578
11579 // this looks simpler, and is strictly *faster*, but will
11580 // tie up the JavaScript thread and fail on excessively
11581 // deep directory trees.
11582 const rimrafSync = (p, options) => {
11583   options = options || {}
11584   defaults(options)
11585
11586   assert(p, 'rimraf: missing path')
11587   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
11588   assert(options, 'rimraf: missing options')
11589   assert.equal(typeof options, 'object', 'rimraf: options should be object')
11590
11591   let results
11592
11593   if (options.disableGlob || !glob.hasMagic(p)) {
11594     results = [p]
11595   } else {
11596     try {
11597       options.lstatSync(p)
11598       results = [p]
11599     } catch (er) {
11600       results = glob.sync(p, options.glob)
11601     }
11602   }
11603
11604   if (!results.length)
11605     return
11606
11607   for (let i = 0; i < results.length; i++) {
11608     const p = results[i]
11609
11610     let st
11611     try {
11612       st = options.lstatSync(p)
11613     } catch (er) {
11614       if (er.code === "ENOENT")
11615         return
11616
11617       // Windows can EPERM on stat.  Life is suffering.
11618       if (er.code === "EPERM" && isWindows)
11619         fixWinEPERMSync(p, options, er)
11620     }
11621
11622     try {
11623       // sunos lets the root user unlink directories, which is... weird.
11624       if (st && st.isDirectory())
11625         rmdirSync(p, options, null)
11626       else
11627         options.unlinkSync(p)
11628     } catch (er) {
11629       if (er.code === "ENOENT")
11630         return
11631       if (er.code === "EPERM")
11632         return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
11633       if (er.code !== "EISDIR")
11634         throw er
11635
11636       rmdirSync(p, options, er)
11637     }
11638   }
11639 }
11640
11641 const rmdirSync = (p, options, originalEr) => {
11642   assert(p)
11643   assert(options)
11644
11645   try {
11646     options.rmdirSync(p)
11647   } catch (er) {
11648     if (er.code === "ENOENT")
11649       return
11650     if (er.code === "ENOTDIR")
11651       throw originalEr
11652     if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
11653       rmkidsSync(p, options)
11654   }
11655 }
11656
11657 const rmkidsSync = (p, options) => {
11658   assert(p)
11659   assert(options)
11660   options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
11661
11662   // We only end up here once we got ENOTEMPTY at least once, and
11663   // at this point, we are guaranteed to have removed all the kids.
11664   // So, we know that it won't be ENOENT or ENOTDIR or anything else.
11665   // try really hard to delete stuff on windows, because it has a
11666   // PROFOUNDLY annoying habit of not closing handles promptly when
11667   // files are deleted, resulting in spurious ENOTEMPTY errors.
11668   const retries = isWindows ? 100 : 1
11669   let i = 0
11670   do {
11671     let threw = true
11672     try {
11673       const ret = options.rmdirSync(p, options)
11674       threw = false
11675       return ret
11676     } finally {
11677       if (++i < retries && threw)
11678         continue
11679     }
11680   } while (true)
11681 }
11682
11683 module.exports = rimraf
11684 rimraf.sync = rimrafSync
11685
11686
11687 /***/ }),
11688 /* 58 */
11689 /***/ ((module) => {
11690
11691 "use strict";
11692 module.exports = require("assert");;
11693
11694 /***/ }),
11695 /* 59 */
11696 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
11697
11698 // Approach:
11699 //
11700 // 1. Get the minimatch set
11701 // 2. For each pattern in the set, PROCESS(pattern, false)
11702 // 3. Store matches per-set, then uniq them
11703 //
11704 // PROCESS(pattern, inGlobStar)
11705 // Get the first [n] items from pattern that are all strings
11706 // Join these together.  This is PREFIX.
11707 //   If there is no more remaining, then stat(PREFIX) and
11708 //   add to matches if it succeeds.  END.
11709 //
11710 // If inGlobStar and PREFIX is symlink and points to dir
11711 //   set ENTRIES = []
11712 // else readdir(PREFIX) as ENTRIES
11713 //   If fail, END
11714 //
11715 // with ENTRIES
11716 //   If pattern[n] is GLOBSTAR
11717 //     // handle the case where the globstar match is empty
11718 //     // by pruning it out, and testing the resulting pattern
11719 //     PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
11720 //     // handle other cases.
11721 //     for ENTRY in ENTRIES (not dotfiles)
11722 //       // attach globstar + tail onto the entry
11723 //       // Mark that this entry is a globstar match
11724 //       PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
11725 //
11726 //   else // not globstar
11727 //     for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
11728 //       Test ENTRY against pattern[n]
11729 //       If fails, continue
11730 //       If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
11731 //
11732 // Caveat:
11733 //   Cache all stats and readdirs results to minimize syscall.  Since all
11734 //   we ever care about is existence and directory-ness, we can just keep
11735 //   `true` for files, and [children,...] for directories, or `false` for
11736 //   things that don't exist.
11737
11738 module.exports = glob
11739
11740 var fs = __webpack_require__(42)
11741 var rp = __webpack_require__(60)
11742 var minimatch = __webpack_require__(62)
11743 var Minimatch = minimatch.Minimatch
11744 var inherits = __webpack_require__(66)
11745 var EE = __webpack_require__(68).EventEmitter
11746 var path = __webpack_require__(2)
11747 var assert = __webpack_require__(58)
11748 var isAbsolute = __webpack_require__(69)
11749 var globSync = __webpack_require__(70)
11750 var common = __webpack_require__(71)
11751 var alphasort = common.alphasort
11752 var alphasorti = common.alphasorti
11753 var setopts = common.setopts
11754 var ownProp = common.ownProp
11755 var inflight = __webpack_require__(72)
11756 var util = __webpack_require__(50)
11757 var childrenIgnored = common.childrenIgnored
11758 var isIgnored = common.isIgnored
11759
11760 var once = __webpack_require__(74)
11761
11762 function glob (pattern, options, cb) {
11763   if (typeof options === 'function') cb = options, options = {}
11764   if (!options) options = {}
11765
11766   if (options.sync) {
11767     if (cb)
11768       throw new TypeError('callback provided to sync glob')
11769     return globSync(pattern, options)
11770   }
11771
11772   return new Glob(pattern, options, cb)
11773 }
11774
11775 glob.sync = globSync
11776 var GlobSync = glob.GlobSync = globSync.GlobSync
11777
11778 // old api surface
11779 glob.glob = glob
11780
11781 function extend (origin, add) {
11782   if (add === null || typeof add !== 'object') {
11783     return origin
11784   }
11785
11786   var keys = Object.keys(add)
11787   var i = keys.length
11788   while (i--) {
11789     origin[keys[i]] = add[keys[i]]
11790   }
11791   return origin
11792 }
11793
11794 glob.hasMagic = function (pattern, options_) {
11795   var options = extend({}, options_)
11796   options.noprocess = true
11797
11798   var g = new Glob(pattern, options)
11799   var set = g.minimatch.set
11800
11801   if (!pattern)
11802     return false
11803
11804   if (set.length > 1)
11805     return true
11806
11807   for (var j = 0; j < set[0].length; j++) {
11808     if (typeof set[0][j] !== 'string')
11809       return true
11810   }
11811
11812   return false
11813 }
11814
11815 glob.Glob = Glob
11816 inherits(Glob, EE)
11817 function Glob (pattern, options, cb) {
11818   if (typeof options === 'function') {
11819     cb = options
11820     options = null
11821   }
11822
11823   if (options && options.sync) {
11824     if (cb)
11825       throw new TypeError('callback provided to sync glob')
11826     return new GlobSync(pattern, options)
11827   }
11828
11829   if (!(this instanceof Glob))
11830     return new Glob(pattern, options, cb)
11831
11832   setopts(this, pattern, options)
11833   this._didRealPath = false
11834
11835   // process each pattern in the minimatch set
11836   var n = this.minimatch.set.length
11837
11838   // The matches are stored as {<filename>: true,...} so that
11839   // duplicates are automagically pruned.
11840   // Later, we do an Object.keys() on these.
11841   // Keep them as a list so we can fill in when nonull is set.
11842   this.matches = new Array(n)
11843
11844   if (typeof cb === 'function') {
11845     cb = once(cb)
11846     this.on('error', cb)
11847     this.on('end', function (matches) {
11848       cb(null, matches)
11849     })
11850   }
11851
11852   var self = this
11853   this._processing = 0
11854
11855   this._emitQueue = []
11856   this._processQueue = []
11857   this.paused = false
11858
11859   if (this.noprocess)
11860     return this
11861
11862   if (n === 0)
11863     return done()
11864
11865   var sync = true
11866   for (var i = 0; i < n; i ++) {
11867     this._process(this.minimatch.set[i], i, false, done)
11868   }
11869   sync = false
11870
11871   function done () {
11872     --self._processing
11873     if (self._processing <= 0) {
11874       if (sync) {
11875         process.nextTick(function () {
11876           self._finish()
11877         })
11878       } else {
11879         self._finish()
11880       }
11881     }
11882   }
11883 }
11884
11885 Glob.prototype._finish = function () {
11886   assert(this instanceof Glob)
11887   if (this.aborted)
11888     return
11889
11890   if (this.realpath && !this._didRealpath)
11891     return this._realpath()
11892
11893   common.finish(this)
11894   this.emit('end', this.found)
11895 }
11896
11897 Glob.prototype._realpath = function () {
11898   if (this._didRealpath)
11899     return
11900
11901   this._didRealpath = true
11902
11903   var n = this.matches.length
11904   if (n === 0)
11905     return this._finish()
11906
11907   var self = this
11908   for (var i = 0; i < this.matches.length; i++)
11909     this._realpathSet(i, next)
11910
11911   function next () {
11912     if (--n === 0)
11913       self._finish()
11914   }
11915 }
11916
11917 Glob.prototype._realpathSet = function (index, cb) {
11918   var matchset = this.matches[index]
11919   if (!matchset)
11920     return cb()
11921
11922   var found = Object.keys(matchset)
11923   var self = this
11924   var n = found.length
11925
11926   if (n === 0)
11927     return cb()
11928
11929   var set = this.matches[index] = Object.create(null)
11930   found.forEach(function (p, i) {
11931     // If there's a problem with the stat, then it means that
11932     // one or more of the links in the realpath couldn't be
11933     // resolved.  just return the abs value in that case.
11934     p = self._makeAbs(p)
11935     rp.realpath(p, self.realpathCache, function (er, real) {
11936       if (!er)
11937         set[real] = true
11938       else if (er.syscall === 'stat')
11939         set[p] = true
11940       else
11941         self.emit('error', er) // srsly wtf right here
11942
11943       if (--n === 0) {
11944         self.matches[index] = set
11945         cb()
11946       }
11947     })
11948   })
11949 }
11950
11951 Glob.prototype._mark = function (p) {
11952   return common.mark(this, p)
11953 }
11954
11955 Glob.prototype._makeAbs = function (f) {
11956   return common.makeAbs(this, f)
11957 }
11958
11959 Glob.prototype.abort = function () {
11960   this.aborted = true
11961   this.emit('abort')
11962 }
11963
11964 Glob.prototype.pause = function () {
11965   if (!this.paused) {
11966     this.paused = true
11967     this.emit('pause')
11968   }
11969 }
11970
11971 Glob.prototype.resume = function () {
11972   if (this.paused) {
11973     this.emit('resume')
11974     this.paused = false
11975     if (this._emitQueue.length) {
11976       var eq = this._emitQueue.slice(0)
11977       this._emitQueue.length = 0
11978       for (var i = 0; i < eq.length; i ++) {
11979         var e = eq[i]
11980         this._emitMatch(e[0], e[1])
11981       }
11982     }
11983     if (this._processQueue.length) {
11984       var pq = this._processQueue.slice(0)
11985       this._processQueue.length = 0
11986       for (var i = 0; i < pq.length; i ++) {
11987         var p = pq[i]
11988         this._processing--
11989         this._process(p[0], p[1], p[2], p[3])
11990       }
11991     }
11992   }
11993 }
11994
11995 Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
11996   assert(this instanceof Glob)
11997   assert(typeof cb === 'function')
11998
11999   if (this.aborted)
12000     return
12001
12002   this._processing++
12003   if (this.paused) {
12004     this._processQueue.push([pattern, index, inGlobStar, cb])
12005     return
12006   }
12007
12008   //console.error('PROCESS %d', this._processing, pattern)
12009
12010   // Get the first [n] parts of pattern that are all strings.
12011   var n = 0
12012   while (typeof pattern[n] === 'string') {
12013     n ++
12014   }
12015   // now n is the index of the first one that is *not* a string.
12016
12017   // see if there's anything else
12018   var prefix
12019   switch (n) {
12020     // if not, then this is rather simple
12021     case pattern.length:
12022       this._processSimple(pattern.join('/'), index, cb)
12023       return
12024
12025     case 0:
12026       // pattern *starts* with some non-trivial item.
12027       // going to readdir(cwd), but not include the prefix in matches.
12028       prefix = null
12029       break
12030
12031     default:
12032       // pattern has some string bits in the front.
12033       // whatever it starts with, whether that's 'absolute' like /foo/bar,
12034       // or 'relative' like '../baz'
12035       prefix = pattern.slice(0, n).join('/')
12036       break
12037   }
12038
12039   var remain = pattern.slice(n)
12040
12041   // get the list of entries.
12042   var read
12043   if (prefix === null)
12044     read = '.'
12045   else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
12046     if (!prefix || !isAbsolute(prefix))
12047       prefix = '/' + prefix
12048     read = prefix
12049   } else
12050     read = prefix
12051
12052   var abs = this._makeAbs(read)
12053
12054   //if ignored, skip _processing
12055   if (childrenIgnored(this, read))
12056     return cb()
12057
12058   var isGlobStar = remain[0] === minimatch.GLOBSTAR
12059   if (isGlobStar)
12060     this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
12061   else
12062     this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
12063 }
12064
12065 Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
12066   var self = this
12067   this._readdir(abs, inGlobStar, function (er, entries) {
12068     return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
12069   })
12070 }
12071
12072 Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
12073
12074   // if the abs isn't a dir, then nothing can match!
12075   if (!entries)
12076     return cb()
12077
12078   // It will only match dot entries if it starts with a dot, or if
12079   // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
12080   var pn = remain[0]
12081   var negate = !!this.minimatch.negate
12082   var rawGlob = pn._glob
12083   var dotOk = this.dot || rawGlob.charAt(0) === '.'
12084
12085   var matchedEntries = []
12086   for (var i = 0; i < entries.length; i++) {
12087     var e = entries[i]
12088     if (e.charAt(0) !== '.' || dotOk) {
12089       var m
12090       if (negate && !prefix) {
12091         m = !e.match(pn)
12092       } else {
12093         m = e.match(pn)
12094       }
12095       if (m)
12096         matchedEntries.push(e)
12097     }
12098   }
12099
12100   //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
12101
12102   var len = matchedEntries.length
12103   // If there are no matched entries, then nothing matches.
12104   if (len === 0)
12105     return cb()
12106
12107   // if this is the last remaining pattern bit, then no need for
12108   // an additional stat *unless* the user has specified mark or
12109   // stat explicitly.  We know they exist, since readdir returned
12110   // them.
12111
12112   if (remain.length === 1 && !this.mark && !this.stat) {
12113     if (!this.matches[index])
12114       this.matches[index] = Object.create(null)
12115
12116     for (var i = 0; i < len; i ++) {
12117       var e = matchedEntries[i]
12118       if (prefix) {
12119         if (prefix !== '/')
12120           e = prefix + '/' + e
12121         else
12122           e = prefix + e
12123       }
12124
12125       if (e.charAt(0) === '/' && !this.nomount) {
12126         e = path.join(this.root, e)
12127       }
12128       this._emitMatch(index, e)
12129     }
12130     // This was the last one, and no stats were needed
12131     return cb()
12132   }
12133
12134   // now test all matched entries as stand-ins for that part
12135   // of the pattern.
12136   remain.shift()
12137   for (var i = 0; i < len; i ++) {
12138     var e = matchedEntries[i]
12139     var newPattern
12140     if (prefix) {
12141       if (prefix !== '/')
12142         e = prefix + '/' + e
12143       else
12144         e = prefix + e
12145     }
12146     this._process([e].concat(remain), index, inGlobStar, cb)
12147   }
12148   cb()
12149 }
12150
12151 Glob.prototype._emitMatch = function (index, e) {
12152   if (this.aborted)
12153     return
12154
12155   if (isIgnored(this, e))
12156     return
12157
12158   if (this.paused) {
12159     this._emitQueue.push([index, e])
12160     return
12161   }
12162
12163   var abs = isAbsolute(e) ? e : this._makeAbs(e)
12164
12165   if (this.mark)
12166     e = this._mark(e)
12167
12168   if (this.absolute)
12169     e = abs
12170
12171   if (this.matches[index][e])
12172     return
12173
12174   if (this.nodir) {
12175     var c = this.cache[abs]
12176     if (c === 'DIR' || Array.isArray(c))
12177       return
12178   }
12179
12180   this.matches[index][e] = true
12181
12182   var st = this.statCache[abs]
12183   if (st)
12184     this.emit('stat', e, st)
12185
12186   this.emit('match', e)
12187 }
12188
12189 Glob.prototype._readdirInGlobStar = function (abs, cb) {
12190   if (this.aborted)
12191     return
12192
12193   // follow all symlinked directories forever
12194   // just proceed as if this is a non-globstar situation
12195   if (this.follow)
12196     return this._readdir(abs, false, cb)
12197
12198   var lstatkey = 'lstat\0' + abs
12199   var self = this
12200   var lstatcb = inflight(lstatkey, lstatcb_)
12201
12202   if (lstatcb)
12203     fs.lstat(abs, lstatcb)
12204
12205   function lstatcb_ (er, lstat) {
12206     if (er && er.code === 'ENOENT')
12207       return cb()
12208
12209     var isSym = lstat && lstat.isSymbolicLink()
12210     self.symlinks[abs] = isSym
12211
12212     // If it's not a symlink or a dir, then it's definitely a regular file.
12213     // don't bother doing a readdir in that case.
12214     if (!isSym && lstat && !lstat.isDirectory()) {
12215       self.cache[abs] = 'FILE'
12216       cb()
12217     } else
12218       self._readdir(abs, false, cb)
12219   }
12220 }
12221
12222 Glob.prototype._readdir = function (abs, inGlobStar, cb) {
12223   if (this.aborted)
12224     return
12225
12226   cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
12227   if (!cb)
12228     return
12229
12230   //console.error('RD %j %j', +inGlobStar, abs)
12231   if (inGlobStar && !ownProp(this.symlinks, abs))
12232     return this._readdirInGlobStar(abs, cb)
12233
12234   if (ownProp(this.cache, abs)) {
12235     var c = this.cache[abs]
12236     if (!c || c === 'FILE')
12237       return cb()
12238
12239     if (Array.isArray(c))
12240       return cb(null, c)
12241   }
12242
12243   var self = this
12244   fs.readdir(abs, readdirCb(this, abs, cb))
12245 }
12246
12247 function readdirCb (self, abs, cb) {
12248   return function (er, entries) {
12249     if (er)
12250       self._readdirError(abs, er, cb)
12251     else
12252       self._readdirEntries(abs, entries, cb)
12253   }
12254 }
12255
12256 Glob.prototype._readdirEntries = function (abs, entries, cb) {
12257   if (this.aborted)
12258     return
12259
12260   // if we haven't asked to stat everything, then just
12261   // assume that everything in there exists, so we can avoid
12262   // having to stat it a second time.
12263   if (!this.mark && !this.stat) {
12264     for (var i = 0; i < entries.length; i ++) {
12265       var e = entries[i]
12266       if (abs === '/')
12267         e = abs + e
12268       else
12269         e = abs + '/' + e
12270       this.cache[e] = true
12271     }
12272   }
12273
12274   this.cache[abs] = entries
12275   return cb(null, entries)
12276 }
12277
12278 Glob.prototype._readdirError = function (f, er, cb) {
12279   if (this.aborted)
12280     return
12281
12282   // handle errors, and cache the information
12283   switch (er.code) {
12284     case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
12285     case 'ENOTDIR': // totally normal. means it *does* exist.
12286       var abs = this._makeAbs(f)
12287       this.cache[abs] = 'FILE'
12288       if (abs === this.cwdAbs) {
12289         var error = new Error(er.code + ' invalid cwd ' + this.cwd)
12290         error.path = this.cwd
12291         error.code = er.code
12292         this.emit('error', error)
12293         this.abort()
12294       }
12295       break
12296
12297     case 'ENOENT': // not terribly unusual
12298     case 'ELOOP':
12299     case 'ENAMETOOLONG':
12300     case 'UNKNOWN':
12301       this.cache[this._makeAbs(f)] = false
12302       break
12303
12304     default: // some unusual error.  Treat as failure.
12305       this.cache[this._makeAbs(f)] = false
12306       if (this.strict) {
12307         this.emit('error', er)
12308         // If the error is handled, then we abort
12309         // if not, we threw out of here
12310         this.abort()
12311       }
12312       if (!this.silent)
12313         console.error('glob error', er)
12314       break
12315   }
12316
12317   return cb()
12318 }
12319
12320 Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
12321   var self = this
12322   this._readdir(abs, inGlobStar, function (er, entries) {
12323     self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
12324   })
12325 }
12326
12327
12328 Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
12329   //console.error('pgs2', prefix, remain[0], entries)
12330
12331   // no entries means not a dir, so it can never have matches
12332   // foo.txt/** doesn't match foo.txt
12333   if (!entries)
12334     return cb()
12335
12336   // test without the globstar, and with every child both below
12337   // and replacing the globstar.
12338   var remainWithoutGlobStar = remain.slice(1)
12339   var gspref = prefix ? [ prefix ] : []
12340   var noGlobStar = gspref.concat(remainWithoutGlobStar)
12341
12342   // the noGlobStar pattern exits the inGlobStar state
12343   this._process(noGlobStar, index, false, cb)
12344
12345   var isSym = this.symlinks[abs]
12346   var len = entries.length
12347
12348   // If it's a symlink, and we're in a globstar, then stop
12349   if (isSym && inGlobStar)
12350     return cb()
12351
12352   for (var i = 0; i < len; i++) {
12353     var e = entries[i]
12354     if (e.charAt(0) === '.' && !this.dot)
12355       continue
12356
12357     // these two cases enter the inGlobStar state
12358     var instead = gspref.concat(entries[i], remainWithoutGlobStar)
12359     this._process(instead, index, true, cb)
12360
12361     var below = gspref.concat(entries[i], remain)
12362     this._process(below, index, true, cb)
12363   }
12364
12365   cb()
12366 }
12367
12368 Glob.prototype._processSimple = function (prefix, index, cb) {
12369   // XXX review this.  Shouldn't it be doing the mounting etc
12370   // before doing stat?  kinda weird?
12371   var self = this
12372   this._stat(prefix, function (er, exists) {
12373     self._processSimple2(prefix, index, er, exists, cb)
12374   })
12375 }
12376 Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
12377
12378   //console.error('ps2', prefix, exists)
12379
12380   if (!this.matches[index])
12381     this.matches[index] = Object.create(null)
12382
12383   // If it doesn't exist, then just mark the lack of results
12384   if (!exists)
12385     return cb()
12386
12387   if (prefix && isAbsolute(prefix) && !this.nomount) {
12388     var trail = /[\/\\]$/.test(prefix)
12389     if (prefix.charAt(0) === '/') {
12390       prefix = path.join(this.root, prefix)
12391     } else {
12392       prefix = path.resolve(this.root, prefix)
12393       if (trail)
12394         prefix += '/'
12395     }
12396   }
12397
12398   if (process.platform === 'win32')
12399     prefix = prefix.replace(/\\/g, '/')
12400
12401   // Mark this as a match
12402   this._emitMatch(index, prefix)
12403   cb()
12404 }
12405
12406 // Returns either 'DIR', 'FILE', or false
12407 Glob.prototype._stat = function (f, cb) {
12408   var abs = this._makeAbs(f)
12409   var needDir = f.slice(-1) === '/'
12410
12411   if (f.length > this.maxLength)
12412     return cb()
12413
12414   if (!this.stat && ownProp(this.cache, abs)) {
12415     var c = this.cache[abs]
12416
12417     if (Array.isArray(c))
12418       c = 'DIR'
12419
12420     // It exists, but maybe not how we need it
12421     if (!needDir || c === 'DIR')
12422       return cb(null, c)
12423
12424     if (needDir && c === 'FILE')
12425       return cb()
12426
12427     // otherwise we have to stat, because maybe c=true
12428     // if we know it exists, but not what it is.
12429   }
12430
12431   var exists
12432   var stat = this.statCache[abs]
12433   if (stat !== undefined) {
12434     if (stat === false)
12435       return cb(null, stat)
12436     else {
12437       var type = stat.isDirectory() ? 'DIR' : 'FILE'
12438       if (needDir && type === 'FILE')
12439         return cb()
12440       else
12441         return cb(null, type, stat)
12442     }
12443   }
12444
12445   var self = this
12446   var statcb = inflight('stat\0' + abs, lstatcb_)
12447   if (statcb)
12448     fs.lstat(abs, statcb)
12449
12450   function lstatcb_ (er, lstat) {
12451     if (lstat && lstat.isSymbolicLink()) {
12452       // If it's a symlink, then treat it as the target, unless
12453       // the target does not exist, then treat it as a file.
12454       return fs.stat(abs, function (er, stat) {
12455         if (er)
12456           self._stat2(f, abs, null, lstat, cb)
12457         else
12458           self._stat2(f, abs, er, stat, cb)
12459       })
12460     } else {
12461       self._stat2(f, abs, er, lstat, cb)
12462     }
12463   }
12464 }
12465
12466 Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
12467   if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
12468     this.statCache[abs] = false
12469     return cb()
12470   }
12471
12472   var needDir = f.slice(-1) === '/'
12473   this.statCache[abs] = stat
12474
12475   if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
12476     return cb(null, false, stat)
12477
12478   var c = true
12479   if (stat)
12480     c = stat.isDirectory() ? 'DIR' : 'FILE'
12481   this.cache[abs] = this.cache[abs] || c
12482
12483   if (needDir && c === 'FILE')
12484     return cb()
12485
12486   return cb(null, c, stat)
12487 }
12488
12489
12490 /***/ }),
12491 /* 60 */
12492 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
12493
12494 module.exports = realpath
12495 realpath.realpath = realpath
12496 realpath.sync = realpathSync
12497 realpath.realpathSync = realpathSync
12498 realpath.monkeypatch = monkeypatch
12499 realpath.unmonkeypatch = unmonkeypatch
12500
12501 var fs = __webpack_require__(42)
12502 var origRealpath = fs.realpath
12503 var origRealpathSync = fs.realpathSync
12504
12505 var version = process.version
12506 var ok = /^v[0-5]\./.test(version)
12507 var old = __webpack_require__(61)
12508
12509 function newError (er) {
12510   return er && er.syscall === 'realpath' && (
12511     er.code === 'ELOOP' ||
12512     er.code === 'ENOMEM' ||
12513     er.code === 'ENAMETOOLONG'
12514   )
12515 }
12516
12517 function realpath (p, cache, cb) {
12518   if (ok) {
12519     return origRealpath(p, cache, cb)
12520   }
12521
12522   if (typeof cache === 'function') {
12523     cb = cache
12524     cache = null
12525   }
12526   origRealpath(p, cache, function (er, result) {
12527     if (newError(er)) {
12528       old.realpath(p, cache, cb)
12529     } else {
12530       cb(er, result)
12531     }
12532   })
12533 }
12534
12535 function realpathSync (p, cache) {
12536   if (ok) {
12537     return origRealpathSync(p, cache)
12538   }
12539
12540   try {
12541     return origRealpathSync(p, cache)
12542   } catch (er) {
12543     if (newError(er)) {
12544       return old.realpathSync(p, cache)
12545     } else {
12546       throw er
12547     }
12548   }
12549 }
12550
12551 function monkeypatch () {
12552   fs.realpath = realpath
12553   fs.realpathSync = realpathSync
12554 }
12555
12556 function unmonkeypatch () {
12557   fs.realpath = origRealpath
12558   fs.realpathSync = origRealpathSync
12559 }
12560
12561
12562 /***/ }),
12563 /* 61 */
12564 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12565
12566 // Copyright Joyent, Inc. and other Node contributors.
12567 //
12568 // Permission is hereby granted, free of charge, to any person obtaining a
12569 // copy of this software and associated documentation files (the
12570 // "Software"), to deal in the Software without restriction, including
12571 // without limitation the rights to use, copy, modify, merge, publish,
12572 // distribute, sublicense, and/or sell copies of the Software, and to permit
12573 // persons to whom the Software is furnished to do so, subject to the
12574 // following conditions:
12575 //
12576 // The above copyright notice and this permission notice shall be included
12577 // in all copies or substantial portions of the Software.
12578 //
12579 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12580 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12581 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12582 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12583 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12584 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12585 // USE OR OTHER DEALINGS IN THE SOFTWARE.
12586
12587 var pathModule = __webpack_require__(2);
12588 var isWindows = process.platform === 'win32';
12589 var fs = __webpack_require__(42);
12590
12591 // JavaScript implementation of realpath, ported from node pre-v6
12592
12593 var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
12594
12595 function rethrow() {
12596   // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
12597   // is fairly slow to generate.
12598   var callback;
12599   if (DEBUG) {
12600     var backtrace = new Error;
12601     callback = debugCallback;
12602   } else
12603     callback = missingCallback;
12604
12605   return callback;
12606
12607   function debugCallback(err) {
12608     if (err) {
12609       backtrace.message = err.message;
12610       err = backtrace;
12611       missingCallback(err);
12612     }
12613   }
12614
12615   function missingCallback(err) {
12616     if (err) {
12617       if (process.throwDeprecation)
12618         throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
12619       else if (!process.noDeprecation) {
12620         var msg = 'fs: missing callback ' + (err.stack || err.message);
12621         if (process.traceDeprecation)
12622           console.trace(msg);
12623         else
12624           console.error(msg);
12625       }
12626     }
12627   }
12628 }
12629
12630 function maybeCallback(cb) {
12631   return typeof cb === 'function' ? cb : rethrow();
12632 }
12633
12634 var normalize = pathModule.normalize;
12635
12636 // Regexp that finds the next partion of a (partial) path
12637 // result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
12638 if (isWindows) {
12639   var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
12640 } else {
12641   var nextPartRe = /(.*?)(?:[\/]+|$)/g;
12642 }
12643
12644 // Regex to find the device root, including trailing slash. E.g. 'c:\\'.
12645 if (isWindows) {
12646   var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
12647 } else {
12648   var splitRootRe = /^[\/]*/;
12649 }
12650
12651 exports.realpathSync = function realpathSync(p, cache) {
12652   // make p is absolute
12653   p = pathModule.resolve(p);
12654
12655   if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
12656     return cache[p];
12657   }
12658
12659   var original = p,
12660       seenLinks = {},
12661       knownHard = {};
12662
12663   // current character position in p
12664   var pos;
12665   // the partial path so far, including a trailing slash if any
12666   var current;
12667   // the partial path without a trailing slash (except when pointing at a root)
12668   var base;
12669   // the partial path scanned in the previous round, with slash
12670   var previous;
12671
12672   start();
12673
12674   function start() {
12675     // Skip over roots
12676     var m = splitRootRe.exec(p);
12677     pos = m[0].length;
12678     current = m[0];
12679     base = m[0];
12680     previous = '';
12681
12682     // On windows, check that the root exists. On unix there is no need.
12683     if (isWindows && !knownHard[base]) {
12684       fs.lstatSync(base);
12685       knownHard[base] = true;
12686     }
12687   }
12688
12689   // walk down the path, swapping out linked pathparts for their real
12690   // values
12691   // NB: p.length changes.
12692   while (pos < p.length) {
12693     // find the next part
12694     nextPartRe.lastIndex = pos;
12695     var result = nextPartRe.exec(p);
12696     previous = current;
12697     current += result[0];
12698     base = previous + result[1];
12699     pos = nextPartRe.lastIndex;
12700
12701     // continue if not a symlink
12702     if (knownHard[base] || (cache && cache[base] === base)) {
12703       continue;
12704     }
12705
12706     var resolvedLink;
12707     if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
12708       // some known symbolic link.  no need to stat again.
12709       resolvedLink = cache[base];
12710     } else {
12711       var stat = fs.lstatSync(base);
12712       if (!stat.isSymbolicLink()) {
12713         knownHard[base] = true;
12714         if (cache) cache[base] = base;
12715         continue;
12716       }
12717
12718       // read the link if it wasn't read before
12719       // dev/ino always return 0 on windows, so skip the check.
12720       var linkTarget = null;
12721       if (!isWindows) {
12722         var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
12723         if (seenLinks.hasOwnProperty(id)) {
12724           linkTarget = seenLinks[id];
12725         }
12726       }
12727       if (linkTarget === null) {
12728         fs.statSync(base);
12729         linkTarget = fs.readlinkSync(base);
12730       }
12731       resolvedLink = pathModule.resolve(previous, linkTarget);
12732       // track this, if given a cache.
12733       if (cache) cache[base] = resolvedLink;
12734       if (!isWindows) seenLinks[id] = linkTarget;
12735     }
12736
12737     // resolve the link, then start over
12738     p = pathModule.resolve(resolvedLink, p.slice(pos));
12739     start();
12740   }
12741
12742   if (cache) cache[original] = p;
12743
12744   return p;
12745 };
12746
12747
12748 exports.realpath = function realpath(p, cache, cb) {
12749   if (typeof cb !== 'function') {
12750     cb = maybeCallback(cache);
12751     cache = null;
12752   }
12753
12754   // make p is absolute
12755   p = pathModule.resolve(p);
12756
12757   if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
12758     return process.nextTick(cb.bind(null, null, cache[p]));
12759   }
12760
12761   var original = p,
12762       seenLinks = {},
12763       knownHard = {};
12764
12765   // current character position in p
12766   var pos;
12767   // the partial path so far, including a trailing slash if any
12768   var current;
12769   // the partial path without a trailing slash (except when pointing at a root)
12770   var base;
12771   // the partial path scanned in the previous round, with slash
12772   var previous;
12773
12774   start();
12775
12776   function start() {
12777     // Skip over roots
12778     var m = splitRootRe.exec(p);
12779     pos = m[0].length;
12780     current = m[0];
12781     base = m[0];
12782     previous = '';
12783
12784     // On windows, check that the root exists. On unix there is no need.
12785     if (isWindows && !knownHard[base]) {
12786       fs.lstat(base, function(err) {
12787         if (err) return cb(err);
12788         knownHard[base] = true;
12789         LOOP();
12790       });
12791     } else {
12792       process.nextTick(LOOP);
12793     }
12794   }
12795
12796   // walk down the path, swapping out linked pathparts for their real
12797   // values
12798   function LOOP() {
12799     // stop if scanned past end of path
12800     if (pos >= p.length) {
12801       if (cache) cache[original] = p;
12802       return cb(null, p);
12803     }
12804
12805     // find the next part
12806     nextPartRe.lastIndex = pos;
12807     var result = nextPartRe.exec(p);
12808     previous = current;
12809     current += result[0];
12810     base = previous + result[1];
12811     pos = nextPartRe.lastIndex;
12812
12813     // continue if not a symlink
12814     if (knownHard[base] || (cache && cache[base] === base)) {
12815       return process.nextTick(LOOP);
12816     }
12817
12818     if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
12819       // known symbolic link.  no need to stat again.
12820       return gotResolvedLink(cache[base]);
12821     }
12822
12823     return fs.lstat(base, gotStat);
12824   }
12825
12826   function gotStat(err, stat) {
12827     if (err) return cb(err);
12828
12829     // if not a symlink, skip to the next path part
12830     if (!stat.isSymbolicLink()) {
12831       knownHard[base] = true;
12832       if (cache) cache[base] = base;
12833       return process.nextTick(LOOP);
12834     }
12835
12836     // stat & read the link if not read before
12837     // call gotTarget as soon as the link target is known
12838     // dev/ino always return 0 on windows, so skip the check.
12839     if (!isWindows) {
12840       var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
12841       if (seenLinks.hasOwnProperty(id)) {
12842         return gotTarget(null, seenLinks[id], base);
12843       }
12844     }
12845     fs.stat(base, function(err) {
12846       if (err) return cb(err);
12847
12848       fs.readlink(base, function(err, target) {
12849         if (!isWindows) seenLinks[id] = target;
12850         gotTarget(err, target);
12851       });
12852     });
12853   }
12854
12855   function gotTarget(err, target, base) {
12856     if (err) return cb(err);
12857
12858     var resolvedLink = pathModule.resolve(previous, target);
12859     if (cache) cache[base] = resolvedLink;
12860     gotResolvedLink(resolvedLink);
12861   }
12862
12863   function gotResolvedLink(resolvedLink) {
12864     // resolve the link, then start over
12865     p = pathModule.resolve(resolvedLink, p.slice(pos));
12866     start();
12867   }
12868 };
12869
12870
12871 /***/ }),
12872 /* 62 */
12873 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
12874
12875 module.exports = minimatch
12876 minimatch.Minimatch = Minimatch
12877
12878 var path = { sep: '/' }
12879 try {
12880   path = __webpack_require__(2)
12881 } catch (er) {}
12882
12883 var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
12884 var expand = __webpack_require__(63)
12885
12886 var plTypes = {
12887   '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
12888   '?': { open: '(?:', close: ')?' },
12889   '+': { open: '(?:', close: ')+' },
12890   '*': { open: '(?:', close: ')*' },
12891   '@': { open: '(?:', close: ')' }
12892 }
12893
12894 // any single thing other than /
12895 // don't need to escape / when using new RegExp()
12896 var qmark = '[^/]'
12897
12898 // * => any number of characters
12899 var star = qmark + '*?'
12900
12901 // ** when dots are allowed.  Anything goes, except .. and .
12902 // not (^ or / followed by one or two dots followed by $ or /),
12903 // followed by anything, any number of times.
12904 var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
12905
12906 // not a ^ or / followed by a dot,
12907 // followed by anything, any number of times.
12908 var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
12909
12910 // characters that need to be escaped in RegExp.
12911 var reSpecials = charSet('().*{}+?[]^$\\!')
12912
12913 // "abc" -> { a:true, b:true, c:true }
12914 function charSet (s) {
12915   return s.split('').reduce(function (set, c) {
12916     set[c] = true
12917     return set
12918   }, {})
12919 }
12920
12921 // normalizes slashes.
12922 var slashSplit = /\/+/
12923
12924 minimatch.filter = filter
12925 function filter (pattern, options) {
12926   options = options || {}
12927   return function (p, i, list) {
12928     return minimatch(p, pattern, options)
12929   }
12930 }
12931
12932 function ext (a, b) {
12933   a = a || {}
12934   b = b || {}
12935   var t = {}
12936   Object.keys(b).forEach(function (k) {
12937     t[k] = b[k]
12938   })
12939   Object.keys(a).forEach(function (k) {
12940     t[k] = a[k]
12941   })
12942   return t
12943 }
12944
12945 minimatch.defaults = function (def) {
12946   if (!def || !Object.keys(def).length) return minimatch
12947
12948   var orig = minimatch
12949
12950   var m = function minimatch (p, pattern, options) {
12951     return orig.minimatch(p, pattern, ext(def, options))
12952   }
12953
12954   m.Minimatch = function Minimatch (pattern, options) {
12955     return new orig.Minimatch(pattern, ext(def, options))
12956   }
12957
12958   return m
12959 }
12960
12961 Minimatch.defaults = function (def) {
12962   if (!def || !Object.keys(def).length) return Minimatch
12963   return minimatch.defaults(def).Minimatch
12964 }
12965
12966 function minimatch (p, pattern, options) {
12967   if (typeof pattern !== 'string') {
12968     throw new TypeError('glob pattern string required')
12969   }
12970
12971   if (!options) options = {}
12972
12973   // shortcut: comments match nothing.
12974   if (!options.nocomment && pattern.charAt(0) === '#') {
12975     return false
12976   }
12977
12978   // "" only matches ""
12979   if (pattern.trim() === '') return p === ''
12980
12981   return new Minimatch(pattern, options).match(p)
12982 }
12983
12984 function Minimatch (pattern, options) {
12985   if (!(this instanceof Minimatch)) {
12986     return new Minimatch(pattern, options)
12987   }
12988
12989   if (typeof pattern !== 'string') {
12990     throw new TypeError('glob pattern string required')
12991   }
12992
12993   if (!options) options = {}
12994   pattern = pattern.trim()
12995
12996   // windows support: need to use /, not \
12997   if (path.sep !== '/') {
12998     pattern = pattern.split(path.sep).join('/')
12999   }
13000
13001   this.options = options
13002   this.set = []
13003   this.pattern = pattern
13004   this.regexp = null
13005   this.negate = false
13006   this.comment = false
13007   this.empty = false
13008
13009   // make the set of regexps etc.
13010   this.make()
13011 }
13012
13013 Minimatch.prototype.debug = function () {}
13014
13015 Minimatch.prototype.make = make
13016 function make () {
13017   // don't do it more than once.
13018   if (this._made) return
13019
13020   var pattern = this.pattern
13021   var options = this.options
13022
13023   // empty patterns and comments match nothing.
13024   if (!options.nocomment && pattern.charAt(0) === '#') {
13025     this.comment = true
13026     return
13027   }
13028   if (!pattern) {
13029     this.empty = true
13030     return
13031   }
13032
13033   // step 1: figure out negation, etc.
13034   this.parseNegate()
13035
13036   // step 2: expand braces
13037   var set = this.globSet = this.braceExpand()
13038
13039   if (options.debug) this.debug = console.error
13040
13041   this.debug(this.pattern, set)
13042
13043   // step 3: now we have a set, so turn each one into a series of path-portion
13044   // matching patterns.
13045   // These will be regexps, except in the case of "**", which is
13046   // set to the GLOBSTAR object for globstar behavior,
13047   // and will not contain any / characters
13048   set = this.globParts = set.map(function (s) {
13049     return s.split(slashSplit)
13050   })
13051
13052   this.debug(this.pattern, set)
13053
13054   // glob --> regexps
13055   set = set.map(function (s, si, set) {
13056     return s.map(this.parse, this)
13057   }, this)
13058
13059   this.debug(this.pattern, set)
13060
13061   // filter out everything that didn't compile properly.
13062   set = set.filter(function (s) {
13063     return s.indexOf(false) === -1
13064   })
13065
13066   this.debug(this.pattern, set)
13067
13068   this.set = set
13069 }
13070
13071 Minimatch.prototype.parseNegate = parseNegate
13072 function parseNegate () {
13073   var pattern = this.pattern
13074   var negate = false
13075   var options = this.options
13076   var negateOffset = 0
13077
13078   if (options.nonegate) return
13079
13080   for (var i = 0, l = pattern.length
13081     ; i < l && pattern.charAt(i) === '!'
13082     ; i++) {
13083     negate = !negate
13084     negateOffset++
13085   }
13086
13087   if (negateOffset) this.pattern = pattern.substr(negateOffset)
13088   this.negate = negate
13089 }
13090
13091 // Brace expansion:
13092 // a{b,c}d -> abd acd
13093 // a{b,}c -> abc ac
13094 // a{0..3}d -> a0d a1d a2d a3d
13095 // a{b,c{d,e}f}g -> abg acdfg acefg
13096 // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
13097 //
13098 // Invalid sets are not expanded.
13099 // a{2..}b -> a{2..}b
13100 // a{b}c -> a{b}c
13101 minimatch.braceExpand = function (pattern, options) {
13102   return braceExpand(pattern, options)
13103 }
13104
13105 Minimatch.prototype.braceExpand = braceExpand
13106
13107 function braceExpand (pattern, options) {
13108   if (!options) {
13109     if (this instanceof Minimatch) {
13110       options = this.options
13111     } else {
13112       options = {}
13113     }
13114   }
13115
13116   pattern = typeof pattern === 'undefined'
13117     ? this.pattern : pattern
13118
13119   if (typeof pattern === 'undefined') {
13120     throw new TypeError('undefined pattern')
13121   }
13122
13123   if (options.nobrace ||
13124     !pattern.match(/\{.*\}/)) {
13125     // shortcut. no need to expand.
13126     return [pattern]
13127   }
13128
13129   return expand(pattern)
13130 }
13131
13132 // parse a component of the expanded set.
13133 // At this point, no pattern may contain "/" in it
13134 // so we're going to return a 2d array, where each entry is the full
13135 // pattern, split on '/', and then turned into a regular expression.
13136 // A regexp is made at the end which joins each array with an
13137 // escaped /, and another full one which joins each regexp with |.
13138 //
13139 // Following the lead of Bash 4.1, note that "**" only has special meaning
13140 // when it is the *only* thing in a path portion.  Otherwise, any series
13141 // of * is equivalent to a single *.  Globstar behavior is enabled by
13142 // default, and can be disabled by setting options.noglobstar.
13143 Minimatch.prototype.parse = parse
13144 var SUBPARSE = {}
13145 function parse (pattern, isSub) {
13146   if (pattern.length > 1024 * 64) {
13147     throw new TypeError('pattern is too long')
13148   }
13149
13150   var options = this.options
13151
13152   // shortcuts
13153   if (!options.noglobstar && pattern === '**') return GLOBSTAR
13154   if (pattern === '') return ''
13155
13156   var re = ''
13157   var hasMagic = !!options.nocase
13158   var escaping = false
13159   // ? => one single character
13160   var patternListStack = []
13161   var negativeLists = []
13162   var stateChar
13163   var inClass = false
13164   var reClassStart = -1
13165   var classStart = -1
13166   // . and .. never match anything that doesn't start with .,
13167   // even when options.dot is set.
13168   var patternStart = pattern.charAt(0) === '.' ? '' // anything
13169   // not (start or / followed by . or .. followed by / or end)
13170   : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
13171   : '(?!\\.)'
13172   var self = this
13173
13174   function clearStateChar () {
13175     if (stateChar) {
13176       // we had some state-tracking character
13177       // that wasn't consumed by this pass.
13178       switch (stateChar) {
13179         case '*':
13180           re += star
13181           hasMagic = true
13182         break
13183         case '?':
13184           re += qmark
13185           hasMagic = true
13186         break
13187         default:
13188           re += '\\' + stateChar
13189         break
13190       }
13191       self.debug('clearStateChar %j %j', stateChar, re)
13192       stateChar = false
13193     }
13194   }
13195
13196   for (var i = 0, len = pattern.length, c
13197     ; (i < len) && (c = pattern.charAt(i))
13198     ; i++) {
13199     this.debug('%s\t%s %s %j', pattern, i, re, c)
13200
13201     // skip over any that are escaped.
13202     if (escaping && reSpecials[c]) {
13203       re += '\\' + c
13204       escaping = false
13205       continue
13206     }
13207
13208     switch (c) {
13209       case '/':
13210         // completely not allowed, even escaped.
13211         // Should already be path-split by now.
13212         return false
13213
13214       case '\\':
13215         clearStateChar()
13216         escaping = true
13217       continue
13218
13219       // the various stateChar values
13220       // for the "extglob" stuff.
13221       case '?':
13222       case '*':
13223       case '+':
13224       case '@':
13225       case '!':
13226         this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
13227
13228         // all of those are literals inside a class, except that
13229         // the glob [!a] means [^a] in regexp
13230         if (inClass) {
13231           this.debug('  in class')
13232           if (c === '!' && i === classStart + 1) c = '^'
13233           re += c
13234           continue
13235         }
13236
13237         // if we already have a stateChar, then it means
13238         // that there was something like ** or +? in there.
13239         // Handle the stateChar, then proceed with this one.
13240         self.debug('call clearStateChar %j', stateChar)
13241         clearStateChar()
13242         stateChar = c
13243         // if extglob is disabled, then +(asdf|foo) isn't a thing.
13244         // just clear the statechar *now*, rather than even diving into
13245         // the patternList stuff.
13246         if (options.noext) clearStateChar()
13247       continue
13248
13249       case '(':
13250         if (inClass) {
13251           re += '('
13252           continue
13253         }
13254
13255         if (!stateChar) {
13256           re += '\\('
13257           continue
13258         }
13259
13260         patternListStack.push({
13261           type: stateChar,
13262           start: i - 1,
13263           reStart: re.length,
13264           open: plTypes[stateChar].open,
13265           close: plTypes[stateChar].close
13266         })
13267         // negation is (?:(?!js)[^/]*)
13268         re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
13269         this.debug('plType %j %j', stateChar, re)
13270         stateChar = false
13271       continue
13272
13273       case ')':
13274         if (inClass || !patternListStack.length) {
13275           re += '\\)'
13276           continue
13277         }
13278
13279         clearStateChar()
13280         hasMagic = true
13281         var pl = patternListStack.pop()
13282         // negation is (?:(?!js)[^/]*)
13283         // The others are (?:<pattern>)<type>
13284         re += pl.close
13285         if (pl.type === '!') {
13286           negativeLists.push(pl)
13287         }
13288         pl.reEnd = re.length
13289       continue
13290
13291       case '|':
13292         if (inClass || !patternListStack.length || escaping) {
13293           re += '\\|'
13294           escaping = false
13295           continue
13296         }
13297
13298         clearStateChar()
13299         re += '|'
13300       continue
13301
13302       // these are mostly the same in regexp and glob
13303       case '[':
13304         // swallow any state-tracking char before the [
13305         clearStateChar()
13306
13307         if (inClass) {
13308           re += '\\' + c
13309           continue
13310         }
13311
13312         inClass = true
13313         classStart = i
13314         reClassStart = re.length
13315         re += c
13316       continue
13317
13318       case ']':
13319         //  a right bracket shall lose its special
13320         //  meaning and represent itself in
13321         //  a bracket expression if it occurs
13322         //  first in the list.  -- POSIX.2 2.8.3.2
13323         if (i === classStart + 1 || !inClass) {
13324           re += '\\' + c
13325           escaping = false
13326           continue
13327         }
13328
13329         // handle the case where we left a class open.
13330         // "[z-a]" is valid, equivalent to "\[z-a\]"
13331         if (inClass) {
13332           // split where the last [ was, make sure we don't have
13333           // an invalid re. if so, re-walk the contents of the
13334           // would-be class to re-translate any characters that
13335           // were passed through as-is
13336           // TODO: It would probably be faster to determine this
13337           // without a try/catch and a new RegExp, but it's tricky
13338           // to do safely.  For now, this is safe and works.
13339           var cs = pattern.substring(classStart + 1, i)
13340           try {
13341             RegExp('[' + cs + ']')
13342           } catch (er) {
13343             // not a valid class!
13344             var sp = this.parse(cs, SUBPARSE)
13345             re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
13346             hasMagic = hasMagic || sp[1]
13347             inClass = false
13348             continue
13349           }
13350         }
13351
13352         // finish up the class.
13353         hasMagic = true
13354         inClass = false
13355         re += c
13356       continue
13357
13358       default:
13359         // swallow any state char that wasn't consumed
13360         clearStateChar()
13361
13362         if (escaping) {
13363           // no need
13364           escaping = false
13365         } else if (reSpecials[c]
13366           && !(c === '^' && inClass)) {
13367           re += '\\'
13368         }
13369
13370         re += c
13371
13372     } // switch
13373   } // for
13374
13375   // handle the case where we left a class open.
13376   // "[abc" is valid, equivalent to "\[abc"
13377   if (inClass) {
13378     // split where the last [ was, and escape it
13379     // this is a huge pita.  We now have to re-walk
13380     // the contents of the would-be class to re-translate
13381     // any characters that were passed through as-is
13382     cs = pattern.substr(classStart + 1)
13383     sp = this.parse(cs, SUBPARSE)
13384     re = re.substr(0, reClassStart) + '\\[' + sp[0]
13385     hasMagic = hasMagic || sp[1]
13386   }
13387
13388   // handle the case where we had a +( thing at the *end*
13389   // of the pattern.
13390   // each pattern list stack adds 3 chars, and we need to go through
13391   // and escape any | chars that were passed through as-is for the regexp.
13392   // Go through and escape them, taking care not to double-escape any
13393   // | chars that were already escaped.
13394   for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
13395     var tail = re.slice(pl.reStart + pl.open.length)
13396     this.debug('setting tail', re, pl)
13397     // maybe some even number of \, then maybe 1 \, followed by a |
13398     tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
13399       if (!$2) {
13400         // the | isn't already escaped, so escape it.
13401         $2 = '\\'
13402       }
13403
13404       // need to escape all those slashes *again*, without escaping the
13405       // one that we need for escaping the | character.  As it works out,
13406       // escaping an even number of slashes can be done by simply repeating
13407       // it exactly after itself.  That's why this trick works.
13408       //
13409       // I am sorry that you have to see this.
13410       return $1 + $1 + $2 + '|'
13411     })
13412
13413     this.debug('tail=%j\n   %s', tail, tail, pl, re)
13414     var t = pl.type === '*' ? star
13415       : pl.type === '?' ? qmark
13416       : '\\' + pl.type
13417
13418     hasMagic = true
13419     re = re.slice(0, pl.reStart) + t + '\\(' + tail
13420   }
13421
13422   // handle trailing things that only matter at the very end.
13423   clearStateChar()
13424   if (escaping) {
13425     // trailing \\
13426     re += '\\\\'
13427   }
13428
13429   // only need to apply the nodot start if the re starts with
13430   // something that could conceivably capture a dot
13431   var addPatternStart = false
13432   switch (re.charAt(0)) {
13433     case '.':
13434     case '[':
13435     case '(': addPatternStart = true
13436   }
13437
13438   // Hack to work around lack of negative lookbehind in JS
13439   // A pattern like: *.!(x).!(y|z) needs to ensure that a name
13440   // like 'a.xyz.yz' doesn't match.  So, the first negative
13441   // lookahead, has to look ALL the way ahead, to the end of
13442   // the pattern.
13443   for (var n = negativeLists.length - 1; n > -1; n--) {
13444     var nl = negativeLists[n]
13445
13446     var nlBefore = re.slice(0, nl.reStart)
13447     var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
13448     var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
13449     var nlAfter = re.slice(nl.reEnd)
13450
13451     nlLast += nlAfter
13452
13453     // Handle nested stuff like *(*.js|!(*.json)), where open parens
13454     // mean that we should *not* include the ) in the bit that is considered
13455     // "after" the negated section.
13456     var openParensBefore = nlBefore.split('(').length - 1
13457     var cleanAfter = nlAfter
13458     for (i = 0; i < openParensBefore; i++) {
13459       cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
13460     }
13461     nlAfter = cleanAfter
13462
13463     var dollar = ''
13464     if (nlAfter === '' && isSub !== SUBPARSE) {
13465       dollar = '$'
13466     }
13467     var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
13468     re = newRe
13469   }
13470
13471   // if the re is not "" at this point, then we need to make sure
13472   // it doesn't match against an empty path part.
13473   // Otherwise a/* will match a/, which it should not.
13474   if (re !== '' && hasMagic) {
13475     re = '(?=.)' + re
13476   }
13477
13478   if (addPatternStart) {
13479     re = patternStart + re
13480   }
13481
13482   // parsing just a piece of a larger pattern.
13483   if (isSub === SUBPARSE) {
13484     return [re, hasMagic]
13485   }
13486
13487   // skip the regexp for non-magical patterns
13488   // unescape anything in it, though, so that it'll be
13489   // an exact match against a file etc.
13490   if (!hasMagic) {
13491     return globUnescape(pattern)
13492   }
13493
13494   var flags = options.nocase ? 'i' : ''
13495   try {
13496     var regExp = new RegExp('^' + re + '$', flags)
13497   } catch (er) {
13498     // If it was an invalid regular expression, then it can't match
13499     // anything.  This trick looks for a character after the end of
13500     // the string, which is of course impossible, except in multi-line
13501     // mode, but it's not a /m regex.
13502     return new RegExp('$.')
13503   }
13504
13505   regExp._glob = pattern
13506   regExp._src = re
13507
13508   return regExp
13509 }
13510
13511 minimatch.makeRe = function (pattern, options) {
13512   return new Minimatch(pattern, options || {}).makeRe()
13513 }
13514
13515 Minimatch.prototype.makeRe = makeRe
13516 function makeRe () {
13517   if (this.regexp || this.regexp === false) return this.regexp
13518
13519   // at this point, this.set is a 2d array of partial
13520   // pattern strings, or "**".
13521   //
13522   // It's better to use .match().  This function shouldn't
13523   // be used, really, but it's pretty convenient sometimes,
13524   // when you just want to work with a regex.
13525   var set = this.set
13526
13527   if (!set.length) {
13528     this.regexp = false
13529     return this.regexp
13530   }
13531   var options = this.options
13532
13533   var twoStar = options.noglobstar ? star
13534     : options.dot ? twoStarDot
13535     : twoStarNoDot
13536   var flags = options.nocase ? 'i' : ''
13537
13538   var re = set.map(function (pattern) {
13539     return pattern.map(function (p) {
13540       return (p === GLOBSTAR) ? twoStar
13541       : (typeof p === 'string') ? regExpEscape(p)
13542       : p._src
13543     }).join('\\\/')
13544   }).join('|')
13545
13546   // must match entire pattern
13547   // ending in a * or ** will make it less strict.
13548   re = '^(?:' + re + ')$'
13549
13550   // can match anything, as long as it's not this.
13551   if (this.negate) re = '^(?!' + re + ').*$'
13552
13553   try {
13554     this.regexp = new RegExp(re, flags)
13555   } catch (ex) {
13556     this.regexp = false
13557   }
13558   return this.regexp
13559 }
13560
13561 minimatch.match = function (list, pattern, options) {
13562   options = options || {}
13563   var mm = new Minimatch(pattern, options)
13564   list = list.filter(function (f) {
13565     return mm.match(f)
13566   })
13567   if (mm.options.nonull && !list.length) {
13568     list.push(pattern)
13569   }
13570   return list
13571 }
13572
13573 Minimatch.prototype.match = match
13574 function match (f, partial) {
13575   this.debug('match', f, this.pattern)
13576   // short-circuit in the case of busted things.
13577   // comments, etc.
13578   if (this.comment) return false
13579   if (this.empty) return f === ''
13580
13581   if (f === '/' && partial) return true
13582
13583   var options = this.options
13584
13585   // windows: need to use /, not \
13586   if (path.sep !== '/') {
13587     f = f.split(path.sep).join('/')
13588   }
13589
13590   // treat the test path as a set of pathparts.
13591   f = f.split(slashSplit)
13592   this.debug(this.pattern, 'split', f)
13593
13594   // just ONE of the pattern sets in this.set needs to match
13595   // in order for it to be valid.  If negating, then just one
13596   // match means that we have failed.
13597   // Either way, return on the first hit.
13598
13599   var set = this.set
13600   this.debug(this.pattern, 'set', set)
13601
13602   // Find the basename of the path by looking for the last non-empty segment
13603   var filename
13604   var i
13605   for (i = f.length - 1; i >= 0; i--) {
13606     filename = f[i]
13607     if (filename) break
13608   }
13609
13610   for (i = 0; i < set.length; i++) {
13611     var pattern = set[i]
13612     var file = f
13613     if (options.matchBase && pattern.length === 1) {
13614       file = [filename]
13615     }
13616     var hit = this.matchOne(file, pattern, partial)
13617     if (hit) {
13618       if (options.flipNegate) return true
13619       return !this.negate
13620     }
13621   }
13622
13623   // didn't get any hits.  this is success if it's a negative
13624   // pattern, failure otherwise.
13625   if (options.flipNegate) return false
13626   return this.negate
13627 }
13628
13629 // set partial to true to test if, for example,
13630 // "/a/b" matches the start of "/*/b/*/d"
13631 // Partial means, if you run out of file before you run
13632 // out of pattern, then that's fine, as long as all
13633 // the parts match.
13634 Minimatch.prototype.matchOne = function (file, pattern, partial) {
13635   var options = this.options
13636
13637   this.debug('matchOne',
13638     { 'this': this, file: file, pattern: pattern })
13639
13640   this.debug('matchOne', file.length, pattern.length)
13641
13642   for (var fi = 0,
13643       pi = 0,
13644       fl = file.length,
13645       pl = pattern.length
13646       ; (fi < fl) && (pi < pl)
13647       ; fi++, pi++) {
13648     this.debug('matchOne loop')
13649     var p = pattern[pi]
13650     var f = file[fi]
13651
13652     this.debug(pattern, p, f)
13653
13654     // should be impossible.
13655     // some invalid regexp stuff in the set.
13656     if (p === false) return false
13657
13658     if (p === GLOBSTAR) {
13659       this.debug('GLOBSTAR', [pattern, p, f])
13660
13661       // "**"
13662       // a/**/b/**/c would match the following:
13663       // a/b/x/y/z/c
13664       // a/x/y/z/b/c
13665       // a/b/x/b/x/c
13666       // a/b/c
13667       // To do this, take the rest of the pattern after
13668       // the **, and see if it would match the file remainder.
13669       // If so, return success.
13670       // If not, the ** "swallows" a segment, and try again.
13671       // This is recursively awful.
13672       //
13673       // a/**/b/**/c matching a/b/x/y/z/c
13674       // - a matches a
13675       // - doublestar
13676       //   - matchOne(b/x/y/z/c, b/**/c)
13677       //     - b matches b
13678       //     - doublestar
13679       //       - matchOne(x/y/z/c, c) -> no
13680       //       - matchOne(y/z/c, c) -> no
13681       //       - matchOne(z/c, c) -> no
13682       //       - matchOne(c, c) yes, hit
13683       var fr = fi
13684       var pr = pi + 1
13685       if (pr === pl) {
13686         this.debug('** at the end')
13687         // a ** at the end will just swallow the rest.
13688         // We have found a match.
13689         // however, it will not swallow /.x, unless
13690         // options.dot is set.
13691         // . and .. are *never* matched by **, for explosively
13692         // exponential reasons.
13693         for (; fi < fl; fi++) {
13694           if (file[fi] === '.' || file[fi] === '..' ||
13695             (!options.dot && file[fi].charAt(0) === '.')) return false
13696         }
13697         return true
13698       }
13699
13700       // ok, let's see if we can swallow whatever we can.
13701       while (fr < fl) {
13702         var swallowee = file[fr]
13703
13704         this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
13705
13706         // XXX remove this slice.  Just pass the start index.
13707         if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
13708           this.debug('globstar found match!', fr, fl, swallowee)
13709           // found a match.
13710           return true
13711         } else {
13712           // can't swallow "." or ".." ever.
13713           // can only swallow ".foo" when explicitly asked.
13714           if (swallowee === '.' || swallowee === '..' ||
13715             (!options.dot && swallowee.charAt(0) === '.')) {
13716             this.debug('dot detected!', file, fr, pattern, pr)
13717             break
13718           }
13719
13720           // ** swallows a segment, and continue.
13721           this.debug('globstar swallow a segment, and continue')
13722           fr++
13723         }
13724       }
13725
13726       // no match was found.
13727       // However, in partial mode, we can't say this is necessarily over.
13728       // If there's more *pattern* left, then
13729       if (partial) {
13730         // ran out of file
13731         this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
13732         if (fr === fl) return true
13733       }
13734       return false
13735     }
13736
13737     // something other than **
13738     // non-magic patterns just have to match exactly
13739     // patterns with magic have been turned into regexps.
13740     var hit
13741     if (typeof p === 'string') {
13742       if (options.nocase) {
13743         hit = f.toLowerCase() === p.toLowerCase()
13744       } else {
13745         hit = f === p
13746       }
13747       this.debug('string match', p, f, hit)
13748     } else {
13749       hit = f.match(p)
13750       this.debug('pattern match', p, f, hit)
13751     }
13752
13753     if (!hit) return false
13754   }
13755
13756   // Note: ending in / means that we'll get a final ""
13757   // at the end of the pattern.  This can only match a
13758   // corresponding "" at the end of the file.
13759   // If the file ends in /, then it can only match a
13760   // a pattern that ends in /, unless the pattern just
13761   // doesn't have any more for it. But, a/b/ should *not*
13762   // match "a/b/*", even though "" matches against the
13763   // [^/]*? pattern, except in partial mode, where it might
13764   // simply not be reached yet.
13765   // However, a/b/ should still satisfy a/*
13766
13767   // now either we fell off the end of the pattern, or we're done.
13768   if (fi === fl && pi === pl) {
13769     // ran out of pattern and filename at the same time.
13770     // an exact hit!
13771     return true
13772   } else if (fi === fl) {
13773     // ran out of file, but still had pattern left.
13774     // this is ok if we're doing the match as part of
13775     // a glob fs traversal.
13776     return partial
13777   } else if (pi === pl) {
13778     // ran out of pattern, still have file left.
13779     // this is only acceptable if we're on the very last
13780     // empty segment of a file with a trailing slash.
13781     // a/* should match a/b/
13782     var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
13783     return emptyFileEnd
13784   }
13785
13786   // should be unreachable.
13787   throw new Error('wtf?')
13788 }
13789
13790 // replace stuff like \* with *
13791 function globUnescape (s) {
13792   return s.replace(/\\(.)/g, '$1')
13793 }
13794
13795 function regExpEscape (s) {
13796   return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
13797 }
13798
13799
13800 /***/ }),
13801 /* 63 */
13802 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
13803
13804 var concatMap = __webpack_require__(64);
13805 var balanced = __webpack_require__(65);
13806
13807 module.exports = expandTop;
13808
13809 var escSlash = '\0SLASH'+Math.random()+'\0';
13810 var escOpen = '\0OPEN'+Math.random()+'\0';
13811 var escClose = '\0CLOSE'+Math.random()+'\0';
13812 var escComma = '\0COMMA'+Math.random()+'\0';
13813 var escPeriod = '\0PERIOD'+Math.random()+'\0';
13814
13815 function numeric(str) {
13816   return parseInt(str, 10) == str
13817     ? parseInt(str, 10)
13818     : str.charCodeAt(0);
13819 }
13820
13821 function escapeBraces(str) {
13822   return str.split('\\\\').join(escSlash)
13823             .split('\\{').join(escOpen)
13824             .split('\\}').join(escClose)
13825             .split('\\,').join(escComma)
13826             .split('\\.').join(escPeriod);
13827 }
13828
13829 function unescapeBraces(str) {
13830   return str.split(escSlash).join('\\')
13831             .split(escOpen).join('{')
13832             .split(escClose).join('}')
13833             .split(escComma).join(',')
13834             .split(escPeriod).join('.');
13835 }
13836
13837
13838 // Basically just str.split(","), but handling cases
13839 // where we have nested braced sections, which should be
13840 // treated as individual members, like {a,{b,c},d}
13841 function parseCommaParts(str) {
13842   if (!str)
13843     return [''];
13844
13845   var parts = [];
13846   var m = balanced('{', '}', str);
13847
13848   if (!m)
13849     return str.split(',');
13850
13851   var pre = m.pre;
13852   var body = m.body;
13853   var post = m.post;
13854   var p = pre.split(',');
13855
13856   p[p.length-1] += '{' + body + '}';
13857   var postParts = parseCommaParts(post);
13858   if (post.length) {
13859     p[p.length-1] += postParts.shift();
13860     p.push.apply(p, postParts);
13861   }
13862
13863   parts.push.apply(parts, p);
13864
13865   return parts;
13866 }
13867
13868 function expandTop(str) {
13869   if (!str)
13870     return [];
13871
13872   // I don't know why Bash 4.3 does this, but it does.
13873   // Anything starting with {} will have the first two bytes preserved
13874   // but *only* at the top level, so {},a}b will not expand to anything,
13875   // but a{},b}c will be expanded to [a}c,abc].
13876   // One could argue that this is a bug in Bash, but since the goal of
13877   // this module is to match Bash's rules, we escape a leading {}
13878   if (str.substr(0, 2) === '{}') {
13879     str = '\\{\\}' + str.substr(2);
13880   }
13881
13882   return expand(escapeBraces(str), true).map(unescapeBraces);
13883 }
13884
13885 function identity(e) {
13886   return e;
13887 }
13888
13889 function embrace(str) {
13890   return '{' + str + '}';
13891 }
13892 function isPadded(el) {
13893   return /^-?0\d/.test(el);
13894 }
13895
13896 function lte(i, y) {
13897   return i <= y;
13898 }
13899 function gte(i, y) {
13900   return i >= y;
13901 }
13902
13903 function expand(str, isTop) {
13904   var expansions = [];
13905
13906   var m = balanced('{', '}', str);
13907   if (!m || /\$$/.test(m.pre)) return [str];
13908
13909   var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
13910   var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
13911   var isSequence = isNumericSequence || isAlphaSequence;
13912   var isOptions = m.body.indexOf(',') >= 0;
13913   if (!isSequence && !isOptions) {
13914     // {a},b}
13915     if (m.post.match(/,.*\}/)) {
13916       str = m.pre + '{' + m.body + escClose + m.post;
13917       return expand(str);
13918     }
13919     return [str];
13920   }
13921
13922   var n;
13923   if (isSequence) {
13924     n = m.body.split(/\.\./);
13925   } else {
13926     n = parseCommaParts(m.body);
13927     if (n.length === 1) {
13928       // x{{a,b}}y ==> x{a}y x{b}y
13929       n = expand(n[0], false).map(embrace);
13930       if (n.length === 1) {
13931         var post = m.post.length
13932           ? expand(m.post, false)
13933           : [''];
13934         return post.map(function(p) {
13935           return m.pre + n[0] + p;
13936         });
13937       }
13938     }
13939   }
13940
13941   // at this point, n is the parts, and we know it's not a comma set
13942   // with a single entry.
13943
13944   // no need to expand pre, since it is guaranteed to be free of brace-sets
13945   var pre = m.pre;
13946   var post = m.post.length
13947     ? expand(m.post, false)
13948     : [''];
13949
13950   var N;
13951
13952   if (isSequence) {
13953     var x = numeric(n[0]);
13954     var y = numeric(n[1]);
13955     var width = Math.max(n[0].length, n[1].length)
13956     var incr = n.length == 3
13957       ? Math.abs(numeric(n[2]))
13958       : 1;
13959     var test = lte;
13960     var reverse = y < x;
13961     if (reverse) {
13962       incr *= -1;
13963       test = gte;
13964     }
13965     var pad = n.some(isPadded);
13966
13967     N = [];
13968
13969     for (var i = x; test(i, y); i += incr) {
13970       var c;
13971       if (isAlphaSequence) {
13972         c = String.fromCharCode(i);
13973         if (c === '\\')
13974           c = '';
13975       } else {
13976         c = String(i);
13977         if (pad) {
13978           var need = width - c.length;
13979           if (need > 0) {
13980             var z = new Array(need + 1).join('0');
13981             if (i < 0)
13982               c = '-' + z + c.slice(1);
13983             else
13984               c = z + c;
13985           }
13986         }
13987       }
13988       N.push(c);
13989     }
13990   } else {
13991     N = concatMap(n, function(el) { return expand(el, false) });
13992   }
13993
13994   for (var j = 0; j < N.length; j++) {
13995     for (var k = 0; k < post.length; k++) {
13996       var expansion = pre + N[j] + post[k];
13997       if (!isTop || isSequence || expansion)
13998         expansions.push(expansion);
13999     }
14000   }
14001
14002   return expansions;
14003 }
14004
14005
14006
14007 /***/ }),
14008 /* 64 */
14009 /***/ ((module) => {
14010
14011 module.exports = function (xs, fn) {
14012     var res = [];
14013     for (var i = 0; i < xs.length; i++) {
14014         var x = fn(xs[i], i);
14015         if (isArray(x)) res.push.apply(res, x);
14016         else res.push(x);
14017     }
14018     return res;
14019 };
14020
14021 var isArray = Array.isArray || function (xs) {
14022     return Object.prototype.toString.call(xs) === '[object Array]';
14023 };
14024
14025
14026 /***/ }),
14027 /* 65 */
14028 /***/ ((module) => {
14029
14030 "use strict";
14031
14032 module.exports = balanced;
14033 function balanced(a, b, str) {
14034   if (a instanceof RegExp) a = maybeMatch(a, str);
14035   if (b instanceof RegExp) b = maybeMatch(b, str);
14036
14037   var r = range(a, b, str);
14038
14039   return r && {
14040     start: r[0],
14041     end: r[1],
14042     pre: str.slice(0, r[0]),
14043     body: str.slice(r[0] + a.length, r[1]),
14044     post: str.slice(r[1] + b.length)
14045   };
14046 }
14047
14048 function maybeMatch(reg, str) {
14049   var m = str.match(reg);
14050   return m ? m[0] : null;
14051 }
14052
14053 balanced.range = range;
14054 function range(a, b, str) {
14055   var begs, beg, left, right, result;
14056   var ai = str.indexOf(a);
14057   var bi = str.indexOf(b, ai + 1);
14058   var i = ai;
14059
14060   if (ai >= 0 && bi > 0) {
14061     begs = [];
14062     left = str.length;
14063
14064     while (i >= 0 && !result) {
14065       if (i == ai) {
14066         begs.push(i);
14067         ai = str.indexOf(a, i + 1);
14068       } else if (begs.length == 1) {
14069         result = [ begs.pop(), bi ];
14070       } else {
14071         beg = begs.pop();
14072         if (beg < left) {
14073           left = beg;
14074           right = bi;
14075         }
14076
14077         bi = str.indexOf(b, i + 1);
14078       }
14079
14080       i = ai < bi && ai >= 0 ? ai : bi;
14081     }
14082
14083     if (begs.length) {
14084       result = [ left, right ];
14085     }
14086   }
14087
14088   return result;
14089 }
14090
14091
14092 /***/ }),
14093 /* 66 */
14094 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14095
14096 try {
14097   var util = __webpack_require__(50);
14098   /* istanbul ignore next */
14099   if (typeof util.inherits !== 'function') throw '';
14100   module.exports = util.inherits;
14101 } catch (e) {
14102   /* istanbul ignore next */
14103   module.exports = __webpack_require__(67);
14104 }
14105
14106
14107 /***/ }),
14108 /* 67 */
14109 /***/ ((module) => {
14110
14111 if (typeof Object.create === 'function') {
14112   // implementation from standard node.js 'util' module
14113   module.exports = function inherits(ctor, superCtor) {
14114     if (superCtor) {
14115       ctor.super_ = superCtor
14116       ctor.prototype = Object.create(superCtor.prototype, {
14117         constructor: {
14118           value: ctor,
14119           enumerable: false,
14120           writable: true,
14121           configurable: true
14122         }
14123       })
14124     }
14125   };
14126 } else {
14127   // old school shim for old browsers
14128   module.exports = function inherits(ctor, superCtor) {
14129     if (superCtor) {
14130       ctor.super_ = superCtor
14131       var TempCtor = function () {}
14132       TempCtor.prototype = superCtor.prototype
14133       ctor.prototype = new TempCtor()
14134       ctor.prototype.constructor = ctor
14135     }
14136   }
14137 }
14138
14139
14140 /***/ }),
14141 /* 68 */
14142 /***/ ((module) => {
14143
14144 "use strict";
14145 module.exports = require("events");;
14146
14147 /***/ }),
14148 /* 69 */
14149 /***/ ((module) => {
14150
14151 "use strict";
14152
14153
14154 function posix(path) {
14155         return path.charAt(0) === '/';
14156 }
14157
14158 function win32(path) {
14159         // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
14160         var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
14161         var result = splitDeviceRe.exec(path);
14162         var device = result[1] || '';
14163         var isUnc = Boolean(device && device.charAt(1) !== ':');
14164
14165         // UNC paths are always absolute
14166         return Boolean(result[2] || isUnc);
14167 }
14168
14169 module.exports = process.platform === 'win32' ? win32 : posix;
14170 module.exports.posix = posix;
14171 module.exports.win32 = win32;
14172
14173
14174 /***/ }),
14175 /* 70 */
14176 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14177
14178 module.exports = globSync
14179 globSync.GlobSync = GlobSync
14180
14181 var fs = __webpack_require__(42)
14182 var rp = __webpack_require__(60)
14183 var minimatch = __webpack_require__(62)
14184 var Minimatch = minimatch.Minimatch
14185 var Glob = __webpack_require__(59).Glob
14186 var util = __webpack_require__(50)
14187 var path = __webpack_require__(2)
14188 var assert = __webpack_require__(58)
14189 var isAbsolute = __webpack_require__(69)
14190 var common = __webpack_require__(71)
14191 var alphasort = common.alphasort
14192 var alphasorti = common.alphasorti
14193 var setopts = common.setopts
14194 var ownProp = common.ownProp
14195 var childrenIgnored = common.childrenIgnored
14196 var isIgnored = common.isIgnored
14197
14198 function globSync (pattern, options) {
14199   if (typeof options === 'function' || arguments.length === 3)
14200     throw new TypeError('callback provided to sync glob\n'+
14201                         'See: https://github.com/isaacs/node-glob/issues/167')
14202
14203   return new GlobSync(pattern, options).found
14204 }
14205
14206 function GlobSync (pattern, options) {
14207   if (!pattern)
14208     throw new Error('must provide pattern')
14209
14210   if (typeof options === 'function' || arguments.length === 3)
14211     throw new TypeError('callback provided to sync glob\n'+
14212                         'See: https://github.com/isaacs/node-glob/issues/167')
14213
14214   if (!(this instanceof GlobSync))
14215     return new GlobSync(pattern, options)
14216
14217   setopts(this, pattern, options)
14218
14219   if (this.noprocess)
14220     return this
14221
14222   var n = this.minimatch.set.length
14223   this.matches = new Array(n)
14224   for (var i = 0; i < n; i ++) {
14225     this._process(this.minimatch.set[i], i, false)
14226   }
14227   this._finish()
14228 }
14229
14230 GlobSync.prototype._finish = function () {
14231   assert(this instanceof GlobSync)
14232   if (this.realpath) {
14233     var self = this
14234     this.matches.forEach(function (matchset, index) {
14235       var set = self.matches[index] = Object.create(null)
14236       for (var p in matchset) {
14237         try {
14238           p = self._makeAbs(p)
14239           var real = rp.realpathSync(p, self.realpathCache)
14240           set[real] = true
14241         } catch (er) {
14242           if (er.syscall === 'stat')
14243             set[self._makeAbs(p)] = true
14244           else
14245             throw er
14246         }
14247       }
14248     })
14249   }
14250   common.finish(this)
14251 }
14252
14253
14254 GlobSync.prototype._process = function (pattern, index, inGlobStar) {
14255   assert(this instanceof GlobSync)
14256
14257   // Get the first [n] parts of pattern that are all strings.
14258   var n = 0
14259   while (typeof pattern[n] === 'string') {
14260     n ++
14261   }
14262   // now n is the index of the first one that is *not* a string.
14263
14264   // See if there's anything else
14265   var prefix
14266   switch (n) {
14267     // if not, then this is rather simple
14268     case pattern.length:
14269       this._processSimple(pattern.join('/'), index)
14270       return
14271
14272     case 0:
14273       // pattern *starts* with some non-trivial item.
14274       // going to readdir(cwd), but not include the prefix in matches.
14275       prefix = null
14276       break
14277
14278     default:
14279       // pattern has some string bits in the front.
14280       // whatever it starts with, whether that's 'absolute' like /foo/bar,
14281       // or 'relative' like '../baz'
14282       prefix = pattern.slice(0, n).join('/')
14283       break
14284   }
14285
14286   var remain = pattern.slice(n)
14287
14288   // get the list of entries.
14289   var read
14290   if (prefix === null)
14291     read = '.'
14292   else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
14293     if (!prefix || !isAbsolute(prefix))
14294       prefix = '/' + prefix
14295     read = prefix
14296   } else
14297     read = prefix
14298
14299   var abs = this._makeAbs(read)
14300
14301   //if ignored, skip processing
14302   if (childrenIgnored(this, read))
14303     return
14304
14305   var isGlobStar = remain[0] === minimatch.GLOBSTAR
14306   if (isGlobStar)
14307     this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
14308   else
14309     this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
14310 }
14311
14312
14313 GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
14314   var entries = this._readdir(abs, inGlobStar)
14315
14316   // if the abs isn't a dir, then nothing can match!
14317   if (!entries)
14318     return
14319
14320   // It will only match dot entries if it starts with a dot, or if
14321   // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
14322   var pn = remain[0]
14323   var negate = !!this.minimatch.negate
14324   var rawGlob = pn._glob
14325   var dotOk = this.dot || rawGlob.charAt(0) === '.'
14326
14327   var matchedEntries = []
14328   for (var i = 0; i < entries.length; i++) {
14329     var e = entries[i]
14330     if (e.charAt(0) !== '.' || dotOk) {
14331       var m
14332       if (negate && !prefix) {
14333         m = !e.match(pn)
14334       } else {
14335         m = e.match(pn)
14336       }
14337       if (m)
14338         matchedEntries.push(e)
14339     }
14340   }
14341
14342   var len = matchedEntries.length
14343   // If there are no matched entries, then nothing matches.
14344   if (len === 0)
14345     return
14346
14347   // if this is the last remaining pattern bit, then no need for
14348   // an additional stat *unless* the user has specified mark or
14349   // stat explicitly.  We know they exist, since readdir returned
14350   // them.
14351
14352   if (remain.length === 1 && !this.mark && !this.stat) {
14353     if (!this.matches[index])
14354       this.matches[index] = Object.create(null)
14355
14356     for (var i = 0; i < len; i ++) {
14357       var e = matchedEntries[i]
14358       if (prefix) {
14359         if (prefix.slice(-1) !== '/')
14360           e = prefix + '/' + e
14361         else
14362           e = prefix + e
14363       }
14364
14365       if (e.charAt(0) === '/' && !this.nomount) {
14366         e = path.join(this.root, e)
14367       }
14368       this._emitMatch(index, e)
14369     }
14370     // This was the last one, and no stats were needed
14371     return
14372   }
14373
14374   // now test all matched entries as stand-ins for that part
14375   // of the pattern.
14376   remain.shift()
14377   for (var i = 0; i < len; i ++) {
14378     var e = matchedEntries[i]
14379     var newPattern
14380     if (prefix)
14381       newPattern = [prefix, e]
14382     else
14383       newPattern = [e]
14384     this._process(newPattern.concat(remain), index, inGlobStar)
14385   }
14386 }
14387
14388
14389 GlobSync.prototype._emitMatch = function (index, e) {
14390   if (isIgnored(this, e))
14391     return
14392
14393   var abs = this._makeAbs(e)
14394
14395   if (this.mark)
14396     e = this._mark(e)
14397
14398   if (this.absolute) {
14399     e = abs
14400   }
14401
14402   if (this.matches[index][e])
14403     return
14404
14405   if (this.nodir) {
14406     var c = this.cache[abs]
14407     if (c === 'DIR' || Array.isArray(c))
14408       return
14409   }
14410
14411   this.matches[index][e] = true
14412
14413   if (this.stat)
14414     this._stat(e)
14415 }
14416
14417
14418 GlobSync.prototype._readdirInGlobStar = function (abs) {
14419   // follow all symlinked directories forever
14420   // just proceed as if this is a non-globstar situation
14421   if (this.follow)
14422     return this._readdir(abs, false)
14423
14424   var entries
14425   var lstat
14426   var stat
14427   try {
14428     lstat = fs.lstatSync(abs)
14429   } catch (er) {
14430     if (er.code === 'ENOENT') {
14431       // lstat failed, doesn't exist
14432       return null
14433     }
14434   }
14435
14436   var isSym = lstat && lstat.isSymbolicLink()
14437   this.symlinks[abs] = isSym
14438
14439   // If it's not a symlink or a dir, then it's definitely a regular file.
14440   // don't bother doing a readdir in that case.
14441   if (!isSym && lstat && !lstat.isDirectory())
14442     this.cache[abs] = 'FILE'
14443   else
14444     entries = this._readdir(abs, false)
14445
14446   return entries
14447 }
14448
14449 GlobSync.prototype._readdir = function (abs, inGlobStar) {
14450   var entries
14451
14452   if (inGlobStar && !ownProp(this.symlinks, abs))
14453     return this._readdirInGlobStar(abs)
14454
14455   if (ownProp(this.cache, abs)) {
14456     var c = this.cache[abs]
14457     if (!c || c === 'FILE')
14458       return null
14459
14460     if (Array.isArray(c))
14461       return c
14462   }
14463
14464   try {
14465     return this._readdirEntries(abs, fs.readdirSync(abs))
14466   } catch (er) {
14467     this._readdirError(abs, er)
14468     return null
14469   }
14470 }
14471
14472 GlobSync.prototype._readdirEntries = function (abs, entries) {
14473   // if we haven't asked to stat everything, then just
14474   // assume that everything in there exists, so we can avoid
14475   // having to stat it a second time.
14476   if (!this.mark && !this.stat) {
14477     for (var i = 0; i < entries.length; i ++) {
14478       var e = entries[i]
14479       if (abs === '/')
14480         e = abs + e
14481       else
14482         e = abs + '/' + e
14483       this.cache[e] = true
14484     }
14485   }
14486
14487   this.cache[abs] = entries
14488
14489   // mark and cache dir-ness
14490   return entries
14491 }
14492
14493 GlobSync.prototype._readdirError = function (f, er) {
14494   // handle errors, and cache the information
14495   switch (er.code) {
14496     case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
14497     case 'ENOTDIR': // totally normal. means it *does* exist.
14498       var abs = this._makeAbs(f)
14499       this.cache[abs] = 'FILE'
14500       if (abs === this.cwdAbs) {
14501         var error = new Error(er.code + ' invalid cwd ' + this.cwd)
14502         error.path = this.cwd
14503         error.code = er.code
14504         throw error
14505       }
14506       break
14507
14508     case 'ENOENT': // not terribly unusual
14509     case 'ELOOP':
14510     case 'ENAMETOOLONG':
14511     case 'UNKNOWN':
14512       this.cache[this._makeAbs(f)] = false
14513       break
14514
14515     default: // some unusual error.  Treat as failure.
14516       this.cache[this._makeAbs(f)] = false
14517       if (this.strict)
14518         throw er
14519       if (!this.silent)
14520         console.error('glob error', er)
14521       break
14522   }
14523 }
14524
14525 GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
14526
14527   var entries = this._readdir(abs, inGlobStar)
14528
14529   // no entries means not a dir, so it can never have matches
14530   // foo.txt/** doesn't match foo.txt
14531   if (!entries)
14532     return
14533
14534   // test without the globstar, and with every child both below
14535   // and replacing the globstar.
14536   var remainWithoutGlobStar = remain.slice(1)
14537   var gspref = prefix ? [ prefix ] : []
14538   var noGlobStar = gspref.concat(remainWithoutGlobStar)
14539
14540   // the noGlobStar pattern exits the inGlobStar state
14541   this._process(noGlobStar, index, false)
14542
14543   var len = entries.length
14544   var isSym = this.symlinks[abs]
14545
14546   // If it's a symlink, and we're in a globstar, then stop
14547   if (isSym && inGlobStar)
14548     return
14549
14550   for (var i = 0; i < len; i++) {
14551     var e = entries[i]
14552     if (e.charAt(0) === '.' && !this.dot)
14553       continue
14554
14555     // these two cases enter the inGlobStar state
14556     var instead = gspref.concat(entries[i], remainWithoutGlobStar)
14557     this._process(instead, index, true)
14558
14559     var below = gspref.concat(entries[i], remain)
14560     this._process(below, index, true)
14561   }
14562 }
14563
14564 GlobSync.prototype._processSimple = function (prefix, index) {
14565   // XXX review this.  Shouldn't it be doing the mounting etc
14566   // before doing stat?  kinda weird?
14567   var exists = this._stat(prefix)
14568
14569   if (!this.matches[index])
14570     this.matches[index] = Object.create(null)
14571
14572   // If it doesn't exist, then just mark the lack of results
14573   if (!exists)
14574     return
14575
14576   if (prefix && isAbsolute(prefix) && !this.nomount) {
14577     var trail = /[\/\\]$/.test(prefix)
14578     if (prefix.charAt(0) === '/') {
14579       prefix = path.join(this.root, prefix)
14580     } else {
14581       prefix = path.resolve(this.root, prefix)
14582       if (trail)
14583         prefix += '/'
14584     }
14585   }
14586
14587   if (process.platform === 'win32')
14588     prefix = prefix.replace(/\\/g, '/')
14589
14590   // Mark this as a match
14591   this._emitMatch(index, prefix)
14592 }
14593
14594 // Returns either 'DIR', 'FILE', or false
14595 GlobSync.prototype._stat = function (f) {
14596   var abs = this._makeAbs(f)
14597   var needDir = f.slice(-1) === '/'
14598
14599   if (f.length > this.maxLength)
14600     return false
14601
14602   if (!this.stat && ownProp(this.cache, abs)) {
14603     var c = this.cache[abs]
14604
14605     if (Array.isArray(c))
14606       c = 'DIR'
14607
14608     // It exists, but maybe not how we need it
14609     if (!needDir || c === 'DIR')
14610       return c
14611
14612     if (needDir && c === 'FILE')
14613       return false
14614
14615     // otherwise we have to stat, because maybe c=true
14616     // if we know it exists, but not what it is.
14617   }
14618
14619   var exists
14620   var stat = this.statCache[abs]
14621   if (!stat) {
14622     var lstat
14623     try {
14624       lstat = fs.lstatSync(abs)
14625     } catch (er) {
14626       if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
14627         this.statCache[abs] = false
14628         return false
14629       }
14630     }
14631
14632     if (lstat && lstat.isSymbolicLink()) {
14633       try {
14634         stat = fs.statSync(abs)
14635       } catch (er) {
14636         stat = lstat
14637       }
14638     } else {
14639       stat = lstat
14640     }
14641   }
14642
14643   this.statCache[abs] = stat
14644
14645   var c = true
14646   if (stat)
14647     c = stat.isDirectory() ? 'DIR' : 'FILE'
14648
14649   this.cache[abs] = this.cache[abs] || c
14650
14651   if (needDir && c === 'FILE')
14652     return false
14653
14654   return c
14655 }
14656
14657 GlobSync.prototype._mark = function (p) {
14658   return common.mark(this, p)
14659 }
14660
14661 GlobSync.prototype._makeAbs = function (f) {
14662   return common.makeAbs(this, f)
14663 }
14664
14665
14666 /***/ }),
14667 /* 71 */
14668 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
14669
14670 exports.alphasort = alphasort
14671 exports.alphasorti = alphasorti
14672 exports.setopts = setopts
14673 exports.ownProp = ownProp
14674 exports.makeAbs = makeAbs
14675 exports.finish = finish
14676 exports.mark = mark
14677 exports.isIgnored = isIgnored
14678 exports.childrenIgnored = childrenIgnored
14679
14680 function ownProp (obj, field) {
14681   return Object.prototype.hasOwnProperty.call(obj, field)
14682 }
14683
14684 var path = __webpack_require__(2)
14685 var minimatch = __webpack_require__(62)
14686 var isAbsolute = __webpack_require__(69)
14687 var Minimatch = minimatch.Minimatch
14688
14689 function alphasorti (a, b) {
14690   return a.toLowerCase().localeCompare(b.toLowerCase())
14691 }
14692
14693 function alphasort (a, b) {
14694   return a.localeCompare(b)
14695 }
14696
14697 function setupIgnores (self, options) {
14698   self.ignore = options.ignore || []
14699
14700   if (!Array.isArray(self.ignore))
14701     self.ignore = [self.ignore]
14702
14703   if (self.ignore.length) {
14704     self.ignore = self.ignore.map(ignoreMap)
14705   }
14706 }
14707
14708 // ignore patterns are always in dot:true mode.
14709 function ignoreMap (pattern) {
14710   var gmatcher = null
14711   if (pattern.slice(-3) === '/**') {
14712     var gpattern = pattern.replace(/(\/\*\*)+$/, '')
14713     gmatcher = new Minimatch(gpattern, { dot: true })
14714   }
14715
14716   return {
14717     matcher: new Minimatch(pattern, { dot: true }),
14718     gmatcher: gmatcher
14719   }
14720 }
14721
14722 function setopts (self, pattern, options) {
14723   if (!options)
14724     options = {}
14725
14726   // base-matching: just use globstar for that.
14727   if (options.matchBase && -1 === pattern.indexOf("/")) {
14728     if (options.noglobstar) {
14729       throw new Error("base matching requires globstar")
14730     }
14731     pattern = "**/" + pattern
14732   }
14733
14734   self.silent = !!options.silent
14735   self.pattern = pattern
14736   self.strict = options.strict !== false
14737   self.realpath = !!options.realpath
14738   self.realpathCache = options.realpathCache || Object.create(null)
14739   self.follow = !!options.follow
14740   self.dot = !!options.dot
14741   self.mark = !!options.mark
14742   self.nodir = !!options.nodir
14743   if (self.nodir)
14744     self.mark = true
14745   self.sync = !!options.sync
14746   self.nounique = !!options.nounique
14747   self.nonull = !!options.nonull
14748   self.nosort = !!options.nosort
14749   self.nocase = !!options.nocase
14750   self.stat = !!options.stat
14751   self.noprocess = !!options.noprocess
14752   self.absolute = !!options.absolute
14753
14754   self.maxLength = options.maxLength || Infinity
14755   self.cache = options.cache || Object.create(null)
14756   self.statCache = options.statCache || Object.create(null)
14757   self.symlinks = options.symlinks || Object.create(null)
14758
14759   setupIgnores(self, options)
14760
14761   self.changedCwd = false
14762   var cwd = process.cwd()
14763   if (!ownProp(options, "cwd"))
14764     self.cwd = cwd
14765   else {
14766     self.cwd = path.resolve(options.cwd)
14767     self.changedCwd = self.cwd !== cwd
14768   }
14769
14770   self.root = options.root || path.resolve(self.cwd, "/")
14771   self.root = path.resolve(self.root)
14772   if (process.platform === "win32")
14773     self.root = self.root.replace(/\\/g, "/")
14774
14775   // TODO: is an absolute `cwd` supposed to be resolved against `root`?
14776   // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
14777   self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
14778   if (process.platform === "win32")
14779     self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
14780   self.nomount = !!options.nomount
14781
14782   // disable comments and negation in Minimatch.
14783   // Note that they are not supported in Glob itself anyway.
14784   options.nonegate = true
14785   options.nocomment = true
14786
14787   self.minimatch = new Minimatch(pattern, options)
14788   self.options = self.minimatch.options
14789 }
14790
14791 function finish (self) {
14792   var nou = self.nounique
14793   var all = nou ? [] : Object.create(null)
14794
14795   for (var i = 0, l = self.matches.length; i < l; i ++) {
14796     var matches = self.matches[i]
14797     if (!matches || Object.keys(matches).length === 0) {
14798       if (self.nonull) {
14799         // do like the shell, and spit out the literal glob
14800         var literal = self.minimatch.globSet[i]
14801         if (nou)
14802           all.push(literal)
14803         else
14804           all[literal] = true
14805       }
14806     } else {
14807       // had matches
14808       var m = Object.keys(matches)
14809       if (nou)
14810         all.push.apply(all, m)
14811       else
14812         m.forEach(function (m) {
14813           all[m] = true
14814         })
14815     }
14816   }
14817
14818   if (!nou)
14819     all = Object.keys(all)
14820
14821   if (!self.nosort)
14822     all = all.sort(self.nocase ? alphasorti : alphasort)
14823
14824   // at *some* point we statted all of these
14825   if (self.mark) {
14826     for (var i = 0; i < all.length; i++) {
14827       all[i] = self._mark(all[i])
14828     }
14829     if (self.nodir) {
14830       all = all.filter(function (e) {
14831         var notDir = !(/\/$/.test(e))
14832         var c = self.cache[e] || self.cache[makeAbs(self, e)]
14833         if (notDir && c)
14834           notDir = c !== 'DIR' && !Array.isArray(c)
14835         return notDir
14836       })
14837     }
14838   }
14839
14840   if (self.ignore.length)
14841     all = all.filter(function(m) {
14842       return !isIgnored(self, m)
14843     })
14844
14845   self.found = all
14846 }
14847
14848 function mark (self, p) {
14849   var abs = makeAbs(self, p)
14850   var c = self.cache[abs]
14851   var m = p
14852   if (c) {
14853     var isDir = c === 'DIR' || Array.isArray(c)
14854     var slash = p.slice(-1) === '/'
14855
14856     if (isDir && !slash)
14857       m += '/'
14858     else if (!isDir && slash)
14859       m = m.slice(0, -1)
14860
14861     if (m !== p) {
14862       var mabs = makeAbs(self, m)
14863       self.statCache[mabs] = self.statCache[abs]
14864       self.cache[mabs] = self.cache[abs]
14865     }
14866   }
14867
14868   return m
14869 }
14870
14871 // lotta situps...
14872 function makeAbs (self, f) {
14873   var abs = f
14874   if (f.charAt(0) === '/') {
14875     abs = path.join(self.root, f)
14876   } else if (isAbsolute(f) || f === '') {
14877     abs = f
14878   } else if (self.changedCwd) {
14879     abs = path.resolve(self.cwd, f)
14880   } else {
14881     abs = path.resolve(f)
14882   }
14883
14884   if (process.platform === 'win32')
14885     abs = abs.replace(/\\/g, '/')
14886
14887   return abs
14888 }
14889
14890
14891 // Return true, if pattern ends with globstar '**', for the accompanying parent directory.
14892 // Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
14893 function isIgnored (self, path) {
14894   if (!self.ignore.length)
14895     return false
14896
14897   return self.ignore.some(function(item) {
14898     return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
14899   })
14900 }
14901
14902 function childrenIgnored (self, path) {
14903   if (!self.ignore.length)
14904     return false
14905
14906   return self.ignore.some(function(item) {
14907     return !!(item.gmatcher && item.gmatcher.match(path))
14908   })
14909 }
14910
14911
14912 /***/ }),
14913 /* 72 */
14914 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14915
14916 var wrappy = __webpack_require__(73)
14917 var reqs = Object.create(null)
14918 var once = __webpack_require__(74)
14919
14920 module.exports = wrappy(inflight)
14921
14922 function inflight (key, cb) {
14923   if (reqs[key]) {
14924     reqs[key].push(cb)
14925     return null
14926   } else {
14927     reqs[key] = [cb]
14928     return makeres(key)
14929   }
14930 }
14931
14932 function makeres (key) {
14933   return once(function RES () {
14934     var cbs = reqs[key]
14935     var len = cbs.length
14936     var args = slice(arguments)
14937
14938     // XXX It's somewhat ambiguous whether a new callback added in this
14939     // pass should be queued for later execution if something in the
14940     // list of callbacks throws, or if it should just be discarded.
14941     // However, it's such an edge case that it hardly matters, and either
14942     // choice is likely as surprising as the other.
14943     // As it happens, we do go ahead and schedule it for later execution.
14944     try {
14945       for (var i = 0; i < len; i++) {
14946         cbs[i].apply(null, args)
14947       }
14948     } finally {
14949       if (cbs.length > len) {
14950         // added more in the interim.
14951         // de-zalgo, just in case, but don't call again.
14952         cbs.splice(0, len)
14953         process.nextTick(function () {
14954           RES.apply(null, args)
14955         })
14956       } else {
14957         delete reqs[key]
14958       }
14959     }
14960   })
14961 }
14962
14963 function slice (args) {
14964   var length = args.length
14965   var array = []
14966
14967   for (var i = 0; i < length; i++) array[i] = args[i]
14968   return array
14969 }
14970
14971
14972 /***/ }),
14973 /* 73 */
14974 /***/ ((module) => {
14975
14976 // Returns a wrapper function that returns a wrapped callback
14977 // The wrapper function should do some stuff, and return a
14978 // presumably different callback function.
14979 // This makes sure that own properties are retained, so that
14980 // decorations and such are not lost along the way.
14981 module.exports = wrappy
14982 function wrappy (fn, cb) {
14983   if (fn && cb) return wrappy(fn)(cb)
14984
14985   if (typeof fn !== 'function')
14986     throw new TypeError('need wrapper function')
14987
14988   Object.keys(fn).forEach(function (k) {
14989     wrapper[k] = fn[k]
14990   })
14991
14992   return wrapper
14993
14994   function wrapper() {
14995     var args = new Array(arguments.length)
14996     for (var i = 0; i < args.length; i++) {
14997       args[i] = arguments[i]
14998     }
14999     var ret = fn.apply(this, args)
15000     var cb = args[args.length-1]
15001     if (typeof ret === 'function' && ret !== cb) {
15002       Object.keys(cb).forEach(function (k) {
15003         ret[k] = cb[k]
15004       })
15005     }
15006     return ret
15007   }
15008 }
15009
15010
15011 /***/ }),
15012 /* 74 */
15013 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15014
15015 var wrappy = __webpack_require__(73)
15016 module.exports = wrappy(once)
15017 module.exports.strict = wrappy(onceStrict)
15018
15019 once.proto = once(function () {
15020   Object.defineProperty(Function.prototype, 'once', {
15021     value: function () {
15022       return once(this)
15023     },
15024     configurable: true
15025   })
15026
15027   Object.defineProperty(Function.prototype, 'onceStrict', {
15028     value: function () {
15029       return onceStrict(this)
15030     },
15031     configurable: true
15032   })
15033 })
15034
15035 function once (fn) {
15036   var f = function () {
15037     if (f.called) return f.value
15038     f.called = true
15039     return f.value = fn.apply(this, arguments)
15040   }
15041   f.called = false
15042   return f
15043 }
15044
15045 function onceStrict (fn) {
15046   var f = function () {
15047     if (f.called)
15048       throw new Error(f.onceError)
15049     f.called = true
15050     return f.value = fn.apply(this, arguments)
15051   }
15052   var name = fn.name || 'Function wrapped with `once`'
15053   f.onceError = name + " shouldn't be called more than once"
15054   f.called = false
15055   return f
15056 }
15057
15058
15059 /***/ }),
15060 /* 75 */
15061 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15062
15063 // just pre-load all the stuff that index.js lazily exports
15064 const internalRe = __webpack_require__(76)
15065 module.exports = {
15066   re: internalRe.re,
15067   src: internalRe.src,
15068   tokens: internalRe.t,
15069   SEMVER_SPEC_VERSION: __webpack_require__(77).SEMVER_SPEC_VERSION,
15070   SemVer: __webpack_require__(79),
15071   compareIdentifiers: __webpack_require__(80).compareIdentifiers,
15072   rcompareIdentifiers: __webpack_require__(80).rcompareIdentifiers,
15073   parse: __webpack_require__(81),
15074   valid: __webpack_require__(82),
15075   clean: __webpack_require__(83),
15076   inc: __webpack_require__(84),
15077   diff: __webpack_require__(85),
15078   major: __webpack_require__(88),
15079   minor: __webpack_require__(89),
15080   patch: __webpack_require__(90),
15081   prerelease: __webpack_require__(91),
15082   compare: __webpack_require__(87),
15083   rcompare: __webpack_require__(92),
15084   compareLoose: __webpack_require__(93),
15085   compareBuild: __webpack_require__(94),
15086   sort: __webpack_require__(95),
15087   rsort: __webpack_require__(96),
15088   gt: __webpack_require__(97),
15089   lt: __webpack_require__(98),
15090   eq: __webpack_require__(86),
15091   neq: __webpack_require__(99),
15092   gte: __webpack_require__(100),
15093   lte: __webpack_require__(101),
15094   cmp: __webpack_require__(102),
15095   coerce: __webpack_require__(103),
15096   Comparator: __webpack_require__(104),
15097   Range: __webpack_require__(105),
15098   satisfies: __webpack_require__(106),
15099   toComparators: __webpack_require__(107),
15100   maxSatisfying: __webpack_require__(108),
15101   minSatisfying: __webpack_require__(109),
15102   minVersion: __webpack_require__(110),
15103   validRange: __webpack_require__(111),
15104   outside: __webpack_require__(112),
15105   gtr: __webpack_require__(113),
15106   ltr: __webpack_require__(114),
15107   intersects: __webpack_require__(115),
15108   simplifyRange: __webpack_require__(116),
15109   subset: __webpack_require__(117),
15110 }
15111
15112
15113 /***/ }),
15114 /* 76 */
15115 /***/ ((module, exports, __webpack_require__) => {
15116
15117 const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(77)
15118 const debug = __webpack_require__(78)
15119 exports = module.exports = {}
15120
15121 // The actual regexps go on exports.re
15122 const re = exports.re = []
15123 const src = exports.src = []
15124 const t = exports.t = {}
15125 let R = 0
15126
15127 const createToken = (name, value, isGlobal) => {
15128   const index = R++
15129   debug(index, value)
15130   t[name] = index
15131   src[index] = value
15132   re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
15133 }
15134
15135 // The following Regular Expressions can be used for tokenizing,
15136 // validating, and parsing SemVer version strings.
15137
15138 // ## Numeric Identifier
15139 // A single `0`, or a non-zero digit followed by zero or more digits.
15140
15141 createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
15142 createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
15143
15144 // ## Non-numeric Identifier
15145 // Zero or more digits, followed by a letter or hyphen, and then zero or
15146 // more letters, digits, or hyphens.
15147
15148 createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
15149
15150 // ## Main Version
15151 // Three dot-separated numeric identifiers.
15152
15153 createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
15154                    `(${src[t.NUMERICIDENTIFIER]})\\.` +
15155                    `(${src[t.NUMERICIDENTIFIER]})`)
15156
15157 createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
15158                         `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
15159                         `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
15160
15161 // ## Pre-release Version Identifier
15162 // A numeric identifier, or a non-numeric identifier.
15163
15164 createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
15165 }|${src[t.NONNUMERICIDENTIFIER]})`)
15166
15167 createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
15168 }|${src[t.NONNUMERICIDENTIFIER]})`)
15169
15170 // ## Pre-release Version
15171 // Hyphen, followed by one or more dot-separated pre-release version
15172 // identifiers.
15173
15174 createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
15175 }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
15176
15177 createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
15178 }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
15179
15180 // ## Build Metadata Identifier
15181 // Any combination of digits, letters, or hyphens.
15182
15183 createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
15184
15185 // ## Build Metadata
15186 // Plus sign, followed by one or more period-separated build metadata
15187 // identifiers.
15188
15189 createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
15190 }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
15191
15192 // ## Full Version String
15193 // A main version, followed optionally by a pre-release version and
15194 // build metadata.
15195
15196 // Note that the only major, minor, patch, and pre-release sections of
15197 // the version string are capturing groups.  The build metadata is not a
15198 // capturing group, because it should not ever be used in version
15199 // comparison.
15200
15201 createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
15202 }${src[t.PRERELEASE]}?${
15203   src[t.BUILD]}?`)
15204
15205 createToken('FULL', `^${src[t.FULLPLAIN]}$`)
15206
15207 // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
15208 // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
15209 // common in the npm registry.
15210 createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
15211 }${src[t.PRERELEASELOOSE]}?${
15212   src[t.BUILD]}?`)
15213
15214 createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
15215
15216 createToken('GTLT', '((?:<|>)?=?)')
15217
15218 // Something like "2.*" or "1.2.x".
15219 // Note that "x.x" is a valid xRange identifer, meaning "any version"
15220 // Only the first item is strictly required.
15221 createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
15222 createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
15223
15224 createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
15225                    `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
15226                    `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
15227                    `(?:${src[t.PRERELEASE]})?${
15228                      src[t.BUILD]}?` +
15229                    `)?)?`)
15230
15231 createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15232                         `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15233                         `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15234                         `(?:${src[t.PRERELEASELOOSE]})?${
15235                           src[t.BUILD]}?` +
15236                         `)?)?`)
15237
15238 createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
15239 createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
15240
15241 // Coercion.
15242 // Extract anything that could conceivably be a part of a valid semver
15243 createToken('COERCE', `${'(^|[^\\d])' +
15244               '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
15245               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
15246               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
15247               `(?:$|[^\\d])`)
15248 createToken('COERCERTL', src[t.COERCE], true)
15249
15250 // Tilde ranges.
15251 // Meaning is "reasonably at or greater than"
15252 createToken('LONETILDE', '(?:~>?)')
15253
15254 createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
15255 exports.tildeTrimReplace = '$1~'
15256
15257 createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
15258 createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
15259
15260 // Caret ranges.
15261 // Meaning is "at least and backwards compatible with"
15262 createToken('LONECARET', '(?:\\^)')
15263
15264 createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
15265 exports.caretTrimReplace = '$1^'
15266
15267 createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
15268 createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
15269
15270 // A simple gt/lt/eq thing, or just "" to indicate "any version"
15271 createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
15272 createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
15273
15274 // An expression to strip any whitespace between the gtlt and the thing
15275 // it modifies, so that `> 1.2.3` ==> `>1.2.3`
15276 createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
15277 }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
15278 exports.comparatorTrimReplace = '$1$2$3'
15279
15280 // Something like `1.2.3 - 1.2.4`
15281 // Note that these all use the loose form, because they'll be
15282 // checked against either the strict or loose comparator form
15283 // later.
15284 createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
15285                    `\\s+-\\s+` +
15286                    `(${src[t.XRANGEPLAIN]})` +
15287                    `\\s*$`)
15288
15289 createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
15290                         `\\s+-\\s+` +
15291                         `(${src[t.XRANGEPLAINLOOSE]})` +
15292                         `\\s*$`)
15293
15294 // Star ranges basically just allow anything at all.
15295 createToken('STAR', '(<|>)?=?\\s*\\*')
15296 // >=0.0.0 is like a star
15297 createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
15298 createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
15299
15300
15301 /***/ }),
15302 /* 77 */
15303 /***/ ((module) => {
15304
15305 // Note: this is the semver.org version of the spec that it implements
15306 // Not necessarily the package version of this code.
15307 const SEMVER_SPEC_VERSION = '2.0.0'
15308
15309 const MAX_LENGTH = 256
15310 const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
15311   /* istanbul ignore next */ 9007199254740991
15312
15313 // Max safe segment length for coercion.
15314 const MAX_SAFE_COMPONENT_LENGTH = 16
15315
15316 module.exports = {
15317   SEMVER_SPEC_VERSION,
15318   MAX_LENGTH,
15319   MAX_SAFE_INTEGER,
15320   MAX_SAFE_COMPONENT_LENGTH
15321 }
15322
15323
15324 /***/ }),
15325 /* 78 */
15326 /***/ ((module) => {
15327
15328 const debug = (
15329   typeof process === 'object' &&
15330   process.env &&
15331   process.env.NODE_DEBUG &&
15332   /\bsemver\b/i.test(process.env.NODE_DEBUG)
15333 ) ? (...args) => console.error('SEMVER', ...args)
15334   : () => {}
15335
15336 module.exports = debug
15337
15338
15339 /***/ }),
15340 /* 79 */
15341 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15342
15343 const debug = __webpack_require__(78)
15344 const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(77)
15345 const { re, t } = __webpack_require__(76)
15346
15347 const { compareIdentifiers } = __webpack_require__(80)
15348 class SemVer {
15349   constructor (version, options) {
15350     if (!options || typeof options !== 'object') {
15351       options = {
15352         loose: !!options,
15353         includePrerelease: false
15354       }
15355     }
15356     if (version instanceof SemVer) {
15357       if (version.loose === !!options.loose &&
15358           version.includePrerelease === !!options.includePrerelease) {
15359         return version
15360       } else {
15361         version = version.version
15362       }
15363     } else if (typeof version !== 'string') {
15364       throw new TypeError(`Invalid Version: ${version}`)
15365     }
15366
15367     if (version.length > MAX_LENGTH) {
15368       throw new TypeError(
15369         `version is longer than ${MAX_LENGTH} characters`
15370       )
15371     }
15372
15373     debug('SemVer', version, options)
15374     this.options = options
15375     this.loose = !!options.loose
15376     // this isn't actually relevant for versions, but keep it so that we
15377     // don't run into trouble passing this.options around.
15378     this.includePrerelease = !!options.includePrerelease
15379
15380     const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
15381
15382     if (!m) {
15383       throw new TypeError(`Invalid Version: ${version}`)
15384     }
15385
15386     this.raw = version
15387
15388     // these are actually numbers
15389     this.major = +m[1]
15390     this.minor = +m[2]
15391     this.patch = +m[3]
15392
15393     if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
15394       throw new TypeError('Invalid major version')
15395     }
15396
15397     if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
15398       throw new TypeError('Invalid minor version')
15399     }
15400
15401     if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
15402       throw new TypeError('Invalid patch version')
15403     }
15404
15405     // numberify any prerelease numeric ids
15406     if (!m[4]) {
15407       this.prerelease = []
15408     } else {
15409       this.prerelease = m[4].split('.').map((id) => {
15410         if (/^[0-9]+$/.test(id)) {
15411           const num = +id
15412           if (num >= 0 && num < MAX_SAFE_INTEGER) {
15413             return num
15414           }
15415         }
15416         return id
15417       })
15418     }
15419
15420     this.build = m[5] ? m[5].split('.') : []
15421     this.format()
15422   }
15423
15424   format () {
15425     this.version = `${this.major}.${this.minor}.${this.patch}`
15426     if (this.prerelease.length) {
15427       this.version += `-${this.prerelease.join('.')}`
15428     }
15429     return this.version
15430   }
15431
15432   toString () {
15433     return this.version
15434   }
15435
15436   compare (other) {
15437     debug('SemVer.compare', this.version, this.options, other)
15438     if (!(other instanceof SemVer)) {
15439       if (typeof other === 'string' && other === this.version) {
15440         return 0
15441       }
15442       other = new SemVer(other, this.options)
15443     }
15444
15445     if (other.version === this.version) {
15446       return 0
15447     }
15448
15449     return this.compareMain(other) || this.comparePre(other)
15450   }
15451
15452   compareMain (other) {
15453     if (!(other instanceof SemVer)) {
15454       other = new SemVer(other, this.options)
15455     }
15456
15457     return (
15458       compareIdentifiers(this.major, other.major) ||
15459       compareIdentifiers(this.minor, other.minor) ||
15460       compareIdentifiers(this.patch, other.patch)
15461     )
15462   }
15463
15464   comparePre (other) {
15465     if (!(other instanceof SemVer)) {
15466       other = new SemVer(other, this.options)
15467     }
15468
15469     // NOT having a prerelease is > having one
15470     if (this.prerelease.length && !other.prerelease.length) {
15471       return -1
15472     } else if (!this.prerelease.length && other.prerelease.length) {
15473       return 1
15474     } else if (!this.prerelease.length && !other.prerelease.length) {
15475       return 0
15476     }
15477
15478     let i = 0
15479     do {
15480       const a = this.prerelease[i]
15481       const b = other.prerelease[i]
15482       debug('prerelease compare', i, a, b)
15483       if (a === undefined && b === undefined) {
15484         return 0
15485       } else if (b === undefined) {
15486         return 1
15487       } else if (a === undefined) {
15488         return -1
15489       } else if (a === b) {
15490         continue
15491       } else {
15492         return compareIdentifiers(a, b)
15493       }
15494     } while (++i)
15495   }
15496
15497   compareBuild (other) {
15498     if (!(other instanceof SemVer)) {
15499       other = new SemVer(other, this.options)
15500     }
15501
15502     let i = 0
15503     do {
15504       const a = this.build[i]
15505       const b = other.build[i]
15506       debug('prerelease compare', i, a, b)
15507       if (a === undefined && b === undefined) {
15508         return 0
15509       } else if (b === undefined) {
15510         return 1
15511       } else if (a === undefined) {
15512         return -1
15513       } else if (a === b) {
15514         continue
15515       } else {
15516         return compareIdentifiers(a, b)
15517       }
15518     } while (++i)
15519   }
15520
15521   // preminor will bump the version up to the next minor release, and immediately
15522   // down to pre-release. premajor and prepatch work the same way.
15523   inc (release, identifier) {
15524     switch (release) {
15525       case 'premajor':
15526         this.prerelease.length = 0
15527         this.patch = 0
15528         this.minor = 0
15529         this.major++
15530         this.inc('pre', identifier)
15531         break
15532       case 'preminor':
15533         this.prerelease.length = 0
15534         this.patch = 0
15535         this.minor++
15536         this.inc('pre', identifier)
15537         break
15538       case 'prepatch':
15539         // If this is already a prerelease, it will bump to the next version
15540         // drop any prereleases that might already exist, since they are not
15541         // relevant at this point.
15542         this.prerelease.length = 0
15543         this.inc('patch', identifier)
15544         this.inc('pre', identifier)
15545         break
15546       // If the input is a non-prerelease version, this acts the same as
15547       // prepatch.
15548       case 'prerelease':
15549         if (this.prerelease.length === 0) {
15550           this.inc('patch', identifier)
15551         }
15552         this.inc('pre', identifier)
15553         break
15554
15555       case 'major':
15556         // If this is a pre-major version, bump up to the same major version.
15557         // Otherwise increment major.
15558         // 1.0.0-5 bumps to 1.0.0
15559         // 1.1.0 bumps to 2.0.0
15560         if (
15561           this.minor !== 0 ||
15562           this.patch !== 0 ||
15563           this.prerelease.length === 0
15564         ) {
15565           this.major++
15566         }
15567         this.minor = 0
15568         this.patch = 0
15569         this.prerelease = []
15570         break
15571       case 'minor':
15572         // If this is a pre-minor version, bump up to the same minor version.
15573         // Otherwise increment minor.
15574         // 1.2.0-5 bumps to 1.2.0
15575         // 1.2.1 bumps to 1.3.0
15576         if (this.patch !== 0 || this.prerelease.length === 0) {
15577           this.minor++
15578         }
15579         this.patch = 0
15580         this.prerelease = []
15581         break
15582       case 'patch':
15583         // If this is not a pre-release version, it will increment the patch.
15584         // If it is a pre-release it will bump up to the same patch version.
15585         // 1.2.0-5 patches to 1.2.0
15586         // 1.2.0 patches to 1.2.1
15587         if (this.prerelease.length === 0) {
15588           this.patch++
15589         }
15590         this.prerelease = []
15591         break
15592       // This probably shouldn't be used publicly.
15593       // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
15594       case 'pre':
15595         if (this.prerelease.length === 0) {
15596           this.prerelease = [0]
15597         } else {
15598           let i = this.prerelease.length
15599           while (--i >= 0) {
15600             if (typeof this.prerelease[i] === 'number') {
15601               this.prerelease[i]++
15602               i = -2
15603             }
15604           }
15605           if (i === -1) {
15606             // didn't increment anything
15607             this.prerelease.push(0)
15608           }
15609         }
15610         if (identifier) {
15611           // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
15612           // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
15613           if (this.prerelease[0] === identifier) {
15614             if (isNaN(this.prerelease[1])) {
15615               this.prerelease = [identifier, 0]
15616             }
15617           } else {
15618             this.prerelease = [identifier, 0]
15619           }
15620         }
15621         break
15622
15623       default:
15624         throw new Error(`invalid increment argument: ${release}`)
15625     }
15626     this.format()
15627     this.raw = this.version
15628     return this
15629   }
15630 }
15631
15632 module.exports = SemVer
15633
15634
15635 /***/ }),
15636 /* 80 */
15637 /***/ ((module) => {
15638
15639 const numeric = /^[0-9]+$/
15640 const compareIdentifiers = (a, b) => {
15641   const anum = numeric.test(a)
15642   const bnum = numeric.test(b)
15643
15644   if (anum && bnum) {
15645     a = +a
15646     b = +b
15647   }
15648
15649   return a === b ? 0
15650     : (anum && !bnum) ? -1
15651     : (bnum && !anum) ? 1
15652     : a < b ? -1
15653     : 1
15654 }
15655
15656 const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
15657
15658 module.exports = {
15659   compareIdentifiers,
15660   rcompareIdentifiers
15661 }
15662
15663
15664 /***/ }),
15665 /* 81 */
15666 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15667
15668 const {MAX_LENGTH} = __webpack_require__(77)
15669 const { re, t } = __webpack_require__(76)
15670 const SemVer = __webpack_require__(79)
15671
15672 const parse = (version, options) => {
15673   if (!options || typeof options !== 'object') {
15674     options = {
15675       loose: !!options,
15676       includePrerelease: false
15677     }
15678   }
15679
15680   if (version instanceof SemVer) {
15681     return version
15682   }
15683
15684   if (typeof version !== 'string') {
15685     return null
15686   }
15687
15688   if (version.length > MAX_LENGTH) {
15689     return null
15690   }
15691
15692   const r = options.loose ? re[t.LOOSE] : re[t.FULL]
15693   if (!r.test(version)) {
15694     return null
15695   }
15696
15697   try {
15698     return new SemVer(version, options)
15699   } catch (er) {
15700     return null
15701   }
15702 }
15703
15704 module.exports = parse
15705
15706
15707 /***/ }),
15708 /* 82 */
15709 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15710
15711 const parse = __webpack_require__(81)
15712 const valid = (version, options) => {
15713   const v = parse(version, options)
15714   return v ? v.version : null
15715 }
15716 module.exports = valid
15717
15718
15719 /***/ }),
15720 /* 83 */
15721 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15722
15723 const parse = __webpack_require__(81)
15724 const clean = (version, options) => {
15725   const s = parse(version.trim().replace(/^[=v]+/, ''), options)
15726   return s ? s.version : null
15727 }
15728 module.exports = clean
15729
15730
15731 /***/ }),
15732 /* 84 */
15733 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15734
15735 const SemVer = __webpack_require__(79)
15736
15737 const inc = (version, release, options, identifier) => {
15738   if (typeof (options) === 'string') {
15739     identifier = options
15740     options = undefined
15741   }
15742
15743   try {
15744     return new SemVer(version, options).inc(release, identifier).version
15745   } catch (er) {
15746     return null
15747   }
15748 }
15749 module.exports = inc
15750
15751
15752 /***/ }),
15753 /* 85 */
15754 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15755
15756 const parse = __webpack_require__(81)
15757 const eq = __webpack_require__(86)
15758
15759 const diff = (version1, version2) => {
15760   if (eq(version1, version2)) {
15761     return null
15762   } else {
15763     const v1 = parse(version1)
15764     const v2 = parse(version2)
15765     const hasPre = v1.prerelease.length || v2.prerelease.length
15766     const prefix = hasPre ? 'pre' : ''
15767     const defaultResult = hasPre ? 'prerelease' : ''
15768     for (const key in v1) {
15769       if (key === 'major' || key === 'minor' || key === 'patch') {
15770         if (v1[key] !== v2[key]) {
15771           return prefix + key
15772         }
15773       }
15774     }
15775     return defaultResult // may be undefined
15776   }
15777 }
15778 module.exports = diff
15779
15780
15781 /***/ }),
15782 /* 86 */
15783 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15784
15785 const compare = __webpack_require__(87)
15786 const eq = (a, b, loose) => compare(a, b, loose) === 0
15787 module.exports = eq
15788
15789
15790 /***/ }),
15791 /* 87 */
15792 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15793
15794 const SemVer = __webpack_require__(79)
15795 const compare = (a, b, loose) =>
15796   new SemVer(a, loose).compare(new SemVer(b, loose))
15797
15798 module.exports = compare
15799
15800
15801 /***/ }),
15802 /* 88 */
15803 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15804
15805 const SemVer = __webpack_require__(79)
15806 const major = (a, loose) => new SemVer(a, loose).major
15807 module.exports = major
15808
15809
15810 /***/ }),
15811 /* 89 */
15812 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15813
15814 const SemVer = __webpack_require__(79)
15815 const minor = (a, loose) => new SemVer(a, loose).minor
15816 module.exports = minor
15817
15818
15819 /***/ }),
15820 /* 90 */
15821 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15822
15823 const SemVer = __webpack_require__(79)
15824 const patch = (a, loose) => new SemVer(a, loose).patch
15825 module.exports = patch
15826
15827
15828 /***/ }),
15829 /* 91 */
15830 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15831
15832 const parse = __webpack_require__(81)
15833 const prerelease = (version, options) => {
15834   const parsed = parse(version, options)
15835   return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
15836 }
15837 module.exports = prerelease
15838
15839
15840 /***/ }),
15841 /* 92 */
15842 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15843
15844 const compare = __webpack_require__(87)
15845 const rcompare = (a, b, loose) => compare(b, a, loose)
15846 module.exports = rcompare
15847
15848
15849 /***/ }),
15850 /* 93 */
15851 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15852
15853 const compare = __webpack_require__(87)
15854 const compareLoose = (a, b) => compare(a, b, true)
15855 module.exports = compareLoose
15856
15857
15858 /***/ }),
15859 /* 94 */
15860 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15861
15862 const SemVer = __webpack_require__(79)
15863 const compareBuild = (a, b, loose) => {
15864   const versionA = new SemVer(a, loose)
15865   const versionB = new SemVer(b, loose)
15866   return versionA.compare(versionB) || versionA.compareBuild(versionB)
15867 }
15868 module.exports = compareBuild
15869
15870
15871 /***/ }),
15872 /* 95 */
15873 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15874
15875 const compareBuild = __webpack_require__(94)
15876 const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
15877 module.exports = sort
15878
15879
15880 /***/ }),
15881 /* 96 */
15882 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15883
15884 const compareBuild = __webpack_require__(94)
15885 const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
15886 module.exports = rsort
15887
15888
15889 /***/ }),
15890 /* 97 */
15891 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15892
15893 const compare = __webpack_require__(87)
15894 const gt = (a, b, loose) => compare(a, b, loose) > 0
15895 module.exports = gt
15896
15897
15898 /***/ }),
15899 /* 98 */
15900 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15901
15902 const compare = __webpack_require__(87)
15903 const lt = (a, b, loose) => compare(a, b, loose) < 0
15904 module.exports = lt
15905
15906
15907 /***/ }),
15908 /* 99 */
15909 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15910
15911 const compare = __webpack_require__(87)
15912 const neq = (a, b, loose) => compare(a, b, loose) !== 0
15913 module.exports = neq
15914
15915
15916 /***/ }),
15917 /* 100 */
15918 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15919
15920 const compare = __webpack_require__(87)
15921 const gte = (a, b, loose) => compare(a, b, loose) >= 0
15922 module.exports = gte
15923
15924
15925 /***/ }),
15926 /* 101 */
15927 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15928
15929 const compare = __webpack_require__(87)
15930 const lte = (a, b, loose) => compare(a, b, loose) <= 0
15931 module.exports = lte
15932
15933
15934 /***/ }),
15935 /* 102 */
15936 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15937
15938 const eq = __webpack_require__(86)
15939 const neq = __webpack_require__(99)
15940 const gt = __webpack_require__(97)
15941 const gte = __webpack_require__(100)
15942 const lt = __webpack_require__(98)
15943 const lte = __webpack_require__(101)
15944
15945 const cmp = (a, op, b, loose) => {
15946   switch (op) {
15947     case '===':
15948       if (typeof a === 'object')
15949         a = a.version
15950       if (typeof b === 'object')
15951         b = b.version
15952       return a === b
15953
15954     case '!==':
15955       if (typeof a === 'object')
15956         a = a.version
15957       if (typeof b === 'object')
15958         b = b.version
15959       return a !== b
15960
15961     case '':
15962     case '=':
15963     case '==':
15964       return eq(a, b, loose)
15965
15966     case '!=':
15967       return neq(a, b, loose)
15968
15969     case '>':
15970       return gt(a, b, loose)
15971
15972     case '>=':
15973       return gte(a, b, loose)
15974
15975     case '<':
15976       return lt(a, b, loose)
15977
15978     case '<=':
15979       return lte(a, b, loose)
15980
15981     default:
15982       throw new TypeError(`Invalid operator: ${op}`)
15983   }
15984 }
15985 module.exports = cmp
15986
15987
15988 /***/ }),
15989 /* 103 */
15990 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15991
15992 const SemVer = __webpack_require__(79)
15993 const parse = __webpack_require__(81)
15994 const {re, t} = __webpack_require__(76)
15995
15996 const coerce = (version, options) => {
15997   if (version instanceof SemVer) {
15998     return version
15999   }
16000
16001   if (typeof version === 'number') {
16002     version = String(version)
16003   }
16004
16005   if (typeof version !== 'string') {
16006     return null
16007   }
16008
16009   options = options || {}
16010
16011   let match = null
16012   if (!options.rtl) {
16013     match = version.match(re[t.COERCE])
16014   } else {
16015     // Find the right-most coercible string that does not share
16016     // a terminus with a more left-ward coercible string.
16017     // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
16018     //
16019     // Walk through the string checking with a /g regexp
16020     // Manually set the index so as to pick up overlapping matches.
16021     // Stop when we get a match that ends at the string end, since no
16022     // coercible string can be more right-ward without the same terminus.
16023     let next
16024     while ((next = re[t.COERCERTL].exec(version)) &&
16025         (!match || match.index + match[0].length !== version.length)
16026     ) {
16027       if (!match ||
16028             next.index + next[0].length !== match.index + match[0].length) {
16029         match = next
16030       }
16031       re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
16032     }
16033     // leave it in a clean state
16034     re[t.COERCERTL].lastIndex = -1
16035   }
16036
16037   if (match === null)
16038     return null
16039
16040   return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
16041 }
16042 module.exports = coerce
16043
16044
16045 /***/ }),
16046 /* 104 */
16047 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16048
16049 const ANY = Symbol('SemVer ANY')
16050 // hoisted class for cyclic dependency
16051 class Comparator {
16052   static get ANY () {
16053     return ANY
16054   }
16055   constructor (comp, options) {
16056     if (!options || typeof options !== 'object') {
16057       options = {
16058         loose: !!options,
16059         includePrerelease: false
16060       }
16061     }
16062
16063     if (comp instanceof Comparator) {
16064       if (comp.loose === !!options.loose) {
16065         return comp
16066       } else {
16067         comp = comp.value
16068       }
16069     }
16070
16071     debug('comparator', comp, options)
16072     this.options = options
16073     this.loose = !!options.loose
16074     this.parse(comp)
16075
16076     if (this.semver === ANY) {
16077       this.value = ''
16078     } else {
16079       this.value = this.operator + this.semver.version
16080     }
16081
16082     debug('comp', this)
16083   }
16084
16085   parse (comp) {
16086     const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
16087     const m = comp.match(r)
16088
16089     if (!m) {
16090       throw new TypeError(`Invalid comparator: ${comp}`)
16091     }
16092
16093     this.operator = m[1] !== undefined ? m[1] : ''
16094     if (this.operator === '=') {
16095       this.operator = ''
16096     }
16097
16098     // if it literally is just '>' or '' then allow anything.
16099     if (!m[2]) {
16100       this.semver = ANY
16101     } else {
16102       this.semver = new SemVer(m[2], this.options.loose)
16103     }
16104   }
16105
16106   toString () {
16107     return this.value
16108   }
16109
16110   test (version) {
16111     debug('Comparator.test', version, this.options.loose)
16112
16113     if (this.semver === ANY || version === ANY) {
16114       return true
16115     }
16116
16117     if (typeof version === 'string') {
16118       try {
16119         version = new SemVer(version, this.options)
16120       } catch (er) {
16121         return false
16122       }
16123     }
16124
16125     return cmp(version, this.operator, this.semver, this.options)
16126   }
16127
16128   intersects (comp, options) {
16129     if (!(comp instanceof Comparator)) {
16130       throw new TypeError('a Comparator is required')
16131     }
16132
16133     if (!options || typeof options !== 'object') {
16134       options = {
16135         loose: !!options,
16136         includePrerelease: false
16137       }
16138     }
16139
16140     if (this.operator === '') {
16141       if (this.value === '') {
16142         return true
16143       }
16144       return new Range(comp.value, options).test(this.value)
16145     } else if (comp.operator === '') {
16146       if (comp.value === '') {
16147         return true
16148       }
16149       return new Range(this.value, options).test(comp.semver)
16150     }
16151
16152     const sameDirectionIncreasing =
16153       (this.operator === '>=' || this.operator === '>') &&
16154       (comp.operator === '>=' || comp.operator === '>')
16155     const sameDirectionDecreasing =
16156       (this.operator === '<=' || this.operator === '<') &&
16157       (comp.operator === '<=' || comp.operator === '<')
16158     const sameSemVer = this.semver.version === comp.semver.version
16159     const differentDirectionsInclusive =
16160       (this.operator === '>=' || this.operator === '<=') &&
16161       (comp.operator === '>=' || comp.operator === '<=')
16162     const oppositeDirectionsLessThan =
16163       cmp(this.semver, '<', comp.semver, options) &&
16164       (this.operator === '>=' || this.operator === '>') &&
16165         (comp.operator === '<=' || comp.operator === '<')
16166     const oppositeDirectionsGreaterThan =
16167       cmp(this.semver, '>', comp.semver, options) &&
16168       (this.operator === '<=' || this.operator === '<') &&
16169         (comp.operator === '>=' || comp.operator === '>')
16170
16171     return (
16172       sameDirectionIncreasing ||
16173       sameDirectionDecreasing ||
16174       (sameSemVer && differentDirectionsInclusive) ||
16175       oppositeDirectionsLessThan ||
16176       oppositeDirectionsGreaterThan
16177     )
16178   }
16179 }
16180
16181 module.exports = Comparator
16182
16183 const {re, t} = __webpack_require__(76)
16184 const cmp = __webpack_require__(102)
16185 const debug = __webpack_require__(78)
16186 const SemVer = __webpack_require__(79)
16187 const Range = __webpack_require__(105)
16188
16189
16190 /***/ }),
16191 /* 105 */
16192 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16193
16194 // hoisted class for cyclic dependency
16195 class Range {
16196   constructor (range, options) {
16197     if (!options || typeof options !== 'object') {
16198       options = {
16199         loose: !!options,
16200         includePrerelease: false
16201       }
16202     }
16203
16204     if (range instanceof Range) {
16205       if (
16206         range.loose === !!options.loose &&
16207         range.includePrerelease === !!options.includePrerelease
16208       ) {
16209         return range
16210       } else {
16211         return new Range(range.raw, options)
16212       }
16213     }
16214
16215     if (range instanceof Comparator) {
16216       // just put it in the set and return
16217       this.raw = range.value
16218       this.set = [[range]]
16219       this.format()
16220       return this
16221     }
16222
16223     this.options = options
16224     this.loose = !!options.loose
16225     this.includePrerelease = !!options.includePrerelease
16226
16227     // First, split based on boolean or ||
16228     this.raw = range
16229     this.set = range
16230       .split(/\s*\|\|\s*/)
16231       // map the range to a 2d array of comparators
16232       .map(range => this.parseRange(range.trim()))
16233       // throw out any comparator lists that are empty
16234       // this generally means that it was not a valid range, which is allowed
16235       // in loose mode, but will still throw if the WHOLE range is invalid.
16236       .filter(c => c.length)
16237
16238     if (!this.set.length) {
16239       throw new TypeError(`Invalid SemVer Range: ${range}`)
16240     }
16241
16242     this.format()
16243   }
16244
16245   format () {
16246     this.range = this.set
16247       .map((comps) => {
16248         return comps.join(' ').trim()
16249       })
16250       .join('||')
16251       .trim()
16252     return this.range
16253   }
16254
16255   toString () {
16256     return this.range
16257   }
16258
16259   parseRange (range) {
16260     const loose = this.options.loose
16261     range = range.trim()
16262     // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
16263     const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
16264     range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
16265     debug('hyphen replace', range)
16266     // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
16267     range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
16268     debug('comparator trim', range, re[t.COMPARATORTRIM])
16269
16270     // `~ 1.2.3` => `~1.2.3`
16271     range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
16272
16273     // `^ 1.2.3` => `^1.2.3`
16274     range = range.replace(re[t.CARETTRIM], caretTrimReplace)
16275
16276     // normalize spaces
16277     range = range.split(/\s+/).join(' ')
16278
16279     // At this point, the range is completely trimmed and
16280     // ready to be split into comparators.
16281
16282     const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
16283     return range
16284       .split(' ')
16285       .map(comp => parseComparator(comp, this.options))
16286       .join(' ')
16287       .split(/\s+/)
16288       .map(comp => replaceGTE0(comp, this.options))
16289       // in loose mode, throw out any that are not valid comparators
16290       .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
16291       .map(comp => new Comparator(comp, this.options))
16292   }
16293
16294   intersects (range, options) {
16295     if (!(range instanceof Range)) {
16296       throw new TypeError('a Range is required')
16297     }
16298
16299     return this.set.some((thisComparators) => {
16300       return (
16301         isSatisfiable(thisComparators, options) &&
16302         range.set.some((rangeComparators) => {
16303           return (
16304             isSatisfiable(rangeComparators, options) &&
16305             thisComparators.every((thisComparator) => {
16306               return rangeComparators.every((rangeComparator) => {
16307                 return thisComparator.intersects(rangeComparator, options)
16308               })
16309             })
16310           )
16311         })
16312       )
16313     })
16314   }
16315
16316   // if ANY of the sets match ALL of its comparators, then pass
16317   test (version) {
16318     if (!version) {
16319       return false
16320     }
16321
16322     if (typeof version === 'string') {
16323       try {
16324         version = new SemVer(version, this.options)
16325       } catch (er) {
16326         return false
16327       }
16328     }
16329
16330     for (let i = 0; i < this.set.length; i++) {
16331       if (testSet(this.set[i], version, this.options)) {
16332         return true
16333       }
16334     }
16335     return false
16336   }
16337 }
16338 module.exports = Range
16339
16340 const Comparator = __webpack_require__(104)
16341 const debug = __webpack_require__(78)
16342 const SemVer = __webpack_require__(79)
16343 const {
16344   re,
16345   t,
16346   comparatorTrimReplace,
16347   tildeTrimReplace,
16348   caretTrimReplace
16349 } = __webpack_require__(76)
16350
16351 // take a set of comparators and determine whether there
16352 // exists a version which can satisfy it
16353 const isSatisfiable = (comparators, options) => {
16354   let result = true
16355   const remainingComparators = comparators.slice()
16356   let testComparator = remainingComparators.pop()
16357
16358   while (result && remainingComparators.length) {
16359     result = remainingComparators.every((otherComparator) => {
16360       return testComparator.intersects(otherComparator, options)
16361     })
16362
16363     testComparator = remainingComparators.pop()
16364   }
16365
16366   return result
16367 }
16368
16369 // comprised of xranges, tildes, stars, and gtlt's at this point.
16370 // already replaced the hyphen ranges
16371 // turn into a set of JUST comparators.
16372 const parseComparator = (comp, options) => {
16373   debug('comp', comp, options)
16374   comp = replaceCarets(comp, options)
16375   debug('caret', comp)
16376   comp = replaceTildes(comp, options)
16377   debug('tildes', comp)
16378   comp = replaceXRanges(comp, options)
16379   debug('xrange', comp)
16380   comp = replaceStars(comp, options)
16381   debug('stars', comp)
16382   return comp
16383 }
16384
16385 const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
16386
16387 // ~, ~> --> * (any, kinda silly)
16388 // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
16389 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
16390 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
16391 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
16392 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
16393 const replaceTildes = (comp, options) =>
16394   comp.trim().split(/\s+/).map((comp) => {
16395     return replaceTilde(comp, options)
16396   }).join(' ')
16397
16398 const replaceTilde = (comp, options) => {
16399   const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
16400   return comp.replace(r, (_, M, m, p, pr) => {
16401     debug('tilde', comp, _, M, m, p, pr)
16402     let ret
16403
16404     if (isX(M)) {
16405       ret = ''
16406     } else if (isX(m)) {
16407       ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
16408     } else if (isX(p)) {
16409       // ~1.2 == >=1.2.0 <1.3.0-0
16410       ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
16411     } else if (pr) {
16412       debug('replaceTilde pr', pr)
16413       ret = `>=${M}.${m}.${p}-${pr
16414       } <${M}.${+m + 1}.0-0`
16415     } else {
16416       // ~1.2.3 == >=1.2.3 <1.3.0-0
16417       ret = `>=${M}.${m}.${p
16418       } <${M}.${+m + 1}.0-0`
16419     }
16420
16421     debug('tilde return', ret)
16422     return ret
16423   })
16424 }
16425
16426 // ^ --> * (any, kinda silly)
16427 // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
16428 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
16429 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
16430 // ^1.2.3 --> >=1.2.3 <2.0.0-0
16431 // ^1.2.0 --> >=1.2.0 <2.0.0-0
16432 const replaceCarets = (comp, options) =>
16433   comp.trim().split(/\s+/).map((comp) => {
16434     return replaceCaret(comp, options)
16435   }).join(' ')
16436
16437 const replaceCaret = (comp, options) => {
16438   debug('caret', comp, options)
16439   const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
16440   const z = options.includePrerelease ? '-0' : ''
16441   return comp.replace(r, (_, M, m, p, pr) => {
16442     debug('caret', comp, _, M, m, p, pr)
16443     let ret
16444
16445     if (isX(M)) {
16446       ret = ''
16447     } else if (isX(m)) {
16448       ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
16449     } else if (isX(p)) {
16450       if (M === '0') {
16451         ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
16452       } else {
16453         ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
16454       }
16455     } else if (pr) {
16456       debug('replaceCaret pr', pr)
16457       if (M === '0') {
16458         if (m === '0') {
16459           ret = `>=${M}.${m}.${p}-${pr
16460           } <${M}.${m}.${+p + 1}-0`
16461         } else {
16462           ret = `>=${M}.${m}.${p}-${pr
16463           } <${M}.${+m + 1}.0-0`
16464         }
16465       } else {
16466         ret = `>=${M}.${m}.${p}-${pr
16467         } <${+M + 1}.0.0-0`
16468       }
16469     } else {
16470       debug('no pr')
16471       if (M === '0') {
16472         if (m === '0') {
16473           ret = `>=${M}.${m}.${p
16474           }${z} <${M}.${m}.${+p + 1}-0`
16475         } else {
16476           ret = `>=${M}.${m}.${p
16477           }${z} <${M}.${+m + 1}.0-0`
16478         }
16479       } else {
16480         ret = `>=${M}.${m}.${p
16481         } <${+M + 1}.0.0-0`
16482       }
16483     }
16484
16485     debug('caret return', ret)
16486     return ret
16487   })
16488 }
16489
16490 const replaceXRanges = (comp, options) => {
16491   debug('replaceXRanges', comp, options)
16492   return comp.split(/\s+/).map((comp) => {
16493     return replaceXRange(comp, options)
16494   }).join(' ')
16495 }
16496
16497 const replaceXRange = (comp, options) => {
16498   comp = comp.trim()
16499   const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
16500   return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
16501     debug('xRange', comp, ret, gtlt, M, m, p, pr)
16502     const xM = isX(M)
16503     const xm = xM || isX(m)
16504     const xp = xm || isX(p)
16505     const anyX = xp
16506
16507     if (gtlt === '=' && anyX) {
16508       gtlt = ''
16509     }
16510
16511     // if we're including prereleases in the match, then we need
16512     // to fix this to -0, the lowest possible prerelease value
16513     pr = options.includePrerelease ? '-0' : ''
16514
16515     if (xM) {
16516       if (gtlt === '>' || gtlt === '<') {
16517         // nothing is allowed
16518         ret = '<0.0.0-0'
16519       } else {
16520         // nothing is forbidden
16521         ret = '*'
16522       }
16523     } else if (gtlt && anyX) {
16524       // we know patch is an x, because we have any x at all.
16525       // replace X with 0
16526       if (xm) {
16527         m = 0
16528       }
16529       p = 0
16530
16531       if (gtlt === '>') {
16532         // >1 => >=2.0.0
16533         // >1.2 => >=1.3.0
16534         gtlt = '>='
16535         if (xm) {
16536           M = +M + 1
16537           m = 0
16538           p = 0
16539         } else {
16540           m = +m + 1
16541           p = 0
16542         }
16543       } else if (gtlt === '<=') {
16544         // <=0.7.x is actually <0.8.0, since any 0.7.x should
16545         // pass.  Similarly, <=7.x is actually <8.0.0, etc.
16546         gtlt = '<'
16547         if (xm) {
16548           M = +M + 1
16549         } else {
16550           m = +m + 1
16551         }
16552       }
16553
16554       if (gtlt === '<')
16555         pr = '-0'
16556
16557       ret = `${gtlt + M}.${m}.${p}${pr}`
16558     } else if (xm) {
16559       ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
16560     } else if (xp) {
16561       ret = `>=${M}.${m}.0${pr
16562       } <${M}.${+m + 1}.0-0`
16563     }
16564
16565     debug('xRange return', ret)
16566
16567     return ret
16568   })
16569 }
16570
16571 // Because * is AND-ed with everything else in the comparator,
16572 // and '' means "any version", just remove the *s entirely.
16573 const replaceStars = (comp, options) => {
16574   debug('replaceStars', comp, options)
16575   // Looseness is ignored here.  star is always as loose as it gets!
16576   return comp.trim().replace(re[t.STAR], '')
16577 }
16578
16579 const replaceGTE0 = (comp, options) => {
16580   debug('replaceGTE0', comp, options)
16581   return comp.trim()
16582     .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
16583 }
16584
16585 // This function is passed to string.replace(re[t.HYPHENRANGE])
16586 // M, m, patch, prerelease, build
16587 // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
16588 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
16589 // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
16590 const hyphenReplace = incPr => ($0,
16591   from, fM, fm, fp, fpr, fb,
16592   to, tM, tm, tp, tpr, tb) => {
16593   if (isX(fM)) {
16594     from = ''
16595   } else if (isX(fm)) {
16596     from = `>=${fM}.0.0${incPr ? '-0' : ''}`
16597   } else if (isX(fp)) {
16598     from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
16599   } else if (fpr) {
16600     from = `>=${from}`
16601   } else {
16602     from = `>=${from}${incPr ? '-0' : ''}`
16603   }
16604
16605   if (isX(tM)) {
16606     to = ''
16607   } else if (isX(tm)) {
16608     to = `<${+tM + 1}.0.0-0`
16609   } else if (isX(tp)) {
16610     to = `<${tM}.${+tm + 1}.0-0`
16611   } else if (tpr) {
16612     to = `<=${tM}.${tm}.${tp}-${tpr}`
16613   } else if (incPr) {
16614     to = `<${tM}.${tm}.${+tp + 1}-0`
16615   } else {
16616     to = `<=${to}`
16617   }
16618
16619   return (`${from} ${to}`).trim()
16620 }
16621
16622 const testSet = (set, version, options) => {
16623   for (let i = 0; i < set.length; i++) {
16624     if (!set[i].test(version)) {
16625       return false
16626     }
16627   }
16628
16629   if (version.prerelease.length && !options.includePrerelease) {
16630     // Find the set of versions that are allowed to have prereleases
16631     // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
16632     // That should allow `1.2.3-pr.2` to pass.
16633     // However, `1.2.4-alpha.notready` should NOT be allowed,
16634     // even though it's within the range set by the comparators.
16635     for (let i = 0; i < set.length; i++) {
16636       debug(set[i].semver)
16637       if (set[i].semver === Comparator.ANY) {
16638         continue
16639       }
16640
16641       if (set[i].semver.prerelease.length > 0) {
16642         const allowed = set[i].semver
16643         if (allowed.major === version.major &&
16644             allowed.minor === version.minor &&
16645             allowed.patch === version.patch) {
16646           return true
16647         }
16648       }
16649     }
16650
16651     // Version has a -pre, but it's not one of the ones we like.
16652     return false
16653   }
16654
16655   return true
16656 }
16657
16658
16659 /***/ }),
16660 /* 106 */
16661 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16662
16663 const Range = __webpack_require__(105)
16664 const satisfies = (version, range, options) => {
16665   try {
16666     range = new Range(range, options)
16667   } catch (er) {
16668     return false
16669   }
16670   return range.test(version)
16671 }
16672 module.exports = satisfies
16673
16674
16675 /***/ }),
16676 /* 107 */
16677 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16678
16679 const Range = __webpack_require__(105)
16680
16681 // Mostly just for testing and legacy API reasons
16682 const toComparators = (range, options) =>
16683   new Range(range, options).set
16684     .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
16685
16686 module.exports = toComparators
16687
16688
16689 /***/ }),
16690 /* 108 */
16691 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16692
16693 const SemVer = __webpack_require__(79)
16694 const Range = __webpack_require__(105)
16695
16696 const maxSatisfying = (versions, range, options) => {
16697   let max = null
16698   let maxSV = null
16699   let rangeObj = null
16700   try {
16701     rangeObj = new Range(range, options)
16702   } catch (er) {
16703     return null
16704   }
16705   versions.forEach((v) => {
16706     if (rangeObj.test(v)) {
16707       // satisfies(v, range, options)
16708       if (!max || maxSV.compare(v) === -1) {
16709         // compare(max, v, true)
16710         max = v
16711         maxSV = new SemVer(max, options)
16712       }
16713     }
16714   })
16715   return max
16716 }
16717 module.exports = maxSatisfying
16718
16719
16720 /***/ }),
16721 /* 109 */
16722 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16723
16724 const SemVer = __webpack_require__(79)
16725 const Range = __webpack_require__(105)
16726 const minSatisfying = (versions, range, options) => {
16727   let min = null
16728   let minSV = null
16729   let rangeObj = null
16730   try {
16731     rangeObj = new Range(range, options)
16732   } catch (er) {
16733     return null
16734   }
16735   versions.forEach((v) => {
16736     if (rangeObj.test(v)) {
16737       // satisfies(v, range, options)
16738       if (!min || minSV.compare(v) === 1) {
16739         // compare(min, v, true)
16740         min = v
16741         minSV = new SemVer(min, options)
16742       }
16743     }
16744   })
16745   return min
16746 }
16747 module.exports = minSatisfying
16748
16749
16750 /***/ }),
16751 /* 110 */
16752 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16753
16754 const SemVer = __webpack_require__(79)
16755 const Range = __webpack_require__(105)
16756 const gt = __webpack_require__(97)
16757
16758 const minVersion = (range, loose) => {
16759   range = new Range(range, loose)
16760
16761   let minver = new SemVer('0.0.0')
16762   if (range.test(minver)) {
16763     return minver
16764   }
16765
16766   minver = new SemVer('0.0.0-0')
16767   if (range.test(minver)) {
16768     return minver
16769   }
16770
16771   minver = null
16772   for (let i = 0; i < range.set.length; ++i) {
16773     const comparators = range.set[i]
16774
16775     comparators.forEach((comparator) => {
16776       // Clone to avoid manipulating the comparator's semver object.
16777       const compver = new SemVer(comparator.semver.version)
16778       switch (comparator.operator) {
16779         case '>':
16780           if (compver.prerelease.length === 0) {
16781             compver.patch++
16782           } else {
16783             compver.prerelease.push(0)
16784           }
16785           compver.raw = compver.format()
16786           /* fallthrough */
16787         case '':
16788         case '>=':
16789           if (!minver || gt(minver, compver)) {
16790             minver = compver
16791           }
16792           break
16793         case '<':
16794         case '<=':
16795           /* Ignore maximum versions */
16796           break
16797         /* istanbul ignore next */
16798         default:
16799           throw new Error(`Unexpected operation: ${comparator.operator}`)
16800       }
16801     })
16802   }
16803
16804   if (minver && range.test(minver)) {
16805     return minver
16806   }
16807
16808   return null
16809 }
16810 module.exports = minVersion
16811
16812
16813 /***/ }),
16814 /* 111 */
16815 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16816
16817 const Range = __webpack_require__(105)
16818 const validRange = (range, options) => {
16819   try {
16820     // Return '*' instead of '' so that truthiness works.
16821     // This will throw if it's invalid anyway
16822     return new Range(range, options).range || '*'
16823   } catch (er) {
16824     return null
16825   }
16826 }
16827 module.exports = validRange
16828
16829
16830 /***/ }),
16831 /* 112 */
16832 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16833
16834 const SemVer = __webpack_require__(79)
16835 const Comparator = __webpack_require__(104)
16836 const {ANY} = Comparator
16837 const Range = __webpack_require__(105)
16838 const satisfies = __webpack_require__(106)
16839 const gt = __webpack_require__(97)
16840 const lt = __webpack_require__(98)
16841 const lte = __webpack_require__(101)
16842 const gte = __webpack_require__(100)
16843
16844 const outside = (version, range, hilo, options) => {
16845   version = new SemVer(version, options)
16846   range = new Range(range, options)
16847
16848   let gtfn, ltefn, ltfn, comp, ecomp
16849   switch (hilo) {
16850     case '>':
16851       gtfn = gt
16852       ltefn = lte
16853       ltfn = lt
16854       comp = '>'
16855       ecomp = '>='
16856       break
16857     case '<':
16858       gtfn = lt
16859       ltefn = gte
16860       ltfn = gt
16861       comp = '<'
16862       ecomp = '<='
16863       break
16864     default:
16865       throw new TypeError('Must provide a hilo val of "<" or ">"')
16866   }
16867
16868   // If it satisifes the range it is not outside
16869   if (satisfies(version, range, options)) {
16870     return false
16871   }
16872
16873   // From now on, variable terms are as if we're in "gtr" mode.
16874   // but note that everything is flipped for the "ltr" function.
16875
16876   for (let i = 0; i < range.set.length; ++i) {
16877     const comparators = range.set[i]
16878
16879     let high = null
16880     let low = null
16881
16882     comparators.forEach((comparator) => {
16883       if (comparator.semver === ANY) {
16884         comparator = new Comparator('>=0.0.0')
16885       }
16886       high = high || comparator
16887       low = low || comparator
16888       if (gtfn(comparator.semver, high.semver, options)) {
16889         high = comparator
16890       } else if (ltfn(comparator.semver, low.semver, options)) {
16891         low = comparator
16892       }
16893     })
16894
16895     // If the edge version comparator has a operator then our version
16896     // isn't outside it
16897     if (high.operator === comp || high.operator === ecomp) {
16898       return false
16899     }
16900
16901     // If the lowest version comparator has an operator and our version
16902     // is less than it then it isn't higher than the range
16903     if ((!low.operator || low.operator === comp) &&
16904         ltefn(version, low.semver)) {
16905       return false
16906     } else if (low.operator === ecomp && ltfn(version, low.semver)) {
16907       return false
16908     }
16909   }
16910   return true
16911 }
16912
16913 module.exports = outside
16914
16915
16916 /***/ }),
16917 /* 113 */
16918 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16919
16920 // Determine if version is greater than all the versions possible in the range.
16921 const outside = __webpack_require__(112)
16922 const gtr = (version, range, options) => outside(version, range, '>', options)
16923 module.exports = gtr
16924
16925
16926 /***/ }),
16927 /* 114 */
16928 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16929
16930 const outside = __webpack_require__(112)
16931 // Determine if version is less than all the versions possible in the range
16932 const ltr = (version, range, options) => outside(version, range, '<', options)
16933 module.exports = ltr
16934
16935
16936 /***/ }),
16937 /* 115 */
16938 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16939
16940 const Range = __webpack_require__(105)
16941 const intersects = (r1, r2, options) => {
16942   r1 = new Range(r1, options)
16943   r2 = new Range(r2, options)
16944   return r1.intersects(r2)
16945 }
16946 module.exports = intersects
16947
16948
16949 /***/ }),
16950 /* 116 */
16951 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16952
16953 // given a set of versions and a range, create a "simplified" range
16954 // that includes the same versions that the original range does
16955 // If the original range is shorter than the simplified one, return that.
16956 const satisfies = __webpack_require__(106)
16957 const compare = __webpack_require__(87)
16958 module.exports = (versions, range, options) => {
16959   const set = []
16960   let min = null
16961   let prev = null
16962   const v = versions.sort((a, b) => compare(a, b, options))
16963   for (const version of v) {
16964     const included = satisfies(version, range, options)
16965     if (included) {
16966       prev = version
16967       if (!min)
16968         min = version
16969     } else {
16970       if (prev) {
16971         set.push([min, prev])
16972       }
16973       prev = null
16974       min = null
16975     }
16976   }
16977   if (min)
16978     set.push([min, null])
16979
16980   const ranges = []
16981   for (const [min, max] of set) {
16982     if (min === max)
16983       ranges.push(min)
16984     else if (!max && min === v[0])
16985       ranges.push('*')
16986     else if (!max)
16987       ranges.push(`>=${min}`)
16988     else if (min === v[0])
16989       ranges.push(`<=${max}`)
16990     else
16991       ranges.push(`${min} - ${max}`)
16992   }
16993   const simplified = ranges.join(' || ')
16994   const original = typeof range.raw === 'string' ? range.raw : String(range)
16995   return simplified.length < original.length ? simplified : range
16996 }
16997
16998
16999 /***/ }),
17000 /* 117 */
17001 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17002
17003 const Range = __webpack_require__(105)
17004 const { ANY } = __webpack_require__(104)
17005 const satisfies = __webpack_require__(106)
17006 const compare = __webpack_require__(87)
17007
17008 // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
17009 // - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
17010 //
17011 // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
17012 // - If c is only the ANY comparator
17013 //   - If C is only the ANY comparator, return true
17014 //   - Else return false
17015 // - Let EQ be the set of = comparators in c
17016 // - If EQ is more than one, return true (null set)
17017 // - Let GT be the highest > or >= comparator in c
17018 // - Let LT be the lowest < or <= comparator in c
17019 // - If GT and LT, and GT.semver > LT.semver, return true (null set)
17020 // - If EQ
17021 //   - If GT, and EQ does not satisfy GT, return true (null set)
17022 //   - If LT, and EQ does not satisfy LT, return true (null set)
17023 //   - If EQ satisfies every C, return true
17024 //   - Else return false
17025 // - If GT
17026 //   - If GT is lower than any > or >= comp in C, return false
17027 //   - If GT is >=, and GT.semver does not satisfy every C, return false
17028 // - If LT
17029 //   - If LT.semver is greater than that of any > comp in C, return false
17030 //   - If LT is <=, and LT.semver does not satisfy every C, return false
17031 // - If any C is a = range, and GT or LT are set, return false
17032 // - Else return true
17033
17034 const subset = (sub, dom, options) => {
17035   sub = new Range(sub, options)
17036   dom = new Range(dom, options)
17037   let sawNonNull = false
17038
17039   OUTER: for (const simpleSub of sub.set) {
17040     for (const simpleDom of dom.set) {
17041       const isSub = simpleSubset(simpleSub, simpleDom, options)
17042       sawNonNull = sawNonNull || isSub !== null
17043       if (isSub)
17044         continue OUTER
17045     }
17046     // the null set is a subset of everything, but null simple ranges in
17047     // a complex range should be ignored.  so if we saw a non-null range,
17048     // then we know this isn't a subset, but if EVERY simple range was null,
17049     // then it is a subset.
17050     if (sawNonNull)
17051       return false
17052   }
17053   return true
17054 }
17055
17056 const simpleSubset = (sub, dom, options) => {
17057   if (sub.length === 1 && sub[0].semver === ANY)
17058     return dom.length === 1 && dom[0].semver === ANY
17059
17060   const eqSet = new Set()
17061   let gt, lt
17062   for (const c of sub) {
17063     if (c.operator === '>' || c.operator === '>=')
17064       gt = higherGT(gt, c, options)
17065     else if (c.operator === '<' || c.operator === '<=')
17066       lt = lowerLT(lt, c, options)
17067     else
17068       eqSet.add(c.semver)
17069   }
17070
17071   if (eqSet.size > 1)
17072     return null
17073
17074   let gtltComp
17075   if (gt && lt) {
17076     gtltComp = compare(gt.semver, lt.semver, options)
17077     if (gtltComp > 0)
17078       return null
17079     else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
17080       return null
17081   }
17082
17083   // will iterate one or zero times
17084   for (const eq of eqSet) {
17085     if (gt && !satisfies(eq, String(gt), options))
17086       return null
17087
17088     if (lt && !satisfies(eq, String(lt), options))
17089       return null
17090
17091     for (const c of dom) {
17092       if (!satisfies(eq, String(c), options))
17093         return false
17094     }
17095     return true
17096   }
17097
17098   let higher, lower
17099   let hasDomLT, hasDomGT
17100   for (const c of dom) {
17101     hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
17102     hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
17103     if (gt) {
17104       if (c.operator === '>' || c.operator === '>=') {
17105         higher = higherGT(gt, c, options)
17106         if (higher === c)
17107           return false
17108       } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
17109         return false
17110     }
17111     if (lt) {
17112       if (c.operator === '<' || c.operator === '<=') {
17113         lower = lowerLT(lt, c, options)
17114         if (lower === c)
17115           return false
17116       } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
17117         return false
17118     }
17119     if (!c.operator && (lt || gt) && gtltComp !== 0)
17120       return false
17121   }
17122
17123   // if there was a < or >, and nothing in the dom, then must be false
17124   // UNLESS it was limited by another range in the other direction.
17125   // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
17126   if (gt && hasDomLT && !lt && gtltComp !== 0)
17127     return false
17128
17129   if (lt && hasDomGT && !gt && gtltComp !== 0)
17130     return false
17131
17132   return true
17133 }
17134
17135 // >=1.2.3 is lower than >1.2.3
17136 const higherGT = (a, b, options) => {
17137   if (!a)
17138     return b
17139   const comp = compare(a.semver, b.semver, options)
17140   return comp > 0 ? a
17141     : comp < 0 ? b
17142     : b.operator === '>' && a.operator === '>=' ? b
17143     : a
17144 }
17145
17146 // <=1.2.3 is higher than <1.2.3
17147 const lowerLT = (a, b, options) => {
17148   if (!a)
17149     return b
17150   const comp = compare(a.semver, b.semver, options)
17151   return comp < 0 ? a
17152     : comp > 0 ? b
17153     : b.operator === '<' && a.operator === '<=' ? b
17154     : a
17155 }
17156
17157 module.exports = subset
17158
17159
17160 /***/ }),
17161 /* 118 */
17162 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
17163
17164 "use strict";
17165
17166 // Polyfills for node 0.8
17167 __webpack_require__(119);
17168 __webpack_require__(120);
17169 __webpack_require__(121);
17170
17171
17172 exports.Parse = __webpack_require__(122);
17173 exports.ParseOne = __webpack_require__(186);
17174 exports.Extract = __webpack_require__(188);
17175 exports.Open = __webpack_require__(211);
17176
17177 /***/ }),
17178 /* 119 */
17179 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17180
17181 "use strict";
17182
17183
17184 var listenerCount = __webpack_require__(68).listenerCount
17185 // listenerCount isn't in node 0.10, so here's a basic polyfill
17186 listenerCount = listenerCount || function (ee, event) {
17187   var listeners = ee && ee._events && ee._events[event]
17188   if (Array.isArray(listeners)) {
17189     return listeners.length
17190   } else if (typeof listeners === 'function') {
17191     return 1
17192   } else {
17193     return 0
17194   }
17195 }
17196
17197 module.exports = listenerCount
17198
17199
17200 /***/ }),
17201 /* 120 */
17202 /***/ (() => {
17203
17204 "use strict";
17205
17206
17207 if (!Buffer.prototype.indexOf) {
17208     Buffer.prototype.indexOf = function (value, offset) {
17209         offset = offset || 0;
17210
17211         // Always wrap the input as a Buffer so that this method will support any
17212         // data type such as array octet, string or buffer.
17213         if (typeof value === "string" || value instanceof String) {
17214             value = new Buffer(value);
17215         } else if (typeof value === "number" || value instanceof Number) {
17216             value = new Buffer([ value ]);
17217         }
17218
17219         var len = value.length;
17220
17221         for (var i = offset; i <= this.length - len; i++) {
17222             var mismatch = false;
17223             for (var j = 0; j < len; j++) {
17224                 if (this[i + j] != value[j]) {
17225                     mismatch = true;
17226                     break;
17227                 }
17228             }
17229
17230             if (!mismatch) {
17231                 return i;
17232             }
17233         }
17234
17235         return -1;
17236     };
17237 }
17238
17239 function bufferLastIndexOf (value, offset) {
17240
17241     // Always wrap the input as a Buffer so that this method will support any
17242     // data type such as array octet, string or buffer.
17243     if (typeof value === "string" || value instanceof String) {
17244         value = new Buffer(value);
17245     } else if (typeof value === "number" || value instanceof Number) {
17246         value = new Buffer([ value ]);
17247     }
17248
17249     var len = value.length;
17250     offset = offset || this.length - len;
17251
17252     for (var i = offset; i >= 0; i--) {
17253         var mismatch = false;
17254         for (var j = 0; j < len; j++) {
17255             if (this[i + j] != value[j]) {
17256                 mismatch = true;
17257                 break;
17258             }
17259         }
17260
17261         if (!mismatch) {
17262             return i;
17263         }
17264     }
17265
17266     return -1;
17267 }
17268
17269
17270 if (Buffer.prototype.lastIndexOf) {
17271     // check Buffer#lastIndexOf is usable: https://github.com/nodejs/node/issues/4604
17272     if (new Buffer ("ABC").lastIndexOf ("ABC") === -1)
17273         Buffer.prototype.lastIndexOf = bufferLastIndexOf;
17274 } else {
17275     Buffer.prototype.lastIndexOf = bufferLastIndexOf;
17276 }
17277
17278
17279 /***/ }),
17280 /* 121 */
17281 /***/ (function() {
17282
17283 (function (global, undefined) {
17284     "use strict";
17285
17286     if (global.setImmediate) {
17287         return;
17288     }
17289
17290     var nextHandle = 1; // Spec says greater than zero
17291     var tasksByHandle = {};
17292     var currentlyRunningATask = false;
17293     var doc = global.document;
17294     var registerImmediate;
17295
17296     function setImmediate(callback) {
17297       // Callback can either be a function or a string
17298       if (typeof callback !== "function") {
17299         callback = new Function("" + callback);
17300       }
17301       // Copy function arguments
17302       var args = new Array(arguments.length - 1);
17303       for (var i = 0; i < args.length; i++) {
17304           args[i] = arguments[i + 1];
17305       }
17306       // Store and register the task
17307       var task = { callback: callback, args: args };
17308       tasksByHandle[nextHandle] = task;
17309       registerImmediate(nextHandle);
17310       return nextHandle++;
17311     }
17312
17313     function clearImmediate(handle) {
17314         delete tasksByHandle[handle];
17315     }
17316
17317     function run(task) {
17318         var callback = task.callback;
17319         var args = task.args;
17320         switch (args.length) {
17321         case 0:
17322             callback();
17323             break;
17324         case 1:
17325             callback(args[0]);
17326             break;
17327         case 2:
17328             callback(args[0], args[1]);
17329             break;
17330         case 3:
17331             callback(args[0], args[1], args[2]);
17332             break;
17333         default:
17334             callback.apply(undefined, args);
17335             break;
17336         }
17337     }
17338
17339     function runIfPresent(handle) {
17340         // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
17341         // So if we're currently running a task, we'll need to delay this invocation.
17342         if (currentlyRunningATask) {
17343             // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
17344             // "too much recursion" error.
17345             setTimeout(runIfPresent, 0, handle);
17346         } else {
17347             var task = tasksByHandle[handle];
17348             if (task) {
17349                 currentlyRunningATask = true;
17350                 try {
17351                     run(task);
17352                 } finally {
17353                     clearImmediate(handle);
17354                     currentlyRunningATask = false;
17355                 }
17356             }
17357         }
17358     }
17359
17360     function installNextTickImplementation() {
17361         registerImmediate = function(handle) {
17362             process.nextTick(function () { runIfPresent(handle); });
17363         };
17364     }
17365
17366     function canUsePostMessage() {
17367         // The test against `importScripts` prevents this implementation from being installed inside a web worker,
17368         // where `global.postMessage` means something completely different and can't be used for this purpose.
17369         if (global.postMessage && !global.importScripts) {
17370             var postMessageIsAsynchronous = true;
17371             var oldOnMessage = global.onmessage;
17372             global.onmessage = function() {
17373                 postMessageIsAsynchronous = false;
17374             };
17375             global.postMessage("", "*");
17376             global.onmessage = oldOnMessage;
17377             return postMessageIsAsynchronous;
17378         }
17379     }
17380
17381     function installPostMessageImplementation() {
17382         // Installs an event handler on `global` for the `message` event: see
17383         // * https://developer.mozilla.org/en/DOM/window.postMessage
17384         // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
17385
17386         var messagePrefix = "setImmediate$" + Math.random() + "$";
17387         var onGlobalMessage = function(event) {
17388             if (event.source === global &&
17389                 typeof event.data === "string" &&
17390                 event.data.indexOf(messagePrefix) === 0) {
17391                 runIfPresent(+event.data.slice(messagePrefix.length));
17392             }
17393         };
17394
17395         if (global.addEventListener) {
17396             global.addEventListener("message", onGlobalMessage, false);
17397         } else {
17398             global.attachEvent("onmessage", onGlobalMessage);
17399         }
17400
17401         registerImmediate = function(handle) {
17402             global.postMessage(messagePrefix + handle, "*");
17403         };
17404     }
17405
17406     function installMessageChannelImplementation() {
17407         var channel = new MessageChannel();
17408         channel.port1.onmessage = function(event) {
17409             var handle = event.data;
17410             runIfPresent(handle);
17411         };
17412
17413         registerImmediate = function(handle) {
17414             channel.port2.postMessage(handle);
17415         };
17416     }
17417
17418     function installReadyStateChangeImplementation() {
17419         var html = doc.documentElement;
17420         registerImmediate = function(handle) {
17421             // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
17422             // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
17423             var script = doc.createElement("script");
17424             script.onreadystatechange = function () {
17425                 runIfPresent(handle);
17426                 script.onreadystatechange = null;
17427                 html.removeChild(script);
17428                 script = null;
17429             };
17430             html.appendChild(script);
17431         };
17432     }
17433
17434     function installSetTimeoutImplementation() {
17435         registerImmediate = function(handle) {
17436             setTimeout(runIfPresent, 0, handle);
17437         };
17438     }
17439
17440     // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
17441     var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
17442     attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
17443
17444     // Don't get fooled by e.g. browserify environments.
17445     if ({}.toString.call(global.process) === "[object process]") {
17446         // For Node.js before 0.9
17447         installNextTickImplementation();
17448
17449     } else if (canUsePostMessage()) {
17450         // For non-IE10 modern browsers
17451         installPostMessageImplementation();
17452
17453     } else if (global.MessageChannel) {
17454         // For web workers, where supported
17455         installMessageChannelImplementation();
17456
17457     } else if (doc && "onreadystatechange" in doc.createElement("script")) {
17458         // For IE 6–8
17459         installReadyStateChangeImplementation();
17460
17461     } else {
17462         // For older browsers
17463         installSetTimeoutImplementation();
17464     }
17465
17466     attachTo.setImmediate = setImmediate;
17467     attachTo.clearImmediate = clearImmediate;
17468 }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
17469
17470
17471 /***/ }),
17472 /* 122 */
17473 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17474
17475 var util = __webpack_require__(50);
17476 var zlib = __webpack_require__(48);
17477 var Stream = __webpack_require__(44);
17478 var binary = __webpack_require__(123);
17479 var Promise = __webpack_require__(128);
17480 var PullStream = __webpack_require__(164);
17481 var NoopStream = __webpack_require__(182);
17482 var BufferStream = __webpack_require__(183);
17483 var parseExtraField = __webpack_require__(184);
17484 var Buffer = __webpack_require__(165);
17485 var parseDateTime = __webpack_require__(185);
17486
17487 // Backwards compatibility for node versions < 8
17488 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
17489   Stream = __webpack_require__(167);
17490
17491 var endDirectorySignature = Buffer.alloc(4);
17492 endDirectorySignature.writeUInt32LE(0x06054b50, 0);
17493
17494 function Parse(opts) {
17495   if (!(this instanceof Parse)) {
17496     return new Parse(opts);
17497   }
17498   var self = this;
17499   self._opts = opts || { verbose: false };
17500
17501   PullStream.call(self, self._opts);
17502   self.on('finish',function() {
17503     self.emit('close');
17504   });
17505   self._readRecord().catch(function(e) {
17506     if (!self.__emittedError || self.__emittedError !== e)
17507       self.emit('error',e);
17508   });
17509 }
17510
17511 util.inherits(Parse, PullStream);
17512
17513 Parse.prototype._readRecord = function () {
17514   var self = this;
17515   return self.pull(4).then(function(data) {
17516     if (data.length === 0)
17517       return;
17518
17519     var signature = data.readUInt32LE(0);
17520
17521     if (signature === 0x34327243) {
17522       return self._readCrxHeader();
17523     }
17524     if (signature === 0x04034b50) {
17525       return self._readFile();
17526     }
17527     else if (signature === 0x02014b50) {
17528       self.__ended = true;
17529       return self._readCentralDirectoryFileHeader();
17530     }
17531     else if (signature === 0x06054b50) {
17532       return self._readEndOfCentralDirectoryRecord();
17533     }
17534     else if (self.__ended) {
17535       return self.pull(endDirectorySignature).then(function() {
17536           return self._readEndOfCentralDirectoryRecord();
17537         });
17538     }
17539     else
17540       self.emit('error', new Error('invalid signature: 0x' + signature.toString(16)));
17541   });
17542 };
17543
17544 Parse.prototype._readCrxHeader = function() {
17545   var self = this;
17546   return self.pull(12).then(function(data) {
17547     self.crxHeader = binary.parse(data)
17548       .word32lu('version')
17549       .word32lu('pubKeyLength')
17550       .word32lu('signatureLength')
17551       .vars;
17552     return self.pull(self.crxHeader.pubKeyLength + self.crxHeader.signatureLength);
17553   }).then(function(data) {
17554     self.crxHeader.publicKey = data.slice(0,self.crxHeader.pubKeyLength);
17555     self.crxHeader.signature = data.slice(self.crxHeader.pubKeyLength);
17556     self.emit('crx-header',self.crxHeader);
17557     return self._readRecord();
17558   });
17559 };
17560
17561 Parse.prototype._readFile = function () {
17562   var self = this;
17563   return self.pull(26).then(function(data) {
17564     var vars = binary.parse(data)
17565       .word16lu('versionsNeededToExtract')
17566       .word16lu('flags')
17567       .word16lu('compressionMethod')
17568       .word16lu('lastModifiedTime')
17569       .word16lu('lastModifiedDate')
17570       .word32lu('crc32')
17571       .word32lu('compressedSize')
17572       .word32lu('uncompressedSize')
17573       .word16lu('fileNameLength')
17574       .word16lu('extraFieldLength')
17575       .vars;
17576
17577     vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
17578
17579     if (self.crxHeader) vars.crxHeader = self.crxHeader;
17580
17581     return self.pull(vars.fileNameLength).then(function(fileNameBuffer) {
17582       var fileName = fileNameBuffer.toString('utf8');
17583       var entry = Stream.PassThrough();
17584       var __autodraining = false;
17585
17586       entry.autodrain = function() {
17587         __autodraining = true;
17588         var draining = entry.pipe(NoopStream());
17589         draining.promise = function() {
17590           return new Promise(function(resolve, reject) {
17591             draining.on('finish',resolve);
17592             draining.on('error',reject);
17593           });
17594         };
17595         return draining;
17596       };
17597
17598       entry.buffer = function() {
17599         return BufferStream(entry);
17600       };
17601
17602       entry.path = fileName;
17603       entry.props = {};
17604       entry.props.path = fileName;
17605       entry.props.pathBuffer = fileNameBuffer;
17606       entry.props.flags = {
17607         "isUnicode": vars.flags & 0x11
17608       };
17609       entry.type = (vars.uncompressedSize === 0 && /[\/\\]$/.test(fileName)) ? 'Directory' : 'File';
17610
17611       if (self._opts.verbose) {
17612         if (entry.type === 'Directory') {
17613           console.log('   creating:', fileName);
17614         } else if (entry.type === 'File') {
17615           if (vars.compressionMethod === 0) {
17616             console.log(' extracting:', fileName);
17617           } else {
17618             console.log('  inflating:', fileName);
17619           }
17620         }
17621       }
17622
17623       return self.pull(vars.extraFieldLength).then(function(extraField) {
17624         var extra = parseExtraField(extraField, vars);
17625
17626         entry.vars = vars;
17627         entry.extra = extra;
17628
17629         if (self._opts.forceStream) {
17630           self.push(entry);
17631         } else {
17632           self.emit('entry', entry);
17633
17634           if (self._readableState.pipesCount || (self._readableState.pipes && self._readableState.pipes.length))
17635             self.push(entry);
17636         }
17637
17638         if (self._opts.verbose)
17639           console.log({
17640             filename:fileName,
17641             vars: vars,
17642             extra: extra
17643           });
17644
17645         var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0,
17646             eof;
17647
17648         entry.__autodraining = __autodraining;  // expose __autodraining for test purposes
17649         var inflater = (vars.compressionMethod && !__autodraining) ? zlib.createInflateRaw() : Stream.PassThrough();
17650
17651         if (fileSizeKnown) {
17652           entry.size = vars.uncompressedSize;
17653           eof = vars.compressedSize;
17654         } else {
17655           eof = Buffer.alloc(4);
17656           eof.writeUInt32LE(0x08074b50, 0);
17657         }
17658
17659         return new Promise(function(resolve, reject) {
17660           self.stream(eof)
17661             .pipe(inflater)
17662             .on('error',function(err) { self.emit('error',err);})
17663             .pipe(entry)
17664             .on('finish', function() {
17665               return fileSizeKnown ?
17666                 self._readRecord().then(resolve).catch(reject) :
17667                 self._processDataDescriptor(entry).then(resolve).catch(reject);
17668             });
17669         });
17670       });
17671     });
17672   });
17673 };
17674
17675 Parse.prototype._processDataDescriptor = function (entry) {
17676   var self = this;
17677   return self.pull(16).then(function(data) {
17678     var vars = binary.parse(data)
17679       .word32lu('dataDescriptorSignature')
17680       .word32lu('crc32')
17681       .word32lu('compressedSize')
17682       .word32lu('uncompressedSize')
17683       .vars;
17684
17685     entry.size = vars.uncompressedSize;
17686     return self._readRecord();
17687   });
17688 };
17689
17690 Parse.prototype._readCentralDirectoryFileHeader = function () {
17691   var self = this;
17692   return self.pull(42).then(function(data) {
17693
17694     var vars = binary.parse(data)
17695       .word16lu('versionMadeBy')
17696       .word16lu('versionsNeededToExtract')
17697       .word16lu('flags')
17698       .word16lu('compressionMethod')
17699       .word16lu('lastModifiedTime')
17700       .word16lu('lastModifiedDate')
17701       .word32lu('crc32')
17702       .word32lu('compressedSize')
17703       .word32lu('uncompressedSize')
17704       .word16lu('fileNameLength')
17705       .word16lu('extraFieldLength')
17706       .word16lu('fileCommentLength')
17707       .word16lu('diskNumber')
17708       .word16lu('internalFileAttributes')
17709       .word32lu('externalFileAttributes')
17710       .word32lu('offsetToLocalFileHeader')
17711       .vars;
17712
17713     return self.pull(vars.fileNameLength).then(function(fileName) {
17714       vars.fileName = fileName.toString('utf8');
17715       return self.pull(vars.extraFieldLength);
17716     })
17717     .then(function(extraField) {
17718       return self.pull(vars.fileCommentLength);
17719     })
17720     .then(function(fileComment) {
17721       return self._readRecord();
17722     });
17723   });
17724 };
17725
17726 Parse.prototype._readEndOfCentralDirectoryRecord = function() {
17727   var self = this;
17728   return self.pull(18).then(function(data) {
17729
17730     var vars = binary.parse(data)
17731       .word16lu('diskNumber')
17732       .word16lu('diskStart')
17733       .word16lu('numberOfRecordsOnDisk')
17734       .word16lu('numberOfRecords')
17735       .word32lu('sizeOfCentralDirectory')
17736       .word32lu('offsetToStartOfCentralDirectory')
17737       .word16lu('commentLength')
17738       .vars;
17739
17740     return self.pull(vars.commentLength).then(function(comment) {
17741       comment = comment.toString('utf8');
17742       self.end();
17743       self.push(null);
17744     });
17745
17746   });
17747 };
17748
17749 Parse.prototype.promise = function() {
17750   var self = this;
17751   return new Promise(function(resolve,reject) {
17752     self.on('finish',resolve);
17753     self.on('error',reject);
17754   });
17755 };
17756
17757 module.exports = Parse;
17758
17759
17760 /***/ }),
17761 /* 123 */
17762 /***/ ((module, exports, __webpack_require__) => {
17763
17764 var Chainsaw = __webpack_require__(124);
17765 var EventEmitter = __webpack_require__(68).EventEmitter;
17766 var Buffers = __webpack_require__(126);
17767 var Vars = __webpack_require__(127);
17768 var Stream = __webpack_require__(44).Stream;
17769
17770 exports = module.exports = function (bufOrEm, eventName) {
17771     if (Buffer.isBuffer(bufOrEm)) {
17772         return exports.parse(bufOrEm);
17773     }
17774     
17775     var s = exports.stream();
17776     if (bufOrEm && bufOrEm.pipe) {
17777         bufOrEm.pipe(s);
17778     }
17779     else if (bufOrEm) {
17780         bufOrEm.on(eventName || 'data', function (buf) {
17781             s.write(buf);
17782         });
17783         
17784         bufOrEm.on('end', function () {
17785             s.end();
17786         });
17787     }
17788     return s;
17789 };
17790
17791 exports.stream = function (input) {
17792     if (input) return exports.apply(null, arguments);
17793     
17794     var pending = null;
17795     function getBytes (bytes, cb, skip) {
17796         pending = {
17797             bytes : bytes,
17798             skip : skip,
17799             cb : function (buf) {
17800                 pending = null;
17801                 cb(buf);
17802             },
17803         };
17804         dispatch();
17805     }
17806     
17807     var offset = null;
17808     function dispatch () {
17809         if (!pending) {
17810             if (caughtEnd) done = true;
17811             return;
17812         }
17813         if (typeof pending === 'function') {
17814             pending();
17815         }
17816         else {
17817             var bytes = offset + pending.bytes;
17818             
17819             if (buffers.length >= bytes) {
17820                 var buf;
17821                 if (offset == null) {
17822                     buf = buffers.splice(0, bytes);
17823                     if (!pending.skip) {
17824                         buf = buf.slice();
17825                     }
17826                 }
17827                 else {
17828                     if (!pending.skip) {
17829                         buf = buffers.slice(offset, bytes);
17830                     }
17831                     offset = bytes;
17832                 }
17833                 
17834                 if (pending.skip) {
17835                     pending.cb();
17836                 }
17837                 else {
17838                     pending.cb(buf);
17839                 }
17840             }
17841         }
17842     }
17843     
17844     function builder (saw) {
17845         function next () { if (!done) saw.next() }
17846         
17847         var self = words(function (bytes, cb) {
17848             return function (name) {
17849                 getBytes(bytes, function (buf) {
17850                     vars.set(name, cb(buf));
17851                     next();
17852                 });
17853             };
17854         });
17855         
17856         self.tap = function (cb) {
17857             saw.nest(cb, vars.store);
17858         };
17859         
17860         self.into = function (key, cb) {
17861             if (!vars.get(key)) vars.set(key, {});
17862             var parent = vars;
17863             vars = Vars(parent.get(key));
17864             
17865             saw.nest(function () {
17866                 cb.apply(this, arguments);
17867                 this.tap(function () {
17868                     vars = parent;
17869                 });
17870             }, vars.store);
17871         };
17872         
17873         self.flush = function () {
17874             vars.store = {};
17875             next();
17876         };
17877         
17878         self.loop = function (cb) {
17879             var end = false;
17880             
17881             saw.nest(false, function loop () {
17882                 this.vars = vars.store;
17883                 cb.call(this, function () {
17884                     end = true;
17885                     next();
17886                 }, vars.store);
17887                 this.tap(function () {
17888                     if (end) saw.next()
17889                     else loop.call(this)
17890                 }.bind(this));
17891             }, vars.store);
17892         };
17893         
17894         self.buffer = function (name, bytes) {
17895             if (typeof bytes === 'string') {
17896                 bytes = vars.get(bytes);
17897             }
17898             
17899             getBytes(bytes, function (buf) {
17900                 vars.set(name, buf);
17901                 next();
17902             });
17903         };
17904         
17905         self.skip = function (bytes) {
17906             if (typeof bytes === 'string') {
17907                 bytes = vars.get(bytes);
17908             }
17909             
17910             getBytes(bytes, function () {
17911                 next();
17912             });
17913         };
17914         
17915         self.scan = function find (name, search) {
17916             if (typeof search === 'string') {
17917                 search = new Buffer(search);
17918             }
17919             else if (!Buffer.isBuffer(search)) {
17920                 throw new Error('search must be a Buffer or a string');
17921             }
17922             
17923             var taken = 0;
17924             pending = function () {
17925                 var pos = buffers.indexOf(search, offset + taken);
17926                 var i = pos-offset-taken;
17927                 if (pos !== -1) {
17928                     pending = null;
17929                     if (offset != null) {
17930                         vars.set(
17931                             name,
17932                             buffers.slice(offset, offset + taken + i)
17933                         );
17934                         offset += taken + i + search.length;
17935                     }
17936                     else {
17937                         vars.set(
17938                             name,
17939                             buffers.slice(0, taken + i)
17940                         );
17941                         buffers.splice(0, taken + i + search.length);
17942                     }
17943                     next();
17944                     dispatch();
17945                 } else {
17946                     i = Math.max(buffers.length - search.length - offset - taken, 0);
17947                                 }
17948                 taken += i;
17949             };
17950             dispatch();
17951         };
17952         
17953         self.peek = function (cb) {
17954             offset = 0;
17955             saw.nest(function () {
17956                 cb.call(this, vars.store);
17957                 this.tap(function () {
17958                     offset = null;
17959                 });
17960             });
17961         };
17962         
17963         return self;
17964     };
17965     
17966     var stream = Chainsaw.light(builder);
17967     stream.writable = true;
17968     
17969     var buffers = Buffers();
17970     
17971     stream.write = function (buf) {
17972         buffers.push(buf);
17973         dispatch();
17974     };
17975     
17976     var vars = Vars();
17977     
17978     var done = false, caughtEnd = false;
17979     stream.end = function () {
17980         caughtEnd = true;
17981     };
17982     
17983     stream.pipe = Stream.prototype.pipe;
17984     Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) {
17985         stream[name] = EventEmitter.prototype[name];
17986     });
17987     
17988     return stream;
17989 };
17990
17991 exports.parse = function parse (buffer) {
17992     var self = words(function (bytes, cb) {
17993         return function (name) {
17994             if (offset + bytes <= buffer.length) {
17995                 var buf = buffer.slice(offset, offset + bytes);
17996                 offset += bytes;
17997                 vars.set(name, cb(buf));
17998             }
17999             else {
18000                 vars.set(name, null);
18001             }
18002             return self;
18003         };
18004     });
18005     
18006     var offset = 0;
18007     var vars = Vars();
18008     self.vars = vars.store;
18009     
18010     self.tap = function (cb) {
18011         cb.call(self, vars.store);
18012         return self;
18013     };
18014     
18015     self.into = function (key, cb) {
18016         if (!vars.get(key)) {
18017             vars.set(key, {});
18018         }
18019         var parent = vars;
18020         vars = Vars(parent.get(key));
18021         cb.call(self, vars.store);
18022         vars = parent;
18023         return self;
18024     };
18025     
18026     self.loop = function (cb) {
18027         var end = false;
18028         var ender = function () { end = true };
18029         while (end === false) {
18030             cb.call(self, ender, vars.store);
18031         }
18032         return self;
18033     };
18034     
18035     self.buffer = function (name, size) {
18036         if (typeof size === 'string') {
18037             size = vars.get(size);
18038         }
18039         var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
18040         offset += size;
18041         vars.set(name, buf);
18042         
18043         return self;
18044     };
18045     
18046     self.skip = function (bytes) {
18047         if (typeof bytes === 'string') {
18048             bytes = vars.get(bytes);
18049         }
18050         offset += bytes;
18051         
18052         return self;
18053     };
18054     
18055     self.scan = function (name, search) {
18056         if (typeof search === 'string') {
18057             search = new Buffer(search);
18058         }
18059         else if (!Buffer.isBuffer(search)) {
18060             throw new Error('search must be a Buffer or a string');
18061         }
18062         vars.set(name, null);
18063         
18064         // simple but slow string search
18065         for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
18066             for (
18067                 var j = 0;
18068                 j < search.length && buffer[offset+i+j] === search[j];
18069                 j++
18070             );
18071             if (j === search.length) break;
18072         }
18073         
18074         vars.set(name, buffer.slice(offset, offset + i));
18075         offset += i + search.length;
18076         return self;
18077     };
18078     
18079     self.peek = function (cb) {
18080         var was = offset;
18081         cb.call(self, vars.store);
18082         offset = was;
18083         return self;
18084     };
18085     
18086     self.flush = function () {
18087         vars.store = {};
18088         return self;
18089     };
18090     
18091     self.eof = function () {
18092         return offset >= buffer.length;
18093     };
18094     
18095     return self;
18096 };
18097
18098 // convert byte strings to unsigned little endian numbers
18099 function decodeLEu (bytes) {
18100     var acc = 0;
18101     for (var i = 0; i < bytes.length; i++) {
18102         acc += Math.pow(256,i) * bytes[i];
18103     }
18104     return acc;
18105 }
18106
18107 // convert byte strings to unsigned big endian numbers
18108 function decodeBEu (bytes) {
18109     var acc = 0;
18110     for (var i = 0; i < bytes.length; i++) {
18111         acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
18112     }
18113     return acc;
18114 }
18115
18116 // convert byte strings to signed big endian numbers
18117 function decodeBEs (bytes) {
18118     var val = decodeBEu(bytes);
18119     if ((bytes[0] & 0x80) == 0x80) {
18120         val -= Math.pow(256, bytes.length);
18121     }
18122     return val;
18123 }
18124
18125 // convert byte strings to signed little endian numbers
18126 function decodeLEs (bytes) {
18127     var val = decodeLEu(bytes);
18128     if ((bytes[bytes.length - 1] & 0x80) == 0x80) {
18129         val -= Math.pow(256, bytes.length);
18130     }
18131     return val;
18132 }
18133
18134 function words (decode) {
18135     var self = {};
18136     
18137     [ 1, 2, 4, 8 ].forEach(function (bytes) {
18138         var bits = bytes * 8;
18139         
18140         self['word' + bits + 'le']
18141         = self['word' + bits + 'lu']
18142         = decode(bytes, decodeLEu);
18143         
18144         self['word' + bits + 'ls']
18145         = decode(bytes, decodeLEs);
18146         
18147         self['word' + bits + 'be']
18148         = self['word' + bits + 'bu']
18149         = decode(bytes, decodeBEu);
18150         
18151         self['word' + bits + 'bs']
18152         = decode(bytes, decodeBEs);
18153     });
18154     
18155     // word8be(n) == word8le(n) for all n
18156     self.word8 = self.word8u = self.word8be;
18157     self.word8s = self.word8bs;
18158     
18159     return self;
18160 }
18161
18162
18163 /***/ }),
18164 /* 124 */
18165 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18166
18167 var Traverse = __webpack_require__(125);
18168 var EventEmitter = __webpack_require__(68).EventEmitter;
18169
18170 module.exports = Chainsaw;
18171 function Chainsaw (builder) {
18172     var saw = Chainsaw.saw(builder, {});
18173     var r = builder.call(saw.handlers, saw);
18174     if (r !== undefined) saw.handlers = r;
18175     saw.record();
18176     return saw.chain();
18177 };
18178
18179 Chainsaw.light = function ChainsawLight (builder) {
18180     var saw = Chainsaw.saw(builder, {});
18181     var r = builder.call(saw.handlers, saw);
18182     if (r !== undefined) saw.handlers = r;
18183     return saw.chain();
18184 };
18185
18186 Chainsaw.saw = function (builder, handlers) {
18187     var saw = new EventEmitter;
18188     saw.handlers = handlers;
18189     saw.actions = [];
18190
18191     saw.chain = function () {
18192         var ch = Traverse(saw.handlers).map(function (node) {
18193             if (this.isRoot) return node;
18194             var ps = this.path;
18195
18196             if (typeof node === 'function') {
18197                 this.update(function () {
18198                     saw.actions.push({
18199                         path : ps,
18200                         args : [].slice.call(arguments)
18201                     });
18202                     return ch;
18203                 });
18204             }
18205         });
18206
18207         process.nextTick(function () {
18208             saw.emit('begin');
18209             saw.next();
18210         });
18211
18212         return ch;
18213     };
18214
18215     saw.pop = function () {
18216         return saw.actions.shift();
18217     };
18218
18219     saw.next = function () {
18220         var action = saw.pop();
18221
18222         if (!action) {
18223             saw.emit('end');
18224         }
18225         else if (!action.trap) {
18226             var node = saw.handlers;
18227             action.path.forEach(function (key) { node = node[key] });
18228             node.apply(saw.handlers, action.args);
18229         }
18230     };
18231
18232     saw.nest = function (cb) {
18233         var args = [].slice.call(arguments, 1);
18234         var autonext = true;
18235
18236         if (typeof cb === 'boolean') {
18237             var autonext = cb;
18238             cb = args.shift();
18239         }
18240
18241         var s = Chainsaw.saw(builder, {});
18242         var r = builder.call(s.handlers, s);
18243
18244         if (r !== undefined) s.handlers = r;
18245
18246         // If we are recording...
18247         if ("undefined" !== typeof saw.step) {
18248             // ... our children should, too
18249             s.record();
18250         }
18251
18252         cb.apply(s.chain(), args);
18253         if (autonext !== false) s.on('end', saw.next);
18254     };
18255
18256     saw.record = function () {
18257         upgradeChainsaw(saw);
18258     };
18259
18260     ['trap', 'down', 'jump'].forEach(function (method) {
18261         saw[method] = function () {
18262             throw new Error("To use the trap, down and jump features, please "+
18263                             "call record() first to start recording actions.");
18264         };
18265     });
18266
18267     return saw;
18268 };
18269
18270 function upgradeChainsaw(saw) {
18271     saw.step = 0;
18272
18273     // override pop
18274     saw.pop = function () {
18275         return saw.actions[saw.step++];
18276     };
18277
18278     saw.trap = function (name, cb) {
18279         var ps = Array.isArray(name) ? name : [name];
18280         saw.actions.push({
18281             path : ps,
18282             step : saw.step,
18283             cb : cb,
18284             trap : true
18285         });
18286     };
18287
18288     saw.down = function (name) {
18289         var ps = (Array.isArray(name) ? name : [name]).join('/');
18290         var i = saw.actions.slice(saw.step).map(function (x) {
18291             if (x.trap && x.step <= saw.step) return false;
18292             return x.path.join('/') == ps;
18293         }).indexOf(true);
18294
18295         if (i >= 0) saw.step += i;
18296         else saw.step = saw.actions.length;
18297
18298         var act = saw.actions[saw.step - 1];
18299         if (act && act.trap) {
18300             // It's a trap!
18301             saw.step = act.step;
18302             act.cb();
18303         }
18304         else saw.next();
18305     };
18306
18307     saw.jump = function (step) {
18308         saw.step = step;
18309         saw.next();
18310     };
18311 };
18312
18313
18314 /***/ }),
18315 /* 125 */
18316 /***/ ((module) => {
18317
18318 module.exports = Traverse;
18319 function Traverse (obj) {
18320     if (!(this instanceof Traverse)) return new Traverse(obj);
18321     this.value = obj;
18322 }
18323
18324 Traverse.prototype.get = function (ps) {
18325     var node = this.value;
18326     for (var i = 0; i < ps.length; i ++) {
18327         var key = ps[i];
18328         if (!Object.hasOwnProperty.call(node, key)) {
18329             node = undefined;
18330             break;
18331         }
18332         node = node[key];
18333     }
18334     return node;
18335 };
18336
18337 Traverse.prototype.set = function (ps, value) {
18338     var node = this.value;
18339     for (var i = 0; i < ps.length - 1; i ++) {
18340         var key = ps[i];
18341         if (!Object.hasOwnProperty.call(node, key)) node[key] = {};
18342         node = node[key];
18343     }
18344     node[ps[i]] = value;
18345     return value;
18346 };
18347
18348 Traverse.prototype.map = function (cb) {
18349     return walk(this.value, cb, true);
18350 };
18351
18352 Traverse.prototype.forEach = function (cb) {
18353     this.value = walk(this.value, cb, false);
18354     return this.value;
18355 };
18356
18357 Traverse.prototype.reduce = function (cb, init) {
18358     var skip = arguments.length === 1;
18359     var acc = skip ? this.value : init;
18360     this.forEach(function (x) {
18361         if (!this.isRoot || !skip) {
18362             acc = cb.call(this, acc, x);
18363         }
18364     });
18365     return acc;
18366 };
18367
18368 Traverse.prototype.deepEqual = function (obj) {
18369     if (arguments.length !== 1) {
18370         throw new Error(
18371             'deepEqual requires exactly one object to compare against'
18372         );
18373     }
18374     
18375     var equal = true;
18376     var node = obj;
18377     
18378     this.forEach(function (y) {
18379         var notEqual = (function () {
18380             equal = false;
18381             //this.stop();
18382             return undefined;
18383         }).bind(this);
18384         
18385         //if (node === undefined || node === null) return notEqual();
18386         
18387         if (!this.isRoot) {
18388         /*
18389             if (!Object.hasOwnProperty.call(node, this.key)) {
18390                 return notEqual();
18391             }
18392         */
18393             if (typeof node !== 'object') return notEqual();
18394             node = node[this.key];
18395         }
18396         
18397         var x = node;
18398         
18399         this.post(function () {
18400             node = x;
18401         });
18402         
18403         var toS = function (o) {
18404             return Object.prototype.toString.call(o);
18405         };
18406         
18407         if (this.circular) {
18408             if (Traverse(obj).get(this.circular.path) !== x) notEqual();
18409         }
18410         else if (typeof x !== typeof y) {
18411             notEqual();
18412         }
18413         else if (x === null || y === null || x === undefined || y === undefined) {
18414             if (x !== y) notEqual();
18415         }
18416         else if (x.__proto__ !== y.__proto__) {
18417             notEqual();
18418         }
18419         else if (x === y) {
18420             // nop
18421         }
18422         else if (typeof x === 'function') {
18423             if (x instanceof RegExp) {
18424                 // both regexps on account of the __proto__ check
18425                 if (x.toString() != y.toString()) notEqual();
18426             }
18427             else if (x !== y) notEqual();
18428         }
18429         else if (typeof x === 'object') {
18430             if (toS(y) === '[object Arguments]'
18431             || toS(x) === '[object Arguments]') {
18432                 if (toS(x) !== toS(y)) {
18433                     notEqual();
18434                 }
18435             }
18436             else if (x instanceof Date || y instanceof Date) {
18437                 if (!(x instanceof Date) || !(y instanceof Date)
18438                 || x.getTime() !== y.getTime()) {
18439                     notEqual();
18440                 }
18441             }
18442             else {
18443                 var kx = Object.keys(x);
18444                 var ky = Object.keys(y);
18445                 if (kx.length !== ky.length) return notEqual();
18446                 for (var i = 0; i < kx.length; i++) {
18447                     var k = kx[i];
18448                     if (!Object.hasOwnProperty.call(y, k)) {
18449                         notEqual();
18450                     }
18451                 }
18452             }
18453         }
18454     });
18455     
18456     return equal;
18457 };
18458
18459 Traverse.prototype.paths = function () {
18460     var acc = [];
18461     this.forEach(function (x) {
18462         acc.push(this.path); 
18463     });
18464     return acc;
18465 };
18466
18467 Traverse.prototype.nodes = function () {
18468     var acc = [];
18469     this.forEach(function (x) {
18470         acc.push(this.node);
18471     });
18472     return acc;
18473 };
18474
18475 Traverse.prototype.clone = function () {
18476     var parents = [], nodes = [];
18477     
18478     return (function clone (src) {
18479         for (var i = 0; i < parents.length; i++) {
18480             if (parents[i] === src) {
18481                 return nodes[i];
18482             }
18483         }
18484         
18485         if (typeof src === 'object' && src !== null) {
18486             var dst = copy(src);
18487             
18488             parents.push(src);
18489             nodes.push(dst);
18490             
18491             Object.keys(src).forEach(function (key) {
18492                 dst[key] = clone(src[key]);
18493             });
18494             
18495             parents.pop();
18496             nodes.pop();
18497             return dst;
18498         }
18499         else {
18500             return src;
18501         }
18502     })(this.value);
18503 };
18504
18505 function walk (root, cb, immutable) {
18506     var path = [];
18507     var parents = [];
18508     var alive = true;
18509     
18510     return (function walker (node_) {
18511         var node = immutable ? copy(node_) : node_;
18512         var modifiers = {};
18513         
18514         var state = {
18515             node : node,
18516             node_ : node_,
18517             path : [].concat(path),
18518             parent : parents.slice(-1)[0],
18519             key : path.slice(-1)[0],
18520             isRoot : path.length === 0,
18521             level : path.length,
18522             circular : null,
18523             update : function (x) {
18524                 if (!state.isRoot) {
18525                     state.parent.node[state.key] = x;
18526                 }
18527                 state.node = x;
18528             },
18529             'delete' : function () {
18530                 delete state.parent.node[state.key];
18531             },
18532             remove : function () {
18533                 if (Array.isArray(state.parent.node)) {
18534                     state.parent.node.splice(state.key, 1);
18535                 }
18536                 else {
18537                     delete state.parent.node[state.key];
18538                 }
18539             },
18540             before : function (f) { modifiers.before = f },
18541             after : function (f) { modifiers.after = f },
18542             pre : function (f) { modifiers.pre = f },
18543             post : function (f) { modifiers.post = f },
18544             stop : function () { alive = false }
18545         };
18546         
18547         if (!alive) return state;
18548         
18549         if (typeof node === 'object' && node !== null) {
18550             state.isLeaf = Object.keys(node).length == 0;
18551             
18552             for (var i = 0; i < parents.length; i++) {
18553                 if (parents[i].node_ === node_) {
18554                     state.circular = parents[i];
18555                     break;
18556                 }
18557             }
18558         }
18559         else {
18560             state.isLeaf = true;
18561         }
18562         
18563         state.notLeaf = !state.isLeaf;
18564         state.notRoot = !state.isRoot;
18565         
18566         // use return values to update if defined
18567         var ret = cb.call(state, state.node);
18568         if (ret !== undefined && state.update) state.update(ret);
18569         if (modifiers.before) modifiers.before.call(state, state.node);
18570         
18571         if (typeof state.node == 'object'
18572         && state.node !== null && !state.circular) {
18573             parents.push(state);
18574             
18575             var keys = Object.keys(state.node);
18576             keys.forEach(function (key, i) {
18577                 path.push(key);
18578                 
18579                 if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
18580                 
18581                 var child = walker(state.node[key]);
18582                 if (immutable && Object.hasOwnProperty.call(state.node, key)) {
18583                     state.node[key] = child.node;
18584                 }
18585                 
18586                 child.isLast = i == keys.length - 1;
18587                 child.isFirst = i == 0;
18588                 
18589                 if (modifiers.post) modifiers.post.call(state, child);
18590                 
18591                 path.pop();
18592             });
18593             parents.pop();
18594         }
18595         
18596         if (modifiers.after) modifiers.after.call(state, state.node);
18597         
18598         return state;
18599     })(root).node;
18600 }
18601
18602 Object.keys(Traverse.prototype).forEach(function (key) {
18603     Traverse[key] = function (obj) {
18604         var args = [].slice.call(arguments, 1);
18605         var t = Traverse(obj);
18606         return t[key].apply(t, args);
18607     };
18608 });
18609
18610 function copy (src) {
18611     if (typeof src === 'object' && src !== null) {
18612         var dst;
18613         
18614         if (Array.isArray(src)) {
18615             dst = [];
18616         }
18617         else if (src instanceof Date) {
18618             dst = new Date(src);
18619         }
18620         else if (src instanceof Boolean) {
18621             dst = new Boolean(src);
18622         }
18623         else if (src instanceof Number) {
18624             dst = new Number(src);
18625         }
18626         else if (src instanceof String) {
18627             dst = new String(src);
18628         }
18629         else {
18630             dst = Object.create(Object.getPrototypeOf(src));
18631         }
18632         
18633         Object.keys(src).forEach(function (key) {
18634             dst[key] = src[key];
18635         });
18636         return dst;
18637     }
18638     else return src;
18639 }
18640
18641
18642 /***/ }),
18643 /* 126 */
18644 /***/ ((module) => {
18645
18646 module.exports = Buffers;
18647
18648 function Buffers (bufs) {
18649     if (!(this instanceof Buffers)) return new Buffers(bufs);
18650     this.buffers = bufs || [];
18651     this.length = this.buffers.reduce(function (size, buf) {
18652         return size + buf.length
18653     }, 0);
18654 }
18655
18656 Buffers.prototype.push = function () {
18657     for (var i = 0; i < arguments.length; i++) {
18658         if (!Buffer.isBuffer(arguments[i])) {
18659             throw new TypeError('Tried to push a non-buffer');
18660         }
18661     }
18662     
18663     for (var i = 0; i < arguments.length; i++) {
18664         var buf = arguments[i];
18665         this.buffers.push(buf);
18666         this.length += buf.length;
18667     }
18668     return this.length;
18669 };
18670
18671 Buffers.prototype.unshift = function () {
18672     for (var i = 0; i < arguments.length; i++) {
18673         if (!Buffer.isBuffer(arguments[i])) {
18674             throw new TypeError('Tried to unshift a non-buffer');
18675         }
18676     }
18677     
18678     for (var i = 0; i < arguments.length; i++) {
18679         var buf = arguments[i];
18680         this.buffers.unshift(buf);
18681         this.length += buf.length;
18682     }
18683     return this.length;
18684 };
18685
18686 Buffers.prototype.copy = function (dst, dStart, start, end) {
18687     return this.slice(start, end).copy(dst, dStart, 0, end - start);
18688 };
18689
18690 Buffers.prototype.splice = function (i, howMany) {
18691     var buffers = this.buffers;
18692     var index = i >= 0 ? i : this.length - i;
18693     var reps = [].slice.call(arguments, 2);
18694     
18695     if (howMany === undefined) {
18696         howMany = this.length - index;
18697     }
18698     else if (howMany > this.length - index) {
18699         howMany = this.length - index;
18700     }
18701     
18702     for (var i = 0; i < reps.length; i++) {
18703         this.length += reps[i].length;
18704     }
18705     
18706     var removed = new Buffers();
18707     var bytes = 0;
18708     
18709     var startBytes = 0;
18710     for (
18711         var ii = 0;
18712         ii < buffers.length && startBytes + buffers[ii].length < index;
18713         ii ++
18714     ) { startBytes += buffers[ii].length }
18715     
18716     if (index - startBytes > 0) {
18717         var start = index - startBytes;
18718         
18719         if (start + howMany < buffers[ii].length) {
18720             removed.push(buffers[ii].slice(start, start + howMany));
18721             
18722             var orig = buffers[ii];
18723             //var buf = new Buffer(orig.length - howMany);
18724             var buf0 = new Buffer(start);
18725             for (var i = 0; i < start; i++) {
18726                 buf0[i] = orig[i];
18727             }
18728             
18729             var buf1 = new Buffer(orig.length - start - howMany);
18730             for (var i = start + howMany; i < orig.length; i++) {
18731                 buf1[ i - howMany - start ] = orig[i]
18732             }
18733             
18734             if (reps.length > 0) {
18735                 var reps_ = reps.slice();
18736                 reps_.unshift(buf0);
18737                 reps_.push(buf1);
18738                 buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
18739                 ii += reps_.length;
18740                 reps = [];
18741             }
18742             else {
18743                 buffers.splice(ii, 1, buf0, buf1);
18744                 //buffers[ii] = buf;
18745                 ii += 2;
18746             }
18747         }
18748         else {
18749             removed.push(buffers[ii].slice(start));
18750             buffers[ii] = buffers[ii].slice(0, start);
18751             ii ++;
18752         }
18753     }
18754     
18755     if (reps.length > 0) {
18756         buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
18757         ii += reps.length;
18758     }
18759     
18760     while (removed.length < howMany) {
18761         var buf = buffers[ii];
18762         var len = buf.length;
18763         var take = Math.min(len, howMany - removed.length);
18764         
18765         if (take === len) {
18766             removed.push(buf);
18767             buffers.splice(ii, 1);
18768         }
18769         else {
18770             removed.push(buf.slice(0, take));
18771             buffers[ii] = buffers[ii].slice(take);
18772         }
18773     }
18774     
18775     this.length -= removed.length;
18776     
18777     return removed;
18778 };
18779  
18780 Buffers.prototype.slice = function (i, j) {
18781     var buffers = this.buffers;
18782     if (j === undefined) j = this.length;
18783     if (i === undefined) i = 0;
18784     
18785     if (j > this.length) j = this.length;
18786     
18787     var startBytes = 0;
18788     for (
18789         var si = 0;
18790         si < buffers.length && startBytes + buffers[si].length <= i;
18791         si ++
18792     ) { startBytes += buffers[si].length }
18793     
18794     var target = new Buffer(j - i);
18795     
18796     var ti = 0;
18797     for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
18798         var len = buffers[ii].length;
18799         
18800         var start = ti === 0 ? i - startBytes : 0;
18801         var end = ti + len >= j - i
18802             ? Math.min(start + (j - i) - ti, len)
18803             : len
18804         ;
18805         
18806         buffers[ii].copy(target, ti, start, end);
18807         ti += end - start;
18808     }
18809     
18810     return target;
18811 };
18812
18813 Buffers.prototype.pos = function (i) {
18814     if (i < 0 || i >= this.length) throw new Error('oob');
18815     var l = i, bi = 0, bu = null;
18816     for (;;) {
18817         bu = this.buffers[bi];
18818         if (l < bu.length) {
18819             return {buf: bi, offset: l};
18820         } else {
18821             l -= bu.length;
18822         }
18823         bi++;
18824     }
18825 };
18826
18827 Buffers.prototype.get = function get (i) {
18828     var pos = this.pos(i);
18829
18830     return this.buffers[pos.buf].get(pos.offset);
18831 };
18832
18833 Buffers.prototype.set = function set (i, b) {
18834     var pos = this.pos(i);
18835
18836     return this.buffers[pos.buf].set(pos.offset, b);
18837 };
18838
18839 Buffers.prototype.indexOf = function (needle, offset) {
18840     if ("string" === typeof needle) {
18841         needle = new Buffer(needle);
18842     } else if (needle instanceof Buffer) {
18843         // already a buffer
18844     } else {
18845         throw new Error('Invalid type for a search string');
18846     }
18847
18848     if (!needle.length) {
18849         return 0;
18850     }
18851
18852     if (!this.length) {
18853         return -1;
18854     }
18855
18856     var i = 0, j = 0, match = 0, mstart, pos = 0;
18857
18858     // start search from a particular point in the virtual buffer
18859     if (offset) {
18860         var p = this.pos(offset);
18861         i = p.buf;
18862         j = p.offset;
18863         pos = offset;
18864     }
18865
18866     // for each character in virtual buffer
18867     for (;;) {
18868         while (j >= this.buffers[i].length) {
18869             j = 0;
18870             i++;
18871
18872             if (i >= this.buffers.length) {
18873                 // search string not found
18874                 return -1;
18875             }
18876         }
18877
18878         var char = this.buffers[i][j];
18879
18880         if (char == needle[match]) {
18881             // keep track where match started
18882             if (match == 0) {
18883                 mstart = {
18884                     i: i,
18885                     j: j,
18886                     pos: pos
18887                 };
18888             }
18889             match++;
18890             if (match == needle.length) {
18891                 // full match
18892                 return mstart.pos;
18893             }
18894         } else if (match != 0) {
18895             // a partial match ended, go back to match starting position
18896             // this will continue the search at the next character
18897             i = mstart.i;
18898             j = mstart.j;
18899             pos = mstart.pos;
18900             match = 0;
18901         }
18902
18903         j++;
18904         pos++;
18905     }
18906 };
18907
18908 Buffers.prototype.toBuffer = function() {
18909     return this.slice();
18910 }
18911
18912 Buffers.prototype.toString = function(encoding, start, end) {
18913     return this.slice(start, end).toString(encoding);
18914 }
18915
18916
18917 /***/ }),
18918 /* 127 */
18919 /***/ ((module) => {
18920
18921 module.exports = function (store) {
18922     function getset (name, value) {
18923         var node = vars.store;
18924         var keys = name.split('.');
18925         keys.slice(0,-1).forEach(function (k) {
18926             if (node[k] === undefined) node[k] = {};
18927             node = node[k]
18928         });
18929         var key = keys[keys.length - 1];
18930         if (arguments.length == 1) {
18931             return node[key];
18932         }
18933         else {
18934             return node[key] = value;
18935         }
18936     }
18937     
18938     var vars = {
18939         get : function (name) {
18940             return getset(name);
18941         },
18942         set : function (name, value) {
18943             return getset(name, value);
18944         },
18945         store : store || {},
18946     };
18947     return vars;
18948 };
18949
18950
18951 /***/ }),
18952 /* 128 */
18953 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18954
18955 "use strict";
18956
18957 var old;
18958 if (typeof Promise !== "undefined") old = Promise;
18959 function noConflict() {
18960     try { if (Promise === bluebird) Promise = old; }
18961     catch (e) {}
18962     return bluebird;
18963 }
18964 var bluebird = __webpack_require__(129)();
18965 bluebird.noConflict = noConflict;
18966 module.exports = bluebird;
18967
18968
18969 /***/ }),
18970 /* 129 */
18971 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18972
18973 "use strict";
18974
18975 module.exports = function() {
18976 var makeSelfResolutionError = function () {
18977     return new TypeError("circular promise resolution chain\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
18978 };
18979 var reflectHandler = function() {
18980     return new Promise.PromiseInspection(this._target());
18981 };
18982 var apiRejection = function(msg) {
18983     return Promise.reject(new TypeError(msg));
18984 };
18985 function Proxyable() {}
18986 var UNDEFINED_BINDING = {};
18987 var util = __webpack_require__(130);
18988
18989 var getDomain;
18990 if (util.isNode) {
18991     getDomain = function() {
18992         var ret = process.domain;
18993         if (ret === undefined) ret = null;
18994         return ret;
18995     };
18996 } else {
18997     getDomain = function() {
18998         return null;
18999     };
19000 }
19001 util.notEnumerableProp(Promise, "_getDomain", getDomain);
19002
19003 var es5 = __webpack_require__(131);
19004 var Async = __webpack_require__(132);
19005 var async = new Async();
19006 es5.defineProperty(Promise, "_async", {value: async});
19007 var errors = __webpack_require__(135);
19008 var TypeError = Promise.TypeError = errors.TypeError;
19009 Promise.RangeError = errors.RangeError;
19010 var CancellationError = Promise.CancellationError = errors.CancellationError;
19011 Promise.TimeoutError = errors.TimeoutError;
19012 Promise.OperationalError = errors.OperationalError;
19013 Promise.RejectionError = errors.OperationalError;
19014 Promise.AggregateError = errors.AggregateError;
19015 var INTERNAL = function(){};
19016 var APPLY = {};
19017 var NEXT_FILTER = {};
19018 var tryConvertToPromise = __webpack_require__(136)(Promise, INTERNAL);
19019 var PromiseArray =
19020     __webpack_require__(137)(Promise, INTERNAL,
19021                                tryConvertToPromise, apiRejection, Proxyable);
19022 var Context = __webpack_require__(138)(Promise);
19023  /*jshint unused:false*/
19024 var createContext = Context.create;
19025 var debug = __webpack_require__(139)(Promise, Context);
19026 var CapturedTrace = debug.CapturedTrace;
19027 var PassThroughHandlerContext =
19028     __webpack_require__(140)(Promise, tryConvertToPromise);
19029 var catchFilter = __webpack_require__(141)(NEXT_FILTER);
19030 var nodebackForPromise = __webpack_require__(142);
19031 var errorObj = util.errorObj;
19032 var tryCatch = util.tryCatch;
19033 function check(self, executor) {
19034     if (typeof executor !== "function") {
19035         throw new TypeError("expecting a function but got " + util.classString(executor));
19036     }
19037     if (self.constructor !== Promise) {
19038         throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
19039     }
19040 }
19041
19042 function Promise(executor) {
19043     this._bitField = 0;
19044     this._fulfillmentHandler0 = undefined;
19045     this._rejectionHandler0 = undefined;
19046     this._promise0 = undefined;
19047     this._receiver0 = undefined;
19048     if (executor !== INTERNAL) {
19049         check(this, executor);
19050         this._resolveFromExecutor(executor);
19051     }
19052     this._promiseCreated();
19053     this._fireEvent("promiseCreated", this);
19054 }
19055
19056 Promise.prototype.toString = function () {
19057     return "[object Promise]";
19058 };
19059
19060 Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
19061     var len = arguments.length;
19062     if (len > 1) {
19063         var catchInstances = new Array(len - 1),
19064             j = 0, i;
19065         for (i = 0; i < len - 1; ++i) {
19066             var item = arguments[i];
19067             if (util.isObject(item)) {
19068                 catchInstances[j++] = item;
19069             } else {
19070                 return apiRejection("expecting an object but got " +
19071                     "A catch statement predicate " + util.classString(item));
19072             }
19073         }
19074         catchInstances.length = j;
19075         fn = arguments[i];
19076         return this.then(undefined, catchFilter(catchInstances, fn, this));
19077     }
19078     return this.then(undefined, fn);
19079 };
19080
19081 Promise.prototype.reflect = function () {
19082     return this._then(reflectHandler,
19083         reflectHandler, undefined, this, undefined);
19084 };
19085
19086 Promise.prototype.then = function (didFulfill, didReject) {
19087     if (debug.warnings() && arguments.length > 0 &&
19088         typeof didFulfill !== "function" &&
19089         typeof didReject !== "function") {
19090         var msg = ".then() only accepts functions but was passed: " +
19091                 util.classString(didFulfill);
19092         if (arguments.length > 1) {
19093             msg += ", " + util.classString(didReject);
19094         }
19095         this._warn(msg);
19096     }
19097     return this._then(didFulfill, didReject, undefined, undefined, undefined);
19098 };
19099
19100 Promise.prototype.done = function (didFulfill, didReject) {
19101     var promise =
19102         this._then(didFulfill, didReject, undefined, undefined, undefined);
19103     promise._setIsFinal();
19104 };
19105
19106 Promise.prototype.spread = function (fn) {
19107     if (typeof fn !== "function") {
19108         return apiRejection("expecting a function but got " + util.classString(fn));
19109     }
19110     return this.all()._then(fn, undefined, undefined, APPLY, undefined);
19111 };
19112
19113 Promise.prototype.toJSON = function () {
19114     var ret = {
19115         isFulfilled: false,
19116         isRejected: false,
19117         fulfillmentValue: undefined,
19118         rejectionReason: undefined
19119     };
19120     if (this.isFulfilled()) {
19121         ret.fulfillmentValue = this.value();
19122         ret.isFulfilled = true;
19123     } else if (this.isRejected()) {
19124         ret.rejectionReason = this.reason();
19125         ret.isRejected = true;
19126     }
19127     return ret;
19128 };
19129
19130 Promise.prototype.all = function () {
19131     if (arguments.length > 0) {
19132         this._warn(".all() was passed arguments but it does not take any");
19133     }
19134     return new PromiseArray(this).promise();
19135 };
19136
19137 Promise.prototype.error = function (fn) {
19138     return this.caught(util.originatesFromRejection, fn);
19139 };
19140
19141 Promise.getNewLibraryCopy = module.exports;
19142
19143 Promise.is = function (val) {
19144     return val instanceof Promise;
19145 };
19146
19147 Promise.fromNode = Promise.fromCallback = function(fn) {
19148     var ret = new Promise(INTERNAL);
19149     ret._captureStackTrace();
19150     var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
19151                                          : false;
19152     var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
19153     if (result === errorObj) {
19154         ret._rejectCallback(result.e, true);
19155     }
19156     if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
19157     return ret;
19158 };
19159
19160 Promise.all = function (promises) {
19161     return new PromiseArray(promises).promise();
19162 };
19163
19164 Promise.cast = function (obj) {
19165     var ret = tryConvertToPromise(obj);
19166     if (!(ret instanceof Promise)) {
19167         ret = new Promise(INTERNAL);
19168         ret._captureStackTrace();
19169         ret._setFulfilled();
19170         ret._rejectionHandler0 = obj;
19171     }
19172     return ret;
19173 };
19174
19175 Promise.resolve = Promise.fulfilled = Promise.cast;
19176
19177 Promise.reject = Promise.rejected = function (reason) {
19178     var ret = new Promise(INTERNAL);
19179     ret._captureStackTrace();
19180     ret._rejectCallback(reason, true);
19181     return ret;
19182 };
19183
19184 Promise.setScheduler = function(fn) {
19185     if (typeof fn !== "function") {
19186         throw new TypeError("expecting a function but got " + util.classString(fn));
19187     }
19188     return async.setScheduler(fn);
19189 };
19190
19191 Promise.prototype._then = function (
19192     didFulfill,
19193     didReject,
19194     _,    receiver,
19195     internalData
19196 ) {
19197     var haveInternalData = internalData !== undefined;
19198     var promise = haveInternalData ? internalData : new Promise(INTERNAL);
19199     var target = this._target();
19200     var bitField = target._bitField;
19201
19202     if (!haveInternalData) {
19203         promise._propagateFrom(this, 3);
19204         promise._captureStackTrace();
19205         if (receiver === undefined &&
19206             ((this._bitField & 2097152) !== 0)) {
19207             if (!((bitField & 50397184) === 0)) {
19208                 receiver = this._boundValue();
19209             } else {
19210                 receiver = target === this ? undefined : this._boundTo;
19211             }
19212         }
19213         this._fireEvent("promiseChained", this, promise);
19214     }
19215
19216     var domain = getDomain();
19217     if (!((bitField & 50397184) === 0)) {
19218         var handler, value, settler = target._settlePromiseCtx;
19219         if (((bitField & 33554432) !== 0)) {
19220             value = target._rejectionHandler0;
19221             handler = didFulfill;
19222         } else if (((bitField & 16777216) !== 0)) {
19223             value = target._fulfillmentHandler0;
19224             handler = didReject;
19225             target._unsetRejectionIsUnhandled();
19226         } else {
19227             settler = target._settlePromiseLateCancellationObserver;
19228             value = new CancellationError("late cancellation observer");
19229             target._attachExtraTrace(value);
19230             handler = didReject;
19231         }
19232
19233         async.invoke(settler, target, {
19234             handler: domain === null ? handler
19235                 : (typeof handler === "function" &&
19236                     util.domainBind(domain, handler)),
19237             promise: promise,
19238             receiver: receiver,
19239             value: value
19240         });
19241     } else {
19242         target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
19243     }
19244
19245     return promise;
19246 };
19247
19248 Promise.prototype._length = function () {
19249     return this._bitField & 65535;
19250 };
19251
19252 Promise.prototype._isFateSealed = function () {
19253     return (this._bitField & 117506048) !== 0;
19254 };
19255
19256 Promise.prototype._isFollowing = function () {
19257     return (this._bitField & 67108864) === 67108864;
19258 };
19259
19260 Promise.prototype._setLength = function (len) {
19261     this._bitField = (this._bitField & -65536) |
19262         (len & 65535);
19263 };
19264
19265 Promise.prototype._setFulfilled = function () {
19266     this._bitField = this._bitField | 33554432;
19267     this._fireEvent("promiseFulfilled", this);
19268 };
19269
19270 Promise.prototype._setRejected = function () {
19271     this._bitField = this._bitField | 16777216;
19272     this._fireEvent("promiseRejected", this);
19273 };
19274
19275 Promise.prototype._setFollowing = function () {
19276     this._bitField = this._bitField | 67108864;
19277     this._fireEvent("promiseResolved", this);
19278 };
19279
19280 Promise.prototype._setIsFinal = function () {
19281     this._bitField = this._bitField | 4194304;
19282 };
19283
19284 Promise.prototype._isFinal = function () {
19285     return (this._bitField & 4194304) > 0;
19286 };
19287
19288 Promise.prototype._unsetCancelled = function() {
19289     this._bitField = this._bitField & (~65536);
19290 };
19291
19292 Promise.prototype._setCancelled = function() {
19293     this._bitField = this._bitField | 65536;
19294     this._fireEvent("promiseCancelled", this);
19295 };
19296
19297 Promise.prototype._setWillBeCancelled = function() {
19298     this._bitField = this._bitField | 8388608;
19299 };
19300
19301 Promise.prototype._setAsyncGuaranteed = function() {
19302     if (async.hasCustomScheduler()) return;
19303     this._bitField = this._bitField | 134217728;
19304 };
19305
19306 Promise.prototype._receiverAt = function (index) {
19307     var ret = index === 0 ? this._receiver0 : this[
19308             index * 4 - 4 + 3];
19309     if (ret === UNDEFINED_BINDING) {
19310         return undefined;
19311     } else if (ret === undefined && this._isBound()) {
19312         return this._boundValue();
19313     }
19314     return ret;
19315 };
19316
19317 Promise.prototype._promiseAt = function (index) {
19318     return this[
19319             index * 4 - 4 + 2];
19320 };
19321
19322 Promise.prototype._fulfillmentHandlerAt = function (index) {
19323     return this[
19324             index * 4 - 4 + 0];
19325 };
19326
19327 Promise.prototype._rejectionHandlerAt = function (index) {
19328     return this[
19329             index * 4 - 4 + 1];
19330 };
19331
19332 Promise.prototype._boundValue = function() {};
19333
19334 Promise.prototype._migrateCallback0 = function (follower) {
19335     var bitField = follower._bitField;
19336     var fulfill = follower._fulfillmentHandler0;
19337     var reject = follower._rejectionHandler0;
19338     var promise = follower._promise0;
19339     var receiver = follower._receiverAt(0);
19340     if (receiver === undefined) receiver = UNDEFINED_BINDING;
19341     this._addCallbacks(fulfill, reject, promise, receiver, null);
19342 };
19343
19344 Promise.prototype._migrateCallbackAt = function (follower, index) {
19345     var fulfill = follower._fulfillmentHandlerAt(index);
19346     var reject = follower._rejectionHandlerAt(index);
19347     var promise = follower._promiseAt(index);
19348     var receiver = follower._receiverAt(index);
19349     if (receiver === undefined) receiver = UNDEFINED_BINDING;
19350     this._addCallbacks(fulfill, reject, promise, receiver, null);
19351 };
19352
19353 Promise.prototype._addCallbacks = function (
19354     fulfill,
19355     reject,
19356     promise,
19357     receiver,
19358     domain
19359 ) {
19360     var index = this._length();
19361
19362     if (index >= 65535 - 4) {
19363         index = 0;
19364         this._setLength(0);
19365     }
19366
19367     if (index === 0) {
19368         this._promise0 = promise;
19369         this._receiver0 = receiver;
19370         if (typeof fulfill === "function") {
19371             this._fulfillmentHandler0 =
19372                 domain === null ? fulfill : util.domainBind(domain, fulfill);
19373         }
19374         if (typeof reject === "function") {
19375             this._rejectionHandler0 =
19376                 domain === null ? reject : util.domainBind(domain, reject);
19377         }
19378     } else {
19379         var base = index * 4 - 4;
19380         this[base + 2] = promise;
19381         this[base + 3] = receiver;
19382         if (typeof fulfill === "function") {
19383             this[base + 0] =
19384                 domain === null ? fulfill : util.domainBind(domain, fulfill);
19385         }
19386         if (typeof reject === "function") {
19387             this[base + 1] =
19388                 domain === null ? reject : util.domainBind(domain, reject);
19389         }
19390     }
19391     this._setLength(index + 1);
19392     return index;
19393 };
19394
19395 Promise.prototype._proxy = function (proxyable, arg) {
19396     this._addCallbacks(undefined, undefined, arg, proxyable, null);
19397 };
19398
19399 Promise.prototype._resolveCallback = function(value, shouldBind) {
19400     if (((this._bitField & 117506048) !== 0)) return;
19401     if (value === this)
19402         return this._rejectCallback(makeSelfResolutionError(), false);
19403     var maybePromise = tryConvertToPromise(value, this);
19404     if (!(maybePromise instanceof Promise)) return this._fulfill(value);
19405
19406     if (shouldBind) this._propagateFrom(maybePromise, 2);
19407
19408     var promise = maybePromise._target();
19409
19410     if (promise === this) {
19411         this._reject(makeSelfResolutionError());
19412         return;
19413     }
19414
19415     var bitField = promise._bitField;
19416     if (((bitField & 50397184) === 0)) {
19417         var len = this._length();
19418         if (len > 0) promise._migrateCallback0(this);
19419         for (var i = 1; i < len; ++i) {
19420             promise._migrateCallbackAt(this, i);
19421         }
19422         this._setFollowing();
19423         this._setLength(0);
19424         this._setFollowee(promise);
19425     } else if (((bitField & 33554432) !== 0)) {
19426         this._fulfill(promise._value());
19427     } else if (((bitField & 16777216) !== 0)) {
19428         this._reject(promise._reason());
19429     } else {
19430         var reason = new CancellationError("late cancellation observer");
19431         promise._attachExtraTrace(reason);
19432         this._reject(reason);
19433     }
19434 };
19435
19436 Promise.prototype._rejectCallback =
19437 function(reason, synchronous, ignoreNonErrorWarnings) {
19438     var trace = util.ensureErrorObject(reason);
19439     var hasStack = trace === reason;
19440     if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
19441         var message = "a promise was rejected with a non-error: " +
19442             util.classString(reason);
19443         this._warn(message, true);
19444     }
19445     this._attachExtraTrace(trace, synchronous ? hasStack : false);
19446     this._reject(reason);
19447 };
19448
19449 Promise.prototype._resolveFromExecutor = function (executor) {
19450     var promise = this;
19451     this._captureStackTrace();
19452     this._pushContext();
19453     var synchronous = true;
19454     var r = this._execute(executor, function(value) {
19455         promise._resolveCallback(value);
19456     }, function (reason) {
19457         promise._rejectCallback(reason, synchronous);
19458     });
19459     synchronous = false;
19460     this._popContext();
19461
19462     if (r !== undefined) {
19463         promise._rejectCallback(r, true);
19464     }
19465 };
19466
19467 Promise.prototype._settlePromiseFromHandler = function (
19468     handler, receiver, value, promise
19469 ) {
19470     var bitField = promise._bitField;
19471     if (((bitField & 65536) !== 0)) return;
19472     promise._pushContext();
19473     var x;
19474     if (receiver === APPLY) {
19475         if (!value || typeof value.length !== "number") {
19476             x = errorObj;
19477             x.e = new TypeError("cannot .spread() a non-array: " +
19478                                     util.classString(value));
19479         } else {
19480             x = tryCatch(handler).apply(this._boundValue(), value);
19481         }
19482     } else {
19483         x = tryCatch(handler).call(receiver, value);
19484     }
19485     var promiseCreated = promise._popContext();
19486     bitField = promise._bitField;
19487     if (((bitField & 65536) !== 0)) return;
19488
19489     if (x === NEXT_FILTER) {
19490         promise._reject(value);
19491     } else if (x === errorObj) {
19492         promise._rejectCallback(x.e, false);
19493     } else {
19494         debug.checkForgottenReturns(x, promiseCreated, "",  promise, this);
19495         promise._resolveCallback(x);
19496     }
19497 };
19498
19499 Promise.prototype._target = function() {
19500     var ret = this;
19501     while (ret._isFollowing()) ret = ret._followee();
19502     return ret;
19503 };
19504
19505 Promise.prototype._followee = function() {
19506     return this._rejectionHandler0;
19507 };
19508
19509 Promise.prototype._setFollowee = function(promise) {
19510     this._rejectionHandler0 = promise;
19511 };
19512
19513 Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
19514     var isPromise = promise instanceof Promise;
19515     var bitField = this._bitField;
19516     var asyncGuaranteed = ((bitField & 134217728) !== 0);
19517     if (((bitField & 65536) !== 0)) {
19518         if (isPromise) promise._invokeInternalOnCancel();
19519
19520         if (receiver instanceof PassThroughHandlerContext &&
19521             receiver.isFinallyHandler()) {
19522             receiver.cancelPromise = promise;
19523             if (tryCatch(handler).call(receiver, value) === errorObj) {
19524                 promise._reject(errorObj.e);
19525             }
19526         } else if (handler === reflectHandler) {
19527             promise._fulfill(reflectHandler.call(receiver));
19528         } else if (receiver instanceof Proxyable) {
19529             receiver._promiseCancelled(promise);
19530         } else if (isPromise || promise instanceof PromiseArray) {
19531             promise._cancel();
19532         } else {
19533             receiver.cancel();
19534         }
19535     } else if (typeof handler === "function") {
19536         if (!isPromise) {
19537             handler.call(receiver, value, promise);
19538         } else {
19539             if (asyncGuaranteed) promise._setAsyncGuaranteed();
19540             this._settlePromiseFromHandler(handler, receiver, value, promise);
19541         }
19542     } else if (receiver instanceof Proxyable) {
19543         if (!receiver._isResolved()) {
19544             if (((bitField & 33554432) !== 0)) {
19545                 receiver._promiseFulfilled(value, promise);
19546             } else {
19547                 receiver._promiseRejected(value, promise);
19548             }
19549         }
19550     } else if (isPromise) {
19551         if (asyncGuaranteed) promise._setAsyncGuaranteed();
19552         if (((bitField & 33554432) !== 0)) {
19553             promise._fulfill(value);
19554         } else {
19555             promise._reject(value);
19556         }
19557     }
19558 };
19559
19560 Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
19561     var handler = ctx.handler;
19562     var promise = ctx.promise;
19563     var receiver = ctx.receiver;
19564     var value = ctx.value;
19565     if (typeof handler === "function") {
19566         if (!(promise instanceof Promise)) {
19567             handler.call(receiver, value, promise);
19568         } else {
19569             this._settlePromiseFromHandler(handler, receiver, value, promise);
19570         }
19571     } else if (promise instanceof Promise) {
19572         promise._reject(value);
19573     }
19574 };
19575
19576 Promise.prototype._settlePromiseCtx = function(ctx) {
19577     this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
19578 };
19579
19580 Promise.prototype._settlePromise0 = function(handler, value, bitField) {
19581     var promise = this._promise0;
19582     var receiver = this._receiverAt(0);
19583     this._promise0 = undefined;
19584     this._receiver0 = undefined;
19585     this._settlePromise(promise, handler, receiver, value);
19586 };
19587
19588 Promise.prototype._clearCallbackDataAtIndex = function(index) {
19589     var base = index * 4 - 4;
19590     this[base + 2] =
19591     this[base + 3] =
19592     this[base + 0] =
19593     this[base + 1] = undefined;
19594 };
19595
19596 Promise.prototype._fulfill = function (value) {
19597     var bitField = this._bitField;
19598     if (((bitField & 117506048) >>> 16)) return;
19599     if (value === this) {
19600         var err = makeSelfResolutionError();
19601         this._attachExtraTrace(err);
19602         return this._reject(err);
19603     }
19604     this._setFulfilled();
19605     this._rejectionHandler0 = value;
19606
19607     if ((bitField & 65535) > 0) {
19608         if (((bitField & 134217728) !== 0)) {
19609             this._settlePromises();
19610         } else {
19611             async.settlePromises(this);
19612         }
19613     }
19614 };
19615
19616 Promise.prototype._reject = function (reason) {
19617     var bitField = this._bitField;
19618     if (((bitField & 117506048) >>> 16)) return;
19619     this._setRejected();
19620     this._fulfillmentHandler0 = reason;
19621
19622     if (this._isFinal()) {
19623         return async.fatalError(reason, util.isNode);
19624     }
19625
19626     if ((bitField & 65535) > 0) {
19627         async.settlePromises(this);
19628     } else {
19629         this._ensurePossibleRejectionHandled();
19630     }
19631 };
19632
19633 Promise.prototype._fulfillPromises = function (len, value) {
19634     for (var i = 1; i < len; i++) {
19635         var handler = this._fulfillmentHandlerAt(i);
19636         var promise = this._promiseAt(i);
19637         var receiver = this._receiverAt(i);
19638         this._clearCallbackDataAtIndex(i);
19639         this._settlePromise(promise, handler, receiver, value);
19640     }
19641 };
19642
19643 Promise.prototype._rejectPromises = function (len, reason) {
19644     for (var i = 1; i < len; i++) {
19645         var handler = this._rejectionHandlerAt(i);
19646         var promise = this._promiseAt(i);
19647         var receiver = this._receiverAt(i);
19648         this._clearCallbackDataAtIndex(i);
19649         this._settlePromise(promise, handler, receiver, reason);
19650     }
19651 };
19652
19653 Promise.prototype._settlePromises = function () {
19654     var bitField = this._bitField;
19655     var len = (bitField & 65535);
19656
19657     if (len > 0) {
19658         if (((bitField & 16842752) !== 0)) {
19659             var reason = this._fulfillmentHandler0;
19660             this._settlePromise0(this._rejectionHandler0, reason, bitField);
19661             this._rejectPromises(len, reason);
19662         } else {
19663             var value = this._rejectionHandler0;
19664             this._settlePromise0(this._fulfillmentHandler0, value, bitField);
19665             this._fulfillPromises(len, value);
19666         }
19667         this._setLength(0);
19668     }
19669     this._clearCancellationData();
19670 };
19671
19672 Promise.prototype._settledValue = function() {
19673     var bitField = this._bitField;
19674     if (((bitField & 33554432) !== 0)) {
19675         return this._rejectionHandler0;
19676     } else if (((bitField & 16777216) !== 0)) {
19677         return this._fulfillmentHandler0;
19678     }
19679 };
19680
19681 function deferResolve(v) {this.promise._resolveCallback(v);}
19682 function deferReject(v) {this.promise._rejectCallback(v, false);}
19683
19684 Promise.defer = Promise.pending = function() {
19685     debug.deprecated("Promise.defer", "new Promise");
19686     var promise = new Promise(INTERNAL);
19687     return {
19688         promise: promise,
19689         resolve: deferResolve,
19690         reject: deferReject
19691     };
19692 };
19693
19694 util.notEnumerableProp(Promise,
19695                        "_makeSelfResolutionError",
19696                        makeSelfResolutionError);
19697
19698 __webpack_require__(143)(Promise, INTERNAL, tryConvertToPromise, apiRejection,
19699     debug);
19700 __webpack_require__(144)(Promise, INTERNAL, tryConvertToPromise, debug);
19701 __webpack_require__(145)(Promise, PromiseArray, apiRejection, debug);
19702 __webpack_require__(146)(Promise);
19703 __webpack_require__(147)(Promise);
19704 __webpack_require__(148)(
19705     Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
19706 Promise.Promise = Promise;
19707 Promise.version = "3.4.7";
19708 __webpack_require__(149)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
19709 __webpack_require__(150)(Promise);
19710 __webpack_require__(151)(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
19711 __webpack_require__(152)(Promise, INTERNAL, debug);
19712 __webpack_require__(153)(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
19713 __webpack_require__(154)(Promise);
19714 __webpack_require__(155)(Promise, INTERNAL);
19715 __webpack_require__(156)(Promise, PromiseArray, tryConvertToPromise, apiRejection);
19716 __webpack_require__(157)(Promise, INTERNAL, tryConvertToPromise, apiRejection);
19717 __webpack_require__(158)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
19718 __webpack_require__(159)(Promise, PromiseArray, debug);
19719 __webpack_require__(160)(Promise, PromiseArray, apiRejection);
19720 __webpack_require__(161)(Promise, INTERNAL);
19721 __webpack_require__(162)(Promise, INTERNAL);
19722 __webpack_require__(163)(Promise);
19723                                                          
19724     util.toFastProperties(Promise);                                          
19725     util.toFastProperties(Promise.prototype);                                
19726     function fillTypes(value) {                                              
19727         var p = new Promise(INTERNAL);                                       
19728         p._fulfillmentHandler0 = value;                                      
19729         p._rejectionHandler0 = value;                                        
19730         p._promise0 = value;                                                 
19731         p._receiver0 = value;                                                
19732     }                                                                        
19733     // Complete slack tracking, opt out of field-type tracking and           
19734     // stabilize map                                                         
19735     fillTypes({a: 1});                                                       
19736     fillTypes({b: 2});                                                       
19737     fillTypes({c: 3});                                                       
19738     fillTypes(1);                                                            
19739     fillTypes(function(){});                                                 
19740     fillTypes(undefined);                                                    
19741     fillTypes(false);                                                        
19742     fillTypes(new Promise(INTERNAL));                                        
19743     debug.setBounds(Async.firstLineError, util.lastLineError);               
19744     return Promise;                                                          
19745
19746 };
19747
19748
19749 /***/ }),
19750 /* 130 */
19751 /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
19752
19753 "use strict";
19754
19755 var es5 = __webpack_require__(131);
19756 var canEvaluate = typeof navigator == "undefined";
19757
19758 var errorObj = {e: {}};
19759 var tryCatchTarget;
19760 var globalObject = typeof self !== "undefined" ? self :
19761     typeof window !== "undefined" ? window :
19762     typeof global !== "undefined" ? global :
19763     this !== undefined ? this : null;
19764
19765 function tryCatcher() {
19766     try {
19767         var target = tryCatchTarget;
19768         tryCatchTarget = null;
19769         return target.apply(this, arguments);
19770     } catch (e) {
19771         errorObj.e = e;
19772         return errorObj;
19773     }
19774 }
19775 function tryCatch(fn) {
19776     tryCatchTarget = fn;
19777     return tryCatcher;
19778 }
19779
19780 var inherits = function(Child, Parent) {
19781     var hasProp = {}.hasOwnProperty;
19782
19783     function T() {
19784         this.constructor = Child;
19785         this.constructor$ = Parent;
19786         for (var propertyName in Parent.prototype) {
19787             if (hasProp.call(Parent.prototype, propertyName) &&
19788                 propertyName.charAt(propertyName.length-1) !== "$"
19789            ) {
19790                 this[propertyName + "$"] = Parent.prototype[propertyName];
19791             }
19792         }
19793     }
19794     T.prototype = Parent.prototype;
19795     Child.prototype = new T();
19796     return Child.prototype;
19797 };
19798
19799
19800 function isPrimitive(val) {
19801     return val == null || val === true || val === false ||
19802         typeof val === "string" || typeof val === "number";
19803
19804 }
19805
19806 function isObject(value) {
19807     return typeof value === "function" ||
19808            typeof value === "object" && value !== null;
19809 }
19810
19811 function maybeWrapAsError(maybeError) {
19812     if (!isPrimitive(maybeError)) return maybeError;
19813
19814     return new Error(safeToString(maybeError));
19815 }
19816
19817 function withAppended(target, appendee) {
19818     var len = target.length;
19819     var ret = new Array(len + 1);
19820     var i;
19821     for (i = 0; i < len; ++i) {
19822         ret[i] = target[i];
19823     }
19824     ret[i] = appendee;
19825     return ret;
19826 }
19827
19828 function getDataPropertyOrDefault(obj, key, defaultValue) {
19829     if (es5.isES5) {
19830         var desc = Object.getOwnPropertyDescriptor(obj, key);
19831
19832         if (desc != null) {
19833             return desc.get == null && desc.set == null
19834                     ? desc.value
19835                     : defaultValue;
19836         }
19837     } else {
19838         return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
19839     }
19840 }
19841
19842 function notEnumerableProp(obj, name, value) {
19843     if (isPrimitive(obj)) return obj;
19844     var descriptor = {
19845         value: value,
19846         configurable: true,
19847         enumerable: false,
19848         writable: true
19849     };
19850     es5.defineProperty(obj, name, descriptor);
19851     return obj;
19852 }
19853
19854 function thrower(r) {
19855     throw r;
19856 }
19857
19858 var inheritedDataKeys = (function() {
19859     var excludedPrototypes = [
19860         Array.prototype,
19861         Object.prototype,
19862         Function.prototype
19863     ];
19864
19865     var isExcludedProto = function(val) {
19866         for (var i = 0; i < excludedPrototypes.length; ++i) {
19867             if (excludedPrototypes[i] === val) {
19868                 return true;
19869             }
19870         }
19871         return false;
19872     };
19873
19874     if (es5.isES5) {
19875         var getKeys = Object.getOwnPropertyNames;
19876         return function(obj) {
19877             var ret = [];
19878             var visitedKeys = Object.create(null);
19879             while (obj != null && !isExcludedProto(obj)) {
19880                 var keys;
19881                 try {
19882                     keys = getKeys(obj);
19883                 } catch (e) {
19884                     return ret;
19885                 }
19886                 for (var i = 0; i < keys.length; ++i) {
19887                     var key = keys[i];
19888                     if (visitedKeys[key]) continue;
19889                     visitedKeys[key] = true;
19890                     var desc = Object.getOwnPropertyDescriptor(obj, key);
19891                     if (desc != null && desc.get == null && desc.set == null) {
19892                         ret.push(key);
19893                     }
19894                 }
19895                 obj = es5.getPrototypeOf(obj);
19896             }
19897             return ret;
19898         };
19899     } else {
19900         var hasProp = {}.hasOwnProperty;
19901         return function(obj) {
19902             if (isExcludedProto(obj)) return [];
19903             var ret = [];
19904
19905             /*jshint forin:false */
19906             enumeration: for (var key in obj) {
19907                 if (hasProp.call(obj, key)) {
19908                     ret.push(key);
19909                 } else {
19910                     for (var i = 0; i < excludedPrototypes.length; ++i) {
19911                         if (hasProp.call(excludedPrototypes[i], key)) {
19912                             continue enumeration;
19913                         }
19914                     }
19915                     ret.push(key);
19916                 }
19917             }
19918             return ret;
19919         };
19920     }
19921
19922 })();
19923
19924 var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
19925 function isClass(fn) {
19926     try {
19927         if (typeof fn === "function") {
19928             var keys = es5.names(fn.prototype);
19929
19930             var hasMethods = es5.isES5 && keys.length > 1;
19931             var hasMethodsOtherThanConstructor = keys.length > 0 &&
19932                 !(keys.length === 1 && keys[0] === "constructor");
19933             var hasThisAssignmentAndStaticMethods =
19934                 thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
19935
19936             if (hasMethods || hasMethodsOtherThanConstructor ||
19937                 hasThisAssignmentAndStaticMethods) {
19938                 return true;
19939             }
19940         }
19941         return false;
19942     } catch (e) {
19943         return false;
19944     }
19945 }
19946
19947 function toFastProperties(obj) {
19948     /*jshint -W027,-W055,-W031*/
19949     function FakeConstructor() {}
19950     FakeConstructor.prototype = obj;
19951     var l = 8;
19952     while (l--) new FakeConstructor();
19953     return obj;
19954     eval(obj);
19955 }
19956
19957 var rident = /^[a-z$_][a-z$_0-9]*$/i;
19958 function isIdentifier(str) {
19959     return rident.test(str);
19960 }
19961
19962 function filledRange(count, prefix, suffix) {
19963     var ret = new Array(count);
19964     for(var i = 0; i < count; ++i) {
19965         ret[i] = prefix + i + suffix;
19966     }
19967     return ret;
19968 }
19969
19970 function safeToString(obj) {
19971     try {
19972         return obj + "";
19973     } catch (e) {
19974         return "[no string representation]";
19975     }
19976 }
19977
19978 function isError(obj) {
19979     return obj !== null &&
19980            typeof obj === "object" &&
19981            typeof obj.message === "string" &&
19982            typeof obj.name === "string";
19983 }
19984
19985 function markAsOriginatingFromRejection(e) {
19986     try {
19987         notEnumerableProp(e, "isOperational", true);
19988     }
19989     catch(ignore) {}
19990 }
19991
19992 function originatesFromRejection(e) {
19993     if (e == null) return false;
19994     return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
19995         e["isOperational"] === true);
19996 }
19997
19998 function canAttachTrace(obj) {
19999     return isError(obj) && es5.propertyIsWritable(obj, "stack");
20000 }
20001
20002 var ensureErrorObject = (function() {
20003     if (!("stack" in new Error())) {
20004         return function(value) {
20005             if (canAttachTrace(value)) return value;
20006             try {throw new Error(safeToString(value));}
20007             catch(err) {return err;}
20008         };
20009     } else {
20010         return function(value) {
20011             if (canAttachTrace(value)) return value;
20012             return new Error(safeToString(value));
20013         };
20014     }
20015 })();
20016
20017 function classString(obj) {
20018     return {}.toString.call(obj);
20019 }
20020
20021 function copyDescriptors(from, to, filter) {
20022     var keys = es5.names(from);
20023     for (var i = 0; i < keys.length; ++i) {
20024         var key = keys[i];
20025         if (filter(key)) {
20026             try {
20027                 es5.defineProperty(to, key, es5.getDescriptor(from, key));
20028             } catch (ignore) {}
20029         }
20030     }
20031 }
20032
20033 var asArray = function(v) {
20034     if (es5.isArray(v)) {
20035         return v;
20036     }
20037     return null;
20038 };
20039
20040 if (typeof Symbol !== "undefined" && Symbol.iterator) {
20041     var ArrayFrom = typeof Array.from === "function" ? function(v) {
20042         return Array.from(v);
20043     } : function(v) {
20044         var ret = [];
20045         var it = v[Symbol.iterator]();
20046         var itResult;
20047         while (!((itResult = it.next()).done)) {
20048             ret.push(itResult.value);
20049         }
20050         return ret;
20051     };
20052
20053     asArray = function(v) {
20054         if (es5.isArray(v)) {
20055             return v;
20056         } else if (v != null && typeof v[Symbol.iterator] === "function") {
20057             return ArrayFrom(v);
20058         }
20059         return null;
20060     };
20061 }
20062
20063 var isNode = typeof process !== "undefined" &&
20064         classString(process).toLowerCase() === "[object process]";
20065
20066 var hasEnvVariables = typeof process !== "undefined" &&
20067     typeof process.env !== "undefined";
20068
20069 function env(key) {
20070     return hasEnvVariables ? process.env[key] : undefined;
20071 }
20072
20073 function getNativePromise() {
20074     if (typeof Promise === "function") {
20075         try {
20076             var promise = new Promise(function(){});
20077             if ({}.toString.call(promise) === "[object Promise]") {
20078                 return Promise;
20079             }
20080         } catch (e) {}
20081     }
20082 }
20083
20084 function domainBind(self, cb) {
20085     return self.bind(cb);
20086 }
20087
20088 var ret = {
20089     isClass: isClass,
20090     isIdentifier: isIdentifier,
20091     inheritedDataKeys: inheritedDataKeys,
20092     getDataPropertyOrDefault: getDataPropertyOrDefault,
20093     thrower: thrower,
20094     isArray: es5.isArray,
20095     asArray: asArray,
20096     notEnumerableProp: notEnumerableProp,
20097     isPrimitive: isPrimitive,
20098     isObject: isObject,
20099     isError: isError,
20100     canEvaluate: canEvaluate,
20101     errorObj: errorObj,
20102     tryCatch: tryCatch,
20103     inherits: inherits,
20104     withAppended: withAppended,
20105     maybeWrapAsError: maybeWrapAsError,
20106     toFastProperties: toFastProperties,
20107     filledRange: filledRange,
20108     toString: safeToString,
20109     canAttachTrace: canAttachTrace,
20110     ensureErrorObject: ensureErrorObject,
20111     originatesFromRejection: originatesFromRejection,
20112     markAsOriginatingFromRejection: markAsOriginatingFromRejection,
20113     classString: classString,
20114     copyDescriptors: copyDescriptors,
20115     hasDevTools: typeof chrome !== "undefined" && chrome &&
20116                  typeof chrome.loadTimes === "function",
20117     isNode: isNode,
20118     hasEnvVariables: hasEnvVariables,
20119     env: env,
20120     global: globalObject,
20121     getNativePromise: getNativePromise,
20122     domainBind: domainBind
20123 };
20124 ret.isRecentNode = ret.isNode && (function() {
20125     var version = process.versions.node.split(".").map(Number);
20126     return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
20127 })();
20128
20129 if (ret.isNode) ret.toFastProperties(process);
20130
20131 try {throw new Error(); } catch (e) {ret.lastLineError = e;}
20132 module.exports = ret;
20133
20134
20135 /***/ }),
20136 /* 131 */
20137 /***/ ((module) => {
20138
20139 var isES5 = (function(){
20140     "use strict";
20141     return this === undefined;
20142 })();
20143
20144 if (isES5) {
20145     module.exports = {
20146         freeze: Object.freeze,
20147         defineProperty: Object.defineProperty,
20148         getDescriptor: Object.getOwnPropertyDescriptor,
20149         keys: Object.keys,
20150         names: Object.getOwnPropertyNames,
20151         getPrototypeOf: Object.getPrototypeOf,
20152         isArray: Array.isArray,
20153         isES5: isES5,
20154         propertyIsWritable: function(obj, prop) {
20155             var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
20156             return !!(!descriptor || descriptor.writable || descriptor.set);
20157         }
20158     };
20159 } else {
20160     var has = {}.hasOwnProperty;
20161     var str = {}.toString;
20162     var proto = {}.constructor.prototype;
20163
20164     var ObjectKeys = function (o) {
20165         var ret = [];
20166         for (var key in o) {
20167             if (has.call(o, key)) {
20168                 ret.push(key);
20169             }
20170         }
20171         return ret;
20172     };
20173
20174     var ObjectGetDescriptor = function(o, key) {
20175         return {value: o[key]};
20176     };
20177
20178     var ObjectDefineProperty = function (o, key, desc) {
20179         o[key] = desc.value;
20180         return o;
20181     };
20182
20183     var ObjectFreeze = function (obj) {
20184         return obj;
20185     };
20186
20187     var ObjectGetPrototypeOf = function (obj) {
20188         try {
20189             return Object(obj).constructor.prototype;
20190         }
20191         catch (e) {
20192             return proto;
20193         }
20194     };
20195
20196     var ArrayIsArray = function (obj) {
20197         try {
20198             return str.call(obj) === "[object Array]";
20199         }
20200         catch(e) {
20201             return false;
20202         }
20203     };
20204
20205     module.exports = {
20206         isArray: ArrayIsArray,
20207         keys: ObjectKeys,
20208         names: ObjectKeys,
20209         defineProperty: ObjectDefineProperty,
20210         getDescriptor: ObjectGetDescriptor,
20211         freeze: ObjectFreeze,
20212         getPrototypeOf: ObjectGetPrototypeOf,
20213         isES5: isES5,
20214         propertyIsWritable: function() {
20215             return true;
20216         }
20217     };
20218 }
20219
20220
20221 /***/ }),
20222 /* 132 */
20223 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20224
20225 "use strict";
20226
20227 var firstLineError;
20228 try {throw new Error(); } catch (e) {firstLineError = e;}
20229 var schedule = __webpack_require__(133);
20230 var Queue = __webpack_require__(134);
20231 var util = __webpack_require__(130);
20232
20233 function Async() {
20234     this._customScheduler = false;
20235     this._isTickUsed = false;
20236     this._lateQueue = new Queue(16);
20237     this._normalQueue = new Queue(16);
20238     this._haveDrainedQueues = false;
20239     this._trampolineEnabled = true;
20240     var self = this;
20241     this.drainQueues = function () {
20242         self._drainQueues();
20243     };
20244     this._schedule = schedule;
20245 }
20246
20247 Async.prototype.setScheduler = function(fn) {
20248     var prev = this._schedule;
20249     this._schedule = fn;
20250     this._customScheduler = true;
20251     return prev;
20252 };
20253
20254 Async.prototype.hasCustomScheduler = function() {
20255     return this._customScheduler;
20256 };
20257
20258 Async.prototype.enableTrampoline = function() {
20259     this._trampolineEnabled = true;
20260 };
20261
20262 Async.prototype.disableTrampolineIfNecessary = function() {
20263     if (util.hasDevTools) {
20264         this._trampolineEnabled = false;
20265     }
20266 };
20267
20268 Async.prototype.haveItemsQueued = function () {
20269     return this._isTickUsed || this._haveDrainedQueues;
20270 };
20271
20272
20273 Async.prototype.fatalError = function(e, isNode) {
20274     if (isNode) {
20275         process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
20276             "\n");
20277         process.exit(2);
20278     } else {
20279         this.throwLater(e);
20280     }
20281 };
20282
20283 Async.prototype.throwLater = function(fn, arg) {
20284     if (arguments.length === 1) {
20285         arg = fn;
20286         fn = function () { throw arg; };
20287     }
20288     if (typeof setTimeout !== "undefined") {
20289         setTimeout(function() {
20290             fn(arg);
20291         }, 0);
20292     } else try {
20293         this._schedule(function() {
20294             fn(arg);
20295         });
20296     } catch (e) {
20297         throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
20298     }
20299 };
20300
20301 function AsyncInvokeLater(fn, receiver, arg) {
20302     this._lateQueue.push(fn, receiver, arg);
20303     this._queueTick();
20304 }
20305
20306 function AsyncInvoke(fn, receiver, arg) {
20307     this._normalQueue.push(fn, receiver, arg);
20308     this._queueTick();
20309 }
20310
20311 function AsyncSettlePromises(promise) {
20312     this._normalQueue._pushOne(promise);
20313     this._queueTick();
20314 }
20315
20316 if (!util.hasDevTools) {
20317     Async.prototype.invokeLater = AsyncInvokeLater;
20318     Async.prototype.invoke = AsyncInvoke;
20319     Async.prototype.settlePromises = AsyncSettlePromises;
20320 } else {
20321     Async.prototype.invokeLater = function (fn, receiver, arg) {
20322         if (this._trampolineEnabled) {
20323             AsyncInvokeLater.call(this, fn, receiver, arg);
20324         } else {
20325             this._schedule(function() {
20326                 setTimeout(function() {
20327                     fn.call(receiver, arg);
20328                 }, 100);
20329             });
20330         }
20331     };
20332
20333     Async.prototype.invoke = function (fn, receiver, arg) {
20334         if (this._trampolineEnabled) {
20335             AsyncInvoke.call(this, fn, receiver, arg);
20336         } else {
20337             this._schedule(function() {
20338                 fn.call(receiver, arg);
20339             });
20340         }
20341     };
20342
20343     Async.prototype.settlePromises = function(promise) {
20344         if (this._trampolineEnabled) {
20345             AsyncSettlePromises.call(this, promise);
20346         } else {
20347             this._schedule(function() {
20348                 promise._settlePromises();
20349             });
20350         }
20351     };
20352 }
20353
20354 Async.prototype._drainQueue = function(queue) {
20355     while (queue.length() > 0) {
20356         var fn = queue.shift();
20357         if (typeof fn !== "function") {
20358             fn._settlePromises();
20359             continue;
20360         }
20361         var receiver = queue.shift();
20362         var arg = queue.shift();
20363         fn.call(receiver, arg);
20364     }
20365 };
20366
20367 Async.prototype._drainQueues = function () {
20368     this._drainQueue(this._normalQueue);
20369     this._reset();
20370     this._haveDrainedQueues = true;
20371     this._drainQueue(this._lateQueue);
20372 };
20373
20374 Async.prototype._queueTick = function () {
20375     if (!this._isTickUsed) {
20376         this._isTickUsed = true;
20377         this._schedule(this.drainQueues);
20378     }
20379 };
20380
20381 Async.prototype._reset = function () {
20382     this._isTickUsed = false;
20383 };
20384
20385 module.exports = Async;
20386 module.exports.firstLineError = firstLineError;
20387
20388
20389 /***/ }),
20390 /* 133 */
20391 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20392
20393 "use strict";
20394
20395 var util = __webpack_require__(130);
20396 var schedule;
20397 var noAsyncScheduler = function() {
20398     throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
20399 };
20400 var NativePromise = util.getNativePromise();
20401 if (util.isNode && typeof MutationObserver === "undefined") {
20402     var GlobalSetImmediate = global.setImmediate;
20403     var ProcessNextTick = process.nextTick;
20404     schedule = util.isRecentNode
20405                 ? function(fn) { GlobalSetImmediate.call(global, fn); }
20406                 : function(fn) { ProcessNextTick.call(process, fn); };
20407 } else if (typeof NativePromise === "function" &&
20408            typeof NativePromise.resolve === "function") {
20409     var nativePromise = NativePromise.resolve();
20410     schedule = function(fn) {
20411         nativePromise.then(fn);
20412     };
20413 } else if ((typeof MutationObserver !== "undefined") &&
20414           !(typeof window !== "undefined" &&
20415             window.navigator &&
20416             (window.navigator.standalone || window.cordova))) {
20417     schedule = (function() {
20418         var div = document.createElement("div");
20419         var opts = {attributes: true};
20420         var toggleScheduled = false;
20421         var div2 = document.createElement("div");
20422         var o2 = new MutationObserver(function() {
20423             div.classList.toggle("foo");
20424             toggleScheduled = false;
20425         });
20426         o2.observe(div2, opts);
20427
20428         var scheduleToggle = function() {
20429             if (toggleScheduled) return;
20430                 toggleScheduled = true;
20431                 div2.classList.toggle("foo");
20432             };
20433
20434             return function schedule(fn) {
20435             var o = new MutationObserver(function() {
20436                 o.disconnect();
20437                 fn();
20438             });
20439             o.observe(div, opts);
20440             scheduleToggle();
20441         };
20442     })();
20443 } else if (typeof setImmediate !== "undefined") {
20444     schedule = function (fn) {
20445         setImmediate(fn);
20446     };
20447 } else if (typeof setTimeout !== "undefined") {
20448     schedule = function (fn) {
20449         setTimeout(fn, 0);
20450     };
20451 } else {
20452     schedule = noAsyncScheduler;
20453 }
20454 module.exports = schedule;
20455
20456
20457 /***/ }),
20458 /* 134 */
20459 /***/ ((module) => {
20460
20461 "use strict";
20462
20463 function arrayMove(src, srcIndex, dst, dstIndex, len) {
20464     for (var j = 0; j < len; ++j) {
20465         dst[j + dstIndex] = src[j + srcIndex];
20466         src[j + srcIndex] = void 0;
20467     }
20468 }
20469
20470 function Queue(capacity) {
20471     this._capacity = capacity;
20472     this._length = 0;
20473     this._front = 0;
20474 }
20475
20476 Queue.prototype._willBeOverCapacity = function (size) {
20477     return this._capacity < size;
20478 };
20479
20480 Queue.prototype._pushOne = function (arg) {
20481     var length = this.length();
20482     this._checkCapacity(length + 1);
20483     var i = (this._front + length) & (this._capacity - 1);
20484     this[i] = arg;
20485     this._length = length + 1;
20486 };
20487
20488 Queue.prototype.push = function (fn, receiver, arg) {
20489     var length = this.length() + 3;
20490     if (this._willBeOverCapacity(length)) {
20491         this._pushOne(fn);
20492         this._pushOne(receiver);
20493         this._pushOne(arg);
20494         return;
20495     }
20496     var j = this._front + length - 3;
20497     this._checkCapacity(length);
20498     var wrapMask = this._capacity - 1;
20499     this[(j + 0) & wrapMask] = fn;
20500     this[(j + 1) & wrapMask] = receiver;
20501     this[(j + 2) & wrapMask] = arg;
20502     this._length = length;
20503 };
20504
20505 Queue.prototype.shift = function () {
20506     var front = this._front,
20507         ret = this[front];
20508
20509     this[front] = undefined;
20510     this._front = (front + 1) & (this._capacity - 1);
20511     this._length--;
20512     return ret;
20513 };
20514
20515 Queue.prototype.length = function () {
20516     return this._length;
20517 };
20518
20519 Queue.prototype._checkCapacity = function (size) {
20520     if (this._capacity < size) {
20521         this._resizeTo(this._capacity << 1);
20522     }
20523 };
20524
20525 Queue.prototype._resizeTo = function (capacity) {
20526     var oldCapacity = this._capacity;
20527     this._capacity = capacity;
20528     var front = this._front;
20529     var length = this._length;
20530     var moveItemsCount = (front + length) & (oldCapacity - 1);
20531     arrayMove(this, 0, this, oldCapacity, moveItemsCount);
20532 };
20533
20534 module.exports = Queue;
20535
20536
20537 /***/ }),
20538 /* 135 */
20539 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20540
20541 "use strict";
20542
20543 var es5 = __webpack_require__(131);
20544 var Objectfreeze = es5.freeze;
20545 var util = __webpack_require__(130);
20546 var inherits = util.inherits;
20547 var notEnumerableProp = util.notEnumerableProp;
20548
20549 function subError(nameProperty, defaultMessage) {
20550     function SubError(message) {
20551         if (!(this instanceof SubError)) return new SubError(message);
20552         notEnumerableProp(this, "message",
20553             typeof message === "string" ? message : defaultMessage);
20554         notEnumerableProp(this, "name", nameProperty);
20555         if (Error.captureStackTrace) {
20556             Error.captureStackTrace(this, this.constructor);
20557         } else {
20558             Error.call(this);
20559         }
20560     }
20561     inherits(SubError, Error);
20562     return SubError;
20563 }
20564
20565 var _TypeError, _RangeError;
20566 var Warning = subError("Warning", "warning");
20567 var CancellationError = subError("CancellationError", "cancellation error");
20568 var TimeoutError = subError("TimeoutError", "timeout error");
20569 var AggregateError = subError("AggregateError", "aggregate error");
20570 try {
20571     _TypeError = TypeError;
20572     _RangeError = RangeError;
20573 } catch(e) {
20574     _TypeError = subError("TypeError", "type error");
20575     _RangeError = subError("RangeError", "range error");
20576 }
20577
20578 var methods = ("join pop push shift unshift slice filter forEach some " +
20579     "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
20580
20581 for (var i = 0; i < methods.length; ++i) {
20582     if (typeof Array.prototype[methods[i]] === "function") {
20583         AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
20584     }
20585 }
20586
20587 es5.defineProperty(AggregateError.prototype, "length", {
20588     value: 0,
20589     configurable: false,
20590     writable: true,
20591     enumerable: true
20592 });
20593 AggregateError.prototype["isOperational"] = true;
20594 var level = 0;
20595 AggregateError.prototype.toString = function() {
20596     var indent = Array(level * 4 + 1).join(" ");
20597     var ret = "\n" + indent + "AggregateError of:" + "\n";
20598     level++;
20599     indent = Array(level * 4 + 1).join(" ");
20600     for (var i = 0; i < this.length; ++i) {
20601         var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
20602         var lines = str.split("\n");
20603         for (var j = 0; j < lines.length; ++j) {
20604             lines[j] = indent + lines[j];
20605         }
20606         str = lines.join("\n");
20607         ret += str + "\n";
20608     }
20609     level--;
20610     return ret;
20611 };
20612
20613 function OperationalError(message) {
20614     if (!(this instanceof OperationalError))
20615         return new OperationalError(message);
20616     notEnumerableProp(this, "name", "OperationalError");
20617     notEnumerableProp(this, "message", message);
20618     this.cause = message;
20619     this["isOperational"] = true;
20620
20621     if (message instanceof Error) {
20622         notEnumerableProp(this, "message", message.message);
20623         notEnumerableProp(this, "stack", message.stack);
20624     } else if (Error.captureStackTrace) {
20625         Error.captureStackTrace(this, this.constructor);
20626     }
20627
20628 }
20629 inherits(OperationalError, Error);
20630
20631 var errorTypes = Error["__BluebirdErrorTypes__"];
20632 if (!errorTypes) {
20633     errorTypes = Objectfreeze({
20634         CancellationError: CancellationError,
20635         TimeoutError: TimeoutError,
20636         OperationalError: OperationalError,
20637         RejectionError: OperationalError,
20638         AggregateError: AggregateError
20639     });
20640     es5.defineProperty(Error, "__BluebirdErrorTypes__", {
20641         value: errorTypes,
20642         writable: false,
20643         enumerable: false,
20644         configurable: false
20645     });
20646 }
20647
20648 module.exports = {
20649     Error: Error,
20650     TypeError: _TypeError,
20651     RangeError: _RangeError,
20652     CancellationError: errorTypes.CancellationError,
20653     OperationalError: errorTypes.OperationalError,
20654     TimeoutError: errorTypes.TimeoutError,
20655     AggregateError: errorTypes.AggregateError,
20656     Warning: Warning
20657 };
20658
20659
20660 /***/ }),
20661 /* 136 */
20662 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20663
20664 "use strict";
20665
20666 module.exports = function(Promise, INTERNAL) {
20667 var util = __webpack_require__(130);
20668 var errorObj = util.errorObj;
20669 var isObject = util.isObject;
20670
20671 function tryConvertToPromise(obj, context) {
20672     if (isObject(obj)) {
20673         if (obj instanceof Promise) return obj;
20674         var then = getThen(obj);
20675         if (then === errorObj) {
20676             if (context) context._pushContext();
20677             var ret = Promise.reject(then.e);
20678             if (context) context._popContext();
20679             return ret;
20680         } else if (typeof then === "function") {
20681             if (isAnyBluebirdPromise(obj)) {
20682                 var ret = new Promise(INTERNAL);
20683                 obj._then(
20684                     ret._fulfill,
20685                     ret._reject,
20686                     undefined,
20687                     ret,
20688                     null
20689                 );
20690                 return ret;
20691             }
20692             return doThenable(obj, then, context);
20693         }
20694     }
20695     return obj;
20696 }
20697
20698 function doGetThen(obj) {
20699     return obj.then;
20700 }
20701
20702 function getThen(obj) {
20703     try {
20704         return doGetThen(obj);
20705     } catch (e) {
20706         errorObj.e = e;
20707         return errorObj;
20708     }
20709 }
20710
20711 var hasProp = {}.hasOwnProperty;
20712 function isAnyBluebirdPromise(obj) {
20713     try {
20714         return hasProp.call(obj, "_promise0");
20715     } catch (e) {
20716         return false;
20717     }
20718 }
20719
20720 function doThenable(x, then, context) {
20721     var promise = new Promise(INTERNAL);
20722     var ret = promise;
20723     if (context) context._pushContext();
20724     promise._captureStackTrace();
20725     if (context) context._popContext();
20726     var synchronous = true;
20727     var result = util.tryCatch(then).call(x, resolve, reject);
20728     synchronous = false;
20729
20730     if (promise && result === errorObj) {
20731         promise._rejectCallback(result.e, true, true);
20732         promise = null;
20733     }
20734
20735     function resolve(value) {
20736         if (!promise) return;
20737         promise._resolveCallback(value);
20738         promise = null;
20739     }
20740
20741     function reject(reason) {
20742         if (!promise) return;
20743         promise._rejectCallback(reason, synchronous, true);
20744         promise = null;
20745     }
20746     return ret;
20747 }
20748
20749 return tryConvertToPromise;
20750 };
20751
20752
20753 /***/ }),
20754 /* 137 */
20755 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20756
20757 "use strict";
20758
20759 module.exports = function(Promise, INTERNAL, tryConvertToPromise,
20760     apiRejection, Proxyable) {
20761 var util = __webpack_require__(130);
20762 var isArray = util.isArray;
20763
20764 function toResolutionValue(val) {
20765     switch(val) {
20766     case -2: return [];
20767     case -3: return {};
20768     }
20769 }
20770
20771 function PromiseArray(values) {
20772     var promise = this._promise = new Promise(INTERNAL);
20773     if (values instanceof Promise) {
20774         promise._propagateFrom(values, 3);
20775     }
20776     promise._setOnCancel(this);
20777     this._values = values;
20778     this._length = 0;
20779     this._totalResolved = 0;
20780     this._init(undefined, -2);
20781 }
20782 util.inherits(PromiseArray, Proxyable);
20783
20784 PromiseArray.prototype.length = function () {
20785     return this._length;
20786 };
20787
20788 PromiseArray.prototype.promise = function () {
20789     return this._promise;
20790 };
20791
20792 PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
20793     var values = tryConvertToPromise(this._values, this._promise);
20794     if (values instanceof Promise) {
20795         values = values._target();
20796         var bitField = values._bitField;
20797         ;
20798         this._values = values;
20799
20800         if (((bitField & 50397184) === 0)) {
20801             this._promise._setAsyncGuaranteed();
20802             return values._then(
20803                 init,
20804                 this._reject,
20805                 undefined,
20806                 this,
20807                 resolveValueIfEmpty
20808            );
20809         } else if (((bitField & 33554432) !== 0)) {
20810             values = values._value();
20811         } else if (((bitField & 16777216) !== 0)) {
20812             return this._reject(values._reason());
20813         } else {
20814             return this._cancel();
20815         }
20816     }
20817     values = util.asArray(values);
20818     if (values === null) {
20819         var err = apiRejection(
20820             "expecting an array or an iterable object but got " + util.classString(values)).reason();
20821         this._promise._rejectCallback(err, false);
20822         return;
20823     }
20824
20825     if (values.length === 0) {
20826         if (resolveValueIfEmpty === -5) {
20827             this._resolveEmptyArray();
20828         }
20829         else {
20830             this._resolve(toResolutionValue(resolveValueIfEmpty));
20831         }
20832         return;
20833     }
20834     this._iterate(values);
20835 };
20836
20837 PromiseArray.prototype._iterate = function(values) {
20838     var len = this.getActualLength(values.length);
20839     this._length = len;
20840     this._values = this.shouldCopyValues() ? new Array(len) : this._values;
20841     var result = this._promise;
20842     var isResolved = false;
20843     var bitField = null;
20844     for (var i = 0; i < len; ++i) {
20845         var maybePromise = tryConvertToPromise(values[i], result);
20846
20847         if (maybePromise instanceof Promise) {
20848             maybePromise = maybePromise._target();
20849             bitField = maybePromise._bitField;
20850         } else {
20851             bitField = null;
20852         }
20853
20854         if (isResolved) {
20855             if (bitField !== null) {
20856                 maybePromise.suppressUnhandledRejections();
20857             }
20858         } else if (bitField !== null) {
20859             if (((bitField & 50397184) === 0)) {
20860                 maybePromise._proxy(this, i);
20861                 this._values[i] = maybePromise;
20862             } else if (((bitField & 33554432) !== 0)) {
20863                 isResolved = this._promiseFulfilled(maybePromise._value(), i);
20864             } else if (((bitField & 16777216) !== 0)) {
20865                 isResolved = this._promiseRejected(maybePromise._reason(), i);
20866             } else {
20867                 isResolved = this._promiseCancelled(i);
20868             }
20869         } else {
20870             isResolved = this._promiseFulfilled(maybePromise, i);
20871         }
20872     }
20873     if (!isResolved) result._setAsyncGuaranteed();
20874 };
20875
20876 PromiseArray.prototype._isResolved = function () {
20877     return this._values === null;
20878 };
20879
20880 PromiseArray.prototype._resolve = function (value) {
20881     this._values = null;
20882     this._promise._fulfill(value);
20883 };
20884
20885 PromiseArray.prototype._cancel = function() {
20886     if (this._isResolved() || !this._promise._isCancellable()) return;
20887     this._values = null;
20888     this._promise._cancel();
20889 };
20890
20891 PromiseArray.prototype._reject = function (reason) {
20892     this._values = null;
20893     this._promise._rejectCallback(reason, false);
20894 };
20895
20896 PromiseArray.prototype._promiseFulfilled = function (value, index) {
20897     this._values[index] = value;
20898     var totalResolved = ++this._totalResolved;
20899     if (totalResolved >= this._length) {
20900         this._resolve(this._values);
20901         return true;
20902     }
20903     return false;
20904 };
20905
20906 PromiseArray.prototype._promiseCancelled = function() {
20907     this._cancel();
20908     return true;
20909 };
20910
20911 PromiseArray.prototype._promiseRejected = function (reason) {
20912     this._totalResolved++;
20913     this._reject(reason);
20914     return true;
20915 };
20916
20917 PromiseArray.prototype._resultCancelled = function() {
20918     if (this._isResolved()) return;
20919     var values = this._values;
20920     this._cancel();
20921     if (values instanceof Promise) {
20922         values.cancel();
20923     } else {
20924         for (var i = 0; i < values.length; ++i) {
20925             if (values[i] instanceof Promise) {
20926                 values[i].cancel();
20927             }
20928         }
20929     }
20930 };
20931
20932 PromiseArray.prototype.shouldCopyValues = function () {
20933     return true;
20934 };
20935
20936 PromiseArray.prototype.getActualLength = function (len) {
20937     return len;
20938 };
20939
20940 return PromiseArray;
20941 };
20942
20943
20944 /***/ }),
20945 /* 138 */
20946 /***/ ((module) => {
20947
20948 "use strict";
20949
20950 module.exports = function(Promise) {
20951 var longStackTraces = false;
20952 var contextStack = [];
20953
20954 Promise.prototype._promiseCreated = function() {};
20955 Promise.prototype._pushContext = function() {};
20956 Promise.prototype._popContext = function() {return null;};
20957 Promise._peekContext = Promise.prototype._peekContext = function() {};
20958
20959 function Context() {
20960     this._trace = new Context.CapturedTrace(peekContext());
20961 }
20962 Context.prototype._pushContext = function () {
20963     if (this._trace !== undefined) {
20964         this._trace._promiseCreated = null;
20965         contextStack.push(this._trace);
20966     }
20967 };
20968
20969 Context.prototype._popContext = function () {
20970     if (this._trace !== undefined) {
20971         var trace = contextStack.pop();
20972         var ret = trace._promiseCreated;
20973         trace._promiseCreated = null;
20974         return ret;
20975     }
20976     return null;
20977 };
20978
20979 function createContext() {
20980     if (longStackTraces) return new Context();
20981 }
20982
20983 function peekContext() {
20984     var lastIndex = contextStack.length - 1;
20985     if (lastIndex >= 0) {
20986         return contextStack[lastIndex];
20987     }
20988     return undefined;
20989 }
20990 Context.CapturedTrace = null;
20991 Context.create = createContext;
20992 Context.deactivateLongStackTraces = function() {};
20993 Context.activateLongStackTraces = function() {
20994     var Promise_pushContext = Promise.prototype._pushContext;
20995     var Promise_popContext = Promise.prototype._popContext;
20996     var Promise_PeekContext = Promise._peekContext;
20997     var Promise_peekContext = Promise.prototype._peekContext;
20998     var Promise_promiseCreated = Promise.prototype._promiseCreated;
20999     Context.deactivateLongStackTraces = function() {
21000         Promise.prototype._pushContext = Promise_pushContext;
21001         Promise.prototype._popContext = Promise_popContext;
21002         Promise._peekContext = Promise_PeekContext;
21003         Promise.prototype._peekContext = Promise_peekContext;
21004         Promise.prototype._promiseCreated = Promise_promiseCreated;
21005         longStackTraces = false;
21006     };
21007     longStackTraces = true;
21008     Promise.prototype._pushContext = Context.prototype._pushContext;
21009     Promise.prototype._popContext = Context.prototype._popContext;
21010     Promise._peekContext = Promise.prototype._peekContext = peekContext;
21011     Promise.prototype._promiseCreated = function() {
21012         var ctx = this._peekContext();
21013         if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
21014     };
21015 };
21016 return Context;
21017 };
21018
21019
21020 /***/ }),
21021 /* 139 */
21022 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
21023
21024 "use strict";
21025
21026 module.exports = function(Promise, Context) {
21027 var getDomain = Promise._getDomain;
21028 var async = Promise._async;
21029 var Warning = __webpack_require__(135).Warning;
21030 var util = __webpack_require__(130);
21031 var canAttachTrace = util.canAttachTrace;
21032 var unhandledRejectionHandled;
21033 var possiblyUnhandledRejection;
21034 var bluebirdFramePattern =
21035     /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
21036 var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
21037 var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
21038 var stackFramePattern = null;
21039 var formatStack = null;
21040 var indentStackFrames = false;
21041 var printWarning;
21042 var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
21043                         ( false ||
21044                          util.env("BLUEBIRD_DEBUG") ||
21045                          util.env("NODE_ENV") === "development"));
21046
21047 var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
21048     (debugging || util.env("BLUEBIRD_WARNINGS")));
21049
21050 var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
21051     (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
21052
21053 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
21054     (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
21055
21056 Promise.prototype.suppressUnhandledRejections = function() {
21057     var target = this._target();
21058     target._bitField = ((target._bitField & (~1048576)) |
21059                       524288);
21060 };
21061
21062 Promise.prototype._ensurePossibleRejectionHandled = function () {
21063     if ((this._bitField & 524288) !== 0) return;
21064     this._setRejectionIsUnhandled();
21065     async.invokeLater(this._notifyUnhandledRejection, this, undefined);
21066 };
21067
21068 Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
21069     fireRejectionEvent("rejectionHandled",
21070                                   unhandledRejectionHandled, undefined, this);
21071 };
21072
21073 Promise.prototype._setReturnedNonUndefined = function() {
21074     this._bitField = this._bitField | 268435456;
21075 };
21076
21077 Promise.prototype._returnedNonUndefined = function() {
21078     return (this._bitField & 268435456) !== 0;
21079 };
21080
21081 Promise.prototype._notifyUnhandledRejection = function () {
21082     if (this._isRejectionUnhandled()) {
21083         var reason = this._settledValue();
21084         this._setUnhandledRejectionIsNotified();
21085         fireRejectionEvent("unhandledRejection",
21086                                       possiblyUnhandledRejection, reason, this);
21087     }
21088 };
21089
21090 Promise.prototype._setUnhandledRejectionIsNotified = function () {
21091     this._bitField = this._bitField | 262144;
21092 };
21093
21094 Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
21095     this._bitField = this._bitField & (~262144);
21096 };
21097
21098 Promise.prototype._isUnhandledRejectionNotified = function () {
21099     return (this._bitField & 262144) > 0;
21100 };
21101
21102 Promise.prototype._setRejectionIsUnhandled = function () {
21103     this._bitField = this._bitField | 1048576;
21104 };
21105
21106 Promise.prototype._unsetRejectionIsUnhandled = function () {
21107     this._bitField = this._bitField & (~1048576);
21108     if (this._isUnhandledRejectionNotified()) {
21109         this._unsetUnhandledRejectionIsNotified();
21110         this._notifyUnhandledRejectionIsHandled();
21111     }
21112 };
21113
21114 Promise.prototype._isRejectionUnhandled = function () {
21115     return (this._bitField & 1048576) > 0;
21116 };
21117
21118 Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
21119     return warn(message, shouldUseOwnTrace, promise || this);
21120 };
21121
21122 Promise.onPossiblyUnhandledRejection = function (fn) {
21123     var domain = getDomain();
21124     possiblyUnhandledRejection =
21125         typeof fn === "function" ? (domain === null ?
21126                                             fn : util.domainBind(domain, fn))
21127                                  : undefined;
21128 };
21129
21130 Promise.onUnhandledRejectionHandled = function (fn) {
21131     var domain = getDomain();
21132     unhandledRejectionHandled =
21133         typeof fn === "function" ? (domain === null ?
21134                                             fn : util.domainBind(domain, fn))
21135                                  : undefined;
21136 };
21137
21138 var disableLongStackTraces = function() {};
21139 Promise.longStackTraces = function () {
21140     if (async.haveItemsQueued() && !config.longStackTraces) {
21141         throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
21142     }
21143     if (!config.longStackTraces && longStackTracesIsSupported()) {
21144         var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
21145         var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
21146         config.longStackTraces = true;
21147         disableLongStackTraces = function() {
21148             if (async.haveItemsQueued() && !config.longStackTraces) {
21149                 throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
21150             }
21151             Promise.prototype._captureStackTrace = Promise_captureStackTrace;
21152             Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
21153             Context.deactivateLongStackTraces();
21154             async.enableTrampoline();
21155             config.longStackTraces = false;
21156         };
21157         Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
21158         Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
21159         Context.activateLongStackTraces();
21160         async.disableTrampolineIfNecessary();
21161     }
21162 };
21163
21164 Promise.hasLongStackTraces = function () {
21165     return config.longStackTraces && longStackTracesIsSupported();
21166 };
21167
21168 var fireDomEvent = (function() {
21169     try {
21170         if (typeof CustomEvent === "function") {
21171             var event = new CustomEvent("CustomEvent");
21172             util.global.dispatchEvent(event);
21173             return function(name, event) {
21174                 var domEvent = new CustomEvent(name.toLowerCase(), {
21175                     detail: event,
21176                     cancelable: true
21177                 });
21178                 return !util.global.dispatchEvent(domEvent);
21179             };
21180         } else if (typeof Event === "function") {
21181             var event = new Event("CustomEvent");
21182             util.global.dispatchEvent(event);
21183             return function(name, event) {
21184                 var domEvent = new Event(name.toLowerCase(), {
21185                     cancelable: true
21186                 });
21187                 domEvent.detail = event;
21188                 return !util.global.dispatchEvent(domEvent);
21189             };
21190         } else {
21191             var event = document.createEvent("CustomEvent");
21192             event.initCustomEvent("testingtheevent", false, true, {});
21193             util.global.dispatchEvent(event);
21194             return function(name, event) {
21195                 var domEvent = document.createEvent("CustomEvent");
21196                 domEvent.initCustomEvent(name.toLowerCase(), false, true,
21197                     event);
21198                 return !util.global.dispatchEvent(domEvent);
21199             };
21200         }
21201     } catch (e) {}
21202     return function() {
21203         return false;
21204     };
21205 })();
21206
21207 var fireGlobalEvent = (function() {
21208     if (util.isNode) {
21209         return function() {
21210             return process.emit.apply(process, arguments);
21211         };
21212     } else {
21213         if (!util.global) {
21214             return function() {
21215                 return false;
21216             };
21217         }
21218         return function(name) {
21219             var methodName = "on" + name.toLowerCase();
21220             var method = util.global[methodName];
21221             if (!method) return false;
21222             method.apply(util.global, [].slice.call(arguments, 1));
21223             return true;
21224         };
21225     }
21226 })();
21227
21228 function generatePromiseLifecycleEventObject(name, promise) {
21229     return {promise: promise};
21230 }
21231
21232 var eventToObjectGenerator = {
21233     promiseCreated: generatePromiseLifecycleEventObject,
21234     promiseFulfilled: generatePromiseLifecycleEventObject,
21235     promiseRejected: generatePromiseLifecycleEventObject,
21236     promiseResolved: generatePromiseLifecycleEventObject,
21237     promiseCancelled: generatePromiseLifecycleEventObject,
21238     promiseChained: function(name, promise, child) {
21239         return {promise: promise, child: child};
21240     },
21241     warning: function(name, warning) {
21242         return {warning: warning};
21243     },
21244     unhandledRejection: function (name, reason, promise) {
21245         return {reason: reason, promise: promise};
21246     },
21247     rejectionHandled: generatePromiseLifecycleEventObject
21248 };
21249
21250 var activeFireEvent = function (name) {
21251     var globalEventFired = false;
21252     try {
21253         globalEventFired = fireGlobalEvent.apply(null, arguments);
21254     } catch (e) {
21255         async.throwLater(e);
21256         globalEventFired = true;
21257     }
21258
21259     var domEventFired = false;
21260     try {
21261         domEventFired = fireDomEvent(name,
21262                     eventToObjectGenerator[name].apply(null, arguments));
21263     } catch (e) {
21264         async.throwLater(e);
21265         domEventFired = true;
21266     }
21267
21268     return domEventFired || globalEventFired;
21269 };
21270
21271 Promise.config = function(opts) {
21272     opts = Object(opts);
21273     if ("longStackTraces" in opts) {
21274         if (opts.longStackTraces) {
21275             Promise.longStackTraces();
21276         } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
21277             disableLongStackTraces();
21278         }
21279     }
21280     if ("warnings" in opts) {
21281         var warningsOption = opts.warnings;
21282         config.warnings = !!warningsOption;
21283         wForgottenReturn = config.warnings;
21284
21285         if (util.isObject(warningsOption)) {
21286             if ("wForgottenReturn" in warningsOption) {
21287                 wForgottenReturn = !!warningsOption.wForgottenReturn;
21288             }
21289         }
21290     }
21291     if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
21292         if (async.haveItemsQueued()) {
21293             throw new Error(
21294                 "cannot enable cancellation after promises are in use");
21295         }
21296         Promise.prototype._clearCancellationData =
21297             cancellationClearCancellationData;
21298         Promise.prototype._propagateFrom = cancellationPropagateFrom;
21299         Promise.prototype._onCancel = cancellationOnCancel;
21300         Promise.prototype._setOnCancel = cancellationSetOnCancel;
21301         Promise.prototype._attachCancellationCallback =
21302             cancellationAttachCancellationCallback;
21303         Promise.prototype._execute = cancellationExecute;
21304         propagateFromFunction = cancellationPropagateFrom;
21305         config.cancellation = true;
21306     }
21307     if ("monitoring" in opts) {
21308         if (opts.monitoring && !config.monitoring) {
21309             config.monitoring = true;
21310             Promise.prototype._fireEvent = activeFireEvent;
21311         } else if (!opts.monitoring && config.monitoring) {
21312             config.monitoring = false;
21313             Promise.prototype._fireEvent = defaultFireEvent;
21314         }
21315     }
21316     return Promise;
21317 };
21318
21319 function defaultFireEvent() { return false; }
21320
21321 Promise.prototype._fireEvent = defaultFireEvent;
21322 Promise.prototype._execute = function(executor, resolve, reject) {
21323     try {
21324         executor(resolve, reject);
21325     } catch (e) {
21326         return e;
21327     }
21328 };
21329 Promise.prototype._onCancel = function () {};
21330 Promise.prototype._setOnCancel = function (handler) { ; };
21331 Promise.prototype._attachCancellationCallback = function(onCancel) {
21332     ;
21333 };
21334 Promise.prototype._captureStackTrace = function () {};
21335 Promise.prototype._attachExtraTrace = function () {};
21336 Promise.prototype._clearCancellationData = function() {};
21337 Promise.prototype._propagateFrom = function (parent, flags) {
21338     ;
21339     ;
21340 };
21341
21342 function cancellationExecute(executor, resolve, reject) {
21343     var promise = this;
21344     try {
21345         executor(resolve, reject, function(onCancel) {
21346             if (typeof onCancel !== "function") {
21347                 throw new TypeError("onCancel must be a function, got: " +
21348                                     util.toString(onCancel));
21349             }
21350             promise._attachCancellationCallback(onCancel);
21351         });
21352     } catch (e) {
21353         return e;
21354     }
21355 }
21356
21357 function cancellationAttachCancellationCallback(onCancel) {
21358     if (!this._isCancellable()) return this;
21359
21360     var previousOnCancel = this._onCancel();
21361     if (previousOnCancel !== undefined) {
21362         if (util.isArray(previousOnCancel)) {
21363             previousOnCancel.push(onCancel);
21364         } else {
21365             this._setOnCancel([previousOnCancel, onCancel]);
21366         }
21367     } else {
21368         this._setOnCancel(onCancel);
21369     }
21370 }
21371
21372 function cancellationOnCancel() {
21373     return this._onCancelField;
21374 }
21375
21376 function cancellationSetOnCancel(onCancel) {
21377     this._onCancelField = onCancel;
21378 }
21379
21380 function cancellationClearCancellationData() {
21381     this._cancellationParent = undefined;
21382     this._onCancelField = undefined;
21383 }
21384
21385 function cancellationPropagateFrom(parent, flags) {
21386     if ((flags & 1) !== 0) {
21387         this._cancellationParent = parent;
21388         var branchesRemainingToCancel = parent._branchesRemainingToCancel;
21389         if (branchesRemainingToCancel === undefined) {
21390             branchesRemainingToCancel = 0;
21391         }
21392         parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
21393     }
21394     if ((flags & 2) !== 0 && parent._isBound()) {
21395         this._setBoundTo(parent._boundTo);
21396     }
21397 }
21398
21399 function bindingPropagateFrom(parent, flags) {
21400     if ((flags & 2) !== 0 && parent._isBound()) {
21401         this._setBoundTo(parent._boundTo);
21402     }
21403 }
21404 var propagateFromFunction = bindingPropagateFrom;
21405
21406 function boundValueFunction() {
21407     var ret = this._boundTo;
21408     if (ret !== undefined) {
21409         if (ret instanceof Promise) {
21410             if (ret.isFulfilled()) {
21411                 return ret.value();
21412             } else {
21413                 return undefined;
21414             }
21415         }
21416     }
21417     return ret;
21418 }
21419
21420 function longStackTracesCaptureStackTrace() {
21421     this._trace = new CapturedTrace(this._peekContext());
21422 }
21423
21424 function longStackTracesAttachExtraTrace(error, ignoreSelf) {
21425     if (canAttachTrace(error)) {
21426         var trace = this._trace;
21427         if (trace !== undefined) {
21428             if (ignoreSelf) trace = trace._parent;
21429         }
21430         if (trace !== undefined) {
21431             trace.attachExtraTrace(error);
21432         } else if (!error.__stackCleaned__) {
21433             var parsed = parseStackAndMessage(error);
21434             util.notEnumerableProp(error, "stack",
21435                 parsed.message + "\n" + parsed.stack.join("\n"));
21436             util.notEnumerableProp(error, "__stackCleaned__", true);
21437         }
21438     }
21439 }
21440
21441 function checkForgottenReturns(returnValue, promiseCreated, name, promise,
21442                                parent) {
21443     if (returnValue === undefined && promiseCreated !== null &&
21444         wForgottenReturn) {
21445         if (parent !== undefined && parent._returnedNonUndefined()) return;
21446         if ((promise._bitField & 65535) === 0) return;
21447
21448         if (name) name = name + " ";
21449         var handlerLine = "";
21450         var creatorLine = "";
21451         if (promiseCreated._trace) {
21452             var traceLines = promiseCreated._trace.stack.split("\n");
21453             var stack = cleanStack(traceLines);
21454             for (var i = stack.length - 1; i >= 0; --i) {
21455                 var line = stack[i];
21456                 if (!nodeFramePattern.test(line)) {
21457                     var lineMatches = line.match(parseLinePattern);
21458                     if (lineMatches) {
21459                         handlerLine  = "at " + lineMatches[1] +
21460                             ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
21461                     }
21462                     break;
21463                 }
21464             }
21465
21466             if (stack.length > 0) {
21467                 var firstUserLine = stack[0];
21468                 for (var i = 0; i < traceLines.length; ++i) {
21469
21470                     if (traceLines[i] === firstUserLine) {
21471                         if (i > 0) {
21472                             creatorLine = "\n" + traceLines[i - 1];
21473                         }
21474                         break;
21475                     }
21476                 }
21477
21478             }
21479         }
21480         var msg = "a promise was created in a " + name +
21481             "handler " + handlerLine + "but was not returned from it, " +
21482             "see http://goo.gl/rRqMUw" +
21483             creatorLine;
21484         promise._warn(msg, true, promiseCreated);
21485     }
21486 }
21487
21488 function deprecated(name, replacement) {
21489     var message = name +
21490         " is deprecated and will be removed in a future version.";
21491     if (replacement) message += " Use " + replacement + " instead.";
21492     return warn(message);
21493 }
21494
21495 function warn(message, shouldUseOwnTrace, promise) {
21496     if (!config.warnings) return;
21497     var warning = new Warning(message);
21498     var ctx;
21499     if (shouldUseOwnTrace) {
21500         promise._attachExtraTrace(warning);
21501     } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
21502         ctx.attachExtraTrace(warning);
21503     } else {
21504         var parsed = parseStackAndMessage(warning);
21505         warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
21506     }
21507
21508     if (!activeFireEvent("warning", warning)) {
21509         formatAndLogError(warning, "", true);
21510     }
21511 }
21512
21513 function reconstructStack(message, stacks) {
21514     for (var i = 0; i < stacks.length - 1; ++i) {
21515         stacks[i].push("From previous event:");
21516         stacks[i] = stacks[i].join("\n");
21517     }
21518     if (i < stacks.length) {
21519         stacks[i] = stacks[i].join("\n");
21520     }
21521     return message + "\n" + stacks.join("\n");
21522 }
21523
21524 function removeDuplicateOrEmptyJumps(stacks) {
21525     for (var i = 0; i < stacks.length; ++i) {
21526         if (stacks[i].length === 0 ||
21527             ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
21528             stacks.splice(i, 1);
21529             i--;
21530         }
21531     }
21532 }
21533
21534 function removeCommonRoots(stacks) {
21535     var current = stacks[0];
21536     for (var i = 1; i < stacks.length; ++i) {
21537         var prev = stacks[i];
21538         var currentLastIndex = current.length - 1;
21539         var currentLastLine = current[currentLastIndex];
21540         var commonRootMeetPoint = -1;
21541
21542         for (var j = prev.length - 1; j >= 0; --j) {
21543             if (prev[j] === currentLastLine) {
21544                 commonRootMeetPoint = j;
21545                 break;
21546             }
21547         }
21548
21549         for (var j = commonRootMeetPoint; j >= 0; --j) {
21550             var line = prev[j];
21551             if (current[currentLastIndex] === line) {
21552                 current.pop();
21553                 currentLastIndex--;
21554             } else {
21555                 break;
21556             }
21557         }
21558         current = prev;
21559     }
21560 }
21561
21562 function cleanStack(stack) {
21563     var ret = [];
21564     for (var i = 0; i < stack.length; ++i) {
21565         var line = stack[i];
21566         var isTraceLine = "    (No stack trace)" === line ||
21567             stackFramePattern.test(line);
21568         var isInternalFrame = isTraceLine && shouldIgnore(line);
21569         if (isTraceLine && !isInternalFrame) {
21570             if (indentStackFrames && line.charAt(0) !== " ") {
21571                 line = "    " + line;
21572             }
21573             ret.push(line);
21574         }
21575     }
21576     return ret;
21577 }
21578
21579 function stackFramesAsArray(error) {
21580     var stack = error.stack.replace(/\s+$/g, "").split("\n");
21581     for (var i = 0; i < stack.length; ++i) {
21582         var line = stack[i];
21583         if ("    (No stack trace)" === line || stackFramePattern.test(line)) {
21584             break;
21585         }
21586     }
21587     if (i > 0 && error.name != "SyntaxError") {
21588         stack = stack.slice(i);
21589     }
21590     return stack;
21591 }
21592
21593 function parseStackAndMessage(error) {
21594     var stack = error.stack;
21595     var message = error.toString();
21596     stack = typeof stack === "string" && stack.length > 0
21597                 ? stackFramesAsArray(error) : ["    (No stack trace)"];
21598     return {
21599         message: message,
21600         stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
21601     };
21602 }
21603
21604 function formatAndLogError(error, title, isSoft) {
21605     if (typeof console !== "undefined") {
21606         var message;
21607         if (util.isObject(error)) {
21608             var stack = error.stack;
21609             message = title + formatStack(stack, error);
21610         } else {
21611             message = title + String(error);
21612         }
21613         if (typeof printWarning === "function") {
21614             printWarning(message, isSoft);
21615         } else if (typeof console.log === "function" ||
21616             typeof console.log === "object") {
21617             console.log(message);
21618         }
21619     }
21620 }
21621
21622 function fireRejectionEvent(name, localHandler, reason, promise) {
21623     var localEventFired = false;
21624     try {
21625         if (typeof localHandler === "function") {
21626             localEventFired = true;
21627             if (name === "rejectionHandled") {
21628                 localHandler(promise);
21629             } else {
21630                 localHandler(reason, promise);
21631             }
21632         }
21633     } catch (e) {
21634         async.throwLater(e);
21635     }
21636
21637     if (name === "unhandledRejection") {
21638         if (!activeFireEvent(name, reason, promise) && !localEventFired) {
21639             formatAndLogError(reason, "Unhandled rejection ");
21640         }
21641     } else {
21642         activeFireEvent(name, promise);
21643     }
21644 }
21645
21646 function formatNonError(obj) {
21647     var str;
21648     if (typeof obj === "function") {
21649         str = "[function " +
21650             (obj.name || "anonymous") +
21651             "]";
21652     } else {
21653         str = obj && typeof obj.toString === "function"
21654             ? obj.toString() : util.toString(obj);
21655         var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
21656         if (ruselessToString.test(str)) {
21657             try {
21658                 var newStr = JSON.stringify(obj);
21659                 str = newStr;
21660             }
21661             catch(e) {
21662
21663             }
21664         }
21665         if (str.length === 0) {
21666             str = "(empty array)";
21667         }
21668     }
21669     return ("(<" + snip(str) + ">, no stack trace)");
21670 }
21671
21672 function snip(str) {
21673     var maxChars = 41;
21674     if (str.length < maxChars) {
21675         return str;
21676     }
21677     return str.substr(0, maxChars - 3) + "...";
21678 }
21679
21680 function longStackTracesIsSupported() {
21681     return typeof captureStackTrace === "function";
21682 }
21683
21684 var shouldIgnore = function() { return false; };
21685 var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
21686 function parseLineInfo(line) {
21687     var matches = line.match(parseLineInfoRegex);
21688     if (matches) {
21689         return {
21690             fileName: matches[1],
21691             line: parseInt(matches[2], 10)
21692         };
21693     }
21694 }
21695
21696 function setBounds(firstLineError, lastLineError) {
21697     if (!longStackTracesIsSupported()) return;
21698     var firstStackLines = firstLineError.stack.split("\n");
21699     var lastStackLines = lastLineError.stack.split("\n");
21700     var firstIndex = -1;
21701     var lastIndex = -1;
21702     var firstFileName;
21703     var lastFileName;
21704     for (var i = 0; i < firstStackLines.length; ++i) {
21705         var result = parseLineInfo(firstStackLines[i]);
21706         if (result) {
21707             firstFileName = result.fileName;
21708             firstIndex = result.line;
21709             break;
21710         }
21711     }
21712     for (var i = 0; i < lastStackLines.length; ++i) {
21713         var result = parseLineInfo(lastStackLines[i]);
21714         if (result) {
21715             lastFileName = result.fileName;
21716             lastIndex = result.line;
21717             break;
21718         }
21719     }
21720     if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
21721         firstFileName !== lastFileName || firstIndex >= lastIndex) {
21722         return;
21723     }
21724
21725     shouldIgnore = function(line) {
21726         if (bluebirdFramePattern.test(line)) return true;
21727         var info = parseLineInfo(line);
21728         if (info) {
21729             if (info.fileName === firstFileName &&
21730                 (firstIndex <= info.line && info.line <= lastIndex)) {
21731                 return true;
21732             }
21733         }
21734         return false;
21735     };
21736 }
21737
21738 function CapturedTrace(parent) {
21739     this._parent = parent;
21740     this._promisesCreated = 0;
21741     var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
21742     captureStackTrace(this, CapturedTrace);
21743     if (length > 32) this.uncycle();
21744 }
21745 util.inherits(CapturedTrace, Error);
21746 Context.CapturedTrace = CapturedTrace;
21747
21748 CapturedTrace.prototype.uncycle = function() {
21749     var length = this._length;
21750     if (length < 2) return;
21751     var nodes = [];
21752     var stackToIndex = {};
21753
21754     for (var i = 0, node = this; node !== undefined; ++i) {
21755         nodes.push(node);
21756         node = node._parent;
21757     }
21758     length = this._length = i;
21759     for (var i = length - 1; i >= 0; --i) {
21760         var stack = nodes[i].stack;
21761         if (stackToIndex[stack] === undefined) {
21762             stackToIndex[stack] = i;
21763         }
21764     }
21765     for (var i = 0; i < length; ++i) {
21766         var currentStack = nodes[i].stack;
21767         var index = stackToIndex[currentStack];
21768         if (index !== undefined && index !== i) {
21769             if (index > 0) {
21770                 nodes[index - 1]._parent = undefined;
21771                 nodes[index - 1]._length = 1;
21772             }
21773             nodes[i]._parent = undefined;
21774             nodes[i]._length = 1;
21775             var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
21776
21777             if (index < length - 1) {
21778                 cycleEdgeNode._parent = nodes[index + 1];
21779                 cycleEdgeNode._parent.uncycle();
21780                 cycleEdgeNode._length =
21781                     cycleEdgeNode._parent._length + 1;
21782             } else {
21783                 cycleEdgeNode._parent = undefined;
21784                 cycleEdgeNode._length = 1;
21785             }
21786             var currentChildLength = cycleEdgeNode._length + 1;
21787             for (var j = i - 2; j >= 0; --j) {
21788                 nodes[j]._length = currentChildLength;
21789                 currentChildLength++;
21790             }
21791             return;
21792         }
21793     }
21794 };
21795
21796 CapturedTrace.prototype.attachExtraTrace = function(error) {
21797     if (error.__stackCleaned__) return;
21798     this.uncycle();
21799     var parsed = parseStackAndMessage(error);
21800     var message = parsed.message;
21801     var stacks = [parsed.stack];
21802
21803     var trace = this;
21804     while (trace !== undefined) {
21805         stacks.push(cleanStack(trace.stack.split("\n")));
21806         trace = trace._parent;
21807     }
21808     removeCommonRoots(stacks);
21809     removeDuplicateOrEmptyJumps(stacks);
21810     util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
21811     util.notEnumerableProp(error, "__stackCleaned__", true);
21812 };
21813
21814 var captureStackTrace = (function stackDetection() {
21815     var v8stackFramePattern = /^\s*at\s*/;
21816     var v8stackFormatter = function(stack, error) {
21817         if (typeof stack === "string") return stack;
21818
21819         if (error.name !== undefined &&
21820             error.message !== undefined) {
21821             return error.toString();
21822         }
21823         return formatNonError(error);
21824     };
21825
21826     if (typeof Error.stackTraceLimit === "number" &&
21827         typeof Error.captureStackTrace === "function") {
21828         Error.stackTraceLimit += 6;
21829         stackFramePattern = v8stackFramePattern;
21830         formatStack = v8stackFormatter;
21831         var captureStackTrace = Error.captureStackTrace;
21832
21833         shouldIgnore = function(line) {
21834             return bluebirdFramePattern.test(line);
21835         };
21836         return function(receiver, ignoreUntil) {
21837             Error.stackTraceLimit += 6;
21838             captureStackTrace(receiver, ignoreUntil);
21839             Error.stackTraceLimit -= 6;
21840         };
21841     }
21842     var err = new Error();
21843
21844     if (typeof err.stack === "string" &&
21845         err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
21846         stackFramePattern = /@/;
21847         formatStack = v8stackFormatter;
21848         indentStackFrames = true;
21849         return function captureStackTrace(o) {
21850             o.stack = new Error().stack;
21851         };
21852     }
21853
21854     var hasStackAfterThrow;
21855     try { throw new Error(); }
21856     catch(e) {
21857         hasStackAfterThrow = ("stack" in e);
21858     }
21859     if (!("stack" in err) && hasStackAfterThrow &&
21860         typeof Error.stackTraceLimit === "number") {
21861         stackFramePattern = v8stackFramePattern;
21862         formatStack = v8stackFormatter;
21863         return function captureStackTrace(o) {
21864             Error.stackTraceLimit += 6;
21865             try { throw new Error(); }
21866             catch(e) { o.stack = e.stack; }
21867             Error.stackTraceLimit -= 6;
21868         };
21869     }
21870
21871     formatStack = function(stack, error) {
21872         if (typeof stack === "string") return stack;
21873
21874         if ((typeof error === "object" ||
21875             typeof error === "function") &&
21876             error.name !== undefined &&
21877             error.message !== undefined) {
21878             return error.toString();
21879         }
21880         return formatNonError(error);
21881     };
21882
21883     return null;
21884
21885 })([]);
21886
21887 if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
21888     printWarning = function (message) {
21889         console.warn(message);
21890     };
21891     if (util.isNode && process.stderr.isTTY) {
21892         printWarning = function(message, isSoft) {
21893             var color = isSoft ? "\u001b[33m" : "\u001b[31m";
21894             console.warn(color + message + "\u001b[0m\n");
21895         };
21896     } else if (!util.isNode && typeof (new Error().stack) === "string") {
21897         printWarning = function(message, isSoft) {
21898             console.warn("%c" + message,
21899                         isSoft ? "color: darkorange" : "color: red");
21900         };
21901     }
21902 }
21903
21904 var config = {
21905     warnings: warnings,
21906     longStackTraces: false,
21907     cancellation: false,
21908     monitoring: false
21909 };
21910
21911 if (longStackTraces) Promise.longStackTraces();
21912
21913 return {
21914     longStackTraces: function() {
21915         return config.longStackTraces;
21916     },
21917     warnings: function() {
21918         return config.warnings;
21919     },
21920     cancellation: function() {
21921         return config.cancellation;
21922     },
21923     monitoring: function() {
21924         return config.monitoring;
21925     },
21926     propagateFromFunction: function() {
21927         return propagateFromFunction;
21928     },
21929     boundValueFunction: function() {
21930         return boundValueFunction;
21931     },
21932     checkForgottenReturns: checkForgottenReturns,
21933     setBounds: setBounds,
21934     warn: warn,
21935     deprecated: deprecated,
21936     CapturedTrace: CapturedTrace,
21937     fireDomEvent: fireDomEvent,
21938     fireGlobalEvent: fireGlobalEvent
21939 };
21940 };
21941
21942
21943 /***/ }),
21944 /* 140 */
21945 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
21946
21947 "use strict";
21948
21949 module.exports = function(Promise, tryConvertToPromise) {
21950 var util = __webpack_require__(130);
21951 var CancellationError = Promise.CancellationError;
21952 var errorObj = util.errorObj;
21953
21954 function PassThroughHandlerContext(promise, type, handler) {
21955     this.promise = promise;
21956     this.type = type;
21957     this.handler = handler;
21958     this.called = false;
21959     this.cancelPromise = null;
21960 }
21961
21962 PassThroughHandlerContext.prototype.isFinallyHandler = function() {
21963     return this.type === 0;
21964 };
21965
21966 function FinallyHandlerCancelReaction(finallyHandler) {
21967     this.finallyHandler = finallyHandler;
21968 }
21969
21970 FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
21971     checkCancel(this.finallyHandler);
21972 };
21973
21974 function checkCancel(ctx, reason) {
21975     if (ctx.cancelPromise != null) {
21976         if (arguments.length > 1) {
21977             ctx.cancelPromise._reject(reason);
21978         } else {
21979             ctx.cancelPromise._cancel();
21980         }
21981         ctx.cancelPromise = null;
21982         return true;
21983     }
21984     return false;
21985 }
21986
21987 function succeed() {
21988     return finallyHandler.call(this, this.promise._target()._settledValue());
21989 }
21990 function fail(reason) {
21991     if (checkCancel(this, reason)) return;
21992     errorObj.e = reason;
21993     return errorObj;
21994 }
21995 function finallyHandler(reasonOrValue) {
21996     var promise = this.promise;
21997     var handler = this.handler;
21998
21999     if (!this.called) {
22000         this.called = true;
22001         var ret = this.isFinallyHandler()
22002             ? handler.call(promise._boundValue())
22003             : handler.call(promise._boundValue(), reasonOrValue);
22004         if (ret !== undefined) {
22005             promise._setReturnedNonUndefined();
22006             var maybePromise = tryConvertToPromise(ret, promise);
22007             if (maybePromise instanceof Promise) {
22008                 if (this.cancelPromise != null) {
22009                     if (maybePromise._isCancelled()) {
22010                         var reason =
22011                             new CancellationError("late cancellation observer");
22012                         promise._attachExtraTrace(reason);
22013                         errorObj.e = reason;
22014                         return errorObj;
22015                     } else if (maybePromise.isPending()) {
22016                         maybePromise._attachCancellationCallback(
22017                             new FinallyHandlerCancelReaction(this));
22018                     }
22019                 }
22020                 return maybePromise._then(
22021                     succeed, fail, undefined, this, undefined);
22022             }
22023         }
22024     }
22025
22026     if (promise.isRejected()) {
22027         checkCancel(this);
22028         errorObj.e = reasonOrValue;
22029         return errorObj;
22030     } else {
22031         checkCancel(this);
22032         return reasonOrValue;
22033     }
22034 }
22035
22036 Promise.prototype._passThrough = function(handler, type, success, fail) {
22037     if (typeof handler !== "function") return this.then();
22038     return this._then(success,
22039                       fail,
22040                       undefined,
22041                       new PassThroughHandlerContext(this, type, handler),
22042                       undefined);
22043 };
22044
22045 Promise.prototype.lastly =
22046 Promise.prototype["finally"] = function (handler) {
22047     return this._passThrough(handler,
22048                              0,
22049                              finallyHandler,
22050                              finallyHandler);
22051 };
22052
22053 Promise.prototype.tap = function (handler) {
22054     return this._passThrough(handler, 1, finallyHandler);
22055 };
22056
22057 return PassThroughHandlerContext;
22058 };
22059
22060
22061 /***/ }),
22062 /* 141 */
22063 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22064
22065 "use strict";
22066
22067 module.exports = function(NEXT_FILTER) {
22068 var util = __webpack_require__(130);
22069 var getKeys = __webpack_require__(131).keys;
22070 var tryCatch = util.tryCatch;
22071 var errorObj = util.errorObj;
22072
22073 function catchFilter(instances, cb, promise) {
22074     return function(e) {
22075         var boundTo = promise._boundValue();
22076         predicateLoop: for (var i = 0; i < instances.length; ++i) {
22077             var item = instances[i];
22078
22079             if (item === Error ||
22080                 (item != null && item.prototype instanceof Error)) {
22081                 if (e instanceof item) {
22082                     return tryCatch(cb).call(boundTo, e);
22083                 }
22084             } else if (typeof item === "function") {
22085                 var matchesPredicate = tryCatch(item).call(boundTo, e);
22086                 if (matchesPredicate === errorObj) {
22087                     return matchesPredicate;
22088                 } else if (matchesPredicate) {
22089                     return tryCatch(cb).call(boundTo, e);
22090                 }
22091             } else if (util.isObject(e)) {
22092                 var keys = getKeys(item);
22093                 for (var j = 0; j < keys.length; ++j) {
22094                     var key = keys[j];
22095                     if (item[key] != e[key]) {
22096                         continue predicateLoop;
22097                     }
22098                 }
22099                 return tryCatch(cb).call(boundTo, e);
22100             }
22101         }
22102         return NEXT_FILTER;
22103     };
22104 }
22105
22106 return catchFilter;
22107 };
22108
22109
22110 /***/ }),
22111 /* 142 */
22112 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22113
22114 "use strict";
22115
22116 var util = __webpack_require__(130);
22117 var maybeWrapAsError = util.maybeWrapAsError;
22118 var errors = __webpack_require__(135);
22119 var OperationalError = errors.OperationalError;
22120 var es5 = __webpack_require__(131);
22121
22122 function isUntypedError(obj) {
22123     return obj instanceof Error &&
22124         es5.getPrototypeOf(obj) === Error.prototype;
22125 }
22126
22127 var rErrorKey = /^(?:name|message|stack|cause)$/;
22128 function wrapAsOperationalError(obj) {
22129     var ret;
22130     if (isUntypedError(obj)) {
22131         ret = new OperationalError(obj);
22132         ret.name = obj.name;
22133         ret.message = obj.message;
22134         ret.stack = obj.stack;
22135         var keys = es5.keys(obj);
22136         for (var i = 0; i < keys.length; ++i) {
22137             var key = keys[i];
22138             if (!rErrorKey.test(key)) {
22139                 ret[key] = obj[key];
22140             }
22141         }
22142         return ret;
22143     }
22144     util.markAsOriginatingFromRejection(obj);
22145     return obj;
22146 }
22147
22148 function nodebackForPromise(promise, multiArgs) {
22149     return function(err, value) {
22150         if (promise === null) return;
22151         if (err) {
22152             var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
22153             promise._attachExtraTrace(wrapped);
22154             promise._reject(wrapped);
22155         } else if (!multiArgs) {
22156             promise._fulfill(value);
22157         } else {
22158             var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
22159             promise._fulfill(args);
22160         }
22161         promise = null;
22162     };
22163 }
22164
22165 module.exports = nodebackForPromise;
22166
22167
22168 /***/ }),
22169 /* 143 */
22170 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22171
22172 "use strict";
22173
22174 module.exports =
22175 function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
22176 var util = __webpack_require__(130);
22177 var tryCatch = util.tryCatch;
22178
22179 Promise.method = function (fn) {
22180     if (typeof fn !== "function") {
22181         throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
22182     }
22183     return function () {
22184         var ret = new Promise(INTERNAL);
22185         ret._captureStackTrace();
22186         ret._pushContext();
22187         var value = tryCatch(fn).apply(this, arguments);
22188         var promiseCreated = ret._popContext();
22189         debug.checkForgottenReturns(
22190             value, promiseCreated, "Promise.method", ret);
22191         ret._resolveFromSyncValue(value);
22192         return ret;
22193     };
22194 };
22195
22196 Promise.attempt = Promise["try"] = function (fn) {
22197     if (typeof fn !== "function") {
22198         return apiRejection("expecting a function but got " + util.classString(fn));
22199     }
22200     var ret = new Promise(INTERNAL);
22201     ret._captureStackTrace();
22202     ret._pushContext();
22203     var value;
22204     if (arguments.length > 1) {
22205         debug.deprecated("calling Promise.try with more than 1 argument");
22206         var arg = arguments[1];
22207         var ctx = arguments[2];
22208         value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
22209                                   : tryCatch(fn).call(ctx, arg);
22210     } else {
22211         value = tryCatch(fn)();
22212     }
22213     var promiseCreated = ret._popContext();
22214     debug.checkForgottenReturns(
22215         value, promiseCreated, "Promise.try", ret);
22216     ret._resolveFromSyncValue(value);
22217     return ret;
22218 };
22219
22220 Promise.prototype._resolveFromSyncValue = function (value) {
22221     if (value === util.errorObj) {
22222         this._rejectCallback(value.e, false);
22223     } else {
22224         this._resolveCallback(value, true);
22225     }
22226 };
22227 };
22228
22229
22230 /***/ }),
22231 /* 144 */
22232 /***/ ((module) => {
22233
22234 "use strict";
22235
22236 module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
22237 var calledBind = false;
22238 var rejectThis = function(_, e) {
22239     this._reject(e);
22240 };
22241
22242 var targetRejected = function(e, context) {
22243     context.promiseRejectionQueued = true;
22244     context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
22245 };
22246
22247 var bindingResolved = function(thisArg, context) {
22248     if (((this._bitField & 50397184) === 0)) {
22249         this._resolveCallback(context.target);
22250     }
22251 };
22252
22253 var bindingRejected = function(e, context) {
22254     if (!context.promiseRejectionQueued) this._reject(e);
22255 };
22256
22257 Promise.prototype.bind = function (thisArg) {
22258     if (!calledBind) {
22259         calledBind = true;
22260         Promise.prototype._propagateFrom = debug.propagateFromFunction();
22261         Promise.prototype._boundValue = debug.boundValueFunction();
22262     }
22263     var maybePromise = tryConvertToPromise(thisArg);
22264     var ret = new Promise(INTERNAL);
22265     ret._propagateFrom(this, 1);
22266     var target = this._target();
22267     ret._setBoundTo(maybePromise);
22268     if (maybePromise instanceof Promise) {
22269         var context = {
22270             promiseRejectionQueued: false,
22271             promise: ret,
22272             target: target,
22273             bindingPromise: maybePromise
22274         };
22275         target._then(INTERNAL, targetRejected, undefined, ret, context);
22276         maybePromise._then(
22277             bindingResolved, bindingRejected, undefined, ret, context);
22278         ret._setOnCancel(maybePromise);
22279     } else {
22280         ret._resolveCallback(target);
22281     }
22282     return ret;
22283 };
22284
22285 Promise.prototype._setBoundTo = function (obj) {
22286     if (obj !== undefined) {
22287         this._bitField = this._bitField | 2097152;
22288         this._boundTo = obj;
22289     } else {
22290         this._bitField = this._bitField & (~2097152);
22291     }
22292 };
22293
22294 Promise.prototype._isBound = function () {
22295     return (this._bitField & 2097152) === 2097152;
22296 };
22297
22298 Promise.bind = function (thisArg, value) {
22299     return Promise.resolve(value).bind(thisArg);
22300 };
22301 };
22302
22303
22304 /***/ }),
22305 /* 145 */
22306 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22307
22308 "use strict";
22309
22310 module.exports = function(Promise, PromiseArray, apiRejection, debug) {
22311 var util = __webpack_require__(130);
22312 var tryCatch = util.tryCatch;
22313 var errorObj = util.errorObj;
22314 var async = Promise._async;
22315
22316 Promise.prototype["break"] = Promise.prototype.cancel = function() {
22317     if (!debug.cancellation()) return this._warn("cancellation is disabled");
22318
22319     var promise = this;
22320     var child = promise;
22321     while (promise._isCancellable()) {
22322         if (!promise._cancelBy(child)) {
22323             if (child._isFollowing()) {
22324                 child._followee().cancel();
22325             } else {
22326                 child._cancelBranched();
22327             }
22328             break;
22329         }
22330
22331         var parent = promise._cancellationParent;
22332         if (parent == null || !parent._isCancellable()) {
22333             if (promise._isFollowing()) {
22334                 promise._followee().cancel();
22335             } else {
22336                 promise._cancelBranched();
22337             }
22338             break;
22339         } else {
22340             if (promise._isFollowing()) promise._followee().cancel();
22341             promise._setWillBeCancelled();
22342             child = promise;
22343             promise = parent;
22344         }
22345     }
22346 };
22347
22348 Promise.prototype._branchHasCancelled = function() {
22349     this._branchesRemainingToCancel--;
22350 };
22351
22352 Promise.prototype._enoughBranchesHaveCancelled = function() {
22353     return this._branchesRemainingToCancel === undefined ||
22354            this._branchesRemainingToCancel <= 0;
22355 };
22356
22357 Promise.prototype._cancelBy = function(canceller) {
22358     if (canceller === this) {
22359         this._branchesRemainingToCancel = 0;
22360         this._invokeOnCancel();
22361         return true;
22362     } else {
22363         this._branchHasCancelled();
22364         if (this._enoughBranchesHaveCancelled()) {
22365             this._invokeOnCancel();
22366             return true;
22367         }
22368     }
22369     return false;
22370 };
22371
22372 Promise.prototype._cancelBranched = function() {
22373     if (this._enoughBranchesHaveCancelled()) {
22374         this._cancel();
22375     }
22376 };
22377
22378 Promise.prototype._cancel = function() {
22379     if (!this._isCancellable()) return;
22380     this._setCancelled();
22381     async.invoke(this._cancelPromises, this, undefined);
22382 };
22383
22384 Promise.prototype._cancelPromises = function() {
22385     if (this._length() > 0) this._settlePromises();
22386 };
22387
22388 Promise.prototype._unsetOnCancel = function() {
22389     this._onCancelField = undefined;
22390 };
22391
22392 Promise.prototype._isCancellable = function() {
22393     return this.isPending() && !this._isCancelled();
22394 };
22395
22396 Promise.prototype.isCancellable = function() {
22397     return this.isPending() && !this.isCancelled();
22398 };
22399
22400 Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
22401     if (util.isArray(onCancelCallback)) {
22402         for (var i = 0; i < onCancelCallback.length; ++i) {
22403             this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
22404         }
22405     } else if (onCancelCallback !== undefined) {
22406         if (typeof onCancelCallback === "function") {
22407             if (!internalOnly) {
22408                 var e = tryCatch(onCancelCallback).call(this._boundValue());
22409                 if (e === errorObj) {
22410                     this._attachExtraTrace(e.e);
22411                     async.throwLater(e.e);
22412                 }
22413             }
22414         } else {
22415             onCancelCallback._resultCancelled(this);
22416         }
22417     }
22418 };
22419
22420 Promise.prototype._invokeOnCancel = function() {
22421     var onCancelCallback = this._onCancel();
22422     this._unsetOnCancel();
22423     async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
22424 };
22425
22426 Promise.prototype._invokeInternalOnCancel = function() {
22427     if (this._isCancellable()) {
22428         this._doInvokeOnCancel(this._onCancel(), true);
22429         this._unsetOnCancel();
22430     }
22431 };
22432
22433 Promise.prototype._resultCancelled = function() {
22434     this.cancel();
22435 };
22436
22437 };
22438
22439
22440 /***/ }),
22441 /* 146 */
22442 /***/ ((module) => {
22443
22444 "use strict";
22445
22446 module.exports = function(Promise) {
22447 function returner() {
22448     return this.value;
22449 }
22450 function thrower() {
22451     throw this.reason;
22452 }
22453
22454 Promise.prototype["return"] =
22455 Promise.prototype.thenReturn = function (value) {
22456     if (value instanceof Promise) value.suppressUnhandledRejections();
22457     return this._then(
22458         returner, undefined, undefined, {value: value}, undefined);
22459 };
22460
22461 Promise.prototype["throw"] =
22462 Promise.prototype.thenThrow = function (reason) {
22463     return this._then(
22464         thrower, undefined, undefined, {reason: reason}, undefined);
22465 };
22466
22467 Promise.prototype.catchThrow = function (reason) {
22468     if (arguments.length <= 1) {
22469         return this._then(
22470             undefined, thrower, undefined, {reason: reason}, undefined);
22471     } else {
22472         var _reason = arguments[1];
22473         var handler = function() {throw _reason;};
22474         return this.caught(reason, handler);
22475     }
22476 };
22477
22478 Promise.prototype.catchReturn = function (value) {
22479     if (arguments.length <= 1) {
22480         if (value instanceof Promise) value.suppressUnhandledRejections();
22481         return this._then(
22482             undefined, returner, undefined, {value: value}, undefined);
22483     } else {
22484         var _value = arguments[1];
22485         if (_value instanceof Promise) _value.suppressUnhandledRejections();
22486         var handler = function() {return _value;};
22487         return this.caught(value, handler);
22488     }
22489 };
22490 };
22491
22492
22493 /***/ }),
22494 /* 147 */
22495 /***/ ((module) => {
22496
22497 "use strict";
22498
22499 module.exports = function(Promise) {
22500 function PromiseInspection(promise) {
22501     if (promise !== undefined) {
22502         promise = promise._target();
22503         this._bitField = promise._bitField;
22504         this._settledValueField = promise._isFateSealed()
22505             ? promise._settledValue() : undefined;
22506     }
22507     else {
22508         this._bitField = 0;
22509         this._settledValueField = undefined;
22510     }
22511 }
22512
22513 PromiseInspection.prototype._settledValue = function() {
22514     return this._settledValueField;
22515 };
22516
22517 var value = PromiseInspection.prototype.value = function () {
22518     if (!this.isFulfilled()) {
22519         throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
22520     }
22521     return this._settledValue();
22522 };
22523
22524 var reason = PromiseInspection.prototype.error =
22525 PromiseInspection.prototype.reason = function () {
22526     if (!this.isRejected()) {
22527         throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
22528     }
22529     return this._settledValue();
22530 };
22531
22532 var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
22533     return (this._bitField & 33554432) !== 0;
22534 };
22535
22536 var isRejected = PromiseInspection.prototype.isRejected = function () {
22537     return (this._bitField & 16777216) !== 0;
22538 };
22539
22540 var isPending = PromiseInspection.prototype.isPending = function () {
22541     return (this._bitField & 50397184) === 0;
22542 };
22543
22544 var isResolved = PromiseInspection.prototype.isResolved = function () {
22545     return (this._bitField & 50331648) !== 0;
22546 };
22547
22548 PromiseInspection.prototype.isCancelled = function() {
22549     return (this._bitField & 8454144) !== 0;
22550 };
22551
22552 Promise.prototype.__isCancelled = function() {
22553     return (this._bitField & 65536) === 65536;
22554 };
22555
22556 Promise.prototype._isCancelled = function() {
22557     return this._target().__isCancelled();
22558 };
22559
22560 Promise.prototype.isCancelled = function() {
22561     return (this._target()._bitField & 8454144) !== 0;
22562 };
22563
22564 Promise.prototype.isPending = function() {
22565     return isPending.call(this._target());
22566 };
22567
22568 Promise.prototype.isRejected = function() {
22569     return isRejected.call(this._target());
22570 };
22571
22572 Promise.prototype.isFulfilled = function() {
22573     return isFulfilled.call(this._target());
22574 };
22575
22576 Promise.prototype.isResolved = function() {
22577     return isResolved.call(this._target());
22578 };
22579
22580 Promise.prototype.value = function() {
22581     return value.call(this._target());
22582 };
22583
22584 Promise.prototype.reason = function() {
22585     var target = this._target();
22586     target._unsetRejectionIsUnhandled();
22587     return reason.call(target);
22588 };
22589
22590 Promise.prototype._value = function() {
22591     return this._settledValue();
22592 };
22593
22594 Promise.prototype._reason = function() {
22595     this._unsetRejectionIsUnhandled();
22596     return this._settledValue();
22597 };
22598
22599 Promise.PromiseInspection = PromiseInspection;
22600 };
22601
22602
22603 /***/ }),
22604 /* 148 */
22605 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22606
22607 "use strict";
22608
22609 module.exports =
22610 function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
22611          getDomain) {
22612 var util = __webpack_require__(130);
22613 var canEvaluate = util.canEvaluate;
22614 var tryCatch = util.tryCatch;
22615 var errorObj = util.errorObj;
22616 var reject;
22617
22618 if (true) {
22619 if (canEvaluate) {
22620     var thenCallback = function(i) {
22621         return new Function("value", "holder", "                             \n\
22622             'use strict';                                                    \n\
22623             holder.pIndex = value;                                           \n\
22624             holder.checkFulfillment(this);                                   \n\
22625             ".replace(/Index/g, i));
22626     };
22627
22628     var promiseSetter = function(i) {
22629         return new Function("promise", "holder", "                           \n\
22630             'use strict';                                                    \n\
22631             holder.pIndex = promise;                                         \n\
22632             ".replace(/Index/g, i));
22633     };
22634
22635     var generateHolderClass = function(total) {
22636         var props = new Array(total);
22637         for (var i = 0; i < props.length; ++i) {
22638             props[i] = "this.p" + (i+1);
22639         }
22640         var assignment = props.join(" = ") + " = null;";
22641         var cancellationCode= "var promise;\n" + props.map(function(prop) {
22642             return "                                                         \n\
22643                 promise = " + prop + ";                                      \n\
22644                 if (promise instanceof Promise) {                            \n\
22645                     promise.cancel();                                        \n\
22646                 }                                                            \n\
22647             ";
22648         }).join("\n");
22649         var passedArguments = props.join(", ");
22650         var name = "Holder$" + total;
22651
22652
22653         var code = "return function(tryCatch, errorObj, Promise, async) {    \n\
22654             'use strict';                                                    \n\
22655             function [TheName](fn) {                                         \n\
22656                 [TheProperties]                                              \n\
22657                 this.fn = fn;                                                \n\
22658                 this.asyncNeeded = true;                                     \n\
22659                 this.now = 0;                                                \n\
22660             }                                                                \n\
22661                                                                              \n\
22662             [TheName].prototype._callFunction = function(promise) {          \n\
22663                 promise._pushContext();                                      \n\
22664                 var ret = tryCatch(this.fn)([ThePassedArguments]);           \n\
22665                 promise._popContext();                                       \n\
22666                 if (ret === errorObj) {                                      \n\
22667                     promise._rejectCallback(ret.e, false);                   \n\
22668                 } else {                                                     \n\
22669                     promise._resolveCallback(ret);                           \n\
22670                 }                                                            \n\
22671             };                                                               \n\
22672                                                                              \n\
22673             [TheName].prototype.checkFulfillment = function(promise) {       \n\
22674                 var now = ++this.now;                                        \n\
22675                 if (now === [TheTotal]) {                                    \n\
22676                     if (this.asyncNeeded) {                                  \n\
22677                         async.invoke(this._callFunction, this, promise);     \n\
22678                     } else {                                                 \n\
22679                         this._callFunction(promise);                         \n\
22680                     }                                                        \n\
22681                                                                              \n\
22682                 }                                                            \n\
22683             };                                                               \n\
22684                                                                              \n\
22685             [TheName].prototype._resultCancelled = function() {              \n\
22686                 [CancellationCode]                                           \n\
22687             };                                                               \n\
22688                                                                              \n\
22689             return [TheName];                                                \n\
22690         }(tryCatch, errorObj, Promise, async);                               \n\
22691         ";
22692
22693         code = code.replace(/\[TheName\]/g, name)
22694             .replace(/\[TheTotal\]/g, total)
22695             .replace(/\[ThePassedArguments\]/g, passedArguments)
22696             .replace(/\[TheProperties\]/g, assignment)
22697             .replace(/\[CancellationCode\]/g, cancellationCode);
22698
22699         return new Function("tryCatch", "errorObj", "Promise", "async", code)
22700                            (tryCatch, errorObj, Promise, async);
22701     };
22702
22703     var holderClasses = [];
22704     var thenCallbacks = [];
22705     var promiseSetters = [];
22706
22707     for (var i = 0; i < 8; ++i) {
22708         holderClasses.push(generateHolderClass(i + 1));
22709         thenCallbacks.push(thenCallback(i + 1));
22710         promiseSetters.push(promiseSetter(i + 1));
22711     }
22712
22713     reject = function (reason) {
22714         this._reject(reason);
22715     };
22716 }}
22717
22718 Promise.join = function () {
22719     var last = arguments.length - 1;
22720     var fn;
22721     if (last > 0 && typeof arguments[last] === "function") {
22722         fn = arguments[last];
22723         if (true) {
22724             if (last <= 8 && canEvaluate) {
22725                 var ret = new Promise(INTERNAL);
22726                 ret._captureStackTrace();
22727                 var HolderClass = holderClasses[last - 1];
22728                 var holder = new HolderClass(fn);
22729                 var callbacks = thenCallbacks;
22730
22731                 for (var i = 0; i < last; ++i) {
22732                     var maybePromise = tryConvertToPromise(arguments[i], ret);
22733                     if (maybePromise instanceof Promise) {
22734                         maybePromise = maybePromise._target();
22735                         var bitField = maybePromise._bitField;
22736                         ;
22737                         if (((bitField & 50397184) === 0)) {
22738                             maybePromise._then(callbacks[i], reject,
22739                                                undefined, ret, holder);
22740                             promiseSetters[i](maybePromise, holder);
22741                             holder.asyncNeeded = false;
22742                         } else if (((bitField & 33554432) !== 0)) {
22743                             callbacks[i].call(ret,
22744                                               maybePromise._value(), holder);
22745                         } else if (((bitField & 16777216) !== 0)) {
22746                             ret._reject(maybePromise._reason());
22747                         } else {
22748                             ret._cancel();
22749                         }
22750                     } else {
22751                         callbacks[i].call(ret, maybePromise, holder);
22752                     }
22753                 }
22754
22755                 if (!ret._isFateSealed()) {
22756                     if (holder.asyncNeeded) {
22757                         var domain = getDomain();
22758                         if (domain !== null) {
22759                             holder.fn = util.domainBind(domain, holder.fn);
22760                         }
22761                     }
22762                     ret._setAsyncGuaranteed();
22763                     ret._setOnCancel(holder);
22764                 }
22765                 return ret;
22766             }
22767         }
22768     }
22769     var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];};
22770     if (fn) args.pop();
22771     var ret = new PromiseArray(args).promise();
22772     return fn !== undefined ? ret.spread(fn) : ret;
22773 };
22774
22775 };
22776
22777
22778 /***/ }),
22779 /* 149 */
22780 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22781
22782 "use strict";
22783
22784 module.exports = function(Promise,
22785                           PromiseArray,
22786                           apiRejection,
22787                           tryConvertToPromise,
22788                           INTERNAL,
22789                           debug) {
22790 var getDomain = Promise._getDomain;
22791 var util = __webpack_require__(130);
22792 var tryCatch = util.tryCatch;
22793 var errorObj = util.errorObj;
22794 var async = Promise._async;
22795
22796 function MappingPromiseArray(promises, fn, limit, _filter) {
22797     this.constructor$(promises);
22798     this._promise._captureStackTrace();
22799     var domain = getDomain();
22800     this._callback = domain === null ? fn : util.domainBind(domain, fn);
22801     this._preservedValues = _filter === INTERNAL
22802         ? new Array(this.length())
22803         : null;
22804     this._limit = limit;
22805     this._inFlight = 0;
22806     this._queue = [];
22807     async.invoke(this._asyncInit, this, undefined);
22808 }
22809 util.inherits(MappingPromiseArray, PromiseArray);
22810
22811 MappingPromiseArray.prototype._asyncInit = function() {
22812     this._init$(undefined, -2);
22813 };
22814
22815 MappingPromiseArray.prototype._init = function () {};
22816
22817 MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
22818     var values = this._values;
22819     var length = this.length();
22820     var preservedValues = this._preservedValues;
22821     var limit = this._limit;
22822
22823     if (index < 0) {
22824         index = (index * -1) - 1;
22825         values[index] = value;
22826         if (limit >= 1) {
22827             this._inFlight--;
22828             this._drainQueue();
22829             if (this._isResolved()) return true;
22830         }
22831     } else {
22832         if (limit >= 1 && this._inFlight >= limit) {
22833             values[index] = value;
22834             this._queue.push(index);
22835             return false;
22836         }
22837         if (preservedValues !== null) preservedValues[index] = value;
22838
22839         var promise = this._promise;
22840         var callback = this._callback;
22841         var receiver = promise._boundValue();
22842         promise._pushContext();
22843         var ret = tryCatch(callback).call(receiver, value, index, length);
22844         var promiseCreated = promise._popContext();
22845         debug.checkForgottenReturns(
22846             ret,
22847             promiseCreated,
22848             preservedValues !== null ? "Promise.filter" : "Promise.map",
22849             promise
22850         );
22851         if (ret === errorObj) {
22852             this._reject(ret.e);
22853             return true;
22854         }
22855
22856         var maybePromise = tryConvertToPromise(ret, this._promise);
22857         if (maybePromise instanceof Promise) {
22858             maybePromise = maybePromise._target();
22859             var bitField = maybePromise._bitField;
22860             ;
22861             if (((bitField & 50397184) === 0)) {
22862                 if (limit >= 1) this._inFlight++;
22863                 values[index] = maybePromise;
22864                 maybePromise._proxy(this, (index + 1) * -1);
22865                 return false;
22866             } else if (((bitField & 33554432) !== 0)) {
22867                 ret = maybePromise._value();
22868             } else if (((bitField & 16777216) !== 0)) {
22869                 this._reject(maybePromise._reason());
22870                 return true;
22871             } else {
22872                 this._cancel();
22873                 return true;
22874             }
22875         }
22876         values[index] = ret;
22877     }
22878     var totalResolved = ++this._totalResolved;
22879     if (totalResolved >= length) {
22880         if (preservedValues !== null) {
22881             this._filter(values, preservedValues);
22882         } else {
22883             this._resolve(values);
22884         }
22885         return true;
22886     }
22887     return false;
22888 };
22889
22890 MappingPromiseArray.prototype._drainQueue = function () {
22891     var queue = this._queue;
22892     var limit = this._limit;
22893     var values = this._values;
22894     while (queue.length > 0 && this._inFlight < limit) {
22895         if (this._isResolved()) return;
22896         var index = queue.pop();
22897         this._promiseFulfilled(values[index], index);
22898     }
22899 };
22900
22901 MappingPromiseArray.prototype._filter = function (booleans, values) {
22902     var len = values.length;
22903     var ret = new Array(len);
22904     var j = 0;
22905     for (var i = 0; i < len; ++i) {
22906         if (booleans[i]) ret[j++] = values[i];
22907     }
22908     ret.length = j;
22909     this._resolve(ret);
22910 };
22911
22912 MappingPromiseArray.prototype.preservedValues = function () {
22913     return this._preservedValues;
22914 };
22915
22916 function map(promises, fn, options, _filter) {
22917     if (typeof fn !== "function") {
22918         return apiRejection("expecting a function but got " + util.classString(fn));
22919     }
22920
22921     var limit = 0;
22922     if (options !== undefined) {
22923         if (typeof options === "object" && options !== null) {
22924             if (typeof options.concurrency !== "number") {
22925                 return Promise.reject(
22926                     new TypeError("'concurrency' must be a number but it is " +
22927                                     util.classString(options.concurrency)));
22928             }
22929             limit = options.concurrency;
22930         } else {
22931             return Promise.reject(new TypeError(
22932                             "options argument must be an object but it is " +
22933                              util.classString(options)));
22934         }
22935     }
22936     limit = typeof limit === "number" &&
22937         isFinite(limit) && limit >= 1 ? limit : 0;
22938     return new MappingPromiseArray(promises, fn, limit, _filter).promise();
22939 }
22940
22941 Promise.prototype.map = function (fn, options) {
22942     return map(this, fn, options, null);
22943 };
22944
22945 Promise.map = function (promises, fn, options, _filter) {
22946     return map(promises, fn, options, _filter);
22947 };
22948
22949
22950 };
22951
22952
22953 /***/ }),
22954 /* 150 */
22955 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22956
22957 "use strict";
22958
22959 var cr = Object.create;
22960 if (cr) {
22961     var callerCache = cr(null);
22962     var getterCache = cr(null);
22963     callerCache[" size"] = getterCache[" size"] = 0;
22964 }
22965
22966 module.exports = function(Promise) {
22967 var util = __webpack_require__(130);
22968 var canEvaluate = util.canEvaluate;
22969 var isIdentifier = util.isIdentifier;
22970
22971 var getMethodCaller;
22972 var getGetter;
22973 if (true) {
22974 var makeMethodCaller = function (methodName) {
22975     return new Function("ensureMethod", "                                    \n\
22976         return function(obj) {                                               \n\
22977             'use strict'                                                     \n\
22978             var len = this.length;                                           \n\
22979             ensureMethod(obj, 'methodName');                                 \n\
22980             switch(len) {                                                    \n\
22981                 case 1: return obj.methodName(this[0]);                      \n\
22982                 case 2: return obj.methodName(this[0], this[1]);             \n\
22983                 case 3: return obj.methodName(this[0], this[1], this[2]);    \n\
22984                 case 0: return obj.methodName();                             \n\
22985                 default:                                                     \n\
22986                     return obj.methodName.apply(obj, this);                  \n\
22987             }                                                                \n\
22988         };                                                                   \n\
22989         ".replace(/methodName/g, methodName))(ensureMethod);
22990 };
22991
22992 var makeGetter = function (propertyName) {
22993     return new Function("obj", "                                             \n\
22994         'use strict';                                                        \n\
22995         return obj.propertyName;                                             \n\
22996         ".replace("propertyName", propertyName));
22997 };
22998
22999 var getCompiled = function(name, compiler, cache) {
23000     var ret = cache[name];
23001     if (typeof ret !== "function") {
23002         if (!isIdentifier(name)) {
23003             return null;
23004         }
23005         ret = compiler(name);
23006         cache[name] = ret;
23007         cache[" size"]++;
23008         if (cache[" size"] > 512) {
23009             var keys = Object.keys(cache);
23010             for (var i = 0; i < 256; ++i) delete cache[keys[i]];
23011             cache[" size"] = keys.length - 256;
23012         }
23013     }
23014     return ret;
23015 };
23016
23017 getMethodCaller = function(name) {
23018     return getCompiled(name, makeMethodCaller, callerCache);
23019 };
23020
23021 getGetter = function(name) {
23022     return getCompiled(name, makeGetter, getterCache);
23023 };
23024 }
23025
23026 function ensureMethod(obj, methodName) {
23027     var fn;
23028     if (obj != null) fn = obj[methodName];
23029     if (typeof fn !== "function") {
23030         var message = "Object " + util.classString(obj) + " has no method '" +
23031             util.toString(methodName) + "'";
23032         throw new Promise.TypeError(message);
23033     }
23034     return fn;
23035 }
23036
23037 function caller(obj) {
23038     var methodName = this.pop();
23039     var fn = ensureMethod(obj, methodName);
23040     return fn.apply(obj, this);
23041 }
23042 Promise.prototype.call = function (methodName) {
23043     var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
23044     if (true) {
23045         if (canEvaluate) {
23046             var maybeCaller = getMethodCaller(methodName);
23047             if (maybeCaller !== null) {
23048                 return this._then(
23049                     maybeCaller, undefined, undefined, args, undefined);
23050             }
23051         }
23052     }
23053     args.push(methodName);
23054     return this._then(caller, undefined, undefined, args, undefined);
23055 };
23056
23057 function namedGetter(obj) {
23058     return obj[this];
23059 }
23060 function indexedGetter(obj) {
23061     var index = +this;
23062     if (index < 0) index = Math.max(0, index + obj.length);
23063     return obj[index];
23064 }
23065 Promise.prototype.get = function (propertyName) {
23066     var isIndex = (typeof propertyName === "number");
23067     var getter;
23068     if (!isIndex) {
23069         if (canEvaluate) {
23070             var maybeGetter = getGetter(propertyName);
23071             getter = maybeGetter !== null ? maybeGetter : namedGetter;
23072         } else {
23073             getter = namedGetter;
23074         }
23075     } else {
23076         getter = indexedGetter;
23077     }
23078     return this._then(getter, undefined, undefined, propertyName, undefined);
23079 };
23080 };
23081
23082
23083 /***/ }),
23084 /* 151 */
23085 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23086
23087 "use strict";
23088
23089 module.exports = function (Promise, apiRejection, tryConvertToPromise,
23090     createContext, INTERNAL, debug) {
23091     var util = __webpack_require__(130);
23092     var TypeError = __webpack_require__(135).TypeError;
23093     var inherits = __webpack_require__(130).inherits;
23094     var errorObj = util.errorObj;
23095     var tryCatch = util.tryCatch;
23096     var NULL = {};
23097
23098     function thrower(e) {
23099         setTimeout(function(){throw e;}, 0);
23100     }
23101
23102     function castPreservingDisposable(thenable) {
23103         var maybePromise = tryConvertToPromise(thenable);
23104         if (maybePromise !== thenable &&
23105             typeof thenable._isDisposable === "function" &&
23106             typeof thenable._getDisposer === "function" &&
23107             thenable._isDisposable()) {
23108             maybePromise._setDisposable(thenable._getDisposer());
23109         }
23110         return maybePromise;
23111     }
23112     function dispose(resources, inspection) {
23113         var i = 0;
23114         var len = resources.length;
23115         var ret = new Promise(INTERNAL);
23116         function iterator() {
23117             if (i >= len) return ret._fulfill();
23118             var maybePromise = castPreservingDisposable(resources[i++]);
23119             if (maybePromise instanceof Promise &&
23120                 maybePromise._isDisposable()) {
23121                 try {
23122                     maybePromise = tryConvertToPromise(
23123                         maybePromise._getDisposer().tryDispose(inspection),
23124                         resources.promise);
23125                 } catch (e) {
23126                     return thrower(e);
23127                 }
23128                 if (maybePromise instanceof Promise) {
23129                     return maybePromise._then(iterator, thrower,
23130                                               null, null, null);
23131                 }
23132             }
23133             iterator();
23134         }
23135         iterator();
23136         return ret;
23137     }
23138
23139     function Disposer(data, promise, context) {
23140         this._data = data;
23141         this._promise = promise;
23142         this._context = context;
23143     }
23144
23145     Disposer.prototype.data = function () {
23146         return this._data;
23147     };
23148
23149     Disposer.prototype.promise = function () {
23150         return this._promise;
23151     };
23152
23153     Disposer.prototype.resource = function () {
23154         if (this.promise().isFulfilled()) {
23155             return this.promise().value();
23156         }
23157         return NULL;
23158     };
23159
23160     Disposer.prototype.tryDispose = function(inspection) {
23161         var resource = this.resource();
23162         var context = this._context;
23163         if (context !== undefined) context._pushContext();
23164         var ret = resource !== NULL
23165             ? this.doDispose(resource, inspection) : null;
23166         if (context !== undefined) context._popContext();
23167         this._promise._unsetDisposable();
23168         this._data = null;
23169         return ret;
23170     };
23171
23172     Disposer.isDisposer = function (d) {
23173         return (d != null &&
23174                 typeof d.resource === "function" &&
23175                 typeof d.tryDispose === "function");
23176     };
23177
23178     function FunctionDisposer(fn, promise, context) {
23179         this.constructor$(fn, promise, context);
23180     }
23181     inherits(FunctionDisposer, Disposer);
23182
23183     FunctionDisposer.prototype.doDispose = function (resource, inspection) {
23184         var fn = this.data();
23185         return fn.call(resource, resource, inspection);
23186     };
23187
23188     function maybeUnwrapDisposer(value) {
23189         if (Disposer.isDisposer(value)) {
23190             this.resources[this.index]._setDisposable(value);
23191             return value.promise();
23192         }
23193         return value;
23194     }
23195
23196     function ResourceList(length) {
23197         this.length = length;
23198         this.promise = null;
23199         this[length-1] = null;
23200     }
23201
23202     ResourceList.prototype._resultCancelled = function() {
23203         var len = this.length;
23204         for (var i = 0; i < len; ++i) {
23205             var item = this[i];
23206             if (item instanceof Promise) {
23207                 item.cancel();
23208             }
23209         }
23210     };
23211
23212     Promise.using = function () {
23213         var len = arguments.length;
23214         if (len < 2) return apiRejection(
23215                         "you must pass at least 2 arguments to Promise.using");
23216         var fn = arguments[len - 1];
23217         if (typeof fn !== "function") {
23218             return apiRejection("expecting a function but got " + util.classString(fn));
23219         }
23220         var input;
23221         var spreadArgs = true;
23222         if (len === 2 && Array.isArray(arguments[0])) {
23223             input = arguments[0];
23224             len = input.length;
23225             spreadArgs = false;
23226         } else {
23227             input = arguments;
23228             len--;
23229         }
23230         var resources = new ResourceList(len);
23231         for (var i = 0; i < len; ++i) {
23232             var resource = input[i];
23233             if (Disposer.isDisposer(resource)) {
23234                 var disposer = resource;
23235                 resource = resource.promise();
23236                 resource._setDisposable(disposer);
23237             } else {
23238                 var maybePromise = tryConvertToPromise(resource);
23239                 if (maybePromise instanceof Promise) {
23240                     resource =
23241                         maybePromise._then(maybeUnwrapDisposer, null, null, {
23242                             resources: resources,
23243                             index: i
23244                     }, undefined);
23245                 }
23246             }
23247             resources[i] = resource;
23248         }
23249
23250         var reflectedResources = new Array(resources.length);
23251         for (var i = 0; i < reflectedResources.length; ++i) {
23252             reflectedResources[i] = Promise.resolve(resources[i]).reflect();
23253         }
23254
23255         var resultPromise = Promise.all(reflectedResources)
23256             .then(function(inspections) {
23257                 for (var i = 0; i < inspections.length; ++i) {
23258                     var inspection = inspections[i];
23259                     if (inspection.isRejected()) {
23260                         errorObj.e = inspection.error();
23261                         return errorObj;
23262                     } else if (!inspection.isFulfilled()) {
23263                         resultPromise.cancel();
23264                         return;
23265                     }
23266                     inspections[i] = inspection.value();
23267                 }
23268                 promise._pushContext();
23269
23270                 fn = tryCatch(fn);
23271                 var ret = spreadArgs
23272                     ? fn.apply(undefined, inspections) : fn(inspections);
23273                 var promiseCreated = promise._popContext();
23274                 debug.checkForgottenReturns(
23275                     ret, promiseCreated, "Promise.using", promise);
23276                 return ret;
23277             });
23278
23279         var promise = resultPromise.lastly(function() {
23280             var inspection = new Promise.PromiseInspection(resultPromise);
23281             return dispose(resources, inspection);
23282         });
23283         resources.promise = promise;
23284         promise._setOnCancel(resources);
23285         return promise;
23286     };
23287
23288     Promise.prototype._setDisposable = function (disposer) {
23289         this._bitField = this._bitField | 131072;
23290         this._disposer = disposer;
23291     };
23292
23293     Promise.prototype._isDisposable = function () {
23294         return (this._bitField & 131072) > 0;
23295     };
23296
23297     Promise.prototype._getDisposer = function () {
23298         return this._disposer;
23299     };
23300
23301     Promise.prototype._unsetDisposable = function () {
23302         this._bitField = this._bitField & (~131072);
23303         this._disposer = undefined;
23304     };
23305
23306     Promise.prototype.disposer = function (fn) {
23307         if (typeof fn === "function") {
23308             return new FunctionDisposer(fn, this, createContext());
23309         }
23310         throw new TypeError();
23311     };
23312
23313 };
23314
23315
23316 /***/ }),
23317 /* 152 */
23318 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23319
23320 "use strict";
23321
23322 module.exports = function(Promise, INTERNAL, debug) {
23323 var util = __webpack_require__(130);
23324 var TimeoutError = Promise.TimeoutError;
23325
23326 function HandleWrapper(handle)  {
23327     this.handle = handle;
23328 }
23329
23330 HandleWrapper.prototype._resultCancelled = function() {
23331     clearTimeout(this.handle);
23332 };
23333
23334 var afterValue = function(value) { return delay(+this).thenReturn(value); };
23335 var delay = Promise.delay = function (ms, value) {
23336     var ret;
23337     var handle;
23338     if (value !== undefined) {
23339         ret = Promise.resolve(value)
23340                 ._then(afterValue, null, null, ms, undefined);
23341         if (debug.cancellation() && value instanceof Promise) {
23342             ret._setOnCancel(value);
23343         }
23344     } else {
23345         ret = new Promise(INTERNAL);
23346         handle = setTimeout(function() { ret._fulfill(); }, +ms);
23347         if (debug.cancellation()) {
23348             ret._setOnCancel(new HandleWrapper(handle));
23349         }
23350         ret._captureStackTrace();
23351     }
23352     ret._setAsyncGuaranteed();
23353     return ret;
23354 };
23355
23356 Promise.prototype.delay = function (ms) {
23357     return delay(ms, this);
23358 };
23359
23360 var afterTimeout = function (promise, message, parent) {
23361     var err;
23362     if (typeof message !== "string") {
23363         if (message instanceof Error) {
23364             err = message;
23365         } else {
23366             err = new TimeoutError("operation timed out");
23367         }
23368     } else {
23369         err = new TimeoutError(message);
23370     }
23371     util.markAsOriginatingFromRejection(err);
23372     promise._attachExtraTrace(err);
23373     promise._reject(err);
23374
23375     if (parent != null) {
23376         parent.cancel();
23377     }
23378 };
23379
23380 function successClear(value) {
23381     clearTimeout(this.handle);
23382     return value;
23383 }
23384
23385 function failureClear(reason) {
23386     clearTimeout(this.handle);
23387     throw reason;
23388 }
23389
23390 Promise.prototype.timeout = function (ms, message) {
23391     ms = +ms;
23392     var ret, parent;
23393
23394     var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
23395         if (ret.isPending()) {
23396             afterTimeout(ret, message, parent);
23397         }
23398     }, ms));
23399
23400     if (debug.cancellation()) {
23401         parent = this.then();
23402         ret = parent._then(successClear, failureClear,
23403                             undefined, handleWrapper, undefined);
23404         ret._setOnCancel(handleWrapper);
23405     } else {
23406         ret = this._then(successClear, failureClear,
23407                             undefined, handleWrapper, undefined);
23408     }
23409
23410     return ret;
23411 };
23412
23413 };
23414
23415
23416 /***/ }),
23417 /* 153 */
23418 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23419
23420 "use strict";
23421
23422 module.exports = function(Promise,
23423                           apiRejection,
23424                           INTERNAL,
23425                           tryConvertToPromise,
23426                           Proxyable,
23427                           debug) {
23428 var errors = __webpack_require__(135);
23429 var TypeError = errors.TypeError;
23430 var util = __webpack_require__(130);
23431 var errorObj = util.errorObj;
23432 var tryCatch = util.tryCatch;
23433 var yieldHandlers = [];
23434
23435 function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
23436     for (var i = 0; i < yieldHandlers.length; ++i) {
23437         traceParent._pushContext();
23438         var result = tryCatch(yieldHandlers[i])(value);
23439         traceParent._popContext();
23440         if (result === errorObj) {
23441             traceParent._pushContext();
23442             var ret = Promise.reject(errorObj.e);
23443             traceParent._popContext();
23444             return ret;
23445         }
23446         var maybePromise = tryConvertToPromise(result, traceParent);
23447         if (maybePromise instanceof Promise) return maybePromise;
23448     }
23449     return null;
23450 }
23451
23452 function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
23453     if (debug.cancellation()) {
23454         var internal = new Promise(INTERNAL);
23455         var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
23456         this._promise = internal.lastly(function() {
23457             return _finallyPromise;
23458         });
23459         internal._captureStackTrace();
23460         internal._setOnCancel(this);
23461     } else {
23462         var promise = this._promise = new Promise(INTERNAL);
23463         promise._captureStackTrace();
23464     }
23465     this._stack = stack;
23466     this._generatorFunction = generatorFunction;
23467     this._receiver = receiver;
23468     this._generator = undefined;
23469     this._yieldHandlers = typeof yieldHandler === "function"
23470         ? [yieldHandler].concat(yieldHandlers)
23471         : yieldHandlers;
23472     this._yieldedPromise = null;
23473     this._cancellationPhase = false;
23474 }
23475 util.inherits(PromiseSpawn, Proxyable);
23476
23477 PromiseSpawn.prototype._isResolved = function() {
23478     return this._promise === null;
23479 };
23480
23481 PromiseSpawn.prototype._cleanup = function() {
23482     this._promise = this._generator = null;
23483     if (debug.cancellation() && this._finallyPromise !== null) {
23484         this._finallyPromise._fulfill();
23485         this._finallyPromise = null;
23486     }
23487 };
23488
23489 PromiseSpawn.prototype._promiseCancelled = function() {
23490     if (this._isResolved()) return;
23491     var implementsReturn = typeof this._generator["return"] !== "undefined";
23492
23493     var result;
23494     if (!implementsReturn) {
23495         var reason = new Promise.CancellationError(
23496             "generator .return() sentinel");
23497         Promise.coroutine.returnSentinel = reason;
23498         this._promise._attachExtraTrace(reason);
23499         this._promise._pushContext();
23500         result = tryCatch(this._generator["throw"]).call(this._generator,
23501                                                          reason);
23502         this._promise._popContext();
23503     } else {
23504         this._promise._pushContext();
23505         result = tryCatch(this._generator["return"]).call(this._generator,
23506                                                           undefined);
23507         this._promise._popContext();
23508     }
23509     this._cancellationPhase = true;
23510     this._yieldedPromise = null;
23511     this._continue(result);
23512 };
23513
23514 PromiseSpawn.prototype._promiseFulfilled = function(value) {
23515     this._yieldedPromise = null;
23516     this._promise._pushContext();
23517     var result = tryCatch(this._generator.next).call(this._generator, value);
23518     this._promise._popContext();
23519     this._continue(result);
23520 };
23521
23522 PromiseSpawn.prototype._promiseRejected = function(reason) {
23523     this._yieldedPromise = null;
23524     this._promise._attachExtraTrace(reason);
23525     this._promise._pushContext();
23526     var result = tryCatch(this._generator["throw"])
23527         .call(this._generator, reason);
23528     this._promise._popContext();
23529     this._continue(result);
23530 };
23531
23532 PromiseSpawn.prototype._resultCancelled = function() {
23533     if (this._yieldedPromise instanceof Promise) {
23534         var promise = this._yieldedPromise;
23535         this._yieldedPromise = null;
23536         promise.cancel();
23537     }
23538 };
23539
23540 PromiseSpawn.prototype.promise = function () {
23541     return this._promise;
23542 };
23543
23544 PromiseSpawn.prototype._run = function () {
23545     this._generator = this._generatorFunction.call(this._receiver);
23546     this._receiver =
23547         this._generatorFunction = undefined;
23548     this._promiseFulfilled(undefined);
23549 };
23550
23551 PromiseSpawn.prototype._continue = function (result) {
23552     var promise = this._promise;
23553     if (result === errorObj) {
23554         this._cleanup();
23555         if (this._cancellationPhase) {
23556             return promise.cancel();
23557         } else {
23558             return promise._rejectCallback(result.e, false);
23559         }
23560     }
23561
23562     var value = result.value;
23563     if (result.done === true) {
23564         this._cleanup();
23565         if (this._cancellationPhase) {
23566             return promise.cancel();
23567         } else {
23568             return promise._resolveCallback(value);
23569         }
23570     } else {
23571         var maybePromise = tryConvertToPromise(value, this._promise);
23572         if (!(maybePromise instanceof Promise)) {
23573             maybePromise =
23574                 promiseFromYieldHandler(maybePromise,
23575                                         this._yieldHandlers,
23576                                         this._promise);
23577             if (maybePromise === null) {
23578                 this._promiseRejected(
23579                     new TypeError(
23580                         "A value %s was yielded that could not be treated as a promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", value) +
23581                         "From coroutine:\u000a" +
23582                         this._stack.split("\n").slice(1, -7).join("\n")
23583                     )
23584                 );
23585                 return;
23586             }
23587         }
23588         maybePromise = maybePromise._target();
23589         var bitField = maybePromise._bitField;
23590         ;
23591         if (((bitField & 50397184) === 0)) {
23592             this._yieldedPromise = maybePromise;
23593             maybePromise._proxy(this, null);
23594         } else if (((bitField & 33554432) !== 0)) {
23595             Promise._async.invoke(
23596                 this._promiseFulfilled, this, maybePromise._value()
23597             );
23598         } else if (((bitField & 16777216) !== 0)) {
23599             Promise._async.invoke(
23600                 this._promiseRejected, this, maybePromise._reason()
23601             );
23602         } else {
23603             this._promiseCancelled();
23604         }
23605     }
23606 };
23607
23608 Promise.coroutine = function (generatorFunction, options) {
23609     if (typeof generatorFunction !== "function") {
23610         throw new TypeError("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
23611     }
23612     var yieldHandler = Object(options).yieldHandler;
23613     var PromiseSpawn$ = PromiseSpawn;
23614     var stack = new Error().stack;
23615     return function () {
23616         var generator = generatorFunction.apply(this, arguments);
23617         var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
23618                                       stack);
23619         var ret = spawn.promise();
23620         spawn._generator = generator;
23621         spawn._promiseFulfilled(undefined);
23622         return ret;
23623     };
23624 };
23625
23626 Promise.coroutine.addYieldHandler = function(fn) {
23627     if (typeof fn !== "function") {
23628         throw new TypeError("expecting a function but got " + util.classString(fn));
23629     }
23630     yieldHandlers.push(fn);
23631 };
23632
23633 Promise.spawn = function (generatorFunction) {
23634     debug.deprecated("Promise.spawn()", "Promise.coroutine()");
23635     if (typeof generatorFunction !== "function") {
23636         return apiRejection("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
23637     }
23638     var spawn = new PromiseSpawn(generatorFunction, this);
23639     var ret = spawn.promise();
23640     spawn._run(Promise.spawn);
23641     return ret;
23642 };
23643 };
23644
23645
23646 /***/ }),
23647 /* 154 */
23648 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23649
23650 "use strict";
23651
23652 module.exports = function(Promise) {
23653 var util = __webpack_require__(130);
23654 var async = Promise._async;
23655 var tryCatch = util.tryCatch;
23656 var errorObj = util.errorObj;
23657
23658 function spreadAdapter(val, nodeback) {
23659     var promise = this;
23660     if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
23661     var ret =
23662         tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
23663     if (ret === errorObj) {
23664         async.throwLater(ret.e);
23665     }
23666 }
23667
23668 function successAdapter(val, nodeback) {
23669     var promise = this;
23670     var receiver = promise._boundValue();
23671     var ret = val === undefined
23672         ? tryCatch(nodeback).call(receiver, null)
23673         : tryCatch(nodeback).call(receiver, null, val);
23674     if (ret === errorObj) {
23675         async.throwLater(ret.e);
23676     }
23677 }
23678 function errorAdapter(reason, nodeback) {
23679     var promise = this;
23680     if (!reason) {
23681         var newReason = new Error(reason + "");
23682         newReason.cause = reason;
23683         reason = newReason;
23684     }
23685     var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
23686     if (ret === errorObj) {
23687         async.throwLater(ret.e);
23688     }
23689 }
23690
23691 Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
23692                                                                      options) {
23693     if (typeof nodeback == "function") {
23694         var adapter = successAdapter;
23695         if (options !== undefined && Object(options).spread) {
23696             adapter = spreadAdapter;
23697         }
23698         this._then(
23699             adapter,
23700             errorAdapter,
23701             undefined,
23702             this,
23703             nodeback
23704         );
23705     }
23706     return this;
23707 };
23708 };
23709
23710
23711 /***/ }),
23712 /* 155 */
23713 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23714
23715 "use strict";
23716
23717 module.exports = function(Promise, INTERNAL) {
23718 var THIS = {};
23719 var util = __webpack_require__(130);
23720 var nodebackForPromise = __webpack_require__(142);
23721 var withAppended = util.withAppended;
23722 var maybeWrapAsError = util.maybeWrapAsError;
23723 var canEvaluate = util.canEvaluate;
23724 var TypeError = __webpack_require__(135).TypeError;
23725 var defaultSuffix = "Async";
23726 var defaultPromisified = {__isPromisified__: true};
23727 var noCopyProps = [
23728     "arity",    "length",
23729     "name",
23730     "arguments",
23731     "caller",
23732     "callee",
23733     "prototype",
23734     "__isPromisified__"
23735 ];
23736 var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
23737
23738 var defaultFilter = function(name) {
23739     return util.isIdentifier(name) &&
23740         name.charAt(0) !== "_" &&
23741         name !== "constructor";
23742 };
23743
23744 function propsFilter(key) {
23745     return !noCopyPropsPattern.test(key);
23746 }
23747
23748 function isPromisified(fn) {
23749     try {
23750         return fn.__isPromisified__ === true;
23751     }
23752     catch (e) {
23753         return false;
23754     }
23755 }
23756
23757 function hasPromisified(obj, key, suffix) {
23758     var val = util.getDataPropertyOrDefault(obj, key + suffix,
23759                                             defaultPromisified);
23760     return val ? isPromisified(val) : false;
23761 }
23762 function checkValid(ret, suffix, suffixRegexp) {
23763     for (var i = 0; i < ret.length; i += 2) {
23764         var key = ret[i];
23765         if (suffixRegexp.test(key)) {
23766             var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
23767             for (var j = 0; j < ret.length; j += 2) {
23768                 if (ret[j] === keyWithoutAsyncSuffix) {
23769                     throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a    See http://goo.gl/MqrFmX\u000a"
23770                         .replace("%s", suffix));
23771                 }
23772             }
23773         }
23774     }
23775 }
23776
23777 function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
23778     var keys = util.inheritedDataKeys(obj);
23779     var ret = [];
23780     for (var i = 0; i < keys.length; ++i) {
23781         var key = keys[i];
23782         var value = obj[key];
23783         var passesDefaultFilter = filter === defaultFilter
23784             ? true : defaultFilter(key, value, obj);
23785         if (typeof value === "function" &&
23786             !isPromisified(value) &&
23787             !hasPromisified(obj, key, suffix) &&
23788             filter(key, value, obj, passesDefaultFilter)) {
23789             ret.push(key, value);
23790         }
23791     }
23792     checkValid(ret, suffix, suffixRegexp);
23793     return ret;
23794 }
23795
23796 var escapeIdentRegex = function(str) {
23797     return str.replace(/([$])/, "\\$");
23798 };
23799
23800 var makeNodePromisifiedEval;
23801 if (true) {
23802 var switchCaseArgumentOrder = function(likelyArgumentCount) {
23803     var ret = [likelyArgumentCount];
23804     var min = Math.max(0, likelyArgumentCount - 1 - 3);
23805     for(var i = likelyArgumentCount - 1; i >= min; --i) {
23806         ret.push(i);
23807     }
23808     for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
23809         ret.push(i);
23810     }
23811     return ret;
23812 };
23813
23814 var argumentSequence = function(argumentCount) {
23815     return util.filledRange(argumentCount, "_arg", "");
23816 };
23817
23818 var parameterDeclaration = function(parameterCount) {
23819     return util.filledRange(
23820         Math.max(parameterCount, 3), "_arg", "");
23821 };
23822
23823 var parameterCount = function(fn) {
23824     if (typeof fn.length === "number") {
23825         return Math.max(Math.min(fn.length, 1023 + 1), 0);
23826     }
23827     return 0;
23828 };
23829
23830 makeNodePromisifiedEval =
23831 function(callback, receiver, originalName, fn, _, multiArgs) {
23832     var newParameterCount = Math.max(0, parameterCount(fn) - 1);
23833     var argumentOrder = switchCaseArgumentOrder(newParameterCount);
23834     var shouldProxyThis = typeof callback === "string" || receiver === THIS;
23835
23836     function generateCallForArgumentCount(count) {
23837         var args = argumentSequence(count).join(", ");
23838         var comma = count > 0 ? ", " : "";
23839         var ret;
23840         if (shouldProxyThis) {
23841             ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
23842         } else {
23843             ret = receiver === undefined
23844                 ? "ret = callback({{args}}, nodeback); break;\n"
23845                 : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
23846         }
23847         return ret.replace("{{args}}", args).replace(", ", comma);
23848     }
23849
23850     function generateArgumentSwitchCase() {
23851         var ret = "";
23852         for (var i = 0; i < argumentOrder.length; ++i) {
23853             ret += "case " + argumentOrder[i] +":" +
23854                 generateCallForArgumentCount(argumentOrder[i]);
23855         }
23856
23857         ret += "                                                             \n\
23858         default:                                                             \n\
23859             var args = new Array(len + 1);                                   \n\
23860             var i = 0;                                                       \n\
23861             for (var i = 0; i < len; ++i) {                                  \n\
23862                args[i] = arguments[i];                                       \n\
23863             }                                                                \n\
23864             args[i] = nodeback;                                              \n\
23865             [CodeForCall]                                                    \n\
23866             break;                                                           \n\
23867         ".replace("[CodeForCall]", (shouldProxyThis
23868                                 ? "ret = callback.apply(this, args);\n"
23869                                 : "ret = callback.apply(receiver, args);\n"));
23870         return ret;
23871     }
23872
23873     var getFunctionCode = typeof callback === "string"
23874                                 ? ("this != null ? this['"+callback+"'] : fn")
23875                                 : "fn";
23876     var body = "'use strict';                                                \n\
23877         var ret = function (Parameters) {                                    \n\
23878             'use strict';                                                    \n\
23879             var len = arguments.length;                                      \n\
23880             var promise = new Promise(INTERNAL);                             \n\
23881             promise._captureStackTrace();                                    \n\
23882             var nodeback = nodebackForPromise(promise, " + multiArgs + ");   \n\
23883             var ret;                                                         \n\
23884             var callback = tryCatch([GetFunctionCode]);                      \n\
23885             switch(len) {                                                    \n\
23886                 [CodeForSwitchCase]                                          \n\
23887             }                                                                \n\
23888             if (ret === errorObj) {                                          \n\
23889                 promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
23890             }                                                                \n\
23891             if (!promise._isFateSealed()) promise._setAsyncGuaranteed();     \n\
23892             return promise;                                                  \n\
23893         };                                                                   \n\
23894         notEnumerableProp(ret, '__isPromisified__', true);                   \n\
23895         return ret;                                                          \n\
23896     ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
23897         .replace("[GetFunctionCode]", getFunctionCode);
23898     body = body.replace("Parameters", parameterDeclaration(newParameterCount));
23899     return new Function("Promise",
23900                         "fn",
23901                         "receiver",
23902                         "withAppended",
23903                         "maybeWrapAsError",
23904                         "nodebackForPromise",
23905                         "tryCatch",
23906                         "errorObj",
23907                         "notEnumerableProp",
23908                         "INTERNAL",
23909                         body)(
23910                     Promise,
23911                     fn,
23912                     receiver,
23913                     withAppended,
23914                     maybeWrapAsError,
23915                     nodebackForPromise,
23916                     util.tryCatch,
23917                     util.errorObj,
23918                     util.notEnumerableProp,
23919                     INTERNAL);
23920 };
23921 }
23922
23923 function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
23924     var defaultThis = (function() {return this;})();
23925     var method = callback;
23926     if (typeof method === "string") {
23927         callback = fn;
23928     }
23929     function promisified() {
23930         var _receiver = receiver;
23931         if (receiver === THIS) _receiver = this;
23932         var promise = new Promise(INTERNAL);
23933         promise._captureStackTrace();
23934         var cb = typeof method === "string" && this !== defaultThis
23935             ? this[method] : callback;
23936         var fn = nodebackForPromise(promise, multiArgs);
23937         try {
23938             cb.apply(_receiver, withAppended(arguments, fn));
23939         } catch(e) {
23940             promise._rejectCallback(maybeWrapAsError(e), true, true);
23941         }
23942         if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
23943         return promise;
23944     }
23945     util.notEnumerableProp(promisified, "__isPromisified__", true);
23946     return promisified;
23947 }
23948
23949 var makeNodePromisified = canEvaluate
23950     ? makeNodePromisifiedEval
23951     : makeNodePromisifiedClosure;
23952
23953 function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
23954     var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
23955     var methods =
23956         promisifiableMethods(obj, suffix, suffixRegexp, filter);
23957
23958     for (var i = 0, len = methods.length; i < len; i+= 2) {
23959         var key = methods[i];
23960         var fn = methods[i+1];
23961         var promisifiedKey = key + suffix;
23962         if (promisifier === makeNodePromisified) {
23963             obj[promisifiedKey] =
23964                 makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
23965         } else {
23966             var promisified = promisifier(fn, function() {
23967                 return makeNodePromisified(key, THIS, key,
23968                                            fn, suffix, multiArgs);
23969             });
23970             util.notEnumerableProp(promisified, "__isPromisified__", true);
23971             obj[promisifiedKey] = promisified;
23972         }
23973     }
23974     util.toFastProperties(obj);
23975     return obj;
23976 }
23977
23978 function promisify(callback, receiver, multiArgs) {
23979     return makeNodePromisified(callback, receiver, undefined,
23980                                 callback, null, multiArgs);
23981 }
23982
23983 Promise.promisify = function (fn, options) {
23984     if (typeof fn !== "function") {
23985         throw new TypeError("expecting a function but got " + util.classString(fn));
23986     }
23987     if (isPromisified(fn)) {
23988         return fn;
23989     }
23990     options = Object(options);
23991     var receiver = options.context === undefined ? THIS : options.context;
23992     var multiArgs = !!options.multiArgs;
23993     var ret = promisify(fn, receiver, multiArgs);
23994     util.copyDescriptors(fn, ret, propsFilter);
23995     return ret;
23996 };
23997
23998 Promise.promisifyAll = function (target, options) {
23999     if (typeof target !== "function" && typeof target !== "object") {
24000         throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24001     }
24002     options = Object(options);
24003     var multiArgs = !!options.multiArgs;
24004     var suffix = options.suffix;
24005     if (typeof suffix !== "string") suffix = defaultSuffix;
24006     var filter = options.filter;
24007     if (typeof filter !== "function") filter = defaultFilter;
24008     var promisifier = options.promisifier;
24009     if (typeof promisifier !== "function") promisifier = makeNodePromisified;
24010
24011     if (!util.isIdentifier(suffix)) {
24012         throw new RangeError("suffix must be a valid identifier\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24013     }
24014
24015     var keys = util.inheritedDataKeys(target);
24016     for (var i = 0; i < keys.length; ++i) {
24017         var value = target[keys[i]];
24018         if (keys[i] !== "constructor" &&
24019             util.isClass(value)) {
24020             promisifyAll(value.prototype, suffix, filter, promisifier,
24021                 multiArgs);
24022             promisifyAll(value, suffix, filter, promisifier, multiArgs);
24023         }
24024     }
24025
24026     return promisifyAll(target, suffix, filter, promisifier, multiArgs);
24027 };
24028 };
24029
24030
24031
24032 /***/ }),
24033 /* 156 */
24034 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24035
24036 "use strict";
24037
24038 module.exports = function(
24039     Promise, PromiseArray, tryConvertToPromise, apiRejection) {
24040 var util = __webpack_require__(130);
24041 var isObject = util.isObject;
24042 var es5 = __webpack_require__(131);
24043 var Es6Map;
24044 if (typeof Map === "function") Es6Map = Map;
24045
24046 var mapToEntries = (function() {
24047     var index = 0;
24048     var size = 0;
24049
24050     function extractEntry(value, key) {
24051         this[index] = value;
24052         this[index + size] = key;
24053         index++;
24054     }
24055
24056     return function mapToEntries(map) {
24057         size = map.size;
24058         index = 0;
24059         var ret = new Array(map.size * 2);
24060         map.forEach(extractEntry, ret);
24061         return ret;
24062     };
24063 })();
24064
24065 var entriesToMap = function(entries) {
24066     var ret = new Es6Map();
24067     var length = entries.length / 2 | 0;
24068     for (var i = 0; i < length; ++i) {
24069         var key = entries[length + i];
24070         var value = entries[i];
24071         ret.set(key, value);
24072     }
24073     return ret;
24074 };
24075
24076 function PropertiesPromiseArray(obj) {
24077     var isMap = false;
24078     var entries;
24079     if (Es6Map !== undefined && obj instanceof Es6Map) {
24080         entries = mapToEntries(obj);
24081         isMap = true;
24082     } else {
24083         var keys = es5.keys(obj);
24084         var len = keys.length;
24085         entries = new Array(len * 2);
24086         for (var i = 0; i < len; ++i) {
24087             var key = keys[i];
24088             entries[i] = obj[key];
24089             entries[i + len] = key;
24090         }
24091     }
24092     this.constructor$(entries);
24093     this._isMap = isMap;
24094     this._init$(undefined, -3);
24095 }
24096 util.inherits(PropertiesPromiseArray, PromiseArray);
24097
24098 PropertiesPromiseArray.prototype._init = function () {};
24099
24100 PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
24101     this._values[index] = value;
24102     var totalResolved = ++this._totalResolved;
24103     if (totalResolved >= this._length) {
24104         var val;
24105         if (this._isMap) {
24106             val = entriesToMap(this._values);
24107         } else {
24108             val = {};
24109             var keyOffset = this.length();
24110             for (var i = 0, len = this.length(); i < len; ++i) {
24111                 val[this._values[i + keyOffset]] = this._values[i];
24112             }
24113         }
24114         this._resolve(val);
24115         return true;
24116     }
24117     return false;
24118 };
24119
24120 PropertiesPromiseArray.prototype.shouldCopyValues = function () {
24121     return false;
24122 };
24123
24124 PropertiesPromiseArray.prototype.getActualLength = function (len) {
24125     return len >> 1;
24126 };
24127
24128 function props(promises) {
24129     var ret;
24130     var castValue = tryConvertToPromise(promises);
24131
24132     if (!isObject(castValue)) {
24133         return apiRejection("cannot await properties of a non-object\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24134     } else if (castValue instanceof Promise) {
24135         ret = castValue._then(
24136             Promise.props, undefined, undefined, undefined, undefined);
24137     } else {
24138         ret = new PropertiesPromiseArray(castValue).promise();
24139     }
24140
24141     if (castValue instanceof Promise) {
24142         ret._propagateFrom(castValue, 2);
24143     }
24144     return ret;
24145 }
24146
24147 Promise.prototype.props = function () {
24148     return props(this);
24149 };
24150
24151 Promise.props = function (promises) {
24152     return props(promises);
24153 };
24154 };
24155
24156
24157 /***/ }),
24158 /* 157 */
24159 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24160
24161 "use strict";
24162
24163 module.exports = function(
24164     Promise, INTERNAL, tryConvertToPromise, apiRejection) {
24165 var util = __webpack_require__(130);
24166
24167 var raceLater = function (promise) {
24168     return promise.then(function(array) {
24169         return race(array, promise);
24170     });
24171 };
24172
24173 function race(promises, parent) {
24174     var maybePromise = tryConvertToPromise(promises);
24175
24176     if (maybePromise instanceof Promise) {
24177         return raceLater(maybePromise);
24178     } else {
24179         promises = util.asArray(promises);
24180         if (promises === null)
24181             return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
24182     }
24183
24184     var ret = new Promise(INTERNAL);
24185     if (parent !== undefined) {
24186         ret._propagateFrom(parent, 3);
24187     }
24188     var fulfill = ret._fulfill;
24189     var reject = ret._reject;
24190     for (var i = 0, len = promises.length; i < len; ++i) {
24191         var val = promises[i];
24192
24193         if (val === undefined && !(i in promises)) {
24194             continue;
24195         }
24196
24197         Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
24198     }
24199     return ret;
24200 }
24201
24202 Promise.race = function (promises) {
24203     return race(promises, undefined);
24204 };
24205
24206 Promise.prototype.race = function () {
24207     return race(this, undefined);
24208 };
24209
24210 };
24211
24212
24213 /***/ }),
24214 /* 158 */
24215 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24216
24217 "use strict";
24218
24219 module.exports = function(Promise,
24220                           PromiseArray,
24221                           apiRejection,
24222                           tryConvertToPromise,
24223                           INTERNAL,
24224                           debug) {
24225 var getDomain = Promise._getDomain;
24226 var util = __webpack_require__(130);
24227 var tryCatch = util.tryCatch;
24228
24229 function ReductionPromiseArray(promises, fn, initialValue, _each) {
24230     this.constructor$(promises);
24231     var domain = getDomain();
24232     this._fn = domain === null ? fn : util.domainBind(domain, fn);
24233     if (initialValue !== undefined) {
24234         initialValue = Promise.resolve(initialValue);
24235         initialValue._attachCancellationCallback(this);
24236     }
24237     this._initialValue = initialValue;
24238     this._currentCancellable = null;
24239     if(_each === INTERNAL) {
24240         this._eachValues = Array(this._length);
24241     } else if (_each === 0) {
24242         this._eachValues = null;
24243     } else {
24244         this._eachValues = undefined;
24245     }
24246     this._promise._captureStackTrace();
24247     this._init$(undefined, -5);
24248 }
24249 util.inherits(ReductionPromiseArray, PromiseArray);
24250
24251 ReductionPromiseArray.prototype._gotAccum = function(accum) {
24252     if (this._eachValues !== undefined && 
24253         this._eachValues !== null && 
24254         accum !== INTERNAL) {
24255         this._eachValues.push(accum);
24256     }
24257 };
24258
24259 ReductionPromiseArray.prototype._eachComplete = function(value) {
24260     if (this._eachValues !== null) {
24261         this._eachValues.push(value);
24262     }
24263     return this._eachValues;
24264 };
24265
24266 ReductionPromiseArray.prototype._init = function() {};
24267
24268 ReductionPromiseArray.prototype._resolveEmptyArray = function() {
24269     this._resolve(this._eachValues !== undefined ? this._eachValues
24270                                                  : this._initialValue);
24271 };
24272
24273 ReductionPromiseArray.prototype.shouldCopyValues = function () {
24274     return false;
24275 };
24276
24277 ReductionPromiseArray.prototype._resolve = function(value) {
24278     this._promise._resolveCallback(value);
24279     this._values = null;
24280 };
24281
24282 ReductionPromiseArray.prototype._resultCancelled = function(sender) {
24283     if (sender === this._initialValue) return this._cancel();
24284     if (this._isResolved()) return;
24285     this._resultCancelled$();
24286     if (this._currentCancellable instanceof Promise) {
24287         this._currentCancellable.cancel();
24288     }
24289     if (this._initialValue instanceof Promise) {
24290         this._initialValue.cancel();
24291     }
24292 };
24293
24294 ReductionPromiseArray.prototype._iterate = function (values) {
24295     this._values = values;
24296     var value;
24297     var i;
24298     var length = values.length;
24299     if (this._initialValue !== undefined) {
24300         value = this._initialValue;
24301         i = 0;
24302     } else {
24303         value = Promise.resolve(values[0]);
24304         i = 1;
24305     }
24306
24307     this._currentCancellable = value;
24308
24309     if (!value.isRejected()) {
24310         for (; i < length; ++i) {
24311             var ctx = {
24312                 accum: null,
24313                 value: values[i],
24314                 index: i,
24315                 length: length,
24316                 array: this
24317             };
24318             value = value._then(gotAccum, undefined, undefined, ctx, undefined);
24319         }
24320     }
24321
24322     if (this._eachValues !== undefined) {
24323         value = value
24324             ._then(this._eachComplete, undefined, undefined, this, undefined);
24325     }
24326     value._then(completed, completed, undefined, value, this);
24327 };
24328
24329 Promise.prototype.reduce = function (fn, initialValue) {
24330     return reduce(this, fn, initialValue, null);
24331 };
24332
24333 Promise.reduce = function (promises, fn, initialValue, _each) {
24334     return reduce(promises, fn, initialValue, _each);
24335 };
24336
24337 function completed(valueOrReason, array) {
24338     if (this.isFulfilled()) {
24339         array._resolve(valueOrReason);
24340     } else {
24341         array._reject(valueOrReason);
24342     }
24343 }
24344
24345 function reduce(promises, fn, initialValue, _each) {
24346     if (typeof fn !== "function") {
24347         return apiRejection("expecting a function but got " + util.classString(fn));
24348     }
24349     var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
24350     return array.promise();
24351 }
24352
24353 function gotAccum(accum) {
24354     this.accum = accum;
24355     this.array._gotAccum(accum);
24356     var value = tryConvertToPromise(this.value, this.array._promise);
24357     if (value instanceof Promise) {
24358         this.array._currentCancellable = value;
24359         return value._then(gotValue, undefined, undefined, this, undefined);
24360     } else {
24361         return gotValue.call(this, value);
24362     }
24363 }
24364
24365 function gotValue(value) {
24366     var array = this.array;
24367     var promise = array._promise;
24368     var fn = tryCatch(array._fn);
24369     promise._pushContext();
24370     var ret;
24371     if (array._eachValues !== undefined) {
24372         ret = fn.call(promise._boundValue(), value, this.index, this.length);
24373     } else {
24374         ret = fn.call(promise._boundValue(),
24375                               this.accum, value, this.index, this.length);
24376     }
24377     if (ret instanceof Promise) {
24378         array._currentCancellable = ret;
24379     }
24380     var promiseCreated = promise._popContext();
24381     debug.checkForgottenReturns(
24382         ret,
24383         promiseCreated,
24384         array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
24385         promise
24386     );
24387     return ret;
24388 }
24389 };
24390
24391
24392 /***/ }),
24393 /* 159 */
24394 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24395
24396 "use strict";
24397
24398 module.exports =
24399     function(Promise, PromiseArray, debug) {
24400 var PromiseInspection = Promise.PromiseInspection;
24401 var util = __webpack_require__(130);
24402
24403 function SettledPromiseArray(values) {
24404     this.constructor$(values);
24405 }
24406 util.inherits(SettledPromiseArray, PromiseArray);
24407
24408 SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
24409     this._values[index] = inspection;
24410     var totalResolved = ++this._totalResolved;
24411     if (totalResolved >= this._length) {
24412         this._resolve(this._values);
24413         return true;
24414     }
24415     return false;
24416 };
24417
24418 SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
24419     var ret = new PromiseInspection();
24420     ret._bitField = 33554432;
24421     ret._settledValueField = value;
24422     return this._promiseResolved(index, ret);
24423 };
24424 SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
24425     var ret = new PromiseInspection();
24426     ret._bitField = 16777216;
24427     ret._settledValueField = reason;
24428     return this._promiseResolved(index, ret);
24429 };
24430
24431 Promise.settle = function (promises) {
24432     debug.deprecated(".settle()", ".reflect()");
24433     return new SettledPromiseArray(promises).promise();
24434 };
24435
24436 Promise.prototype.settle = function () {
24437     return Promise.settle(this);
24438 };
24439 };
24440
24441
24442 /***/ }),
24443 /* 160 */
24444 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24445
24446 "use strict";
24447
24448 module.exports =
24449 function(Promise, PromiseArray, apiRejection) {
24450 var util = __webpack_require__(130);
24451 var RangeError = __webpack_require__(135).RangeError;
24452 var AggregateError = __webpack_require__(135).AggregateError;
24453 var isArray = util.isArray;
24454 var CANCELLATION = {};
24455
24456
24457 function SomePromiseArray(values) {
24458     this.constructor$(values);
24459     this._howMany = 0;
24460     this._unwrap = false;
24461     this._initialized = false;
24462 }
24463 util.inherits(SomePromiseArray, PromiseArray);
24464
24465 SomePromiseArray.prototype._init = function () {
24466     if (!this._initialized) {
24467         return;
24468     }
24469     if (this._howMany === 0) {
24470         this._resolve([]);
24471         return;
24472     }
24473     this._init$(undefined, -5);
24474     var isArrayResolved = isArray(this._values);
24475     if (!this._isResolved() &&
24476         isArrayResolved &&
24477         this._howMany > this._canPossiblyFulfill()) {
24478         this._reject(this._getRangeError(this.length()));
24479     }
24480 };
24481
24482 SomePromiseArray.prototype.init = function () {
24483     this._initialized = true;
24484     this._init();
24485 };
24486
24487 SomePromiseArray.prototype.setUnwrap = function () {
24488     this._unwrap = true;
24489 };
24490
24491 SomePromiseArray.prototype.howMany = function () {
24492     return this._howMany;
24493 };
24494
24495 SomePromiseArray.prototype.setHowMany = function (count) {
24496     this._howMany = count;
24497 };
24498
24499 SomePromiseArray.prototype._promiseFulfilled = function (value) {
24500     this._addFulfilled(value);
24501     if (this._fulfilled() === this.howMany()) {
24502         this._values.length = this.howMany();
24503         if (this.howMany() === 1 && this._unwrap) {
24504             this._resolve(this._values[0]);
24505         } else {
24506             this._resolve(this._values);
24507         }
24508         return true;
24509     }
24510     return false;
24511
24512 };
24513 SomePromiseArray.prototype._promiseRejected = function (reason) {
24514     this._addRejected(reason);
24515     return this._checkOutcome();
24516 };
24517
24518 SomePromiseArray.prototype._promiseCancelled = function () {
24519     if (this._values instanceof Promise || this._values == null) {
24520         return this._cancel();
24521     }
24522     this._addRejected(CANCELLATION);
24523     return this._checkOutcome();
24524 };
24525
24526 SomePromiseArray.prototype._checkOutcome = function() {
24527     if (this.howMany() > this._canPossiblyFulfill()) {
24528         var e = new AggregateError();
24529         for (var i = this.length(); i < this._values.length; ++i) {
24530             if (this._values[i] !== CANCELLATION) {
24531                 e.push(this._values[i]);
24532             }
24533         }
24534         if (e.length > 0) {
24535             this._reject(e);
24536         } else {
24537             this._cancel();
24538         }
24539         return true;
24540     }
24541     return false;
24542 };
24543
24544 SomePromiseArray.prototype._fulfilled = function () {
24545     return this._totalResolved;
24546 };
24547
24548 SomePromiseArray.prototype._rejected = function () {
24549     return this._values.length - this.length();
24550 };
24551
24552 SomePromiseArray.prototype._addRejected = function (reason) {
24553     this._values.push(reason);
24554 };
24555
24556 SomePromiseArray.prototype._addFulfilled = function (value) {
24557     this._values[this._totalResolved++] = value;
24558 };
24559
24560 SomePromiseArray.prototype._canPossiblyFulfill = function () {
24561     return this.length() - this._rejected();
24562 };
24563
24564 SomePromiseArray.prototype._getRangeError = function (count) {
24565     var message = "Input array must contain at least " +
24566             this._howMany + " items but contains only " + count + " items";
24567     return new RangeError(message);
24568 };
24569
24570 SomePromiseArray.prototype._resolveEmptyArray = function () {
24571     this._reject(this._getRangeError(0));
24572 };
24573
24574 function some(promises, howMany) {
24575     if ((howMany | 0) !== howMany || howMany < 0) {
24576         return apiRejection("expecting a positive integer\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24577     }
24578     var ret = new SomePromiseArray(promises);
24579     var promise = ret.promise();
24580     ret.setHowMany(howMany);
24581     ret.init();
24582     return promise;
24583 }
24584
24585 Promise.some = function (promises, howMany) {
24586     return some(promises, howMany);
24587 };
24588
24589 Promise.prototype.some = function (howMany) {
24590     return some(this, howMany);
24591 };
24592
24593 Promise._SomePromiseArray = SomePromiseArray;
24594 };
24595
24596
24597 /***/ }),
24598 /* 161 */
24599 /***/ ((module) => {
24600
24601 "use strict";
24602
24603 module.exports = function(Promise, INTERNAL) {
24604 var PromiseMap = Promise.map;
24605
24606 Promise.prototype.filter = function (fn, options) {
24607     return PromiseMap(this, fn, options, INTERNAL);
24608 };
24609
24610 Promise.filter = function (promises, fn, options) {
24611     return PromiseMap(promises, fn, options, INTERNAL);
24612 };
24613 };
24614
24615
24616 /***/ }),
24617 /* 162 */
24618 /***/ ((module) => {
24619
24620 "use strict";
24621
24622 module.exports = function(Promise, INTERNAL) {
24623 var PromiseReduce = Promise.reduce;
24624 var PromiseAll = Promise.all;
24625
24626 function promiseAllThis() {
24627     return PromiseAll(this);
24628 }
24629
24630 function PromiseMapSeries(promises, fn) {
24631     return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
24632 }
24633
24634 Promise.prototype.each = function (fn) {
24635     return PromiseReduce(this, fn, INTERNAL, 0)
24636               ._then(promiseAllThis, undefined, undefined, this, undefined);
24637 };
24638
24639 Promise.prototype.mapSeries = function (fn) {
24640     return PromiseReduce(this, fn, INTERNAL, INTERNAL);
24641 };
24642
24643 Promise.each = function (promises, fn) {
24644     return PromiseReduce(promises, fn, INTERNAL, 0)
24645               ._then(promiseAllThis, undefined, undefined, promises, undefined);
24646 };
24647
24648 Promise.mapSeries = PromiseMapSeries;
24649 };
24650
24651
24652
24653 /***/ }),
24654 /* 163 */
24655 /***/ ((module) => {
24656
24657 "use strict";
24658
24659 module.exports = function(Promise) {
24660 var SomePromiseArray = Promise._SomePromiseArray;
24661 function any(promises) {
24662     var ret = new SomePromiseArray(promises);
24663     var promise = ret.promise();
24664     ret.setHowMany(1);
24665     ret.setUnwrap();
24666     ret.init();
24667     return promise;
24668 }
24669
24670 Promise.any = function (promises) {
24671     return any(promises);
24672 };
24673
24674 Promise.prototype.any = function () {
24675     return any(this);
24676 };
24677
24678 };
24679
24680
24681 /***/ }),
24682 /* 164 */
24683 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24684
24685 var Stream = __webpack_require__(44);
24686 var Promise = __webpack_require__(128);
24687 var util = __webpack_require__(50);
24688 var Buffer = __webpack_require__(165);
24689 var strFunction = 'function';
24690
24691 // Backwards compatibility for node versions < 8
24692 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
24693   Stream = __webpack_require__(167);
24694
24695 function PullStream() {
24696   if (!(this instanceof PullStream))
24697     return new PullStream();
24698
24699   Stream.Duplex.call(this,{decodeStrings:false, objectMode:true});
24700   this.buffer = Buffer.from('');
24701   var self = this;
24702   self.on('finish',function() {
24703     self.finished = true;
24704     self.emit('chunk',false);
24705   });
24706 }
24707
24708 util.inherits(PullStream,Stream.Duplex);
24709
24710 PullStream.prototype._write = function(chunk,e,cb) {
24711   this.buffer = Buffer.concat([this.buffer,chunk]);
24712   this.cb = cb;
24713   this.emit('chunk');
24714 };
24715
24716
24717 // The `eof` parameter is interpreted as `file_length` if the type is number
24718 // otherwise (i.e. buffer) it is interpreted as a pattern signaling end of stream
24719 PullStream.prototype.stream = function(eof,includeEof) {
24720   var p = Stream.PassThrough();
24721   var done,self= this;
24722
24723   function cb() {
24724     if (typeof self.cb === strFunction) {
24725       var callback = self.cb;
24726       self.cb = undefined;
24727       return callback();
24728     }
24729   }
24730
24731   function pull() {
24732     var packet;
24733     if (self.buffer && self.buffer.length) {
24734       if (typeof eof === 'number') {
24735         packet = self.buffer.slice(0,eof);
24736         self.buffer = self.buffer.slice(eof);
24737         eof -= packet.length;
24738         done = !eof;
24739       } else {
24740         var match = self.buffer.indexOf(eof);
24741         if (match !== -1) {
24742           // store signature match byte offset to allow us to reference
24743           // this for zip64 offset
24744           self.match = match
24745           if (includeEof) match = match + eof.length;
24746           packet = self.buffer.slice(0,match);
24747           self.buffer = self.buffer.slice(match);
24748           done = true;
24749         } else {
24750           var len = self.buffer.length - eof.length;
24751           if (len <= 0) {
24752             cb();
24753           } else {
24754             packet = self.buffer.slice(0,len);
24755             self.buffer = self.buffer.slice(len);
24756           }
24757         }
24758       }
24759       if (packet) p.write(packet,function() {
24760         if (self.buffer.length === 0 || (eof.length && self.buffer.length <= eof.length)) cb();
24761       });
24762     }
24763     
24764     if (!done) {
24765       if (self.finished && !this.__ended) {
24766         self.removeListener('chunk',pull);
24767         self.emit('error', new Error('FILE_ENDED'));
24768         this.__ended = true;
24769         return;
24770       }
24771       
24772     } else {
24773       self.removeListener('chunk',pull);
24774       p.end();
24775     }
24776   }
24777
24778   self.on('chunk',pull);
24779   pull();
24780   return p;
24781 };
24782
24783 PullStream.prototype.pull = function(eof,includeEof) {
24784   if (eof === 0) return Promise.resolve('');
24785
24786   // If we already have the required data in buffer
24787   // we can resolve the request immediately
24788   if (!isNaN(eof) && this.buffer.length > eof) {
24789     var data = this.buffer.slice(0,eof);
24790     this.buffer = this.buffer.slice(eof);
24791     return Promise.resolve(data);
24792   }
24793
24794   // Otherwise we stream until we have it
24795   var buffer = Buffer.from(''),
24796       self = this;
24797
24798   var concatStream = Stream.Transform();
24799   concatStream._transform = function(d,e,cb) {
24800     buffer = Buffer.concat([buffer,d]);
24801     cb();
24802   };
24803   
24804   var rejectHandler;
24805   var pullStreamRejectHandler;
24806   return new Promise(function(resolve,reject) {
24807     rejectHandler = reject;
24808     pullStreamRejectHandler = function(e) {
24809       self.__emittedError = e;
24810       reject(e);
24811     }
24812     if (self.finished)
24813       return reject(new Error('FILE_ENDED'));
24814     self.once('error',pullStreamRejectHandler);  // reject any errors from pullstream itself
24815     self.stream(eof,includeEof)
24816       .on('error',reject)
24817       .pipe(concatStream)
24818       .on('finish',function() {resolve(buffer);})
24819       .on('error',reject);
24820   })
24821   .finally(function() {
24822     self.removeListener('error',rejectHandler);
24823     self.removeListener('error',pullStreamRejectHandler);
24824   });
24825 };
24826
24827 PullStream.prototype._read = function(){};
24828
24829 module.exports = PullStream;
24830
24831
24832 /***/ }),
24833 /* 165 */
24834 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24835
24836 var Buffer = __webpack_require__(166).Buffer;
24837
24838 // Backwards compatibility for node versions < 8
24839 if (Buffer.from === undefined) {
24840   Buffer.from = function (a, b, c) {
24841     return new Buffer(a, b, c)
24842   };
24843
24844   Buffer.alloc = Buffer.from;
24845 }
24846
24847 module.exports = Buffer;
24848
24849 /***/ }),
24850 /* 166 */
24851 /***/ ((module) => {
24852
24853 "use strict";
24854 module.exports = require("buffer");;
24855
24856 /***/ }),
24857 /* 167 */
24858 /***/ ((module, exports, __webpack_require__) => {
24859
24860 var Stream = __webpack_require__(44);
24861 if (process.env.READABLE_STREAM === 'disable' && Stream) {
24862   module.exports = Stream;
24863   exports = module.exports = Stream.Readable;
24864   exports.Readable = Stream.Readable;
24865   exports.Writable = Stream.Writable;
24866   exports.Duplex = Stream.Duplex;
24867   exports.Transform = Stream.Transform;
24868   exports.PassThrough = Stream.PassThrough;
24869   exports.Stream = Stream;
24870 } else {
24871   exports = module.exports = __webpack_require__(168);
24872   exports.Stream = Stream || exports;
24873   exports.Readable = exports;
24874   exports.Writable = __webpack_require__(177);
24875   exports.Duplex = __webpack_require__(176);
24876   exports.Transform = __webpack_require__(180);
24877   exports.PassThrough = __webpack_require__(181);
24878 }
24879
24880
24881 /***/ }),
24882 /* 168 */
24883 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24884
24885 "use strict";
24886 // Copyright Joyent, Inc. and other Node contributors.
24887 //
24888 // Permission is hereby granted, free of charge, to any person obtaining a
24889 // copy of this software and associated documentation files (the
24890 // "Software"), to deal in the Software without restriction, including
24891 // without limitation the rights to use, copy, modify, merge, publish,
24892 // distribute, sublicense, and/or sell copies of the Software, and to permit
24893 // persons to whom the Software is furnished to do so, subject to the
24894 // following conditions:
24895 //
24896 // The above copyright notice and this permission notice shall be included
24897 // in all copies or substantial portions of the Software.
24898 //
24899 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24900 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24901 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
24902 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24903 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24904 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24905 // USE OR OTHER DEALINGS IN THE SOFTWARE.
24906
24907
24908
24909 /*<replacement>*/
24910
24911 var pna = __webpack_require__(169);
24912 /*</replacement>*/
24913
24914 module.exports = Readable;
24915
24916 /*<replacement>*/
24917 var isArray = __webpack_require__(170);
24918 /*</replacement>*/
24919
24920 /*<replacement>*/
24921 var Duplex;
24922 /*</replacement>*/
24923
24924 Readable.ReadableState = ReadableState;
24925
24926 /*<replacement>*/
24927 var EE = __webpack_require__(68).EventEmitter;
24928
24929 var EElistenerCount = function (emitter, type) {
24930   return emitter.listeners(type).length;
24931 };
24932 /*</replacement>*/
24933
24934 /*<replacement>*/
24935 var Stream = __webpack_require__(171);
24936 /*</replacement>*/
24937
24938 /*<replacement>*/
24939
24940 var Buffer = __webpack_require__(172).Buffer;
24941 var OurUint8Array = global.Uint8Array || function () {};
24942 function _uint8ArrayToBuffer(chunk) {
24943   return Buffer.from(chunk);
24944 }
24945 function _isUint8Array(obj) {
24946   return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
24947 }
24948
24949 /*</replacement>*/
24950
24951 /*<replacement>*/
24952 var util = Object.create(__webpack_require__(173));
24953 util.inherits = __webpack_require__(66);
24954 /*</replacement>*/
24955
24956 /*<replacement>*/
24957 var debugUtil = __webpack_require__(50);
24958 var debug = void 0;
24959 if (debugUtil && debugUtil.debuglog) {
24960   debug = debugUtil.debuglog('stream');
24961 } else {
24962   debug = function () {};
24963 }
24964 /*</replacement>*/
24965
24966 var BufferList = __webpack_require__(174);
24967 var destroyImpl = __webpack_require__(175);
24968 var StringDecoder;
24969
24970 util.inherits(Readable, Stream);
24971
24972 var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
24973
24974 function prependListener(emitter, event, fn) {
24975   // Sadly this is not cacheable as some libraries bundle their own
24976   // event emitter implementation with them.
24977   if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
24978
24979   // This is a hack to make sure that our error handler is attached before any
24980   // userland ones.  NEVER DO THIS. This is here only because this code needs
24981   // to continue to work with older versions of Node.js that do not include
24982   // the prependListener() method. The goal is to eventually remove this hack.
24983   if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
24984 }
24985
24986 function ReadableState(options, stream) {
24987   Duplex = Duplex || __webpack_require__(176);
24988
24989   options = options || {};
24990
24991   // Duplex streams are both readable and writable, but share
24992   // the same options object.
24993   // However, some cases require setting options to different
24994   // values for the readable and the writable sides of the duplex stream.
24995   // These options can be provided separately as readableXXX and writableXXX.
24996   var isDuplex = stream instanceof Duplex;
24997
24998   // object stream flag. Used to make read(n) ignore n and to
24999   // make all the buffer merging and length checks go away
25000   this.objectMode = !!options.objectMode;
25001
25002   if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
25003
25004   // the point at which it stops calling _read() to fill the buffer
25005   // Note: 0 is a valid value, means "don't call _read preemptively ever"
25006   var hwm = options.highWaterMark;
25007   var readableHwm = options.readableHighWaterMark;
25008   var defaultHwm = this.objectMode ? 16 : 16 * 1024;
25009
25010   if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
25011
25012   // cast to ints.
25013   this.highWaterMark = Math.floor(this.highWaterMark);
25014
25015   // A linked list is used to store data chunks instead of an array because the
25016   // linked list can remove elements from the beginning faster than
25017   // array.shift()
25018   this.buffer = new BufferList();
25019   this.length = 0;
25020   this.pipes = null;
25021   this.pipesCount = 0;
25022   this.flowing = null;
25023   this.ended = false;
25024   this.endEmitted = false;
25025   this.reading = false;
25026
25027   // a flag to be able to tell if the event 'readable'/'data' is emitted
25028   // immediately, or on a later tick.  We set this to true at first, because
25029   // any actions that shouldn't happen until "later" should generally also
25030   // not happen before the first read call.
25031   this.sync = true;
25032
25033   // whenever we return null, then we set a flag to say
25034   // that we're awaiting a 'readable' event emission.
25035   this.needReadable = false;
25036   this.emittedReadable = false;
25037   this.readableListening = false;
25038   this.resumeScheduled = false;
25039
25040   // has it been destroyed
25041   this.destroyed = false;
25042
25043   // Crypto is kind of old and crusty.  Historically, its default string
25044   // encoding is 'binary' so we have to make this configurable.
25045   // Everything else in the universe uses 'utf8', though.
25046   this.defaultEncoding = options.defaultEncoding || 'utf8';
25047
25048   // the number of writers that are awaiting a drain event in .pipe()s
25049   this.awaitDrain = 0;
25050
25051   // if true, a maybeReadMore has been scheduled
25052   this.readingMore = false;
25053
25054   this.decoder = null;
25055   this.encoding = null;
25056   if (options.encoding) {
25057     if (!StringDecoder) StringDecoder = __webpack_require__(179).StringDecoder;
25058     this.decoder = new StringDecoder(options.encoding);
25059     this.encoding = options.encoding;
25060   }
25061 }
25062
25063 function Readable(options) {
25064   Duplex = Duplex || __webpack_require__(176);
25065
25066   if (!(this instanceof Readable)) return new Readable(options);
25067
25068   this._readableState = new ReadableState(options, this);
25069
25070   // legacy
25071   this.readable = true;
25072
25073   if (options) {
25074     if (typeof options.read === 'function') this._read = options.read;
25075
25076     if (typeof options.destroy === 'function') this._destroy = options.destroy;
25077   }
25078
25079   Stream.call(this);
25080 }
25081
25082 Object.defineProperty(Readable.prototype, 'destroyed', {
25083   get: function () {
25084     if (this._readableState === undefined) {
25085       return false;
25086     }
25087     return this._readableState.destroyed;
25088   },
25089   set: function (value) {
25090     // we ignore the value if the stream
25091     // has not been initialized yet
25092     if (!this._readableState) {
25093       return;
25094     }
25095
25096     // backward compatibility, the user is explicitly
25097     // managing destroyed
25098     this._readableState.destroyed = value;
25099   }
25100 });
25101
25102 Readable.prototype.destroy = destroyImpl.destroy;
25103 Readable.prototype._undestroy = destroyImpl.undestroy;
25104 Readable.prototype._destroy = function (err, cb) {
25105   this.push(null);
25106   cb(err);
25107 };
25108
25109 // Manually shove something into the read() buffer.
25110 // This returns true if the highWaterMark has not been hit yet,
25111 // similar to how Writable.write() returns true if you should
25112 // write() some more.
25113 Readable.prototype.push = function (chunk, encoding) {
25114   var state = this._readableState;
25115   var skipChunkCheck;
25116
25117   if (!state.objectMode) {
25118     if (typeof chunk === 'string') {
25119       encoding = encoding || state.defaultEncoding;
25120       if (encoding !== state.encoding) {
25121         chunk = Buffer.from(chunk, encoding);
25122         encoding = '';
25123       }
25124       skipChunkCheck = true;
25125     }
25126   } else {
25127     skipChunkCheck = true;
25128   }
25129
25130   return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
25131 };
25132
25133 // Unshift should *always* be something directly out of read()
25134 Readable.prototype.unshift = function (chunk) {
25135   return readableAddChunk(this, chunk, null, true, false);
25136 };
25137
25138 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
25139   var state = stream._readableState;
25140   if (chunk === null) {
25141     state.reading = false;
25142     onEofChunk(stream, state);
25143   } else {
25144     var er;
25145     if (!skipChunkCheck) er = chunkInvalid(state, chunk);
25146     if (er) {
25147       stream.emit('error', er);
25148     } else if (state.objectMode || chunk && chunk.length > 0) {
25149       if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
25150         chunk = _uint8ArrayToBuffer(chunk);
25151       }
25152
25153       if (addToFront) {
25154         if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
25155       } else if (state.ended) {
25156         stream.emit('error', new Error('stream.push() after EOF'));
25157       } else {
25158         state.reading = false;
25159         if (state.decoder && !encoding) {
25160           chunk = state.decoder.write(chunk);
25161           if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
25162         } else {
25163           addChunk(stream, state, chunk, false);
25164         }
25165       }
25166     } else if (!addToFront) {
25167       state.reading = false;
25168     }
25169   }
25170
25171   return needMoreData(state);
25172 }
25173
25174 function addChunk(stream, state, chunk, addToFront) {
25175   if (state.flowing && state.length === 0 && !state.sync) {
25176     stream.emit('data', chunk);
25177     stream.read(0);
25178   } else {
25179     // update the buffer info.
25180     state.length += state.objectMode ? 1 : chunk.length;
25181     if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
25182
25183     if (state.needReadable) emitReadable(stream);
25184   }
25185   maybeReadMore(stream, state);
25186 }
25187
25188 function chunkInvalid(state, chunk) {
25189   var er;
25190   if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
25191     er = new TypeError('Invalid non-string/buffer chunk');
25192   }
25193   return er;
25194 }
25195
25196 // if it's past the high water mark, we can push in some more.
25197 // Also, if we have no data yet, we can stand some
25198 // more bytes.  This is to work around cases where hwm=0,
25199 // such as the repl.  Also, if the push() triggered a
25200 // readable event, and the user called read(largeNumber) such that
25201 // needReadable was set, then we ought to push more, so that another
25202 // 'readable' event will be triggered.
25203 function needMoreData(state) {
25204   return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
25205 }
25206
25207 Readable.prototype.isPaused = function () {
25208   return this._readableState.flowing === false;
25209 };
25210
25211 // backwards compatibility.
25212 Readable.prototype.setEncoding = function (enc) {
25213   if (!StringDecoder) StringDecoder = __webpack_require__(179).StringDecoder;
25214   this._readableState.decoder = new StringDecoder(enc);
25215   this._readableState.encoding = enc;
25216   return this;
25217 };
25218
25219 // Don't raise the hwm > 8MB
25220 var MAX_HWM = 0x800000;
25221 function computeNewHighWaterMark(n) {
25222   if (n >= MAX_HWM) {
25223     n = MAX_HWM;
25224   } else {
25225     // Get the next highest power of 2 to prevent increasing hwm excessively in
25226     // tiny amounts
25227     n--;
25228     n |= n >>> 1;
25229     n |= n >>> 2;
25230     n |= n >>> 4;
25231     n |= n >>> 8;
25232     n |= n >>> 16;
25233     n++;
25234   }
25235   return n;
25236 }
25237
25238 // This function is designed to be inlinable, so please take care when making
25239 // changes to the function body.
25240 function howMuchToRead(n, state) {
25241   if (n <= 0 || state.length === 0 && state.ended) return 0;
25242   if (state.objectMode) return 1;
25243   if (n !== n) {
25244     // Only flow one buffer at a time
25245     if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
25246   }
25247   // If we're asking for more than the current hwm, then raise the hwm.
25248   if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
25249   if (n <= state.length) return n;
25250   // Don't have enough
25251   if (!state.ended) {
25252     state.needReadable = true;
25253     return 0;
25254   }
25255   return state.length;
25256 }
25257
25258 // you can override either this method, or the async _read(n) below.
25259 Readable.prototype.read = function (n) {
25260   debug('read', n);
25261   n = parseInt(n, 10);
25262   var state = this._readableState;
25263   var nOrig = n;
25264
25265   if (n !== 0) state.emittedReadable = false;
25266
25267   // if we're doing read(0) to trigger a readable event, but we
25268   // already have a bunch of data in the buffer, then just trigger
25269   // the 'readable' event and move on.
25270   if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
25271     debug('read: emitReadable', state.length, state.ended);
25272     if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
25273     return null;
25274   }
25275
25276   n = howMuchToRead(n, state);
25277
25278   // if we've ended, and we're now clear, then finish it up.
25279   if (n === 0 && state.ended) {
25280     if (state.length === 0) endReadable(this);
25281     return null;
25282   }
25283
25284   // All the actual chunk generation logic needs to be
25285   // *below* the call to _read.  The reason is that in certain
25286   // synthetic stream cases, such as passthrough streams, _read
25287   // may be a completely synchronous operation which may change
25288   // the state of the read buffer, providing enough data when
25289   // before there was *not* enough.
25290   //
25291   // So, the steps are:
25292   // 1. Figure out what the state of things will be after we do
25293   // a read from the buffer.
25294   //
25295   // 2. If that resulting state will trigger a _read, then call _read.
25296   // Note that this may be asynchronous, or synchronous.  Yes, it is
25297   // deeply ugly to write APIs this way, but that still doesn't mean
25298   // that the Readable class should behave improperly, as streams are
25299   // designed to be sync/async agnostic.
25300   // Take note if the _read call is sync or async (ie, if the read call
25301   // has returned yet), so that we know whether or not it's safe to emit
25302   // 'readable' etc.
25303   //
25304   // 3. Actually pull the requested chunks out of the buffer and return.
25305
25306   // if we need a readable event, then we need to do some reading.
25307   var doRead = state.needReadable;
25308   debug('need readable', doRead);
25309
25310   // if we currently have less than the highWaterMark, then also read some
25311   if (state.length === 0 || state.length - n < state.highWaterMark) {
25312     doRead = true;
25313     debug('length less than watermark', doRead);
25314   }
25315
25316   // however, if we've ended, then there's no point, and if we're already
25317   // reading, then it's unnecessary.
25318   if (state.ended || state.reading) {
25319     doRead = false;
25320     debug('reading or ended', doRead);
25321   } else if (doRead) {
25322     debug('do read');
25323     state.reading = true;
25324     state.sync = true;
25325     // if the length is currently zero, then we *need* a readable event.
25326     if (state.length === 0) state.needReadable = true;
25327     // call internal read method
25328     this._read(state.highWaterMark);
25329     state.sync = false;
25330     // If _read pushed data synchronously, then `reading` will be false,
25331     // and we need to re-evaluate how much data we can return to the user.
25332     if (!state.reading) n = howMuchToRead(nOrig, state);
25333   }
25334
25335   var ret;
25336   if (n > 0) ret = fromList(n, state);else ret = null;
25337
25338   if (ret === null) {
25339     state.needReadable = true;
25340     n = 0;
25341   } else {
25342     state.length -= n;
25343   }
25344
25345   if (state.length === 0) {
25346     // If we have nothing in the buffer, then we want to know
25347     // as soon as we *do* get something into the buffer.
25348     if (!state.ended) state.needReadable = true;
25349
25350     // If we tried to read() past the EOF, then emit end on the next tick.
25351     if (nOrig !== n && state.ended) endReadable(this);
25352   }
25353
25354   if (ret !== null) this.emit('data', ret);
25355
25356   return ret;
25357 };
25358
25359 function onEofChunk(stream, state) {
25360   if (state.ended) return;
25361   if (state.decoder) {
25362     var chunk = state.decoder.end();
25363     if (chunk && chunk.length) {
25364       state.buffer.push(chunk);
25365       state.length += state.objectMode ? 1 : chunk.length;
25366     }
25367   }
25368   state.ended = true;
25369
25370   // emit 'readable' now to make sure it gets picked up.
25371   emitReadable(stream);
25372 }
25373
25374 // Don't emit readable right away in sync mode, because this can trigger
25375 // another read() call => stack overflow.  This way, it might trigger
25376 // a nextTick recursion warning, but that's not so bad.
25377 function emitReadable(stream) {
25378   var state = stream._readableState;
25379   state.needReadable = false;
25380   if (!state.emittedReadable) {
25381     debug('emitReadable', state.flowing);
25382     state.emittedReadable = true;
25383     if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
25384   }
25385 }
25386
25387 function emitReadable_(stream) {
25388   debug('emit readable');
25389   stream.emit('readable');
25390   flow(stream);
25391 }
25392
25393 // at this point, the user has presumably seen the 'readable' event,
25394 // and called read() to consume some data.  that may have triggered
25395 // in turn another _read(n) call, in which case reading = true if
25396 // it's in progress.
25397 // However, if we're not ended, or reading, and the length < hwm,
25398 // then go ahead and try to read some more preemptively.
25399 function maybeReadMore(stream, state) {
25400   if (!state.readingMore) {
25401     state.readingMore = true;
25402     pna.nextTick(maybeReadMore_, stream, state);
25403   }
25404 }
25405
25406 function maybeReadMore_(stream, state) {
25407   var len = state.length;
25408   while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
25409     debug('maybeReadMore read 0');
25410     stream.read(0);
25411     if (len === state.length)
25412       // didn't get any data, stop spinning.
25413       break;else len = state.length;
25414   }
25415   state.readingMore = false;
25416 }
25417
25418 // abstract method.  to be overridden in specific implementation classes.
25419 // call cb(er, data) where data is <= n in length.
25420 // for virtual (non-string, non-buffer) streams, "length" is somewhat
25421 // arbitrary, and perhaps not very meaningful.
25422 Readable.prototype._read = function (n) {
25423   this.emit('error', new Error('_read() is not implemented'));
25424 };
25425
25426 Readable.prototype.pipe = function (dest, pipeOpts) {
25427   var src = this;
25428   var state = this._readableState;
25429
25430   switch (state.pipesCount) {
25431     case 0:
25432       state.pipes = dest;
25433       break;
25434     case 1:
25435       state.pipes = [state.pipes, dest];
25436       break;
25437     default:
25438       state.pipes.push(dest);
25439       break;
25440   }
25441   state.pipesCount += 1;
25442   debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
25443
25444   var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
25445
25446   var endFn = doEnd ? onend : unpipe;
25447   if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
25448
25449   dest.on('unpipe', onunpipe);
25450   function onunpipe(readable, unpipeInfo) {
25451     debug('onunpipe');
25452     if (readable === src) {
25453       if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
25454         unpipeInfo.hasUnpiped = true;
25455         cleanup();
25456       }
25457     }
25458   }
25459
25460   function onend() {
25461     debug('onend');
25462     dest.end();
25463   }
25464
25465   // when the dest drains, it reduces the awaitDrain counter
25466   // on the source.  This would be more elegant with a .once()
25467   // handler in flow(), but adding and removing repeatedly is
25468   // too slow.
25469   var ondrain = pipeOnDrain(src);
25470   dest.on('drain', ondrain);
25471
25472   var cleanedUp = false;
25473   function cleanup() {
25474     debug('cleanup');
25475     // cleanup event handlers once the pipe is broken
25476     dest.removeListener('close', onclose);
25477     dest.removeListener('finish', onfinish);
25478     dest.removeListener('drain', ondrain);
25479     dest.removeListener('error', onerror);
25480     dest.removeListener('unpipe', onunpipe);
25481     src.removeListener('end', onend);
25482     src.removeListener('end', unpipe);
25483     src.removeListener('data', ondata);
25484
25485     cleanedUp = true;
25486
25487     // if the reader is waiting for a drain event from this
25488     // specific writer, then it would cause it to never start
25489     // flowing again.
25490     // So, if this is awaiting a drain, then we just call it now.
25491     // If we don't know, then assume that we are waiting for one.
25492     if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
25493   }
25494
25495   // If the user pushes more data while we're writing to dest then we'll end up
25496   // in ondata again. However, we only want to increase awaitDrain once because
25497   // dest will only emit one 'drain' event for the multiple writes.
25498   // => Introduce a guard on increasing awaitDrain.
25499   var increasedAwaitDrain = false;
25500   src.on('data', ondata);
25501   function ondata(chunk) {
25502     debug('ondata');
25503     increasedAwaitDrain = false;
25504     var ret = dest.write(chunk);
25505     if (false === ret && !increasedAwaitDrain) {
25506       // If the user unpiped during `dest.write()`, it is possible
25507       // to get stuck in a permanently paused state if that write
25508       // also returned false.
25509       // => Check whether `dest` is still a piping destination.
25510       if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
25511         debug('false write response, pause', src._readableState.awaitDrain);
25512         src._readableState.awaitDrain++;
25513         increasedAwaitDrain = true;
25514       }
25515       src.pause();
25516     }
25517   }
25518
25519   // if the dest has an error, then stop piping into it.
25520   // however, don't suppress the throwing behavior for this.
25521   function onerror(er) {
25522     debug('onerror', er);
25523     unpipe();
25524     dest.removeListener('error', onerror);
25525     if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
25526   }
25527
25528   // Make sure our error handler is attached before userland ones.
25529   prependListener(dest, 'error', onerror);
25530
25531   // Both close and finish should trigger unpipe, but only once.
25532   function onclose() {
25533     dest.removeListener('finish', onfinish);
25534     unpipe();
25535   }
25536   dest.once('close', onclose);
25537   function onfinish() {
25538     debug('onfinish');
25539     dest.removeListener('close', onclose);
25540     unpipe();
25541   }
25542   dest.once('finish', onfinish);
25543
25544   function unpipe() {
25545     debug('unpipe');
25546     src.unpipe(dest);
25547   }
25548
25549   // tell the dest that it's being piped to
25550   dest.emit('pipe', src);
25551
25552   // start the flow if it hasn't been started already.
25553   if (!state.flowing) {
25554     debug('pipe resume');
25555     src.resume();
25556   }
25557
25558   return dest;
25559 };
25560
25561 function pipeOnDrain(src) {
25562   return function () {
25563     var state = src._readableState;
25564     debug('pipeOnDrain', state.awaitDrain);
25565     if (state.awaitDrain) state.awaitDrain--;
25566     if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
25567       state.flowing = true;
25568       flow(src);
25569     }
25570   };
25571 }
25572
25573 Readable.prototype.unpipe = function (dest) {
25574   var state = this._readableState;
25575   var unpipeInfo = { hasUnpiped: false };
25576
25577   // if we're not piping anywhere, then do nothing.
25578   if (state.pipesCount === 0) return this;
25579
25580   // just one destination.  most common case.
25581   if (state.pipesCount === 1) {
25582     // passed in one, but it's not the right one.
25583     if (dest && dest !== state.pipes) return this;
25584
25585     if (!dest) dest = state.pipes;
25586
25587     // got a match.
25588     state.pipes = null;
25589     state.pipesCount = 0;
25590     state.flowing = false;
25591     if (dest) dest.emit('unpipe', this, unpipeInfo);
25592     return this;
25593   }
25594
25595   // slow case. multiple pipe destinations.
25596
25597   if (!dest) {
25598     // remove all.
25599     var dests = state.pipes;
25600     var len = state.pipesCount;
25601     state.pipes = null;
25602     state.pipesCount = 0;
25603     state.flowing = false;
25604
25605     for (var i = 0; i < len; i++) {
25606       dests[i].emit('unpipe', this, unpipeInfo);
25607     }return this;
25608   }
25609
25610   // try to find the right one.
25611   var index = indexOf(state.pipes, dest);
25612   if (index === -1) return this;
25613
25614   state.pipes.splice(index, 1);
25615   state.pipesCount -= 1;
25616   if (state.pipesCount === 1) state.pipes = state.pipes[0];
25617
25618   dest.emit('unpipe', this, unpipeInfo);
25619
25620   return this;
25621 };
25622
25623 // set up data events if they are asked for
25624 // Ensure readable listeners eventually get something
25625 Readable.prototype.on = function (ev, fn) {
25626   var res = Stream.prototype.on.call(this, ev, fn);
25627
25628   if (ev === 'data') {
25629     // Start flowing on next tick if stream isn't explicitly paused
25630     if (this._readableState.flowing !== false) this.resume();
25631   } else if (ev === 'readable') {
25632     var state = this._readableState;
25633     if (!state.endEmitted && !state.readableListening) {
25634       state.readableListening = state.needReadable = true;
25635       state.emittedReadable = false;
25636       if (!state.reading) {
25637         pna.nextTick(nReadingNextTick, this);
25638       } else if (state.length) {
25639         emitReadable(this);
25640       }
25641     }
25642   }
25643
25644   return res;
25645 };
25646 Readable.prototype.addListener = Readable.prototype.on;
25647
25648 function nReadingNextTick(self) {
25649   debug('readable nexttick read 0');
25650   self.read(0);
25651 }
25652
25653 // pause() and resume() are remnants of the legacy readable stream API
25654 // If the user uses them, then switch into old mode.
25655 Readable.prototype.resume = function () {
25656   var state = this._readableState;
25657   if (!state.flowing) {
25658     debug('resume');
25659     state.flowing = true;
25660     resume(this, state);
25661   }
25662   return this;
25663 };
25664
25665 function resume(stream, state) {
25666   if (!state.resumeScheduled) {
25667     state.resumeScheduled = true;
25668     pna.nextTick(resume_, stream, state);
25669   }
25670 }
25671
25672 function resume_(stream, state) {
25673   if (!state.reading) {
25674     debug('resume read 0');
25675     stream.read(0);
25676   }
25677
25678   state.resumeScheduled = false;
25679   state.awaitDrain = 0;
25680   stream.emit('resume');
25681   flow(stream);
25682   if (state.flowing && !state.reading) stream.read(0);
25683 }
25684
25685 Readable.prototype.pause = function () {
25686   debug('call pause flowing=%j', this._readableState.flowing);
25687   if (false !== this._readableState.flowing) {
25688     debug('pause');
25689     this._readableState.flowing = false;
25690     this.emit('pause');
25691   }
25692   return this;
25693 };
25694
25695 function flow(stream) {
25696   var state = stream._readableState;
25697   debug('flow', state.flowing);
25698   while (state.flowing && stream.read() !== null) {}
25699 }
25700
25701 // wrap an old-style stream as the async data source.
25702 // This is *not* part of the readable stream interface.
25703 // It is an ugly unfortunate mess of history.
25704 Readable.prototype.wrap = function (stream) {
25705   var _this = this;
25706
25707   var state = this._readableState;
25708   var paused = false;
25709
25710   stream.on('end', function () {
25711     debug('wrapped end');
25712     if (state.decoder && !state.ended) {
25713       var chunk = state.decoder.end();
25714       if (chunk && chunk.length) _this.push(chunk);
25715     }
25716
25717     _this.push(null);
25718   });
25719
25720   stream.on('data', function (chunk) {
25721     debug('wrapped data');
25722     if (state.decoder) chunk = state.decoder.write(chunk);
25723
25724     // don't skip over falsy values in objectMode
25725     if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
25726
25727     var ret = _this.push(chunk);
25728     if (!ret) {
25729       paused = true;
25730       stream.pause();
25731     }
25732   });
25733
25734   // proxy all the other methods.
25735   // important when wrapping filters and duplexes.
25736   for (var i in stream) {
25737     if (this[i] === undefined && typeof stream[i] === 'function') {
25738       this[i] = function (method) {
25739         return function () {
25740           return stream[method].apply(stream, arguments);
25741         };
25742       }(i);
25743     }
25744   }
25745
25746   // proxy certain important events.
25747   for (var n = 0; n < kProxyEvents.length; n++) {
25748     stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
25749   }
25750
25751   // when we try to consume some more bytes, simply unpause the
25752   // underlying stream.
25753   this._read = function (n) {
25754     debug('wrapped _read', n);
25755     if (paused) {
25756       paused = false;
25757       stream.resume();
25758     }
25759   };
25760
25761   return this;
25762 };
25763
25764 Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
25765   // making it explicit this property is not enumerable
25766   // because otherwise some prototype manipulation in
25767   // userland will fail
25768   enumerable: false,
25769   get: function () {
25770     return this._readableState.highWaterMark;
25771   }
25772 });
25773
25774 // exposed for testing purposes only.
25775 Readable._fromList = fromList;
25776
25777 // Pluck off n bytes from an array of buffers.
25778 // Length is the combined lengths of all the buffers in the list.
25779 // This function is designed to be inlinable, so please take care when making
25780 // changes to the function body.
25781 function fromList(n, state) {
25782   // nothing buffered
25783   if (state.length === 0) return null;
25784
25785   var ret;
25786   if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
25787     // read it all, truncate the list
25788     if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
25789     state.buffer.clear();
25790   } else {
25791     // read part of list
25792     ret = fromListPartial(n, state.buffer, state.decoder);
25793   }
25794
25795   return ret;
25796 }
25797
25798 // Extracts only enough buffered data to satisfy the amount requested.
25799 // This function is designed to be inlinable, so please take care when making
25800 // changes to the function body.
25801 function fromListPartial(n, list, hasStrings) {
25802   var ret;
25803   if (n < list.head.data.length) {
25804     // slice is the same for buffers and strings
25805     ret = list.head.data.slice(0, n);
25806     list.head.data = list.head.data.slice(n);
25807   } else if (n === list.head.data.length) {
25808     // first chunk is a perfect match
25809     ret = list.shift();
25810   } else {
25811     // result spans more than one buffer
25812     ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
25813   }
25814   return ret;
25815 }
25816
25817 // Copies a specified amount of characters from the list of buffered data
25818 // chunks.
25819 // This function is designed to be inlinable, so please take care when making
25820 // changes to the function body.
25821 function copyFromBufferString(n, list) {
25822   var p = list.head;
25823   var c = 1;
25824   var ret = p.data;
25825   n -= ret.length;
25826   while (p = p.next) {
25827     var str = p.data;
25828     var nb = n > str.length ? str.length : n;
25829     if (nb === str.length) ret += str;else ret += str.slice(0, n);
25830     n -= nb;
25831     if (n === 0) {
25832       if (nb === str.length) {
25833         ++c;
25834         if (p.next) list.head = p.next;else list.head = list.tail = null;
25835       } else {
25836         list.head = p;
25837         p.data = str.slice(nb);
25838       }
25839       break;
25840     }
25841     ++c;
25842   }
25843   list.length -= c;
25844   return ret;
25845 }
25846
25847 // Copies a specified amount of bytes from the list of buffered data chunks.
25848 // This function is designed to be inlinable, so please take care when making
25849 // changes to the function body.
25850 function copyFromBuffer(n, list) {
25851   var ret = Buffer.allocUnsafe(n);
25852   var p = list.head;
25853   var c = 1;
25854   p.data.copy(ret);
25855   n -= p.data.length;
25856   while (p = p.next) {
25857     var buf = p.data;
25858     var nb = n > buf.length ? buf.length : n;
25859     buf.copy(ret, ret.length - n, 0, nb);
25860     n -= nb;
25861     if (n === 0) {
25862       if (nb === buf.length) {
25863         ++c;
25864         if (p.next) list.head = p.next;else list.head = list.tail = null;
25865       } else {
25866         list.head = p;
25867         p.data = buf.slice(nb);
25868       }
25869       break;
25870     }
25871     ++c;
25872   }
25873   list.length -= c;
25874   return ret;
25875 }
25876
25877 function endReadable(stream) {
25878   var state = stream._readableState;
25879
25880   // If we get here before consuming all the bytes, then that is a
25881   // bug in node.  Should never happen.
25882   if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
25883
25884   if (!state.endEmitted) {
25885     state.ended = true;
25886     pna.nextTick(endReadableNT, state, stream);
25887   }
25888 }
25889
25890 function endReadableNT(state, stream) {
25891   // Check that we didn't get one last unshift.
25892   if (!state.endEmitted && state.length === 0) {
25893     state.endEmitted = true;
25894     stream.readable = false;
25895     stream.emit('end');
25896   }
25897 }
25898
25899 function indexOf(xs, x) {
25900   for (var i = 0, l = xs.length; i < l; i++) {
25901     if (xs[i] === x) return i;
25902   }
25903   return -1;
25904 }
25905
25906 /***/ }),
25907 /* 169 */
25908 /***/ ((module) => {
25909
25910 "use strict";
25911
25912
25913 if (typeof process === 'undefined' ||
25914     !process.version ||
25915     process.version.indexOf('v0.') === 0 ||
25916     process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
25917   module.exports = { nextTick: nextTick };
25918 } else {
25919   module.exports = process
25920 }
25921
25922 function nextTick(fn, arg1, arg2, arg3) {
25923   if (typeof fn !== 'function') {
25924     throw new TypeError('"callback" argument must be a function');
25925   }
25926   var len = arguments.length;
25927   var args, i;
25928   switch (len) {
25929   case 0:
25930   case 1:
25931     return process.nextTick(fn);
25932   case 2:
25933     return process.nextTick(function afterTickOne() {
25934       fn.call(null, arg1);
25935     });
25936   case 3:
25937     return process.nextTick(function afterTickTwo() {
25938       fn.call(null, arg1, arg2);
25939     });
25940   case 4:
25941     return process.nextTick(function afterTickThree() {
25942       fn.call(null, arg1, arg2, arg3);
25943     });
25944   default:
25945     args = new Array(len - 1);
25946     i = 0;
25947     while (i < args.length) {
25948       args[i++] = arguments[i];
25949     }
25950     return process.nextTick(function afterTick() {
25951       fn.apply(null, args);
25952     });
25953   }
25954 }
25955
25956
25957
25958 /***/ }),
25959 /* 170 */
25960 /***/ ((module) => {
25961
25962 var toString = {}.toString;
25963
25964 module.exports = Array.isArray || function (arr) {
25965   return toString.call(arr) == '[object Array]';
25966 };
25967
25968
25969 /***/ }),
25970 /* 171 */
25971 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25972
25973 module.exports = __webpack_require__(44);
25974
25975
25976 /***/ }),
25977 /* 172 */
25978 /***/ ((module, exports, __webpack_require__) => {
25979
25980 /* eslint-disable node/no-deprecated-api */
25981 var buffer = __webpack_require__(166)
25982 var Buffer = buffer.Buffer
25983
25984 // alternative to using Object.keys for old browsers
25985 function copyProps (src, dst) {
25986   for (var key in src) {
25987     dst[key] = src[key]
25988   }
25989 }
25990 if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
25991   module.exports = buffer
25992 } else {
25993   // Copy properties from require('buffer')
25994   copyProps(buffer, exports)
25995   exports.Buffer = SafeBuffer
25996 }
25997
25998 function SafeBuffer (arg, encodingOrOffset, length) {
25999   return Buffer(arg, encodingOrOffset, length)
26000 }
26001
26002 // Copy static methods from Buffer
26003 copyProps(Buffer, SafeBuffer)
26004
26005 SafeBuffer.from = function (arg, encodingOrOffset, length) {
26006   if (typeof arg === 'number') {
26007     throw new TypeError('Argument must not be a number')
26008   }
26009   return Buffer(arg, encodingOrOffset, length)
26010 }
26011
26012 SafeBuffer.alloc = function (size, fill, encoding) {
26013   if (typeof size !== 'number') {
26014     throw new TypeError('Argument must be a number')
26015   }
26016   var buf = Buffer(size)
26017   if (fill !== undefined) {
26018     if (typeof encoding === 'string') {
26019       buf.fill(fill, encoding)
26020     } else {
26021       buf.fill(fill)
26022     }
26023   } else {
26024     buf.fill(0)
26025   }
26026   return buf
26027 }
26028
26029 SafeBuffer.allocUnsafe = function (size) {
26030   if (typeof size !== 'number') {
26031     throw new TypeError('Argument must be a number')
26032   }
26033   return Buffer(size)
26034 }
26035
26036 SafeBuffer.allocUnsafeSlow = function (size) {
26037   if (typeof size !== 'number') {
26038     throw new TypeError('Argument must be a number')
26039   }
26040   return buffer.SlowBuffer(size)
26041 }
26042
26043
26044 /***/ }),
26045 /* 173 */
26046 /***/ ((__unused_webpack_module, exports) => {
26047
26048 // Copyright Joyent, Inc. and other Node contributors.
26049 //
26050 // Permission is hereby granted, free of charge, to any person obtaining a
26051 // copy of this software and associated documentation files (the
26052 // "Software"), to deal in the Software without restriction, including
26053 // without limitation the rights to use, copy, modify, merge, publish,
26054 // distribute, sublicense, and/or sell copies of the Software, and to permit
26055 // persons to whom the Software is furnished to do so, subject to the
26056 // following conditions:
26057 //
26058 // The above copyright notice and this permission notice shall be included
26059 // in all copies or substantial portions of the Software.
26060 //
26061 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26062 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26063 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26064 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26065 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26066 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26067 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26068
26069 // NOTE: These type checking functions intentionally don't use `instanceof`
26070 // because it is fragile and can be easily faked with `Object.create()`.
26071
26072 function isArray(arg) {
26073   if (Array.isArray) {
26074     return Array.isArray(arg);
26075   }
26076   return objectToString(arg) === '[object Array]';
26077 }
26078 exports.isArray = isArray;
26079
26080 function isBoolean(arg) {
26081   return typeof arg === 'boolean';
26082 }
26083 exports.isBoolean = isBoolean;
26084
26085 function isNull(arg) {
26086   return arg === null;
26087 }
26088 exports.isNull = isNull;
26089
26090 function isNullOrUndefined(arg) {
26091   return arg == null;
26092 }
26093 exports.isNullOrUndefined = isNullOrUndefined;
26094
26095 function isNumber(arg) {
26096   return typeof arg === 'number';
26097 }
26098 exports.isNumber = isNumber;
26099
26100 function isString(arg) {
26101   return typeof arg === 'string';
26102 }
26103 exports.isString = isString;
26104
26105 function isSymbol(arg) {
26106   return typeof arg === 'symbol';
26107 }
26108 exports.isSymbol = isSymbol;
26109
26110 function isUndefined(arg) {
26111   return arg === void 0;
26112 }
26113 exports.isUndefined = isUndefined;
26114
26115 function isRegExp(re) {
26116   return objectToString(re) === '[object RegExp]';
26117 }
26118 exports.isRegExp = isRegExp;
26119
26120 function isObject(arg) {
26121   return typeof arg === 'object' && arg !== null;
26122 }
26123 exports.isObject = isObject;
26124
26125 function isDate(d) {
26126   return objectToString(d) === '[object Date]';
26127 }
26128 exports.isDate = isDate;
26129
26130 function isError(e) {
26131   return (objectToString(e) === '[object Error]' || e instanceof Error);
26132 }
26133 exports.isError = isError;
26134
26135 function isFunction(arg) {
26136   return typeof arg === 'function';
26137 }
26138 exports.isFunction = isFunction;
26139
26140 function isPrimitive(arg) {
26141   return arg === null ||
26142          typeof arg === 'boolean' ||
26143          typeof arg === 'number' ||
26144          typeof arg === 'string' ||
26145          typeof arg === 'symbol' ||  // ES6 symbol
26146          typeof arg === 'undefined';
26147 }
26148 exports.isPrimitive = isPrimitive;
26149
26150 exports.isBuffer = Buffer.isBuffer;
26151
26152 function objectToString(o) {
26153   return Object.prototype.toString.call(o);
26154 }
26155
26156
26157 /***/ }),
26158 /* 174 */
26159 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26160
26161 "use strict";
26162
26163
26164 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26165
26166 var Buffer = __webpack_require__(172).Buffer;
26167 var util = __webpack_require__(50);
26168
26169 function copyBuffer(src, target, offset) {
26170   src.copy(target, offset);
26171 }
26172
26173 module.exports = function () {
26174   function BufferList() {
26175     _classCallCheck(this, BufferList);
26176
26177     this.head = null;
26178     this.tail = null;
26179     this.length = 0;
26180   }
26181
26182   BufferList.prototype.push = function push(v) {
26183     var entry = { data: v, next: null };
26184     if (this.length > 0) this.tail.next = entry;else this.head = entry;
26185     this.tail = entry;
26186     ++this.length;
26187   };
26188
26189   BufferList.prototype.unshift = function unshift(v) {
26190     var entry = { data: v, next: this.head };
26191     if (this.length === 0) this.tail = entry;
26192     this.head = entry;
26193     ++this.length;
26194   };
26195
26196   BufferList.prototype.shift = function shift() {
26197     if (this.length === 0) return;
26198     var ret = this.head.data;
26199     if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
26200     --this.length;
26201     return ret;
26202   };
26203
26204   BufferList.prototype.clear = function clear() {
26205     this.head = this.tail = null;
26206     this.length = 0;
26207   };
26208
26209   BufferList.prototype.join = function join(s) {
26210     if (this.length === 0) return '';
26211     var p = this.head;
26212     var ret = '' + p.data;
26213     while (p = p.next) {
26214       ret += s + p.data;
26215     }return ret;
26216   };
26217
26218   BufferList.prototype.concat = function concat(n) {
26219     if (this.length === 0) return Buffer.alloc(0);
26220     if (this.length === 1) return this.head.data;
26221     var ret = Buffer.allocUnsafe(n >>> 0);
26222     var p = this.head;
26223     var i = 0;
26224     while (p) {
26225       copyBuffer(p.data, ret, i);
26226       i += p.data.length;
26227       p = p.next;
26228     }
26229     return ret;
26230   };
26231
26232   return BufferList;
26233 }();
26234
26235 if (util && util.inspect && util.inspect.custom) {
26236   module.exports.prototype[util.inspect.custom] = function () {
26237     var obj = util.inspect({ length: this.length });
26238     return this.constructor.name + ' ' + obj;
26239   };
26240 }
26241
26242 /***/ }),
26243 /* 175 */
26244 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26245
26246 "use strict";
26247
26248
26249 /*<replacement>*/
26250
26251 var pna = __webpack_require__(169);
26252 /*</replacement>*/
26253
26254 // undocumented cb() API, needed for core, not for public API
26255 function destroy(err, cb) {
26256   var _this = this;
26257
26258   var readableDestroyed = this._readableState && this._readableState.destroyed;
26259   var writableDestroyed = this._writableState && this._writableState.destroyed;
26260
26261   if (readableDestroyed || writableDestroyed) {
26262     if (cb) {
26263       cb(err);
26264     } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
26265       pna.nextTick(emitErrorNT, this, err);
26266     }
26267     return this;
26268   }
26269
26270   // we set destroyed to true before firing error callbacks in order
26271   // to make it re-entrance safe in case destroy() is called within callbacks
26272
26273   if (this._readableState) {
26274     this._readableState.destroyed = true;
26275   }
26276
26277   // if this is a duplex stream mark the writable part as destroyed as well
26278   if (this._writableState) {
26279     this._writableState.destroyed = true;
26280   }
26281
26282   this._destroy(err || null, function (err) {
26283     if (!cb && err) {
26284       pna.nextTick(emitErrorNT, _this, err);
26285       if (_this._writableState) {
26286         _this._writableState.errorEmitted = true;
26287       }
26288     } else if (cb) {
26289       cb(err);
26290     }
26291   });
26292
26293   return this;
26294 }
26295
26296 function undestroy() {
26297   if (this._readableState) {
26298     this._readableState.destroyed = false;
26299     this._readableState.reading = false;
26300     this._readableState.ended = false;
26301     this._readableState.endEmitted = false;
26302   }
26303
26304   if (this._writableState) {
26305     this._writableState.destroyed = false;
26306     this._writableState.ended = false;
26307     this._writableState.ending = false;
26308     this._writableState.finished = false;
26309     this._writableState.errorEmitted = false;
26310   }
26311 }
26312
26313 function emitErrorNT(self, err) {
26314   self.emit('error', err);
26315 }
26316
26317 module.exports = {
26318   destroy: destroy,
26319   undestroy: undestroy
26320 };
26321
26322 /***/ }),
26323 /* 176 */
26324 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26325
26326 "use strict";
26327 // Copyright Joyent, Inc. and other Node contributors.
26328 //
26329 // Permission is hereby granted, free of charge, to any person obtaining a
26330 // copy of this software and associated documentation files (the
26331 // "Software"), to deal in the Software without restriction, including
26332 // without limitation the rights to use, copy, modify, merge, publish,
26333 // distribute, sublicense, and/or sell copies of the Software, and to permit
26334 // persons to whom the Software is furnished to do so, subject to the
26335 // following conditions:
26336 //
26337 // The above copyright notice and this permission notice shall be included
26338 // in all copies or substantial portions of the Software.
26339 //
26340 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26341 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26342 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26343 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26344 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26345 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26346 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26347
26348 // a duplex stream is just a stream that is both readable and writable.
26349 // Since JS doesn't have multiple prototypal inheritance, this class
26350 // prototypally inherits from Readable, and then parasitically from
26351 // Writable.
26352
26353
26354
26355 /*<replacement>*/
26356
26357 var pna = __webpack_require__(169);
26358 /*</replacement>*/
26359
26360 /*<replacement>*/
26361 var objectKeys = Object.keys || function (obj) {
26362   var keys = [];
26363   for (var key in obj) {
26364     keys.push(key);
26365   }return keys;
26366 };
26367 /*</replacement>*/
26368
26369 module.exports = Duplex;
26370
26371 /*<replacement>*/
26372 var util = Object.create(__webpack_require__(173));
26373 util.inherits = __webpack_require__(66);
26374 /*</replacement>*/
26375
26376 var Readable = __webpack_require__(168);
26377 var Writable = __webpack_require__(177);
26378
26379 util.inherits(Duplex, Readable);
26380
26381 {
26382   // avoid scope creep, the keys array can then be collected
26383   var keys = objectKeys(Writable.prototype);
26384   for (var v = 0; v < keys.length; v++) {
26385     var method = keys[v];
26386     if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
26387   }
26388 }
26389
26390 function Duplex(options) {
26391   if (!(this instanceof Duplex)) return new Duplex(options);
26392
26393   Readable.call(this, options);
26394   Writable.call(this, options);
26395
26396   if (options && options.readable === false) this.readable = false;
26397
26398   if (options && options.writable === false) this.writable = false;
26399
26400   this.allowHalfOpen = true;
26401   if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
26402
26403   this.once('end', onend);
26404 }
26405
26406 Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
26407   // making it explicit this property is not enumerable
26408   // because otherwise some prototype manipulation in
26409   // userland will fail
26410   enumerable: false,
26411   get: function () {
26412     return this._writableState.highWaterMark;
26413   }
26414 });
26415
26416 // the no-half-open enforcer
26417 function onend() {
26418   // if we allow half-open state, or if the writable side ended,
26419   // then we're ok.
26420   if (this.allowHalfOpen || this._writableState.ended) return;
26421
26422   // no more data can be written.
26423   // But allow more writes to happen in this tick.
26424   pna.nextTick(onEndNT, this);
26425 }
26426
26427 function onEndNT(self) {
26428   self.end();
26429 }
26430
26431 Object.defineProperty(Duplex.prototype, 'destroyed', {
26432   get: function () {
26433     if (this._readableState === undefined || this._writableState === undefined) {
26434       return false;
26435     }
26436     return this._readableState.destroyed && this._writableState.destroyed;
26437   },
26438   set: function (value) {
26439     // we ignore the value if the stream
26440     // has not been initialized yet
26441     if (this._readableState === undefined || this._writableState === undefined) {
26442       return;
26443     }
26444
26445     // backward compatibility, the user is explicitly
26446     // managing destroyed
26447     this._readableState.destroyed = value;
26448     this._writableState.destroyed = value;
26449   }
26450 });
26451
26452 Duplex.prototype._destroy = function (err, cb) {
26453   this.push(null);
26454   this.end();
26455
26456   pna.nextTick(cb, err);
26457 };
26458
26459 /***/ }),
26460 /* 177 */
26461 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26462
26463 "use strict";
26464 // Copyright Joyent, Inc. and other Node contributors.
26465 //
26466 // Permission is hereby granted, free of charge, to any person obtaining a
26467 // copy of this software and associated documentation files (the
26468 // "Software"), to deal in the Software without restriction, including
26469 // without limitation the rights to use, copy, modify, merge, publish,
26470 // distribute, sublicense, and/or sell copies of the Software, and to permit
26471 // persons to whom the Software is furnished to do so, subject to the
26472 // following conditions:
26473 //
26474 // The above copyright notice and this permission notice shall be included
26475 // in all copies or substantial portions of the Software.
26476 //
26477 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26478 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26479 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26480 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26481 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26482 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26483 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26484
26485 // A bit simpler than readable streams.
26486 // Implement an async ._write(chunk, encoding, cb), and it'll handle all
26487 // the drain event emission and buffering.
26488
26489
26490
26491 /*<replacement>*/
26492
26493 var pna = __webpack_require__(169);
26494 /*</replacement>*/
26495
26496 module.exports = Writable;
26497
26498 /* <replacement> */
26499 function WriteReq(chunk, encoding, cb) {
26500   this.chunk = chunk;
26501   this.encoding = encoding;
26502   this.callback = cb;
26503   this.next = null;
26504 }
26505
26506 // It seems a linked list but it is not
26507 // there will be only 2 of these for each stream
26508 function CorkedRequest(state) {
26509   var _this = this;
26510
26511   this.next = null;
26512   this.entry = null;
26513   this.finish = function () {
26514     onCorkedFinish(_this, state);
26515   };
26516 }
26517 /* </replacement> */
26518
26519 /*<replacement>*/
26520 var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
26521 /*</replacement>*/
26522
26523 /*<replacement>*/
26524 var Duplex;
26525 /*</replacement>*/
26526
26527 Writable.WritableState = WritableState;
26528
26529 /*<replacement>*/
26530 var util = Object.create(__webpack_require__(173));
26531 util.inherits = __webpack_require__(66);
26532 /*</replacement>*/
26533
26534 /*<replacement>*/
26535 var internalUtil = {
26536   deprecate: __webpack_require__(178)
26537 };
26538 /*</replacement>*/
26539
26540 /*<replacement>*/
26541 var Stream = __webpack_require__(171);
26542 /*</replacement>*/
26543
26544 /*<replacement>*/
26545
26546 var Buffer = __webpack_require__(172).Buffer;
26547 var OurUint8Array = global.Uint8Array || function () {};
26548 function _uint8ArrayToBuffer(chunk) {
26549   return Buffer.from(chunk);
26550 }
26551 function _isUint8Array(obj) {
26552   return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
26553 }
26554
26555 /*</replacement>*/
26556
26557 var destroyImpl = __webpack_require__(175);
26558
26559 util.inherits(Writable, Stream);
26560
26561 function nop() {}
26562
26563 function WritableState(options, stream) {
26564   Duplex = Duplex || __webpack_require__(176);
26565
26566   options = options || {};
26567
26568   // Duplex streams are both readable and writable, but share
26569   // the same options object.
26570   // However, some cases require setting options to different
26571   // values for the readable and the writable sides of the duplex stream.
26572   // These options can be provided separately as readableXXX and writableXXX.
26573   var isDuplex = stream instanceof Duplex;
26574
26575   // object stream flag to indicate whether or not this stream
26576   // contains buffers or objects.
26577   this.objectMode = !!options.objectMode;
26578
26579   if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
26580
26581   // the point at which write() starts returning false
26582   // Note: 0 is a valid value, means that we always return false if
26583   // the entire buffer is not flushed immediately on write()
26584   var hwm = options.highWaterMark;
26585   var writableHwm = options.writableHighWaterMark;
26586   var defaultHwm = this.objectMode ? 16 : 16 * 1024;
26587
26588   if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
26589
26590   // cast to ints.
26591   this.highWaterMark = Math.floor(this.highWaterMark);
26592
26593   // if _final has been called
26594   this.finalCalled = false;
26595
26596   // drain event flag.
26597   this.needDrain = false;
26598   // at the start of calling end()
26599   this.ending = false;
26600   // when end() has been called, and returned
26601   this.ended = false;
26602   // when 'finish' is emitted
26603   this.finished = false;
26604
26605   // has it been destroyed
26606   this.destroyed = false;
26607
26608   // should we decode strings into buffers before passing to _write?
26609   // this is here so that some node-core streams can optimize string
26610   // handling at a lower level.
26611   var noDecode = options.decodeStrings === false;
26612   this.decodeStrings = !noDecode;
26613
26614   // Crypto is kind of old and crusty.  Historically, its default string
26615   // encoding is 'binary' so we have to make this configurable.
26616   // Everything else in the universe uses 'utf8', though.
26617   this.defaultEncoding = options.defaultEncoding || 'utf8';
26618
26619   // not an actual buffer we keep track of, but a measurement
26620   // of how much we're waiting to get pushed to some underlying
26621   // socket or file.
26622   this.length = 0;
26623
26624   // a flag to see when we're in the middle of a write.
26625   this.writing = false;
26626
26627   // when true all writes will be buffered until .uncork() call
26628   this.corked = 0;
26629
26630   // a flag to be able to tell if the onwrite cb is called immediately,
26631   // or on a later tick.  We set this to true at first, because any
26632   // actions that shouldn't happen until "later" should generally also
26633   // not happen before the first write call.
26634   this.sync = true;
26635
26636   // a flag to know if we're processing previously buffered items, which
26637   // may call the _write() callback in the same tick, so that we don't
26638   // end up in an overlapped onwrite situation.
26639   this.bufferProcessing = false;
26640
26641   // the callback that's passed to _write(chunk,cb)
26642   this.onwrite = function (er) {
26643     onwrite(stream, er);
26644   };
26645
26646   // the callback that the user supplies to write(chunk,encoding,cb)
26647   this.writecb = null;
26648
26649   // the amount that is being written when _write is called.
26650   this.writelen = 0;
26651
26652   this.bufferedRequest = null;
26653   this.lastBufferedRequest = null;
26654
26655   // number of pending user-supplied write callbacks
26656   // this must be 0 before 'finish' can be emitted
26657   this.pendingcb = 0;
26658
26659   // emit prefinish if the only thing we're waiting for is _write cbs
26660   // This is relevant for synchronous Transform streams
26661   this.prefinished = false;
26662
26663   // True if the error was already emitted and should not be thrown again
26664   this.errorEmitted = false;
26665
26666   // count buffered requests
26667   this.bufferedRequestCount = 0;
26668
26669   // allocate the first CorkedRequest, there is always
26670   // one allocated and free to use, and we maintain at most two
26671   this.corkedRequestsFree = new CorkedRequest(this);
26672 }
26673
26674 WritableState.prototype.getBuffer = function getBuffer() {
26675   var current = this.bufferedRequest;
26676   var out = [];
26677   while (current) {
26678     out.push(current);
26679     current = current.next;
26680   }
26681   return out;
26682 };
26683
26684 (function () {
26685   try {
26686     Object.defineProperty(WritableState.prototype, 'buffer', {
26687       get: internalUtil.deprecate(function () {
26688         return this.getBuffer();
26689       }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
26690     });
26691   } catch (_) {}
26692 })();
26693
26694 // Test _writableState for inheritance to account for Duplex streams,
26695 // whose prototype chain only points to Readable.
26696 var realHasInstance;
26697 if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
26698   realHasInstance = Function.prototype[Symbol.hasInstance];
26699   Object.defineProperty(Writable, Symbol.hasInstance, {
26700     value: function (object) {
26701       if (realHasInstance.call(this, object)) return true;
26702       if (this !== Writable) return false;
26703
26704       return object && object._writableState instanceof WritableState;
26705     }
26706   });
26707 } else {
26708   realHasInstance = function (object) {
26709     return object instanceof this;
26710   };
26711 }
26712
26713 function Writable(options) {
26714   Duplex = Duplex || __webpack_require__(176);
26715
26716   // Writable ctor is applied to Duplexes, too.
26717   // `realHasInstance` is necessary because using plain `instanceof`
26718   // would return false, as no `_writableState` property is attached.
26719
26720   // Trying to use the custom `instanceof` for Writable here will also break the
26721   // Node.js LazyTransform implementation, which has a non-trivial getter for
26722   // `_writableState` that would lead to infinite recursion.
26723   if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
26724     return new Writable(options);
26725   }
26726
26727   this._writableState = new WritableState(options, this);
26728
26729   // legacy.
26730   this.writable = true;
26731
26732   if (options) {
26733     if (typeof options.write === 'function') this._write = options.write;
26734
26735     if (typeof options.writev === 'function') this._writev = options.writev;
26736
26737     if (typeof options.destroy === 'function') this._destroy = options.destroy;
26738
26739     if (typeof options.final === 'function') this._final = options.final;
26740   }
26741
26742   Stream.call(this);
26743 }
26744
26745 // Otherwise people can pipe Writable streams, which is just wrong.
26746 Writable.prototype.pipe = function () {
26747   this.emit('error', new Error('Cannot pipe, not readable'));
26748 };
26749
26750 function writeAfterEnd(stream, cb) {
26751   var er = new Error('write after end');
26752   // TODO: defer error events consistently everywhere, not just the cb
26753   stream.emit('error', er);
26754   pna.nextTick(cb, er);
26755 }
26756
26757 // Checks that a user-supplied chunk is valid, especially for the particular
26758 // mode the stream is in. Currently this means that `null` is never accepted
26759 // and undefined/non-string values are only allowed in object mode.
26760 function validChunk(stream, state, chunk, cb) {
26761   var valid = true;
26762   var er = false;
26763
26764   if (chunk === null) {
26765     er = new TypeError('May not write null values to stream');
26766   } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
26767     er = new TypeError('Invalid non-string/buffer chunk');
26768   }
26769   if (er) {
26770     stream.emit('error', er);
26771     pna.nextTick(cb, er);
26772     valid = false;
26773   }
26774   return valid;
26775 }
26776
26777 Writable.prototype.write = function (chunk, encoding, cb) {
26778   var state = this._writableState;
26779   var ret = false;
26780   var isBuf = !state.objectMode && _isUint8Array(chunk);
26781
26782   if (isBuf && !Buffer.isBuffer(chunk)) {
26783     chunk = _uint8ArrayToBuffer(chunk);
26784   }
26785
26786   if (typeof encoding === 'function') {
26787     cb = encoding;
26788     encoding = null;
26789   }
26790
26791   if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
26792
26793   if (typeof cb !== 'function') cb = nop;
26794
26795   if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
26796     state.pendingcb++;
26797     ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
26798   }
26799
26800   return ret;
26801 };
26802
26803 Writable.prototype.cork = function () {
26804   var state = this._writableState;
26805
26806   state.corked++;
26807 };
26808
26809 Writable.prototype.uncork = function () {
26810   var state = this._writableState;
26811
26812   if (state.corked) {
26813     state.corked--;
26814
26815     if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
26816   }
26817 };
26818
26819 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
26820   // node::ParseEncoding() requires lower case.
26821   if (typeof encoding === 'string') encoding = encoding.toLowerCase();
26822   if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
26823   this._writableState.defaultEncoding = encoding;
26824   return this;
26825 };
26826
26827 function decodeChunk(state, chunk, encoding) {
26828   if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
26829     chunk = Buffer.from(chunk, encoding);
26830   }
26831   return chunk;
26832 }
26833
26834 Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
26835   // making it explicit this property is not enumerable
26836   // because otherwise some prototype manipulation in
26837   // userland will fail
26838   enumerable: false,
26839   get: function () {
26840     return this._writableState.highWaterMark;
26841   }
26842 });
26843
26844 // if we're already writing something, then just put this
26845 // in the queue, and wait our turn.  Otherwise, call _write
26846 // If we return false, then we need a drain event, so set that flag.
26847 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
26848   if (!isBuf) {
26849     var newChunk = decodeChunk(state, chunk, encoding);
26850     if (chunk !== newChunk) {
26851       isBuf = true;
26852       encoding = 'buffer';
26853       chunk = newChunk;
26854     }
26855   }
26856   var len = state.objectMode ? 1 : chunk.length;
26857
26858   state.length += len;
26859
26860   var ret = state.length < state.highWaterMark;
26861   // we must ensure that previous needDrain will not be reset to false.
26862   if (!ret) state.needDrain = true;
26863
26864   if (state.writing || state.corked) {
26865     var last = state.lastBufferedRequest;
26866     state.lastBufferedRequest = {
26867       chunk: chunk,
26868       encoding: encoding,
26869       isBuf: isBuf,
26870       callback: cb,
26871       next: null
26872     };
26873     if (last) {
26874       last.next = state.lastBufferedRequest;
26875     } else {
26876       state.bufferedRequest = state.lastBufferedRequest;
26877     }
26878     state.bufferedRequestCount += 1;
26879   } else {
26880     doWrite(stream, state, false, len, chunk, encoding, cb);
26881   }
26882
26883   return ret;
26884 }
26885
26886 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
26887   state.writelen = len;
26888   state.writecb = cb;
26889   state.writing = true;
26890   state.sync = true;
26891   if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
26892   state.sync = false;
26893 }
26894
26895 function onwriteError(stream, state, sync, er, cb) {
26896   --state.pendingcb;
26897
26898   if (sync) {
26899     // defer the callback if we are being called synchronously
26900     // to avoid piling up things on the stack
26901     pna.nextTick(cb, er);
26902     // this can emit finish, and it will always happen
26903     // after error
26904     pna.nextTick(finishMaybe, stream, state);
26905     stream._writableState.errorEmitted = true;
26906     stream.emit('error', er);
26907   } else {
26908     // the caller expect this to happen before if
26909     // it is async
26910     cb(er);
26911     stream._writableState.errorEmitted = true;
26912     stream.emit('error', er);
26913     // this can emit finish, but finish must
26914     // always follow error
26915     finishMaybe(stream, state);
26916   }
26917 }
26918
26919 function onwriteStateUpdate(state) {
26920   state.writing = false;
26921   state.writecb = null;
26922   state.length -= state.writelen;
26923   state.writelen = 0;
26924 }
26925
26926 function onwrite(stream, er) {
26927   var state = stream._writableState;
26928   var sync = state.sync;
26929   var cb = state.writecb;
26930
26931   onwriteStateUpdate(state);
26932
26933   if (er) onwriteError(stream, state, sync, er, cb);else {
26934     // Check if we're actually ready to finish, but don't emit yet
26935     var finished = needFinish(state);
26936
26937     if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
26938       clearBuffer(stream, state);
26939     }
26940
26941     if (sync) {
26942       /*<replacement>*/
26943       asyncWrite(afterWrite, stream, state, finished, cb);
26944       /*</replacement>*/
26945     } else {
26946       afterWrite(stream, state, finished, cb);
26947     }
26948   }
26949 }
26950
26951 function afterWrite(stream, state, finished, cb) {
26952   if (!finished) onwriteDrain(stream, state);
26953   state.pendingcb--;
26954   cb();
26955   finishMaybe(stream, state);
26956 }
26957
26958 // Must force callback to be called on nextTick, so that we don't
26959 // emit 'drain' before the write() consumer gets the 'false' return
26960 // value, and has a chance to attach a 'drain' listener.
26961 function onwriteDrain(stream, state) {
26962   if (state.length === 0 && state.needDrain) {
26963     state.needDrain = false;
26964     stream.emit('drain');
26965   }
26966 }
26967
26968 // if there's something in the buffer waiting, then process it
26969 function clearBuffer(stream, state) {
26970   state.bufferProcessing = true;
26971   var entry = state.bufferedRequest;
26972
26973   if (stream._writev && entry && entry.next) {
26974     // Fast case, write everything using _writev()
26975     var l = state.bufferedRequestCount;
26976     var buffer = new Array(l);
26977     var holder = state.corkedRequestsFree;
26978     holder.entry = entry;
26979
26980     var count = 0;
26981     var allBuffers = true;
26982     while (entry) {
26983       buffer[count] = entry;
26984       if (!entry.isBuf) allBuffers = false;
26985       entry = entry.next;
26986       count += 1;
26987     }
26988     buffer.allBuffers = allBuffers;
26989
26990     doWrite(stream, state, true, state.length, buffer, '', holder.finish);
26991
26992     // doWrite is almost always async, defer these to save a bit of time
26993     // as the hot path ends with doWrite
26994     state.pendingcb++;
26995     state.lastBufferedRequest = null;
26996     if (holder.next) {
26997       state.corkedRequestsFree = holder.next;
26998       holder.next = null;
26999     } else {
27000       state.corkedRequestsFree = new CorkedRequest(state);
27001     }
27002     state.bufferedRequestCount = 0;
27003   } else {
27004     // Slow case, write chunks one-by-one
27005     while (entry) {
27006       var chunk = entry.chunk;
27007       var encoding = entry.encoding;
27008       var cb = entry.callback;
27009       var len = state.objectMode ? 1 : chunk.length;
27010
27011       doWrite(stream, state, false, len, chunk, encoding, cb);
27012       entry = entry.next;
27013       state.bufferedRequestCount--;
27014       // if we didn't call the onwrite immediately, then
27015       // it means that we need to wait until it does.
27016       // also, that means that the chunk and cb are currently
27017       // being processed, so move the buffer counter past them.
27018       if (state.writing) {
27019         break;
27020       }
27021     }
27022
27023     if (entry === null) state.lastBufferedRequest = null;
27024   }
27025
27026   state.bufferedRequest = entry;
27027   state.bufferProcessing = false;
27028 }
27029
27030 Writable.prototype._write = function (chunk, encoding, cb) {
27031   cb(new Error('_write() is not implemented'));
27032 };
27033
27034 Writable.prototype._writev = null;
27035
27036 Writable.prototype.end = function (chunk, encoding, cb) {
27037   var state = this._writableState;
27038
27039   if (typeof chunk === 'function') {
27040     cb = chunk;
27041     chunk = null;
27042     encoding = null;
27043   } else if (typeof encoding === 'function') {
27044     cb = encoding;
27045     encoding = null;
27046   }
27047
27048   if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
27049
27050   // .end() fully uncorks
27051   if (state.corked) {
27052     state.corked = 1;
27053     this.uncork();
27054   }
27055
27056   // ignore unnecessary end() calls.
27057   if (!state.ending && !state.finished) endWritable(this, state, cb);
27058 };
27059
27060 function needFinish(state) {
27061   return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
27062 }
27063 function callFinal(stream, state) {
27064   stream._final(function (err) {
27065     state.pendingcb--;
27066     if (err) {
27067       stream.emit('error', err);
27068     }
27069     state.prefinished = true;
27070     stream.emit('prefinish');
27071     finishMaybe(stream, state);
27072   });
27073 }
27074 function prefinish(stream, state) {
27075   if (!state.prefinished && !state.finalCalled) {
27076     if (typeof stream._final === 'function') {
27077       state.pendingcb++;
27078       state.finalCalled = true;
27079       pna.nextTick(callFinal, stream, state);
27080     } else {
27081       state.prefinished = true;
27082       stream.emit('prefinish');
27083     }
27084   }
27085 }
27086
27087 function finishMaybe(stream, state) {
27088   var need = needFinish(state);
27089   if (need) {
27090     prefinish(stream, state);
27091     if (state.pendingcb === 0) {
27092       state.finished = true;
27093       stream.emit('finish');
27094     }
27095   }
27096   return need;
27097 }
27098
27099 function endWritable(stream, state, cb) {
27100   state.ending = true;
27101   finishMaybe(stream, state);
27102   if (cb) {
27103     if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
27104   }
27105   state.ended = true;
27106   stream.writable = false;
27107 }
27108
27109 function onCorkedFinish(corkReq, state, err) {
27110   var entry = corkReq.entry;
27111   corkReq.entry = null;
27112   while (entry) {
27113     var cb = entry.callback;
27114     state.pendingcb--;
27115     cb(err);
27116     entry = entry.next;
27117   }
27118   if (state.corkedRequestsFree) {
27119     state.corkedRequestsFree.next = corkReq;
27120   } else {
27121     state.corkedRequestsFree = corkReq;
27122   }
27123 }
27124
27125 Object.defineProperty(Writable.prototype, 'destroyed', {
27126   get: function () {
27127     if (this._writableState === undefined) {
27128       return false;
27129     }
27130     return this._writableState.destroyed;
27131   },
27132   set: function (value) {
27133     // we ignore the value if the stream
27134     // has not been initialized yet
27135     if (!this._writableState) {
27136       return;
27137     }
27138
27139     // backward compatibility, the user is explicitly
27140     // managing destroyed
27141     this._writableState.destroyed = value;
27142   }
27143 });
27144
27145 Writable.prototype.destroy = destroyImpl.destroy;
27146 Writable.prototype._undestroy = destroyImpl.undestroy;
27147 Writable.prototype._destroy = function (err, cb) {
27148   this.end();
27149   cb(err);
27150 };
27151
27152 /***/ }),
27153 /* 178 */
27154 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27155
27156
27157 /**
27158  * For Node.js, simply re-export the core `util.deprecate` function.
27159  */
27160
27161 module.exports = __webpack_require__(50).deprecate;
27162
27163
27164 /***/ }),
27165 /* 179 */
27166 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27167
27168 "use strict";
27169 // Copyright Joyent, Inc. and other Node contributors.
27170 //
27171 // Permission is hereby granted, free of charge, to any person obtaining a
27172 // copy of this software and associated documentation files (the
27173 // "Software"), to deal in the Software without restriction, including
27174 // without limitation the rights to use, copy, modify, merge, publish,
27175 // distribute, sublicense, and/or sell copies of the Software, and to permit
27176 // persons to whom the Software is furnished to do so, subject to the
27177 // following conditions:
27178 //
27179 // The above copyright notice and this permission notice shall be included
27180 // in all copies or substantial portions of the Software.
27181 //
27182 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27183 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27184 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27185 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27186 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27187 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27188 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27189
27190
27191
27192 /*<replacement>*/
27193
27194 var Buffer = __webpack_require__(172).Buffer;
27195 /*</replacement>*/
27196
27197 var isEncoding = Buffer.isEncoding || function (encoding) {
27198   encoding = '' + encoding;
27199   switch (encoding && encoding.toLowerCase()) {
27200     case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
27201       return true;
27202     default:
27203       return false;
27204   }
27205 };
27206
27207 function _normalizeEncoding(enc) {
27208   if (!enc) return 'utf8';
27209   var retried;
27210   while (true) {
27211     switch (enc) {
27212       case 'utf8':
27213       case 'utf-8':
27214         return 'utf8';
27215       case 'ucs2':
27216       case 'ucs-2':
27217       case 'utf16le':
27218       case 'utf-16le':
27219         return 'utf16le';
27220       case 'latin1':
27221       case 'binary':
27222         return 'latin1';
27223       case 'base64':
27224       case 'ascii':
27225       case 'hex':
27226         return enc;
27227       default:
27228         if (retried) return; // undefined
27229         enc = ('' + enc).toLowerCase();
27230         retried = true;
27231     }
27232   }
27233 };
27234
27235 // Do not cache `Buffer.isEncoding` when checking encoding names as some
27236 // modules monkey-patch it to support additional encodings
27237 function normalizeEncoding(enc) {
27238   var nenc = _normalizeEncoding(enc);
27239   if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
27240   return nenc || enc;
27241 }
27242
27243 // StringDecoder provides an interface for efficiently splitting a series of
27244 // buffers into a series of JS strings without breaking apart multi-byte
27245 // characters.
27246 exports.StringDecoder = StringDecoder;
27247 function StringDecoder(encoding) {
27248   this.encoding = normalizeEncoding(encoding);
27249   var nb;
27250   switch (this.encoding) {
27251     case 'utf16le':
27252       this.text = utf16Text;
27253       this.end = utf16End;
27254       nb = 4;
27255       break;
27256     case 'utf8':
27257       this.fillLast = utf8FillLast;
27258       nb = 4;
27259       break;
27260     case 'base64':
27261       this.text = base64Text;
27262       this.end = base64End;
27263       nb = 3;
27264       break;
27265     default:
27266       this.write = simpleWrite;
27267       this.end = simpleEnd;
27268       return;
27269   }
27270   this.lastNeed = 0;
27271   this.lastTotal = 0;
27272   this.lastChar = Buffer.allocUnsafe(nb);
27273 }
27274
27275 StringDecoder.prototype.write = function (buf) {
27276   if (buf.length === 0) return '';
27277   var r;
27278   var i;
27279   if (this.lastNeed) {
27280     r = this.fillLast(buf);
27281     if (r === undefined) return '';
27282     i = this.lastNeed;
27283     this.lastNeed = 0;
27284   } else {
27285     i = 0;
27286   }
27287   if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
27288   return r || '';
27289 };
27290
27291 StringDecoder.prototype.end = utf8End;
27292
27293 // Returns only complete characters in a Buffer
27294 StringDecoder.prototype.text = utf8Text;
27295
27296 // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
27297 StringDecoder.prototype.fillLast = function (buf) {
27298   if (this.lastNeed <= buf.length) {
27299     buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
27300     return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27301   }
27302   buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
27303   this.lastNeed -= buf.length;
27304 };
27305
27306 // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
27307 // continuation byte. If an invalid byte is detected, -2 is returned.
27308 function utf8CheckByte(byte) {
27309   if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
27310   return byte >> 6 === 0x02 ? -1 : -2;
27311 }
27312
27313 // Checks at most 3 bytes at the end of a Buffer in order to detect an
27314 // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
27315 // needed to complete the UTF-8 character (if applicable) are returned.
27316 function utf8CheckIncomplete(self, buf, i) {
27317   var j = buf.length - 1;
27318   if (j < i) return 0;
27319   var nb = utf8CheckByte(buf[j]);
27320   if (nb >= 0) {
27321     if (nb > 0) self.lastNeed = nb - 1;
27322     return nb;
27323   }
27324   if (--j < i || nb === -2) return 0;
27325   nb = utf8CheckByte(buf[j]);
27326   if (nb >= 0) {
27327     if (nb > 0) self.lastNeed = nb - 2;
27328     return nb;
27329   }
27330   if (--j < i || nb === -2) return 0;
27331   nb = utf8CheckByte(buf[j]);
27332   if (nb >= 0) {
27333     if (nb > 0) {
27334       if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
27335     }
27336     return nb;
27337   }
27338   return 0;
27339 }
27340
27341 // Validates as many continuation bytes for a multi-byte UTF-8 character as
27342 // needed or are available. If we see a non-continuation byte where we expect
27343 // one, we "replace" the validated continuation bytes we've seen so far with
27344 // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
27345 // behavior. The continuation byte check is included three times in the case
27346 // where all of the continuation bytes for a character exist in the same buffer.
27347 // It is also done this way as a slight performance increase instead of using a
27348 // loop.
27349 function utf8CheckExtraBytes(self, buf, p) {
27350   if ((buf[0] & 0xC0) !== 0x80) {
27351     self.lastNeed = 0;
27352     return '\ufffd';
27353   }
27354   if (self.lastNeed > 1 && buf.length > 1) {
27355     if ((buf[1] & 0xC0) !== 0x80) {
27356       self.lastNeed = 1;
27357       return '\ufffd';
27358     }
27359     if (self.lastNeed > 2 && buf.length > 2) {
27360       if ((buf[2] & 0xC0) !== 0x80) {
27361         self.lastNeed = 2;
27362         return '\ufffd';
27363       }
27364     }
27365   }
27366 }
27367
27368 // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
27369 function utf8FillLast(buf) {
27370   var p = this.lastTotal - this.lastNeed;
27371   var r = utf8CheckExtraBytes(this, buf, p);
27372   if (r !== undefined) return r;
27373   if (this.lastNeed <= buf.length) {
27374     buf.copy(this.lastChar, p, 0, this.lastNeed);
27375     return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27376   }
27377   buf.copy(this.lastChar, p, 0, buf.length);
27378   this.lastNeed -= buf.length;
27379 }
27380
27381 // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
27382 // partial character, the character's bytes are buffered until the required
27383 // number of bytes are available.
27384 function utf8Text(buf, i) {
27385   var total = utf8CheckIncomplete(this, buf, i);
27386   if (!this.lastNeed) return buf.toString('utf8', i);
27387   this.lastTotal = total;
27388   var end = buf.length - (total - this.lastNeed);
27389   buf.copy(this.lastChar, 0, end);
27390   return buf.toString('utf8', i, end);
27391 }
27392
27393 // For UTF-8, a replacement character is added when ending on a partial
27394 // character.
27395 function utf8End(buf) {
27396   var r = buf && buf.length ? this.write(buf) : '';
27397   if (this.lastNeed) return r + '\ufffd';
27398   return r;
27399 }
27400
27401 // UTF-16LE typically needs two bytes per character, but even if we have an even
27402 // number of bytes available, we need to check if we end on a leading/high
27403 // surrogate. In that case, we need to wait for the next two bytes in order to
27404 // decode the last character properly.
27405 function utf16Text(buf, i) {
27406   if ((buf.length - i) % 2 === 0) {
27407     var r = buf.toString('utf16le', i);
27408     if (r) {
27409       var c = r.charCodeAt(r.length - 1);
27410       if (c >= 0xD800 && c <= 0xDBFF) {
27411         this.lastNeed = 2;
27412         this.lastTotal = 4;
27413         this.lastChar[0] = buf[buf.length - 2];
27414         this.lastChar[1] = buf[buf.length - 1];
27415         return r.slice(0, -1);
27416       }
27417     }
27418     return r;
27419   }
27420   this.lastNeed = 1;
27421   this.lastTotal = 2;
27422   this.lastChar[0] = buf[buf.length - 1];
27423   return buf.toString('utf16le', i, buf.length - 1);
27424 }
27425
27426 // For UTF-16LE we do not explicitly append special replacement characters if we
27427 // end on a partial character, we simply let v8 handle that.
27428 function utf16End(buf) {
27429   var r = buf && buf.length ? this.write(buf) : '';
27430   if (this.lastNeed) {
27431     var end = this.lastTotal - this.lastNeed;
27432     return r + this.lastChar.toString('utf16le', 0, end);
27433   }
27434   return r;
27435 }
27436
27437 function base64Text(buf, i) {
27438   var n = (buf.length - i) % 3;
27439   if (n === 0) return buf.toString('base64', i);
27440   this.lastNeed = 3 - n;
27441   this.lastTotal = 3;
27442   if (n === 1) {
27443     this.lastChar[0] = buf[buf.length - 1];
27444   } else {
27445     this.lastChar[0] = buf[buf.length - 2];
27446     this.lastChar[1] = buf[buf.length - 1];
27447   }
27448   return buf.toString('base64', i, buf.length - n);
27449 }
27450
27451 function base64End(buf) {
27452   var r = buf && buf.length ? this.write(buf) : '';
27453   if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
27454   return r;
27455 }
27456
27457 // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
27458 function simpleWrite(buf) {
27459   return buf.toString(this.encoding);
27460 }
27461
27462 function simpleEnd(buf) {
27463   return buf && buf.length ? this.write(buf) : '';
27464 }
27465
27466 /***/ }),
27467 /* 180 */
27468 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27469
27470 "use strict";
27471 // Copyright Joyent, Inc. and other Node contributors.
27472 //
27473 // Permission is hereby granted, free of charge, to any person obtaining a
27474 // copy of this software and associated documentation files (the
27475 // "Software"), to deal in the Software without restriction, including
27476 // without limitation the rights to use, copy, modify, merge, publish,
27477 // distribute, sublicense, and/or sell copies of the Software, and to permit
27478 // persons to whom the Software is furnished to do so, subject to the
27479 // following conditions:
27480 //
27481 // The above copyright notice and this permission notice shall be included
27482 // in all copies or substantial portions of the Software.
27483 //
27484 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27485 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27486 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27487 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27488 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27489 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27490 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27491
27492 // a transform stream is a readable/writable stream where you do
27493 // something with the data.  Sometimes it's called a "filter",
27494 // but that's not a great name for it, since that implies a thing where
27495 // some bits pass through, and others are simply ignored.  (That would
27496 // be a valid example of a transform, of course.)
27497 //
27498 // While the output is causally related to the input, it's not a
27499 // necessarily symmetric or synchronous transformation.  For example,
27500 // a zlib stream might take multiple plain-text writes(), and then
27501 // emit a single compressed chunk some time in the future.
27502 //
27503 // Here's how this works:
27504 //
27505 // The Transform stream has all the aspects of the readable and writable
27506 // stream classes.  When you write(chunk), that calls _write(chunk,cb)
27507 // internally, and returns false if there's a lot of pending writes
27508 // buffered up.  When you call read(), that calls _read(n) until
27509 // there's enough pending readable data buffered up.
27510 //
27511 // In a transform stream, the written data is placed in a buffer.  When
27512 // _read(n) is called, it transforms the queued up data, calling the
27513 // buffered _write cb's as it consumes chunks.  If consuming a single
27514 // written chunk would result in multiple output chunks, then the first
27515 // outputted bit calls the readcb, and subsequent chunks just go into
27516 // the read buffer, and will cause it to emit 'readable' if necessary.
27517 //
27518 // This way, back-pressure is actually determined by the reading side,
27519 // since _read has to be called to start processing a new chunk.  However,
27520 // a pathological inflate type of transform can cause excessive buffering
27521 // here.  For example, imagine a stream where every byte of input is
27522 // interpreted as an integer from 0-255, and then results in that many
27523 // bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
27524 // 1kb of data being output.  In this case, you could write a very small
27525 // amount of input, and end up with a very large amount of output.  In
27526 // such a pathological inflating mechanism, there'd be no way to tell
27527 // the system to stop doing the transform.  A single 4MB write could
27528 // cause the system to run out of memory.
27529 //
27530 // However, even in such a pathological case, only a single written chunk
27531 // would be consumed, and then the rest would wait (un-transformed) until
27532 // the results of the previous transformed chunk were consumed.
27533
27534
27535
27536 module.exports = Transform;
27537
27538 var Duplex = __webpack_require__(176);
27539
27540 /*<replacement>*/
27541 var util = Object.create(__webpack_require__(173));
27542 util.inherits = __webpack_require__(66);
27543 /*</replacement>*/
27544
27545 util.inherits(Transform, Duplex);
27546
27547 function afterTransform(er, data) {
27548   var ts = this._transformState;
27549   ts.transforming = false;
27550
27551   var cb = ts.writecb;
27552
27553   if (!cb) {
27554     return this.emit('error', new Error('write callback called multiple times'));
27555   }
27556
27557   ts.writechunk = null;
27558   ts.writecb = null;
27559
27560   if (data != null) // single equals check for both `null` and `undefined`
27561     this.push(data);
27562
27563   cb(er);
27564
27565   var rs = this._readableState;
27566   rs.reading = false;
27567   if (rs.needReadable || rs.length < rs.highWaterMark) {
27568     this._read(rs.highWaterMark);
27569   }
27570 }
27571
27572 function Transform(options) {
27573   if (!(this instanceof Transform)) return new Transform(options);
27574
27575   Duplex.call(this, options);
27576
27577   this._transformState = {
27578     afterTransform: afterTransform.bind(this),
27579     needTransform: false,
27580     transforming: false,
27581     writecb: null,
27582     writechunk: null,
27583     writeencoding: null
27584   };
27585
27586   // start out asking for a readable event once data is transformed.
27587   this._readableState.needReadable = true;
27588
27589   // we have implemented the _read method, and done the other things
27590   // that Readable wants before the first _read call, so unset the
27591   // sync guard flag.
27592   this._readableState.sync = false;
27593
27594   if (options) {
27595     if (typeof options.transform === 'function') this._transform = options.transform;
27596
27597     if (typeof options.flush === 'function') this._flush = options.flush;
27598   }
27599
27600   // When the writable side finishes, then flush out anything remaining.
27601   this.on('prefinish', prefinish);
27602 }
27603
27604 function prefinish() {
27605   var _this = this;
27606
27607   if (typeof this._flush === 'function') {
27608     this._flush(function (er, data) {
27609       done(_this, er, data);
27610     });
27611   } else {
27612     done(this, null, null);
27613   }
27614 }
27615
27616 Transform.prototype.push = function (chunk, encoding) {
27617   this._transformState.needTransform = false;
27618   return Duplex.prototype.push.call(this, chunk, encoding);
27619 };
27620
27621 // This is the part where you do stuff!
27622 // override this function in implementation classes.
27623 // 'chunk' is an input chunk.
27624 //
27625 // Call `push(newChunk)` to pass along transformed output
27626 // to the readable side.  You may call 'push' zero or more times.
27627 //
27628 // Call `cb(err)` when you are done with this chunk.  If you pass
27629 // an error, then that'll put the hurt on the whole operation.  If you
27630 // never call cb(), then you'll never get another chunk.
27631 Transform.prototype._transform = function (chunk, encoding, cb) {
27632   throw new Error('_transform() is not implemented');
27633 };
27634
27635 Transform.prototype._write = function (chunk, encoding, cb) {
27636   var ts = this._transformState;
27637   ts.writecb = cb;
27638   ts.writechunk = chunk;
27639   ts.writeencoding = encoding;
27640   if (!ts.transforming) {
27641     var rs = this._readableState;
27642     if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
27643   }
27644 };
27645
27646 // Doesn't matter what the args are here.
27647 // _transform does all the work.
27648 // That we got here means that the readable side wants more data.
27649 Transform.prototype._read = function (n) {
27650   var ts = this._transformState;
27651
27652   if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
27653     ts.transforming = true;
27654     this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
27655   } else {
27656     // mark that we need a transform, so that any data that comes in
27657     // will get processed, now that we've asked for it.
27658     ts.needTransform = true;
27659   }
27660 };
27661
27662 Transform.prototype._destroy = function (err, cb) {
27663   var _this2 = this;
27664
27665   Duplex.prototype._destroy.call(this, err, function (err2) {
27666     cb(err2);
27667     _this2.emit('close');
27668   });
27669 };
27670
27671 function done(stream, er, data) {
27672   if (er) return stream.emit('error', er);
27673
27674   if (data != null) // single equals check for both `null` and `undefined`
27675     stream.push(data);
27676
27677   // if there's nothing in the write buffer, then that means
27678   // that nothing more will ever be provided
27679   if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
27680
27681   if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
27682
27683   return stream.push(null);
27684 }
27685
27686 /***/ }),
27687 /* 181 */
27688 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27689
27690 "use strict";
27691 // Copyright Joyent, Inc. and other Node contributors.
27692 //
27693 // Permission is hereby granted, free of charge, to any person obtaining a
27694 // copy of this software and associated documentation files (the
27695 // "Software"), to deal in the Software without restriction, including
27696 // without limitation the rights to use, copy, modify, merge, publish,
27697 // distribute, sublicense, and/or sell copies of the Software, and to permit
27698 // persons to whom the Software is furnished to do so, subject to the
27699 // following conditions:
27700 //
27701 // The above copyright notice and this permission notice shall be included
27702 // in all copies or substantial portions of the Software.
27703 //
27704 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27705 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27706 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27707 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27708 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27709 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27710 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27711
27712 // a passthrough stream.
27713 // basically just the most minimal sort of Transform stream.
27714 // Every written chunk gets output as-is.
27715
27716
27717
27718 module.exports = PassThrough;
27719
27720 var Transform = __webpack_require__(180);
27721
27722 /*<replacement>*/
27723 var util = Object.create(__webpack_require__(173));
27724 util.inherits = __webpack_require__(66);
27725 /*</replacement>*/
27726
27727 util.inherits(PassThrough, Transform);
27728
27729 function PassThrough(options) {
27730   if (!(this instanceof PassThrough)) return new PassThrough(options);
27731
27732   Transform.call(this, options);
27733 }
27734
27735 PassThrough.prototype._transform = function (chunk, encoding, cb) {
27736   cb(null, chunk);
27737 };
27738
27739 /***/ }),
27740 /* 182 */
27741 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27742
27743 var Stream = __webpack_require__(44);
27744 var util = __webpack_require__(50);
27745
27746 // Backwards compatibility for node versions < 8
27747 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27748   Stream = __webpack_require__(167);
27749
27750 function NoopStream() {
27751   if (!(this instanceof NoopStream)) {
27752     return new NoopStream();
27753   }
27754   Stream.Transform.call(this);
27755 }
27756
27757 util.inherits(NoopStream,Stream.Transform);
27758
27759 NoopStream.prototype._transform = function(d,e,cb) { cb() ;};
27760   
27761 module.exports = NoopStream;
27762
27763 /***/ }),
27764 /* 183 */
27765 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27766
27767 var Promise = __webpack_require__(128);
27768 var Stream = __webpack_require__(44);
27769 var Buffer = __webpack_require__(165);
27770
27771 // Backwards compatibility for node versions < 8
27772 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27773   Stream = __webpack_require__(167);
27774
27775 module.exports = function(entry) {
27776   return new Promise(function(resolve,reject) {
27777     var chunks = [];
27778     var bufferStream = Stream.Transform()
27779       .on('finish',function() {
27780         resolve(Buffer.concat(chunks));
27781       })
27782       .on('error',reject);
27783         
27784     bufferStream._transform = function(d,e,cb) {
27785       chunks.push(d);
27786       cb();
27787     };
27788     entry.on('error',reject)
27789       .pipe(bufferStream);
27790   });
27791 };
27792
27793
27794 /***/ }),
27795 /* 184 */
27796 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27797
27798 var binary = __webpack_require__(123);
27799
27800 module.exports = function(extraField, vars) {
27801   var extra;
27802   // Find the ZIP64 header, if present.
27803   while(!extra && extraField && extraField.length) {
27804     var candidateExtra = binary.parse(extraField)
27805       .word16lu('signature')
27806       .word16lu('partsize')
27807       .word64lu('uncompressedSize')
27808       .word64lu('compressedSize')
27809       .word64lu('offset')
27810       .word64lu('disknum')
27811       .vars;
27812
27813     if(candidateExtra.signature === 0x0001) {
27814       extra = candidateExtra;
27815     } else {
27816       // Advance the buffer to the next part.
27817       // The total size of this part is the 4 byte header + partsize.
27818       extraField = extraField.slice(candidateExtra.partsize + 4);
27819     }
27820   }
27821
27822   extra = extra || {};
27823
27824   if (vars.compressedSize === 0xffffffff)
27825     vars.compressedSize = extra.compressedSize;
27826
27827   if (vars.uncompressedSize  === 0xffffffff)
27828     vars.uncompressedSize= extra.uncompressedSize;
27829
27830   if (vars.offsetToLocalFileHeader === 0xffffffff)
27831     vars.offsetToLocalFileHeader= extra.offset;
27832
27833   return extra;
27834 };
27835
27836
27837 /***/ }),
27838 /* 185 */
27839 /***/ ((module) => {
27840
27841 // Dates in zip file entries are stored as DosDateTime
27842 // Spec is here: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-dosdatetimetofiletime
27843
27844 module.exports = function parseDateTime(date, time) {
27845   const day = date & 0x1F;
27846   const month = date >> 5 & 0x0F;
27847   const year = (date >> 9 & 0x7F) + 1980;
27848   const seconds = time ? (time & 0x1F) * 2 : 0;
27849   const minutes = time ? (time >> 5) & 0x3F : 0;
27850   const hours = time ? (time >> 11): 0;
27851
27852   return new Date(Date.UTC(year, month-1, day, hours, minutes, seconds));
27853 };
27854
27855 /***/ }),
27856 /* 186 */
27857 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27858
27859 var Stream = __webpack_require__(44);
27860 var Parse = __webpack_require__(122);
27861 var duplexer2 = __webpack_require__(187);
27862 var BufferStream = __webpack_require__(183);
27863
27864 // Backwards compatibility for node versions < 8
27865 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27866   Stream = __webpack_require__(167);
27867
27868 function parseOne(match,opts) {
27869   var inStream = Stream.PassThrough({objectMode:true});
27870   var outStream = Stream.PassThrough();
27871   var transform = Stream.Transform({objectMode:true});
27872   var re = match instanceof RegExp ? match : (match && new RegExp(match));
27873   var found;
27874
27875   transform._transform = function(entry,e,cb) {
27876     if (found || (re && !re.exec(entry.path))) {
27877       entry.autodrain();
27878       return cb();
27879     } else {
27880       found = true;
27881       out.emit('entry',entry);
27882       entry.on('error',function(e) {
27883         outStream.emit('error',e);
27884       });
27885       entry.pipe(outStream)
27886         .on('error',function(err) {
27887           cb(err);
27888         })
27889         .on('finish',function(d) {
27890           cb(null,d);
27891         });
27892     }
27893   };
27894
27895   inStream.pipe(Parse(opts))
27896     .on('error',function(err) {
27897       outStream.emit('error',err);
27898     })
27899     .pipe(transform)
27900     .on('error',Object)  // Silence error as its already addressed in transform
27901     .on('finish',function() {
27902       if (!found)
27903         outStream.emit('error',new Error('PATTERN_NOT_FOUND'));
27904       else
27905         outStream.end();
27906     });
27907
27908   var out = duplexer2(inStream,outStream);
27909   out.buffer = function() {
27910     return BufferStream(outStream);
27911   };
27912
27913   return out;
27914 }
27915
27916 module.exports = parseOne;
27917
27918
27919 /***/ }),
27920 /* 187 */
27921 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27922
27923 "use strict";
27924
27925
27926 var stream = __webpack_require__(167);
27927
27928 function DuplexWrapper(options, writable, readable) {
27929   if (typeof readable === "undefined") {
27930     readable = writable;
27931     writable = options;
27932     options = null;
27933   }
27934
27935   stream.Duplex.call(this, options);
27936
27937   if (typeof readable.read !== "function") {
27938     readable = (new stream.Readable(options)).wrap(readable);
27939   }
27940
27941   this._writable = writable;
27942   this._readable = readable;
27943   this._waiting = false;
27944
27945   var self = this;
27946
27947   writable.once("finish", function() {
27948     self.end();
27949   });
27950
27951   this.once("finish", function() {
27952     writable.end();
27953   });
27954
27955   readable.on("readable", function() {
27956     if (self._waiting) {
27957       self._waiting = false;
27958       self._read();
27959     }
27960   });
27961
27962   readable.once("end", function() {
27963     self.push(null);
27964   });
27965
27966   if (!options || typeof options.bubbleErrors === "undefined" || options.bubbleErrors) {
27967     writable.on("error", function(err) {
27968       self.emit("error", err);
27969     });
27970
27971     readable.on("error", function(err) {
27972       self.emit("error", err);
27973     });
27974   }
27975 }
27976
27977 DuplexWrapper.prototype = Object.create(stream.Duplex.prototype, {constructor: {value: DuplexWrapper}});
27978
27979 DuplexWrapper.prototype._write = function _write(input, encoding, done) {
27980   this._writable.write(input, encoding, done);
27981 };
27982
27983 DuplexWrapper.prototype._read = function _read() {
27984   var buf;
27985   var reads = 0;
27986   while ((buf = this._readable.read()) !== null) {
27987     this.push(buf);
27988     reads++;
27989   }
27990   if (reads === 0) {
27991     this._waiting = true;
27992   }
27993 };
27994
27995 module.exports = function duplex2(options, writable, readable) {
27996   return new DuplexWrapper(options, writable, readable);
27997 };
27998
27999 module.exports.DuplexWrapper = DuplexWrapper;
28000
28001
28002 /***/ }),
28003 /* 188 */
28004 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28005
28006 module.exports = Extract;
28007
28008 var Parse = __webpack_require__(122);
28009 var Writer = __webpack_require__(189).Writer;
28010 var path = __webpack_require__(2);
28011 var stream = __webpack_require__(44);
28012 var duplexer2 = __webpack_require__(187);
28013 var Promise = __webpack_require__(128);
28014
28015 function Extract (opts) {
28016   // make sure path is normalized before using it
28017   opts.path = path.resolve(path.normalize(opts.path));
28018
28019   var parser = new Parse(opts);
28020
28021   var outStream = new stream.Writable({objectMode: true});
28022   outStream._write = function(entry, encoding, cb) {
28023
28024     if (entry.type == 'Directory') return cb();
28025
28026     // to avoid zip slip (writing outside of the destination), we resolve
28027     // the target path, and make sure it's nested in the intended
28028     // destination, or not extract it otherwise.
28029     var extractPath = path.join(opts.path, entry.path);
28030     if (extractPath.indexOf(opts.path) != 0) {
28031       return cb();
28032     }
28033
28034     const writer = opts.getWriter ? opts.getWriter({path: extractPath}) :  Writer({ path: extractPath });
28035
28036     entry.pipe(writer)
28037       .on('error', cb)
28038       .on('close', cb);
28039   };
28040
28041   var extract = duplexer2(parser,outStream);
28042   parser.once('crx-header', function(crxHeader) {
28043     extract.crxHeader = crxHeader;
28044   });
28045
28046   parser
28047     .pipe(outStream)
28048     .on('finish',function() {
28049       extract.emit('close');
28050     });
28051   
28052   extract.promise = function() {
28053     return new Promise(function(resolve, reject) {
28054       extract.on('close', resolve);
28055       extract.on('error',reject);
28056     });
28057   };
28058
28059   return extract;
28060 }
28061
28062
28063 /***/ }),
28064 /* 189 */
28065 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
28066
28067 exports.Abstract = __webpack_require__(190)
28068 exports.Reader = __webpack_require__(191)
28069 exports.Writer = __webpack_require__(203)
28070
28071 exports.File = {
28072   Reader: __webpack_require__(200),
28073   Writer: __webpack_require__(209)
28074 }
28075
28076 exports.Dir = {
28077   Reader: __webpack_require__(199),
28078   Writer: __webpack_require__(206)
28079 }
28080
28081 exports.Link = {
28082   Reader: __webpack_require__(198),
28083   Writer: __webpack_require__(208)
28084 }
28085
28086 exports.Proxy = {
28087   Reader: __webpack_require__(202),
28088   Writer: __webpack_require__(210)
28089 }
28090
28091 exports.Reader.Dir = exports.DirReader = exports.Dir.Reader
28092 exports.Reader.File = exports.FileReader = exports.File.Reader
28093 exports.Reader.Link = exports.LinkReader = exports.Link.Reader
28094 exports.Reader.Proxy = exports.ProxyReader = exports.Proxy.Reader
28095
28096 exports.Writer.Dir = exports.DirWriter = exports.Dir.Writer
28097 exports.Writer.File = exports.FileWriter = exports.File.Writer
28098 exports.Writer.Link = exports.LinkWriter = exports.Link.Writer
28099 exports.Writer.Proxy = exports.ProxyWriter = exports.Proxy.Writer
28100
28101 exports.collect = __webpack_require__(207)
28102
28103
28104 /***/ }),
28105 /* 190 */
28106 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28107
28108 // the parent class for all fstreams.
28109
28110 module.exports = Abstract
28111
28112 var Stream = __webpack_require__(44).Stream
28113 var inherits = __webpack_require__(66)
28114
28115 function Abstract () {
28116   Stream.call(this)
28117 }
28118
28119 inherits(Abstract, Stream)
28120
28121 Abstract.prototype.on = function (ev, fn) {
28122   if (ev === 'ready' && this.ready) {
28123     process.nextTick(fn.bind(this))
28124   } else {
28125     Stream.prototype.on.call(this, ev, fn)
28126   }
28127   return this
28128 }
28129
28130 Abstract.prototype.abort = function () {
28131   this._aborted = true
28132   this.emit('abort')
28133 }
28134
28135 Abstract.prototype.destroy = function () {}
28136
28137 Abstract.prototype.warn = function (msg, code) {
28138   var self = this
28139   var er = decorate(msg, code, self)
28140   if (!self.listeners('warn')) {
28141     console.error('%s %s\n' +
28142     'path = %s\n' +
28143     'syscall = %s\n' +
28144     'fstream_type = %s\n' +
28145     'fstream_path = %s\n' +
28146     'fstream_unc_path = %s\n' +
28147     'fstream_class = %s\n' +
28148     'fstream_stack =\n%s\n',
28149       code || 'UNKNOWN',
28150       er.stack,
28151       er.path,
28152       er.syscall,
28153       er.fstream_type,
28154       er.fstream_path,
28155       er.fstream_unc_path,
28156       er.fstream_class,
28157       er.fstream_stack.join('\n'))
28158   } else {
28159     self.emit('warn', er)
28160   }
28161 }
28162
28163 Abstract.prototype.info = function (msg, code) {
28164   this.emit('info', msg, code)
28165 }
28166
28167 Abstract.prototype.error = function (msg, code, th) {
28168   var er = decorate(msg, code, this)
28169   if (th) throw er
28170   else this.emit('error', er)
28171 }
28172
28173 function decorate (er, code, self) {
28174   if (!(er instanceof Error)) er = new Error(er)
28175   er.code = er.code || code
28176   er.path = er.path || self.path
28177   er.fstream_type = er.fstream_type || self.type
28178   er.fstream_path = er.fstream_path || self.path
28179   if (self._path !== self.path) {
28180     er.fstream_unc_path = er.fstream_unc_path || self._path
28181   }
28182   if (self.linkpath) {
28183     er.fstream_linkpath = er.fstream_linkpath || self.linkpath
28184   }
28185   er.fstream_class = er.fstream_class || self.constructor.name
28186   er.fstream_stack = er.fstream_stack ||
28187     new Error().stack.split(/\n/).slice(3).map(function (s) {
28188       return s.replace(/^ {4}at /, '')
28189     })
28190
28191   return er
28192 }
28193
28194
28195 /***/ }),
28196 /* 191 */
28197 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28198
28199 module.exports = Reader
28200
28201 var fs = __webpack_require__(192)
28202 var Stream = __webpack_require__(44).Stream
28203 var inherits = __webpack_require__(66)
28204 var path = __webpack_require__(2)
28205 var getType = __webpack_require__(197)
28206 var hardLinks = Reader.hardLinks = {}
28207 var Abstract = __webpack_require__(190)
28208
28209 // Must do this *before* loading the child classes
28210 inherits(Reader, Abstract)
28211
28212 var LinkReader = __webpack_require__(198)
28213
28214 function Reader (props, currentStat) {
28215   var self = this
28216   if (!(self instanceof Reader)) return new Reader(props, currentStat)
28217
28218   if (typeof props === 'string') {
28219     props = { path: props }
28220   }
28221
28222   // polymorphism.
28223   // call fstream.Reader(dir) to get a DirReader object, etc.
28224   // Note that, unlike in the Writer case, ProxyReader is going
28225   // to be the *normal* state of affairs, since we rarely know
28226   // the type of a file prior to reading it.
28227
28228   var type
28229   var ClassType
28230
28231   if (props.type && typeof props.type === 'function') {
28232     type = props.type
28233     ClassType = type
28234   } else {
28235     type = getType(props)
28236     ClassType = Reader
28237   }
28238
28239   if (currentStat && !type) {
28240     type = getType(currentStat)
28241     props[type] = true
28242     props.type = type
28243   }
28244
28245   switch (type) {
28246     case 'Directory':
28247       ClassType = __webpack_require__(199)
28248       break
28249
28250     case 'Link':
28251     // XXX hard links are just files.
28252     // However, it would be good to keep track of files' dev+inode
28253     // and nlink values, and create a HardLinkReader that emits
28254     // a linkpath value of the original copy, so that the tar
28255     // writer can preserve them.
28256     // ClassType = HardLinkReader
28257     // break
28258
28259     case 'File':
28260       ClassType = __webpack_require__(200)
28261       break
28262
28263     case 'SymbolicLink':
28264       ClassType = LinkReader
28265       break
28266
28267     case 'Socket':
28268       ClassType = __webpack_require__(201)
28269       break
28270
28271     case null:
28272       ClassType = __webpack_require__(202)
28273       break
28274   }
28275
28276   if (!(self instanceof ClassType)) {
28277     return new ClassType(props)
28278   }
28279
28280   Abstract.call(self)
28281
28282   if (!props.path) {
28283     self.error('Must provide a path', null, true)
28284   }
28285
28286   self.readable = true
28287   self.writable = false
28288
28289   self.type = type
28290   self.props = props
28291   self.depth = props.depth = props.depth || 0
28292   self.parent = props.parent || null
28293   self.root = props.root || (props.parent && props.parent.root) || self
28294
28295   self._path = self.path = path.resolve(props.path)
28296   if (process.platform === 'win32') {
28297     self.path = self._path = self.path.replace(/\?/g, '_')
28298     if (self._path.length >= 260) {
28299       // how DOES one create files on the moon?
28300       // if the path has spaces in it, then UNC will fail.
28301       self._swallowErrors = true
28302       // if (self._path.indexOf(" ") === -1) {
28303       self._path = '\\\\?\\' + self.path.replace(/\//g, '\\')
28304     // }
28305     }
28306   }
28307   self.basename = props.basename = path.basename(self.path)
28308   self.dirname = props.dirname = path.dirname(self.path)
28309
28310   // these have served their purpose, and are now just noisy clutter
28311   props.parent = props.root = null
28312
28313   // console.error("\n\n\n%s setting size to", props.path, props.size)
28314   self.size = props.size
28315   self.filter = typeof props.filter === 'function' ? props.filter : null
28316   if (props.sort === 'alpha') props.sort = alphasort
28317
28318   // start the ball rolling.
28319   // this will stat the thing, and then call self._read()
28320   // to start reading whatever it is.
28321   // console.error("calling stat", props.path, currentStat)
28322   self._stat(currentStat)
28323 }
28324
28325 function alphasort (a, b) {
28326   return a === b ? 0
28327     : a.toLowerCase() > b.toLowerCase() ? 1
28328       : a.toLowerCase() < b.toLowerCase() ? -1
28329         : a > b ? 1
28330           : -1
28331 }
28332
28333 Reader.prototype._stat = function (currentStat) {
28334   var self = this
28335   var props = self.props
28336   var stat = props.follow ? 'stat' : 'lstat'
28337   // console.error("Reader._stat", self._path, currentStat)
28338   if (currentStat) process.nextTick(statCb.bind(null, null, currentStat))
28339   else fs[stat](self._path, statCb)
28340
28341   function statCb (er, props_) {
28342     // console.error("Reader._stat, statCb", self._path, props_, props_.nlink)
28343     if (er) return self.error(er)
28344
28345     Object.keys(props_).forEach(function (k) {
28346       props[k] = props_[k]
28347     })
28348
28349     // if it's not the expected size, then abort here.
28350     if (undefined !== self.size && props.size !== self.size) {
28351       return self.error('incorrect size')
28352     }
28353     self.size = props.size
28354
28355     var type = getType(props)
28356     var handleHardlinks = props.hardlinks !== false
28357
28358     // special little thing for handling hardlinks.
28359     if (handleHardlinks && type !== 'Directory' && props.nlink && props.nlink > 1) {
28360       var k = props.dev + ':' + props.ino
28361       // console.error("Reader has nlink", self._path, k)
28362       if (hardLinks[k] === self._path || !hardLinks[k]) {
28363         hardLinks[k] = self._path
28364       } else {
28365         // switch into hardlink mode.
28366         type = self.type = self.props.type = 'Link'
28367         self.Link = self.props.Link = true
28368         self.linkpath = self.props.linkpath = hardLinks[k]
28369         // console.error("Hardlink detected, switching mode", self._path, self.linkpath)
28370         // Setting __proto__ would arguably be the "correct"
28371         // approach here, but that just seems too wrong.
28372         self._stat = self._read = LinkReader.prototype._read
28373       }
28374     }
28375
28376     if (self.type && self.type !== type) {
28377       self.error('Unexpected type: ' + type)
28378     }
28379
28380     // if the filter doesn't pass, then just skip over this one.
28381     // still have to emit end so that dir-walking can move on.
28382     if (self.filter) {
28383       var who = self._proxy || self
28384       // special handling for ProxyReaders
28385       if (!self.filter.call(who, who, props)) {
28386         if (!self._disowned) {
28387           self.abort()
28388           self.emit('end')
28389           self.emit('close')
28390         }
28391         return
28392       }
28393     }
28394
28395     // last chance to abort or disown before the flow starts!
28396     var events = ['_stat', 'stat', 'ready']
28397     var e = 0
28398     ;(function go () {
28399       if (self._aborted) {
28400         self.emit('end')
28401         self.emit('close')
28402         return
28403       }
28404
28405       if (self._paused && self.type !== 'Directory') {
28406         self.once('resume', go)
28407         return
28408       }
28409
28410       var ev = events[e++]
28411       if (!ev) {
28412         return self._read()
28413       }
28414       self.emit(ev, props)
28415       go()
28416     })()
28417   }
28418 }
28419
28420 Reader.prototype.pipe = function (dest) {
28421   var self = this
28422   if (typeof dest.add === 'function') {
28423     // piping to a multi-compatible, and we've got directory entries.
28424     self.on('entry', function (entry) {
28425       var ret = dest.add(entry)
28426       if (ret === false) {
28427         self.pause()
28428       }
28429     })
28430   }
28431
28432   // console.error("R Pipe apply Stream Pipe")
28433   return Stream.prototype.pipe.apply(this, arguments)
28434 }
28435
28436 Reader.prototype.pause = function (who) {
28437   this._paused = true
28438   who = who || this
28439   this.emit('pause', who)
28440   if (this._stream) this._stream.pause(who)
28441 }
28442
28443 Reader.prototype.resume = function (who) {
28444   this._paused = false
28445   who = who || this
28446   this.emit('resume', who)
28447   if (this._stream) this._stream.resume(who)
28448   this._read()
28449 }
28450
28451 Reader.prototype._read = function () {
28452   this.error('Cannot read unknown type: ' + this.type)
28453 }
28454
28455
28456 /***/ }),
28457 /* 192 */
28458 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28459
28460 var fs = __webpack_require__(42)
28461 var polyfills = __webpack_require__(193)
28462 var legacy = __webpack_require__(195)
28463 var clone = __webpack_require__(196)
28464
28465 var util = __webpack_require__(50)
28466
28467 /* istanbul ignore next - node 0.x polyfill */
28468 var gracefulQueue
28469 var previousSymbol
28470
28471 /* istanbul ignore else - node 0.x polyfill */
28472 if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
28473   gracefulQueue = Symbol.for('graceful-fs.queue')
28474   // This is used in testing by future versions
28475   previousSymbol = Symbol.for('graceful-fs.previous')
28476 } else {
28477   gracefulQueue = '___graceful-fs.queue'
28478   previousSymbol = '___graceful-fs.previous'
28479 }
28480
28481 function noop () {}
28482
28483 function publishQueue(context, queue) {
28484   Object.defineProperty(context, gracefulQueue, {
28485     get: function() {
28486       return queue
28487     }
28488   })
28489 }
28490
28491 var debug = noop
28492 if (util.debuglog)
28493   debug = util.debuglog('gfs4')
28494 else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
28495   debug = function() {
28496     var m = util.format.apply(util, arguments)
28497     m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
28498     console.error(m)
28499   }
28500
28501 // Once time initialization
28502 if (!fs[gracefulQueue]) {
28503   // This queue can be shared by multiple loaded instances
28504   var queue = global[gracefulQueue] || []
28505   publishQueue(fs, queue)
28506
28507   // Patch fs.close/closeSync to shared queue version, because we need
28508   // to retry() whenever a close happens *anywhere* in the program.
28509   // This is essential when multiple graceful-fs instances are
28510   // in play at the same time.
28511   fs.close = (function (fs$close) {
28512     function close (fd, cb) {
28513       return fs$close.call(fs, fd, function (err) {
28514         // This function uses the graceful-fs shared queue
28515         if (!err) {
28516           retry()
28517         }
28518
28519         if (typeof cb === 'function')
28520           cb.apply(this, arguments)
28521       })
28522     }
28523
28524     Object.defineProperty(close, previousSymbol, {
28525       value: fs$close
28526     })
28527     return close
28528   })(fs.close)
28529
28530   fs.closeSync = (function (fs$closeSync) {
28531     function closeSync (fd) {
28532       // This function uses the graceful-fs shared queue
28533       fs$closeSync.apply(fs, arguments)
28534       retry()
28535     }
28536
28537     Object.defineProperty(closeSync, previousSymbol, {
28538       value: fs$closeSync
28539     })
28540     return closeSync
28541   })(fs.closeSync)
28542
28543   if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
28544     process.on('exit', function() {
28545       debug(fs[gracefulQueue])
28546       __webpack_require__(58).equal(fs[gracefulQueue].length, 0)
28547     })
28548   }
28549 }
28550
28551 if (!global[gracefulQueue]) {
28552   publishQueue(global, fs[gracefulQueue]);
28553 }
28554
28555 module.exports = patch(clone(fs))
28556 if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
28557     module.exports = patch(fs)
28558     fs.__patched = true;
28559 }
28560
28561 function patch (fs) {
28562   // Everything that references the open() function needs to be in here
28563   polyfills(fs)
28564   fs.gracefulify = patch
28565
28566   fs.createReadStream = createReadStream
28567   fs.createWriteStream = createWriteStream
28568   var fs$readFile = fs.readFile
28569   fs.readFile = readFile
28570   function readFile (path, options, cb) {
28571     if (typeof options === 'function')
28572       cb = options, options = null
28573
28574     return go$readFile(path, options, cb)
28575
28576     function go$readFile (path, options, cb) {
28577       return fs$readFile(path, options, function (err) {
28578         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28579           enqueue([go$readFile, [path, options, cb]])
28580         else {
28581           if (typeof cb === 'function')
28582             cb.apply(this, arguments)
28583           retry()
28584         }
28585       })
28586     }
28587   }
28588
28589   var fs$writeFile = fs.writeFile
28590   fs.writeFile = writeFile
28591   function writeFile (path, data, options, cb) {
28592     if (typeof options === 'function')
28593       cb = options, options = null
28594
28595     return go$writeFile(path, data, options, cb)
28596
28597     function go$writeFile (path, data, options, cb) {
28598       return fs$writeFile(path, data, options, function (err) {
28599         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28600           enqueue([go$writeFile, [path, data, options, cb]])
28601         else {
28602           if (typeof cb === 'function')
28603             cb.apply(this, arguments)
28604           retry()
28605         }
28606       })
28607     }
28608   }
28609
28610   var fs$appendFile = fs.appendFile
28611   if (fs$appendFile)
28612     fs.appendFile = appendFile
28613   function appendFile (path, data, options, cb) {
28614     if (typeof options === 'function')
28615       cb = options, options = null
28616
28617     return go$appendFile(path, data, options, cb)
28618
28619     function go$appendFile (path, data, options, cb) {
28620       return fs$appendFile(path, data, options, function (err) {
28621         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28622           enqueue([go$appendFile, [path, data, options, cb]])
28623         else {
28624           if (typeof cb === 'function')
28625             cb.apply(this, arguments)
28626           retry()
28627         }
28628       })
28629     }
28630   }
28631
28632   var fs$readdir = fs.readdir
28633   fs.readdir = readdir
28634   function readdir (path, options, cb) {
28635     var args = [path]
28636     if (typeof options !== 'function') {
28637       args.push(options)
28638     } else {
28639       cb = options
28640     }
28641     args.push(go$readdir$cb)
28642
28643     return go$readdir(args)
28644
28645     function go$readdir$cb (err, files) {
28646       if (files && files.sort)
28647         files.sort()
28648
28649       if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28650         enqueue([go$readdir, [args]])
28651
28652       else {
28653         if (typeof cb === 'function')
28654           cb.apply(this, arguments)
28655         retry()
28656       }
28657     }
28658   }
28659
28660   function go$readdir (args) {
28661     return fs$readdir.apply(fs, args)
28662   }
28663
28664   if (process.version.substr(0, 4) === 'v0.8') {
28665     var legStreams = legacy(fs)
28666     ReadStream = legStreams.ReadStream
28667     WriteStream = legStreams.WriteStream
28668   }
28669
28670   var fs$ReadStream = fs.ReadStream
28671   if (fs$ReadStream) {
28672     ReadStream.prototype = Object.create(fs$ReadStream.prototype)
28673     ReadStream.prototype.open = ReadStream$open
28674   }
28675
28676   var fs$WriteStream = fs.WriteStream
28677   if (fs$WriteStream) {
28678     WriteStream.prototype = Object.create(fs$WriteStream.prototype)
28679     WriteStream.prototype.open = WriteStream$open
28680   }
28681
28682   Object.defineProperty(fs, 'ReadStream', {
28683     get: function () {
28684       return ReadStream
28685     },
28686     set: function (val) {
28687       ReadStream = val
28688     },
28689     enumerable: true,
28690     configurable: true
28691   })
28692   Object.defineProperty(fs, 'WriteStream', {
28693     get: function () {
28694       return WriteStream
28695     },
28696     set: function (val) {
28697       WriteStream = val
28698     },
28699     enumerable: true,
28700     configurable: true
28701   })
28702
28703   // legacy names
28704   var FileReadStream = ReadStream
28705   Object.defineProperty(fs, 'FileReadStream', {
28706     get: function () {
28707       return FileReadStream
28708     },
28709     set: function (val) {
28710       FileReadStream = val
28711     },
28712     enumerable: true,
28713     configurable: true
28714   })
28715   var FileWriteStream = WriteStream
28716   Object.defineProperty(fs, 'FileWriteStream', {
28717     get: function () {
28718       return FileWriteStream
28719     },
28720     set: function (val) {
28721       FileWriteStream = val
28722     },
28723     enumerable: true,
28724     configurable: true
28725   })
28726
28727   function ReadStream (path, options) {
28728     if (this instanceof ReadStream)
28729       return fs$ReadStream.apply(this, arguments), this
28730     else
28731       return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
28732   }
28733
28734   function ReadStream$open () {
28735     var that = this
28736     open(that.path, that.flags, that.mode, function (err, fd) {
28737       if (err) {
28738         if (that.autoClose)
28739           that.destroy()
28740
28741         that.emit('error', err)
28742       } else {
28743         that.fd = fd
28744         that.emit('open', fd)
28745         that.read()
28746       }
28747     })
28748   }
28749
28750   function WriteStream (path, options) {
28751     if (this instanceof WriteStream)
28752       return fs$WriteStream.apply(this, arguments), this
28753     else
28754       return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
28755   }
28756
28757   function WriteStream$open () {
28758     var that = this
28759     open(that.path, that.flags, that.mode, function (err, fd) {
28760       if (err) {
28761         that.destroy()
28762         that.emit('error', err)
28763       } else {
28764         that.fd = fd
28765         that.emit('open', fd)
28766       }
28767     })
28768   }
28769
28770   function createReadStream (path, options) {
28771     return new fs.ReadStream(path, options)
28772   }
28773
28774   function createWriteStream (path, options) {
28775     return new fs.WriteStream(path, options)
28776   }
28777
28778   var fs$open = fs.open
28779   fs.open = open
28780   function open (path, flags, mode, cb) {
28781     if (typeof mode === 'function')
28782       cb = mode, mode = null
28783
28784     return go$open(path, flags, mode, cb)
28785
28786     function go$open (path, flags, mode, cb) {
28787       return fs$open(path, flags, mode, function (err, fd) {
28788         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28789           enqueue([go$open, [path, flags, mode, cb]])
28790         else {
28791           if (typeof cb === 'function')
28792             cb.apply(this, arguments)
28793           retry()
28794         }
28795       })
28796     }
28797   }
28798
28799   return fs
28800 }
28801
28802 function enqueue (elem) {
28803   debug('ENQUEUE', elem[0].name, elem[1])
28804   fs[gracefulQueue].push(elem)
28805 }
28806
28807 function retry () {
28808   var elem = fs[gracefulQueue].shift()
28809   if (elem) {
28810     debug('RETRY', elem[0].name, elem[1])
28811     elem[0].apply(null, elem[1])
28812   }
28813 }
28814
28815
28816 /***/ }),
28817 /* 193 */
28818 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28819
28820 var constants = __webpack_require__(194)
28821
28822 var origCwd = process.cwd
28823 var cwd = null
28824
28825 var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
28826
28827 process.cwd = function() {
28828   if (!cwd)
28829     cwd = origCwd.call(process)
28830   return cwd
28831 }
28832 try {
28833   process.cwd()
28834 } catch (er) {}
28835
28836 var chdir = process.chdir
28837 process.chdir = function(d) {
28838   cwd = null
28839   chdir.call(process, d)
28840 }
28841
28842 module.exports = patch
28843
28844 function patch (fs) {
28845   // (re-)implement some things that are known busted or missing.
28846
28847   // lchmod, broken prior to 0.6.2
28848   // back-port the fix here.
28849   if (constants.hasOwnProperty('O_SYMLINK') &&
28850       process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
28851     patchLchmod(fs)
28852   }
28853
28854   // lutimes implementation, or no-op
28855   if (!fs.lutimes) {
28856     patchLutimes(fs)
28857   }
28858
28859   // https://github.com/isaacs/node-graceful-fs/issues/4
28860   // Chown should not fail on einval or eperm if non-root.
28861   // It should not fail on enosys ever, as this just indicates
28862   // that a fs doesn't support the intended operation.
28863
28864   fs.chown = chownFix(fs.chown)
28865   fs.fchown = chownFix(fs.fchown)
28866   fs.lchown = chownFix(fs.lchown)
28867
28868   fs.chmod = chmodFix(fs.chmod)
28869   fs.fchmod = chmodFix(fs.fchmod)
28870   fs.lchmod = chmodFix(fs.lchmod)
28871
28872   fs.chownSync = chownFixSync(fs.chownSync)
28873   fs.fchownSync = chownFixSync(fs.fchownSync)
28874   fs.lchownSync = chownFixSync(fs.lchownSync)
28875
28876   fs.chmodSync = chmodFixSync(fs.chmodSync)
28877   fs.fchmodSync = chmodFixSync(fs.fchmodSync)
28878   fs.lchmodSync = chmodFixSync(fs.lchmodSync)
28879
28880   fs.stat = statFix(fs.stat)
28881   fs.fstat = statFix(fs.fstat)
28882   fs.lstat = statFix(fs.lstat)
28883
28884   fs.statSync = statFixSync(fs.statSync)
28885   fs.fstatSync = statFixSync(fs.fstatSync)
28886   fs.lstatSync = statFixSync(fs.lstatSync)
28887
28888   // if lchmod/lchown do not exist, then make them no-ops
28889   if (!fs.lchmod) {
28890     fs.lchmod = function (path, mode, cb) {
28891       if (cb) process.nextTick(cb)
28892     }
28893     fs.lchmodSync = function () {}
28894   }
28895   if (!fs.lchown) {
28896     fs.lchown = function (path, uid, gid, cb) {
28897       if (cb) process.nextTick(cb)
28898     }
28899     fs.lchownSync = function () {}
28900   }
28901
28902   // on Windows, A/V software can lock the directory, causing this
28903   // to fail with an EACCES or EPERM if the directory contains newly
28904   // created files.  Try again on failure, for up to 60 seconds.
28905
28906   // Set the timeout this long because some Windows Anti-Virus, such as Parity
28907   // bit9, may lock files for up to a minute, causing npm package install
28908   // failures. Also, take care to yield the scheduler. Windows scheduling gives
28909   // CPU to a busy looping process, which can cause the program causing the lock
28910   // contention to be starved of CPU by node, so the contention doesn't resolve.
28911   if (platform === "win32") {
28912     fs.rename = (function (fs$rename) { return function (from, to, cb) {
28913       var start = Date.now()
28914       var backoff = 0;
28915       fs$rename(from, to, function CB (er) {
28916         if (er
28917             && (er.code === "EACCES" || er.code === "EPERM")
28918             && Date.now() - start < 60000) {
28919           setTimeout(function() {
28920             fs.stat(to, function (stater, st) {
28921               if (stater && stater.code === "ENOENT")
28922                 fs$rename(from, to, CB);
28923               else
28924                 cb(er)
28925             })
28926           }, backoff)
28927           if (backoff < 100)
28928             backoff += 10;
28929           return;
28930         }
28931         if (cb) cb(er)
28932       })
28933     }})(fs.rename)
28934   }
28935
28936   // if read() returns EAGAIN, then just try it again.
28937   fs.read = (function (fs$read) {
28938     function read (fd, buffer, offset, length, position, callback_) {
28939       var callback
28940       if (callback_ && typeof callback_ === 'function') {
28941         var eagCounter = 0
28942         callback = function (er, _, __) {
28943           if (er && er.code === 'EAGAIN' && eagCounter < 10) {
28944             eagCounter ++
28945             return fs$read.call(fs, fd, buffer, offset, length, position, callback)
28946           }
28947           callback_.apply(this, arguments)
28948         }
28949       }
28950       return fs$read.call(fs, fd, buffer, offset, length, position, callback)
28951     }
28952
28953     // This ensures `util.promisify` works as it does for native `fs.read`.
28954     read.__proto__ = fs$read
28955     return read
28956   })(fs.read)
28957
28958   fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
28959     var eagCounter = 0
28960     while (true) {
28961       try {
28962         return fs$readSync.call(fs, fd, buffer, offset, length, position)
28963       } catch (er) {
28964         if (er.code === 'EAGAIN' && eagCounter < 10) {
28965           eagCounter ++
28966           continue
28967         }
28968         throw er
28969       }
28970     }
28971   }})(fs.readSync)
28972
28973   function patchLchmod (fs) {
28974     fs.lchmod = function (path, mode, callback) {
28975       fs.open( path
28976              , constants.O_WRONLY | constants.O_SYMLINK
28977              , mode
28978              , function (err, fd) {
28979         if (err) {
28980           if (callback) callback(err)
28981           return
28982         }
28983         // prefer to return the chmod error, if one occurs,
28984         // but still try to close, and report closing errors if they occur.
28985         fs.fchmod(fd, mode, function (err) {
28986           fs.close(fd, function(err2) {
28987             if (callback) callback(err || err2)
28988           })
28989         })
28990       })
28991     }
28992
28993     fs.lchmodSync = function (path, mode) {
28994       var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
28995
28996       // prefer to return the chmod error, if one occurs,
28997       // but still try to close, and report closing errors if they occur.
28998       var threw = true
28999       var ret
29000       try {
29001         ret = fs.fchmodSync(fd, mode)
29002         threw = false
29003       } finally {
29004         if (threw) {
29005           try {
29006             fs.closeSync(fd)
29007           } catch (er) {}
29008         } else {
29009           fs.closeSync(fd)
29010         }
29011       }
29012       return ret
29013     }
29014   }
29015
29016   function patchLutimes (fs) {
29017     if (constants.hasOwnProperty("O_SYMLINK")) {
29018       fs.lutimes = function (path, at, mt, cb) {
29019         fs.open(path, constants.O_SYMLINK, function (er, fd) {
29020           if (er) {
29021             if (cb) cb(er)
29022             return
29023           }
29024           fs.futimes(fd, at, mt, function (er) {
29025             fs.close(fd, function (er2) {
29026               if (cb) cb(er || er2)
29027             })
29028           })
29029         })
29030       }
29031
29032       fs.lutimesSync = function (path, at, mt) {
29033         var fd = fs.openSync(path, constants.O_SYMLINK)
29034         var ret
29035         var threw = true
29036         try {
29037           ret = fs.futimesSync(fd, at, mt)
29038           threw = false
29039         } finally {
29040           if (threw) {
29041             try {
29042               fs.closeSync(fd)
29043             } catch (er) {}
29044           } else {
29045             fs.closeSync(fd)
29046           }
29047         }
29048         return ret
29049       }
29050
29051     } else {
29052       fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
29053       fs.lutimesSync = function () {}
29054     }
29055   }
29056
29057   function chmodFix (orig) {
29058     if (!orig) return orig
29059     return function (target, mode, cb) {
29060       return orig.call(fs, target, mode, function (er) {
29061         if (chownErOk(er)) er = null
29062         if (cb) cb.apply(this, arguments)
29063       })
29064     }
29065   }
29066
29067   function chmodFixSync (orig) {
29068     if (!orig) return orig
29069     return function (target, mode) {
29070       try {
29071         return orig.call(fs, target, mode)
29072       } catch (er) {
29073         if (!chownErOk(er)) throw er
29074       }
29075     }
29076   }
29077
29078
29079   function chownFix (orig) {
29080     if (!orig) return orig
29081     return function (target, uid, gid, cb) {
29082       return orig.call(fs, target, uid, gid, function (er) {
29083         if (chownErOk(er)) er = null
29084         if (cb) cb.apply(this, arguments)
29085       })
29086     }
29087   }
29088
29089   function chownFixSync (orig) {
29090     if (!orig) return orig
29091     return function (target, uid, gid) {
29092       try {
29093         return orig.call(fs, target, uid, gid)
29094       } catch (er) {
29095         if (!chownErOk(er)) throw er
29096       }
29097     }
29098   }
29099
29100   function statFix (orig) {
29101     if (!orig) return orig
29102     // Older versions of Node erroneously returned signed integers for
29103     // uid + gid.
29104     return function (target, options, cb) {
29105       if (typeof options === 'function') {
29106         cb = options
29107         options = null
29108       }
29109       function callback (er, stats) {
29110         if (stats) {
29111           if (stats.uid < 0) stats.uid += 0x100000000
29112           if (stats.gid < 0) stats.gid += 0x100000000
29113         }
29114         if (cb) cb.apply(this, arguments)
29115       }
29116       return options ? orig.call(fs, target, options, callback)
29117         : orig.call(fs, target, callback)
29118     }
29119   }
29120
29121   function statFixSync (orig) {
29122     if (!orig) return orig
29123     // Older versions of Node erroneously returned signed integers for
29124     // uid + gid.
29125     return function (target, options) {
29126       var stats = options ? orig.call(fs, target, options)
29127         : orig.call(fs, target)
29128       if (stats.uid < 0) stats.uid += 0x100000000
29129       if (stats.gid < 0) stats.gid += 0x100000000
29130       return stats;
29131     }
29132   }
29133
29134   // ENOSYS means that the fs doesn't support the op. Just ignore
29135   // that, because it doesn't matter.
29136   //
29137   // if there's no getuid, or if getuid() is something other
29138   // than 0, and the error is EINVAL or EPERM, then just ignore
29139   // it.
29140   //
29141   // This specific case is a silent failure in cp, install, tar,
29142   // and most other unix tools that manage permissions.
29143   //
29144   // When running as root, or if other types of errors are
29145   // encountered, then it's strict.
29146   function chownErOk (er) {
29147     if (!er)
29148       return true
29149
29150     if (er.code === "ENOSYS")
29151       return true
29152
29153     var nonroot = !process.getuid || process.getuid() !== 0
29154     if (nonroot) {
29155       if (er.code === "EINVAL" || er.code === "EPERM")
29156         return true
29157     }
29158
29159     return false
29160   }
29161 }
29162
29163
29164 /***/ }),
29165 /* 194 */
29166 /***/ ((module) => {
29167
29168 "use strict";
29169 module.exports = require("constants");;
29170
29171 /***/ }),
29172 /* 195 */
29173 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29174
29175 var Stream = __webpack_require__(44).Stream
29176
29177 module.exports = legacy
29178
29179 function legacy (fs) {
29180   return {
29181     ReadStream: ReadStream,
29182     WriteStream: WriteStream
29183   }
29184
29185   function ReadStream (path, options) {
29186     if (!(this instanceof ReadStream)) return new ReadStream(path, options);
29187
29188     Stream.call(this);
29189
29190     var self = this;
29191
29192     this.path = path;
29193     this.fd = null;
29194     this.readable = true;
29195     this.paused = false;
29196
29197     this.flags = 'r';
29198     this.mode = 438; /*=0666*/
29199     this.bufferSize = 64 * 1024;
29200
29201     options = options || {};
29202
29203     // Mixin options into this
29204     var keys = Object.keys(options);
29205     for (var index = 0, length = keys.length; index < length; index++) {
29206       var key = keys[index];
29207       this[key] = options[key];
29208     }
29209
29210     if (this.encoding) this.setEncoding(this.encoding);
29211
29212     if (this.start !== undefined) {
29213       if ('number' !== typeof this.start) {
29214         throw TypeError('start must be a Number');
29215       }
29216       if (this.end === undefined) {
29217         this.end = Infinity;
29218       } else if ('number' !== typeof this.end) {
29219         throw TypeError('end must be a Number');
29220       }
29221
29222       if (this.start > this.end) {
29223         throw new Error('start must be <= end');
29224       }
29225
29226       this.pos = this.start;
29227     }
29228
29229     if (this.fd !== null) {
29230       process.nextTick(function() {
29231         self._read();
29232       });
29233       return;
29234     }
29235
29236     fs.open(this.path, this.flags, this.mode, function (err, fd) {
29237       if (err) {
29238         self.emit('error', err);
29239         self.readable = false;
29240         return;
29241       }
29242
29243       self.fd = fd;
29244       self.emit('open', fd);
29245       self._read();
29246     })
29247   }
29248
29249   function WriteStream (path, options) {
29250     if (!(this instanceof WriteStream)) return new WriteStream(path, options);
29251
29252     Stream.call(this);
29253
29254     this.path = path;
29255     this.fd = null;
29256     this.writable = true;
29257
29258     this.flags = 'w';
29259     this.encoding = 'binary';
29260     this.mode = 438; /*=0666*/
29261     this.bytesWritten = 0;
29262
29263     options = options || {};
29264
29265     // Mixin options into this
29266     var keys = Object.keys(options);
29267     for (var index = 0, length = keys.length; index < length; index++) {
29268       var key = keys[index];
29269       this[key] = options[key];
29270     }
29271
29272     if (this.start !== undefined) {
29273       if ('number' !== typeof this.start) {
29274         throw TypeError('start must be a Number');
29275       }
29276       if (this.start < 0) {
29277         throw new Error('start must be >= zero');
29278       }
29279
29280       this.pos = this.start;
29281     }
29282
29283     this.busy = false;
29284     this._queue = [];
29285
29286     if (this.fd === null) {
29287       this._open = fs.open;
29288       this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
29289       this.flush();
29290     }
29291   }
29292 }
29293
29294
29295 /***/ }),
29296 /* 196 */
29297 /***/ ((module) => {
29298
29299 "use strict";
29300
29301
29302 module.exports = clone
29303
29304 function clone (obj) {
29305   if (obj === null || typeof obj !== 'object')
29306     return obj
29307
29308   if (obj instanceof Object)
29309     var copy = { __proto__: obj.__proto__ }
29310   else
29311     var copy = Object.create(null)
29312
29313   Object.getOwnPropertyNames(obj).forEach(function (key) {
29314     Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
29315   })
29316
29317   return copy
29318 }
29319
29320
29321 /***/ }),
29322 /* 197 */
29323 /***/ ((module) => {
29324
29325 module.exports = getType
29326
29327 function getType (st) {
29328   var types = [
29329     'Directory',
29330     'File',
29331     'SymbolicLink',
29332     'Link', // special for hardlinks from tarballs
29333     'BlockDevice',
29334     'CharacterDevice',
29335     'FIFO',
29336     'Socket'
29337   ]
29338   var type
29339
29340   if (st.type && types.indexOf(st.type) !== -1) {
29341     st[st.type] = true
29342     return st.type
29343   }
29344
29345   for (var i = 0, l = types.length; i < l; i++) {
29346     type = types[i]
29347     var is = st[type] || st['is' + type]
29348     if (typeof is === 'function') is = is.call(st)
29349     if (is) {
29350       st[type] = true
29351       st.type = type
29352       return type
29353     }
29354   }
29355
29356   return null
29357 }
29358
29359
29360 /***/ }),
29361 /* 198 */
29362 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29363
29364 // Basically just a wrapper around an fs.readlink
29365 //
29366 // XXX: Enhance this to support the Link type, by keeping
29367 // a lookup table of {<dev+inode>:<path>}, so that hardlinks
29368 // can be preserved in tarballs.
29369
29370 module.exports = LinkReader
29371
29372 var fs = __webpack_require__(192)
29373 var inherits = __webpack_require__(66)
29374 var Reader = __webpack_require__(191)
29375
29376 inherits(LinkReader, Reader)
29377
29378 function LinkReader (props) {
29379   var self = this
29380   if (!(self instanceof LinkReader)) {
29381     throw new Error('LinkReader must be called as constructor.')
29382   }
29383
29384   if (!((props.type === 'Link' && props.Link) ||
29385     (props.type === 'SymbolicLink' && props.SymbolicLink))) {
29386     throw new Error('Non-link type ' + props.type)
29387   }
29388
29389   Reader.call(self, props)
29390 }
29391
29392 // When piping a LinkReader into a LinkWriter, we have to
29393 // already have the linkpath property set, so that has to
29394 // happen *before* the "ready" event, which means we need to
29395 // override the _stat method.
29396 LinkReader.prototype._stat = function (currentStat) {
29397   var self = this
29398   fs.readlink(self._path, function (er, linkpath) {
29399     if (er) return self.error(er)
29400     self.linkpath = self.props.linkpath = linkpath
29401     self.emit('linkpath', linkpath)
29402     Reader.prototype._stat.call(self, currentStat)
29403   })
29404 }
29405
29406 LinkReader.prototype._read = function () {
29407   var self = this
29408   if (self._paused) return
29409   // basically just a no-op, since we got all the info we need
29410   // from the _stat method
29411   if (!self._ended) {
29412     self.emit('end')
29413     self.emit('close')
29414     self._ended = true
29415   }
29416 }
29417
29418
29419 /***/ }),
29420 /* 199 */
29421 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29422
29423 // A thing that emits "entry" events with Reader objects
29424 // Pausing it causes it to stop emitting entry events, and also
29425 // pauses the current entry if there is one.
29426
29427 module.exports = DirReader
29428
29429 var fs = __webpack_require__(192)
29430 var inherits = __webpack_require__(66)
29431 var path = __webpack_require__(2)
29432 var Reader = __webpack_require__(191)
29433 var assert = __webpack_require__(58).ok
29434
29435 inherits(DirReader, Reader)
29436
29437 function DirReader (props) {
29438   var self = this
29439   if (!(self instanceof DirReader)) {
29440     throw new Error('DirReader must be called as constructor.')
29441   }
29442
29443   // should already be established as a Directory type
29444   if (props.type !== 'Directory' || !props.Directory) {
29445     throw new Error('Non-directory type ' + props.type)
29446   }
29447
29448   self.entries = null
29449   self._index = -1
29450   self._paused = false
29451   self._length = -1
29452
29453   if (props.sort) {
29454     this.sort = props.sort
29455   }
29456
29457   Reader.call(this, props)
29458 }
29459
29460 DirReader.prototype._getEntries = function () {
29461   var self = this
29462
29463   // race condition.  might pause() before calling _getEntries,
29464   // and then resume, and try to get them a second time.
29465   if (self._gotEntries) return
29466   self._gotEntries = true
29467
29468   fs.readdir(self._path, function (er, entries) {
29469     if (er) return self.error(er)
29470
29471     self.entries = entries
29472
29473     self.emit('entries', entries)
29474     if (self._paused) self.once('resume', processEntries)
29475     else processEntries()
29476
29477     function processEntries () {
29478       self._length = self.entries.length
29479       if (typeof self.sort === 'function') {
29480         self.entries = self.entries.sort(self.sort.bind(self))
29481       }
29482       self._read()
29483     }
29484   })
29485 }
29486
29487 // start walking the dir, and emit an "entry" event for each one.
29488 DirReader.prototype._read = function () {
29489   var self = this
29490
29491   if (!self.entries) return self._getEntries()
29492
29493   if (self._paused || self._currentEntry || self._aborted) {
29494     // console.error('DR paused=%j, current=%j, aborted=%j', self._paused, !!self._currentEntry, self._aborted)
29495     return
29496   }
29497
29498   self._index++
29499   if (self._index >= self.entries.length) {
29500     if (!self._ended) {
29501       self._ended = true
29502       self.emit('end')
29503       self.emit('close')
29504     }
29505     return
29506   }
29507
29508   // ok, handle this one, then.
29509
29510   // save creating a proxy, by stat'ing the thing now.
29511   var p = path.resolve(self._path, self.entries[self._index])
29512   assert(p !== self._path)
29513   assert(self.entries[self._index])
29514
29515   // set this to prevent trying to _read() again in the stat time.
29516   self._currentEntry = p
29517   fs[ self.props.follow ? 'stat' : 'lstat' ](p, function (er, stat) {
29518     if (er) return self.error(er)
29519
29520     var who = self._proxy || self
29521
29522     stat.path = p
29523     stat.basename = path.basename(p)
29524     stat.dirname = path.dirname(p)
29525     var childProps = self.getChildProps.call(who, stat)
29526     childProps.path = p
29527     childProps.basename = path.basename(p)
29528     childProps.dirname = path.dirname(p)
29529
29530     var entry = Reader(childProps, stat)
29531
29532     // console.error("DR Entry", p, stat.size)
29533
29534     self._currentEntry = entry
29535
29536     // "entry" events are for direct entries in a specific dir.
29537     // "child" events are for any and all children at all levels.
29538     // This nomenclature is not completely final.
29539
29540     entry.on('pause', function (who) {
29541       if (!self._paused && !entry._disowned) {
29542         self.pause(who)
29543       }
29544     })
29545
29546     entry.on('resume', function (who) {
29547       if (self._paused && !entry._disowned) {
29548         self.resume(who)
29549       }
29550     })
29551
29552     entry.on('stat', function (props) {
29553       self.emit('_entryStat', entry, props)
29554       if (entry._aborted) return
29555       if (entry._paused) {
29556         entry.once('resume', function () {
29557           self.emit('entryStat', entry, props)
29558         })
29559       } else self.emit('entryStat', entry, props)
29560     })
29561
29562     entry.on('ready', function EMITCHILD () {
29563       // console.error("DR emit child", entry._path)
29564       if (self._paused) {
29565         // console.error("  DR emit child - try again later")
29566         // pause the child, and emit the "entry" event once we drain.
29567         // console.error("DR pausing child entry")
29568         entry.pause(self)
29569         return self.once('resume', EMITCHILD)
29570       }
29571
29572       // skip over sockets.  they can't be piped around properly,
29573       // so there's really no sense even acknowledging them.
29574       // if someone really wants to see them, they can listen to
29575       // the "socket" events.
29576       if (entry.type === 'Socket') {
29577         self.emit('socket', entry)
29578       } else {
29579         self.emitEntry(entry)
29580       }
29581     })
29582
29583     var ended = false
29584     entry.on('close', onend)
29585     entry.on('disown', onend)
29586     function onend () {
29587       if (ended) return
29588       ended = true
29589       self.emit('childEnd', entry)
29590       self.emit('entryEnd', entry)
29591       self._currentEntry = null
29592       if (!self._paused) {
29593         self._read()
29594       }
29595     }
29596
29597     // XXX Remove this.  Works in node as of 0.6.2 or so.
29598     // Long filenames should not break stuff.
29599     entry.on('error', function (er) {
29600       if (entry._swallowErrors) {
29601         self.warn(er)
29602         entry.emit('end')
29603         entry.emit('close')
29604       } else {
29605         self.emit('error', er)
29606       }
29607     })
29608
29609     // proxy up some events.
29610     ;[
29611       'child',
29612       'childEnd',
29613       'warn'
29614     ].forEach(function (ev) {
29615       entry.on(ev, self.emit.bind(self, ev))
29616     })
29617   })
29618 }
29619
29620 DirReader.prototype.disown = function (entry) {
29621   entry.emit('beforeDisown')
29622   entry._disowned = true
29623   entry.parent = entry.root = null
29624   if (entry === this._currentEntry) {
29625     this._currentEntry = null
29626   }
29627   entry.emit('disown')
29628 }
29629
29630 DirReader.prototype.getChildProps = function () {
29631   return {
29632     depth: this.depth + 1,
29633     root: this.root || this,
29634     parent: this,
29635     follow: this.follow,
29636     filter: this.filter,
29637     sort: this.props.sort,
29638     hardlinks: this.props.hardlinks
29639   }
29640 }
29641
29642 DirReader.prototype.pause = function (who) {
29643   var self = this
29644   if (self._paused) return
29645   who = who || self
29646   self._paused = true
29647   if (self._currentEntry && self._currentEntry.pause) {
29648     self._currentEntry.pause(who)
29649   }
29650   self.emit('pause', who)
29651 }
29652
29653 DirReader.prototype.resume = function (who) {
29654   var self = this
29655   if (!self._paused) return
29656   who = who || self
29657
29658   self._paused = false
29659   // console.error('DR Emit Resume', self._path)
29660   self.emit('resume', who)
29661   if (self._paused) {
29662     // console.error('DR Re-paused', self._path)
29663     return
29664   }
29665
29666   if (self._currentEntry) {
29667     if (self._currentEntry.resume) self._currentEntry.resume(who)
29668   } else self._read()
29669 }
29670
29671 DirReader.prototype.emitEntry = function (entry) {
29672   this.emit('entry', entry)
29673   this.emit('child', entry)
29674 }
29675
29676
29677 /***/ }),
29678 /* 200 */
29679 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29680
29681 // Basically just a wrapper around an fs.ReadStream
29682
29683 module.exports = FileReader
29684
29685 var fs = __webpack_require__(192)
29686 var inherits = __webpack_require__(66)
29687 var Reader = __webpack_require__(191)
29688 var EOF = {EOF: true}
29689 var CLOSE = {CLOSE: true}
29690
29691 inherits(FileReader, Reader)
29692
29693 function FileReader (props) {
29694   // console.error("    FR create", props.path, props.size, new Error().stack)
29695   var self = this
29696   if (!(self instanceof FileReader)) {
29697     throw new Error('FileReader must be called as constructor.')
29698   }
29699
29700   // should already be established as a File type
29701   // XXX Todo: preserve hardlinks by tracking dev+inode+nlink,
29702   // with a HardLinkReader class.
29703   if (!((props.type === 'Link' && props.Link) ||
29704     (props.type === 'File' && props.File))) {
29705     throw new Error('Non-file type ' + props.type)
29706   }
29707
29708   self._buffer = []
29709   self._bytesEmitted = 0
29710   Reader.call(self, props)
29711 }
29712
29713 FileReader.prototype._getStream = function () {
29714   var self = this
29715   var stream = self._stream = fs.createReadStream(self._path, self.props)
29716
29717   if (self.props.blksize) {
29718     stream.bufferSize = self.props.blksize
29719   }
29720
29721   stream.on('open', self.emit.bind(self, 'open'))
29722
29723   stream.on('data', function (c) {
29724     // console.error('\t\t%d %s', c.length, self.basename)
29725     self._bytesEmitted += c.length
29726     // no point saving empty chunks
29727     if (!c.length) {
29728       return
29729     } else if (self._paused || self._buffer.length) {
29730       self._buffer.push(c)
29731       self._read()
29732     } else self.emit('data', c)
29733   })
29734
29735   stream.on('end', function () {
29736     if (self._paused || self._buffer.length) {
29737       // console.error('FR Buffering End', self._path)
29738       self._buffer.push(EOF)
29739       self._read()
29740     } else {
29741       self.emit('end')
29742     }
29743
29744     if (self._bytesEmitted !== self.props.size) {
29745       self.error("Didn't get expected byte count\n" +
29746         'expect: ' + self.props.size + '\n' +
29747         'actual: ' + self._bytesEmitted)
29748     }
29749   })
29750
29751   stream.on('close', function () {
29752     if (self._paused || self._buffer.length) {
29753       // console.error('FR Buffering Close', self._path)
29754       self._buffer.push(CLOSE)
29755       self._read()
29756     } else {
29757       // console.error('FR close 1', self._path)
29758       self.emit('close')
29759     }
29760   })
29761
29762   stream.on('error', function (e) {
29763     self.emit('error', e)
29764   })
29765
29766   self._read()
29767 }
29768
29769 FileReader.prototype._read = function () {
29770   var self = this
29771   // console.error('FR _read', self._path)
29772   if (self._paused) {
29773     // console.error('FR _read paused', self._path)
29774     return
29775   }
29776
29777   if (!self._stream) {
29778     // console.error('FR _getStream calling', self._path)
29779     return self._getStream()
29780   }
29781
29782   // clear out the buffer, if there is one.
29783   if (self._buffer.length) {
29784     // console.error('FR _read has buffer', self._buffer.length, self._path)
29785     var buf = self._buffer
29786     for (var i = 0, l = buf.length; i < l; i++) {
29787       var c = buf[i]
29788       if (c === EOF) {
29789         // console.error('FR Read emitting buffered end', self._path)
29790         self.emit('end')
29791       } else if (c === CLOSE) {
29792         // console.error('FR Read emitting buffered close', self._path)
29793         self.emit('close')
29794       } else {
29795         // console.error('FR Read emitting buffered data', self._path)
29796         self.emit('data', c)
29797       }
29798
29799       if (self._paused) {
29800         // console.error('FR Read Re-pausing at '+i, self._path)
29801         self._buffer = buf.slice(i)
29802         return
29803       }
29804     }
29805     self._buffer.length = 0
29806   }
29807 // console.error("FR _read done")
29808 // that's about all there is to it.
29809 }
29810
29811 FileReader.prototype.pause = function (who) {
29812   var self = this
29813   // console.error('FR Pause', self._path)
29814   if (self._paused) return
29815   who = who || self
29816   self._paused = true
29817   if (self._stream) self._stream.pause()
29818   self.emit('pause', who)
29819 }
29820
29821 FileReader.prototype.resume = function (who) {
29822   var self = this
29823   // console.error('FR Resume', self._path)
29824   if (!self._paused) return
29825   who = who || self
29826   self.emit('resume', who)
29827   self._paused = false
29828   if (self._stream) self._stream.resume()
29829   self._read()
29830 }
29831
29832
29833 /***/ }),
29834 /* 201 */
29835 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29836
29837 // Just get the stats, and then don't do anything.
29838 // You can't really "read" from a socket.  You "connect" to it.
29839 // Mostly, this is here so that reading a dir with a socket in it
29840 // doesn't blow up.
29841
29842 module.exports = SocketReader
29843
29844 var inherits = __webpack_require__(66)
29845 var Reader = __webpack_require__(191)
29846
29847 inherits(SocketReader, Reader)
29848
29849 function SocketReader (props) {
29850   var self = this
29851   if (!(self instanceof SocketReader)) {
29852     throw new Error('SocketReader must be called as constructor.')
29853   }
29854
29855   if (!(props.type === 'Socket' && props.Socket)) {
29856     throw new Error('Non-socket type ' + props.type)
29857   }
29858
29859   Reader.call(self, props)
29860 }
29861
29862 SocketReader.prototype._read = function () {
29863   var self = this
29864   if (self._paused) return
29865   // basically just a no-op, since we got all the info we have
29866   // from the _stat method
29867   if (!self._ended) {
29868     self.emit('end')
29869     self.emit('close')
29870     self._ended = true
29871   }
29872 }
29873
29874
29875 /***/ }),
29876 /* 202 */
29877 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29878
29879 // A reader for when we don't yet know what kind of thing
29880 // the thing is.
29881
29882 module.exports = ProxyReader
29883
29884 var Reader = __webpack_require__(191)
29885 var getType = __webpack_require__(197)
29886 var inherits = __webpack_require__(66)
29887 var fs = __webpack_require__(192)
29888
29889 inherits(ProxyReader, Reader)
29890
29891 function ProxyReader (props) {
29892   var self = this
29893   if (!(self instanceof ProxyReader)) {
29894     throw new Error('ProxyReader must be called as constructor.')
29895   }
29896
29897   self.props = props
29898   self._buffer = []
29899   self.ready = false
29900
29901   Reader.call(self, props)
29902 }
29903
29904 ProxyReader.prototype._stat = function () {
29905   var self = this
29906   var props = self.props
29907   // stat the thing to see what the proxy should be.
29908   var stat = props.follow ? 'stat' : 'lstat'
29909
29910   fs[stat](props.path, function (er, current) {
29911     var type
29912     if (er || !current) {
29913       type = 'File'
29914     } else {
29915       type = getType(current)
29916     }
29917
29918     props[type] = true
29919     props.type = self.type = type
29920
29921     self._old = current
29922     self._addProxy(Reader(props, current))
29923   })
29924 }
29925
29926 ProxyReader.prototype._addProxy = function (proxy) {
29927   var self = this
29928   if (self._proxyTarget) {
29929     return self.error('proxy already set')
29930   }
29931
29932   self._proxyTarget = proxy
29933   proxy._proxy = self
29934
29935   ;[
29936     'error',
29937     'data',
29938     'end',
29939     'close',
29940     'linkpath',
29941     'entry',
29942     'entryEnd',
29943     'child',
29944     'childEnd',
29945     'warn',
29946     'stat'
29947   ].forEach(function (ev) {
29948     // console.error('~~ proxy event', ev, self.path)
29949     proxy.on(ev, self.emit.bind(self, ev))
29950   })
29951
29952   self.emit('proxy', proxy)
29953
29954   proxy.on('ready', function () {
29955     // console.error("~~ proxy is ready!", self.path)
29956     self.ready = true
29957     self.emit('ready')
29958   })
29959
29960   var calls = self._buffer
29961   self._buffer.length = 0
29962   calls.forEach(function (c) {
29963     proxy[c[0]].apply(proxy, c[1])
29964   })
29965 }
29966
29967 ProxyReader.prototype.pause = function () {
29968   return this._proxyTarget ? this._proxyTarget.pause() : false
29969 }
29970
29971 ProxyReader.prototype.resume = function () {
29972   return this._proxyTarget ? this._proxyTarget.resume() : false
29973 }
29974
29975
29976 /***/ }),
29977 /* 203 */
29978 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29979
29980 module.exports = Writer
29981
29982 var fs = __webpack_require__(192)
29983 var inherits = __webpack_require__(66)
29984 var rimraf = __webpack_require__(204)
29985 var mkdir = __webpack_require__(205)
29986 var path = __webpack_require__(2)
29987 var umask = process.platform === 'win32' ? 0 : process.umask()
29988 var getType = __webpack_require__(197)
29989 var Abstract = __webpack_require__(190)
29990
29991 // Must do this *before* loading the child classes
29992 inherits(Writer, Abstract)
29993
29994 Writer.dirmode = parseInt('0777', 8) & (~umask)
29995 Writer.filemode = parseInt('0666', 8) & (~umask)
29996
29997 var DirWriter = __webpack_require__(206)
29998 var LinkWriter = __webpack_require__(208)
29999 var FileWriter = __webpack_require__(209)
30000 var ProxyWriter = __webpack_require__(210)
30001
30002 // props is the desired state.  current is optionally the current stat,
30003 // provided here so that subclasses can avoid statting the target
30004 // more than necessary.
30005 function Writer (props, current) {
30006   var self = this
30007
30008   if (typeof props === 'string') {
30009     props = { path: props }
30010   }
30011
30012   // polymorphism.
30013   // call fstream.Writer(dir) to get a DirWriter object, etc.
30014   var type = getType(props)
30015   var ClassType = Writer
30016
30017   switch (type) {
30018     case 'Directory':
30019       ClassType = DirWriter
30020       break
30021     case 'File':
30022       ClassType = FileWriter
30023       break
30024     case 'Link':
30025     case 'SymbolicLink':
30026       ClassType = LinkWriter
30027       break
30028     case null:
30029     default:
30030       // Don't know yet what type to create, so we wrap in a proxy.
30031       ClassType = ProxyWriter
30032       break
30033   }
30034
30035   if (!(self instanceof ClassType)) return new ClassType(props)
30036
30037   // now get down to business.
30038
30039   Abstract.call(self)
30040
30041   if (!props.path) self.error('Must provide a path', null, true)
30042
30043   // props is what we want to set.
30044   // set some convenience properties as well.
30045   self.type = props.type
30046   self.props = props
30047   self.depth = props.depth || 0
30048   self.clobber = props.clobber === false ? props.clobber : true
30049   self.parent = props.parent || null
30050   self.root = props.root || (props.parent && props.parent.root) || self
30051
30052   self._path = self.path = path.resolve(props.path)
30053   if (process.platform === 'win32') {
30054     self.path = self._path = self.path.replace(/\?/g, '_')
30055     if (self._path.length >= 260) {
30056       self._swallowErrors = true
30057       self._path = '\\\\?\\' + self.path.replace(/\//g, '\\')
30058     }
30059   }
30060   self.basename = path.basename(props.path)
30061   self.dirname = path.dirname(props.path)
30062   self.linkpath = props.linkpath || null
30063
30064   props.parent = props.root = null
30065
30066   // console.error("\n\n\n%s setting size to", props.path, props.size)
30067   self.size = props.size
30068
30069   if (typeof props.mode === 'string') {
30070     props.mode = parseInt(props.mode, 8)
30071   }
30072
30073   self.readable = false
30074   self.writable = true
30075
30076   // buffer until ready, or while handling another entry
30077   self._buffer = []
30078   self.ready = false
30079
30080   self.filter = typeof props.filter === 'function' ? props.filter : null
30081
30082   // start the ball rolling.
30083   // this checks what's there already, and then calls
30084   // self._create() to call the impl-specific creation stuff.
30085   self._stat(current)
30086 }
30087
30088 // Calling this means that it's something we can't create.
30089 // Just assert that it's already there, otherwise raise a warning.
30090 Writer.prototype._create = function () {
30091   var self = this
30092   fs[self.props.follow ? 'stat' : 'lstat'](self._path, function (er) {
30093     if (er) {
30094       return self.warn('Cannot create ' + self._path + '\n' +
30095         'Unsupported type: ' + self.type, 'ENOTSUP')
30096     }
30097     self._finish()
30098   })
30099 }
30100
30101 Writer.prototype._stat = function (current) {
30102   var self = this
30103   var props = self.props
30104   var stat = props.follow ? 'stat' : 'lstat'
30105   var who = self._proxy || self
30106
30107   if (current) statCb(null, current)
30108   else fs[stat](self._path, statCb)
30109
30110   function statCb (er, current) {
30111     if (self.filter && !self.filter.call(who, who, current)) {
30112       self._aborted = true
30113       self.emit('end')
30114       self.emit('close')
30115       return
30116     }
30117
30118     // if it's not there, great.  We'll just create it.
30119     // if it is there, then we'll need to change whatever differs
30120     if (er || !current) {
30121       return create(self)
30122     }
30123
30124     self._old = current
30125     var currentType = getType(current)
30126
30127     // if it's a type change, then we need to clobber or error.
30128     // if it's not a type change, then let the impl take care of it.
30129     if (currentType !== self.type || self.type === 'File' && current.nlink > 1) {
30130       return rimraf(self._path, function (er) {
30131         if (er) return self.error(er)
30132         self._old = null
30133         create(self)
30134       })
30135     }
30136
30137     // otherwise, just handle in the app-specific way
30138     // this creates a fs.WriteStream, or mkdir's, or whatever
30139     create(self)
30140   }
30141 }
30142
30143 function create (self) {
30144   // console.error("W create", self._path, Writer.dirmode)
30145
30146   // XXX Need to clobber non-dirs that are in the way,
30147   // unless { clobber: false } in the props.
30148   mkdir(path.dirname(self._path), Writer.dirmode, function (er, made) {
30149     // console.error("W created", path.dirname(self._path), er)
30150     if (er) return self.error(er)
30151
30152     // later on, we have to set the mode and owner for these
30153     self._madeDir = made
30154     return self._create()
30155   })
30156 }
30157
30158 function endChmod (self, want, current, path, cb) {
30159   var wantMode = want.mode
30160   var chmod = want.follow || self.type !== 'SymbolicLink'
30161     ? 'chmod' : 'lchmod'
30162
30163   if (!fs[chmod]) return cb()
30164   if (typeof wantMode !== 'number') return cb()
30165
30166   var curMode = current.mode & parseInt('0777', 8)
30167   wantMode = wantMode & parseInt('0777', 8)
30168   if (wantMode === curMode) return cb()
30169
30170   fs[chmod](path, wantMode, cb)
30171 }
30172
30173 function endChown (self, want, current, path, cb) {
30174   // Don't even try it unless root.  Too easy to EPERM.
30175   if (process.platform === 'win32') return cb()
30176   if (!process.getuid || process.getuid() !== 0) return cb()
30177   if (typeof want.uid !== 'number' &&
30178     typeof want.gid !== 'number') return cb()
30179
30180   if (current.uid === want.uid &&
30181     current.gid === want.gid) return cb()
30182
30183   var chown = (self.props.follow || self.type !== 'SymbolicLink')
30184     ? 'chown' : 'lchown'
30185   if (!fs[chown]) return cb()
30186
30187   if (typeof want.uid !== 'number') want.uid = current.uid
30188   if (typeof want.gid !== 'number') want.gid = current.gid
30189
30190   fs[chown](path, want.uid, want.gid, cb)
30191 }
30192
30193 function endUtimes (self, want, current, path, cb) {
30194   if (!fs.utimes || process.platform === 'win32') return cb()
30195
30196   var utimes = (want.follow || self.type !== 'SymbolicLink')
30197     ? 'utimes' : 'lutimes'
30198
30199   if (utimes === 'lutimes' && !fs[utimes]) {
30200     utimes = 'utimes'
30201   }
30202
30203   if (!fs[utimes]) return cb()
30204
30205   var curA = current.atime
30206   var curM = current.mtime
30207   var meA = want.atime
30208   var meM = want.mtime
30209
30210   if (meA === undefined) meA = curA
30211   if (meM === undefined) meM = curM
30212
30213   if (!isDate(meA)) meA = new Date(meA)
30214   if (!isDate(meM)) meA = new Date(meM)
30215
30216   if (meA.getTime() === curA.getTime() &&
30217     meM.getTime() === curM.getTime()) return cb()
30218
30219   fs[utimes](path, meA, meM, cb)
30220 }
30221
30222 // XXX This function is beastly.  Break it up!
30223 Writer.prototype._finish = function () {
30224   var self = this
30225
30226   if (self._finishing) return
30227   self._finishing = true
30228
30229   // console.error(" W Finish", self._path, self.size)
30230
30231   // set up all the things.
30232   // At this point, we're already done writing whatever we've gotta write,
30233   // adding files to the dir, etc.
30234   var todo = 0
30235   var errState = null
30236   var done = false
30237
30238   if (self._old) {
30239     // the times will almost *certainly* have changed.
30240     // adds the utimes syscall, but remove another stat.
30241     self._old.atime = new Date(0)
30242     self._old.mtime = new Date(0)
30243     // console.error(" W Finish Stale Stat", self._path, self.size)
30244     setProps(self._old)
30245   } else {
30246     var stat = self.props.follow ? 'stat' : 'lstat'
30247     // console.error(" W Finish Stating", self._path, self.size)
30248     fs[stat](self._path, function (er, current) {
30249       // console.error(" W Finish Stated", self._path, self.size, current)
30250       if (er) {
30251         // if we're in the process of writing out a
30252         // directory, it's very possible that the thing we're linking to
30253         // doesn't exist yet (especially if it was intended as a symlink),
30254         // so swallow ENOENT errors here and just soldier on.
30255         if (er.code === 'ENOENT' &&
30256           (self.type === 'Link' || self.type === 'SymbolicLink') &&
30257           process.platform === 'win32') {
30258           self.ready = true
30259           self.emit('ready')
30260           self.emit('end')
30261           self.emit('close')
30262           self.end = self._finish = function () {}
30263           return
30264         } else return self.error(er)
30265       }
30266       setProps(self._old = current)
30267     })
30268   }
30269
30270   return
30271
30272   function setProps (current) {
30273     todo += 3
30274     endChmod(self, self.props, current, self._path, next('chmod'))
30275     endChown(self, self.props, current, self._path, next('chown'))
30276     endUtimes(self, self.props, current, self._path, next('utimes'))
30277   }
30278
30279   function next (what) {
30280     return function (er) {
30281       // console.error("   W Finish", what, todo)
30282       if (errState) return
30283       if (er) {
30284         er.fstream_finish_call = what
30285         return self.error(errState = er)
30286       }
30287       if (--todo > 0) return
30288       if (done) return
30289       done = true
30290
30291       // we may still need to set the mode/etc. on some parent dirs
30292       // that were created previously.  delay end/close until then.
30293       if (!self._madeDir) return end()
30294       else endMadeDir(self, self._path, end)
30295
30296       function end (er) {
30297         if (er) {
30298           er.fstream_finish_call = 'setupMadeDir'
30299           return self.error(er)
30300         }
30301         // all the props have been set, so we're completely done.
30302         self.emit('end')
30303         self.emit('close')
30304       }
30305     }
30306   }
30307 }
30308
30309 function endMadeDir (self, p, cb) {
30310   var made = self._madeDir
30311   // everything *between* made and path.dirname(self._path)
30312   // needs to be set up.  Note that this may just be one dir.
30313   var d = path.dirname(p)
30314
30315   endMadeDir_(self, d, function (er) {
30316     if (er) return cb(er)
30317     if (d === made) {
30318       return cb()
30319     }
30320     endMadeDir(self, d, cb)
30321   })
30322 }
30323
30324 function endMadeDir_ (self, p, cb) {
30325   var dirProps = {}
30326   Object.keys(self.props).forEach(function (k) {
30327     dirProps[k] = self.props[k]
30328
30329     // only make non-readable dirs if explicitly requested.
30330     if (k === 'mode' && self.type !== 'Directory') {
30331       dirProps[k] = dirProps[k] | parseInt('0111', 8)
30332     }
30333   })
30334
30335   var todo = 3
30336   var errState = null
30337   fs.stat(p, function (er, current) {
30338     if (er) return cb(errState = er)
30339     endChmod(self, dirProps, current, p, next)
30340     endChown(self, dirProps, current, p, next)
30341     endUtimes(self, dirProps, current, p, next)
30342   })
30343
30344   function next (er) {
30345     if (errState) return
30346     if (er) return cb(errState = er)
30347     if (--todo === 0) return cb()
30348   }
30349 }
30350
30351 Writer.prototype.pipe = function () {
30352   this.error("Can't pipe from writable stream")
30353 }
30354
30355 Writer.prototype.add = function () {
30356   this.error("Can't add to non-Directory type")
30357 }
30358
30359 Writer.prototype.write = function () {
30360   return true
30361 }
30362
30363 function objectToString (d) {
30364   return Object.prototype.toString.call(d)
30365 }
30366
30367 function isDate (d) {
30368   return typeof d === 'object' && objectToString(d) === '[object Date]'
30369 }
30370
30371
30372 /***/ }),
30373 /* 204 */
30374 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
30375
30376 module.exports = rimraf
30377 rimraf.sync = rimrafSync
30378
30379 var assert = __webpack_require__(58)
30380 var path = __webpack_require__(2)
30381 var fs = __webpack_require__(42)
30382 var glob = undefined
30383 try {
30384   glob = __webpack_require__(59)
30385 } catch (_err) {
30386   // treat glob as optional.
30387 }
30388 var _0666 = parseInt('666', 8)
30389
30390 var defaultGlobOpts = {
30391   nosort: true,
30392   silent: true
30393 }
30394
30395 // for EMFILE handling
30396 var timeout = 0
30397
30398 var isWindows = (process.platform === "win32")
30399
30400 function defaults (options) {
30401   var methods = [
30402     'unlink',
30403     'chmod',
30404     'stat',
30405     'lstat',
30406     'rmdir',
30407     'readdir'
30408   ]
30409   methods.forEach(function(m) {
30410     options[m] = options[m] || fs[m]
30411     m = m + 'Sync'
30412     options[m] = options[m] || fs[m]
30413   })
30414
30415   options.maxBusyTries = options.maxBusyTries || 3
30416   options.emfileWait = options.emfileWait || 1000
30417   if (options.glob === false) {
30418     options.disableGlob = true
30419   }
30420   if (options.disableGlob !== true && glob === undefined) {
30421     throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
30422   }
30423   options.disableGlob = options.disableGlob || false
30424   options.glob = options.glob || defaultGlobOpts
30425 }
30426
30427 function rimraf (p, options, cb) {
30428   if (typeof options === 'function') {
30429     cb = options
30430     options = {}
30431   }
30432
30433   assert(p, 'rimraf: missing path')
30434   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
30435   assert.equal(typeof cb, 'function', 'rimraf: callback function required')
30436   assert(options, 'rimraf: invalid options argument provided')
30437   assert.equal(typeof options, 'object', 'rimraf: options should be object')
30438
30439   defaults(options)
30440
30441   var busyTries = 0
30442   var errState = null
30443   var n = 0
30444
30445   if (options.disableGlob || !glob.hasMagic(p))
30446     return afterGlob(null, [p])
30447
30448   options.lstat(p, function (er, stat) {
30449     if (!er)
30450       return afterGlob(null, [p])
30451
30452     glob(p, options.glob, afterGlob)
30453   })
30454
30455   function next (er) {
30456     errState = errState || er
30457     if (--n === 0)
30458       cb(errState)
30459   }
30460
30461   function afterGlob (er, results) {
30462     if (er)
30463       return cb(er)
30464
30465     n = results.length
30466     if (n === 0)
30467       return cb()
30468
30469     results.forEach(function (p) {
30470       rimraf_(p, options, function CB (er) {
30471         if (er) {
30472           if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
30473               busyTries < options.maxBusyTries) {
30474             busyTries ++
30475             var time = busyTries * 100
30476             // try again, with the same exact callback as this one.
30477             return setTimeout(function () {
30478               rimraf_(p, options, CB)
30479             }, time)
30480           }
30481
30482           // this one won't happen if graceful-fs is used.
30483           if (er.code === "EMFILE" && timeout < options.emfileWait) {
30484             return setTimeout(function () {
30485               rimraf_(p, options, CB)
30486             }, timeout ++)
30487           }
30488
30489           // already gone
30490           if (er.code === "ENOENT") er = null
30491         }
30492
30493         timeout = 0
30494         next(er)
30495       })
30496     })
30497   }
30498 }
30499
30500 // Two possible strategies.
30501 // 1. Assume it's a file.  unlink it, then do the dir stuff on EPERM or EISDIR
30502 // 2. Assume it's a directory.  readdir, then do the file stuff on ENOTDIR
30503 //
30504 // Both result in an extra syscall when you guess wrong.  However, there
30505 // are likely far more normal files in the world than directories.  This
30506 // is based on the assumption that a the average number of files per
30507 // directory is >= 1.
30508 //
30509 // If anyone ever complains about this, then I guess the strategy could
30510 // be made configurable somehow.  But until then, YAGNI.
30511 function rimraf_ (p, options, cb) {
30512   assert(p)
30513   assert(options)
30514   assert(typeof cb === 'function')
30515
30516   // sunos lets the root user unlink directories, which is... weird.
30517   // so we have to lstat here and make sure it's not a dir.
30518   options.lstat(p, function (er, st) {
30519     if (er && er.code === "ENOENT")
30520       return cb(null)
30521
30522     // Windows can EPERM on stat.  Life is suffering.
30523     if (er && er.code === "EPERM" && isWindows)
30524       fixWinEPERM(p, options, er, cb)
30525
30526     if (st && st.isDirectory())
30527       return rmdir(p, options, er, cb)
30528
30529     options.unlink(p, function (er) {
30530       if (er) {
30531         if (er.code === "ENOENT")
30532           return cb(null)
30533         if (er.code === "EPERM")
30534           return (isWindows)
30535             ? fixWinEPERM(p, options, er, cb)
30536             : rmdir(p, options, er, cb)
30537         if (er.code === "EISDIR")
30538           return rmdir(p, options, er, cb)
30539       }
30540       return cb(er)
30541     })
30542   })
30543 }
30544
30545 function fixWinEPERM (p, options, er, cb) {
30546   assert(p)
30547   assert(options)
30548   assert(typeof cb === 'function')
30549   if (er)
30550     assert(er instanceof Error)
30551
30552   options.chmod(p, _0666, function (er2) {
30553     if (er2)
30554       cb(er2.code === "ENOENT" ? null : er)
30555     else
30556       options.stat(p, function(er3, stats) {
30557         if (er3)
30558           cb(er3.code === "ENOENT" ? null : er)
30559         else if (stats.isDirectory())
30560           rmdir(p, options, er, cb)
30561         else
30562           options.unlink(p, cb)
30563       })
30564   })
30565 }
30566
30567 function fixWinEPERMSync (p, options, er) {
30568   assert(p)
30569   assert(options)
30570   if (er)
30571     assert(er instanceof Error)
30572
30573   try {
30574     options.chmodSync(p, _0666)
30575   } catch (er2) {
30576     if (er2.code === "ENOENT")
30577       return
30578     else
30579       throw er
30580   }
30581
30582   try {
30583     var stats = options.statSync(p)
30584   } catch (er3) {
30585     if (er3.code === "ENOENT")
30586       return
30587     else
30588       throw er
30589   }
30590
30591   if (stats.isDirectory())
30592     rmdirSync(p, options, er)
30593   else
30594     options.unlinkSync(p)
30595 }
30596
30597 function rmdir (p, options, originalEr, cb) {
30598   assert(p)
30599   assert(options)
30600   if (originalEr)
30601     assert(originalEr instanceof Error)
30602   assert(typeof cb === 'function')
30603
30604   // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
30605   // if we guessed wrong, and it's not a directory, then
30606   // raise the original error.
30607   options.rmdir(p, function (er) {
30608     if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
30609       rmkids(p, options, cb)
30610     else if (er && er.code === "ENOTDIR")
30611       cb(originalEr)
30612     else
30613       cb(er)
30614   })
30615 }
30616
30617 function rmkids(p, options, cb) {
30618   assert(p)
30619   assert(options)
30620   assert(typeof cb === 'function')
30621
30622   options.readdir(p, function (er, files) {
30623     if (er)
30624       return cb(er)
30625     var n = files.length
30626     if (n === 0)
30627       return options.rmdir(p, cb)
30628     var errState
30629     files.forEach(function (f) {
30630       rimraf(path.join(p, f), options, function (er) {
30631         if (errState)
30632           return
30633         if (er)
30634           return cb(errState = er)
30635         if (--n === 0)
30636           options.rmdir(p, cb)
30637       })
30638     })
30639   })
30640 }
30641
30642 // this looks simpler, and is strictly *faster*, but will
30643 // tie up the JavaScript thread and fail on excessively
30644 // deep directory trees.
30645 function rimrafSync (p, options) {
30646   options = options || {}
30647   defaults(options)
30648
30649   assert(p, 'rimraf: missing path')
30650   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
30651   assert(options, 'rimraf: missing options')
30652   assert.equal(typeof options, 'object', 'rimraf: options should be object')
30653
30654   var results
30655
30656   if (options.disableGlob || !glob.hasMagic(p)) {
30657     results = [p]
30658   } else {
30659     try {
30660       options.lstatSync(p)
30661       results = [p]
30662     } catch (er) {
30663       results = glob.sync(p, options.glob)
30664     }
30665   }
30666
30667   if (!results.length)
30668     return
30669
30670   for (var i = 0; i < results.length; i++) {
30671     var p = results[i]
30672
30673     try {
30674       var st = options.lstatSync(p)
30675     } catch (er) {
30676       if (er.code === "ENOENT")
30677         return
30678
30679       // Windows can EPERM on stat.  Life is suffering.
30680       if (er.code === "EPERM" && isWindows)
30681         fixWinEPERMSync(p, options, er)
30682     }
30683
30684     try {
30685       // sunos lets the root user unlink directories, which is... weird.
30686       if (st && st.isDirectory())
30687         rmdirSync(p, options, null)
30688       else
30689         options.unlinkSync(p)
30690     } catch (er) {
30691       if (er.code === "ENOENT")
30692         return
30693       if (er.code === "EPERM")
30694         return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
30695       if (er.code !== "EISDIR")
30696         throw er
30697
30698       rmdirSync(p, options, er)
30699     }
30700   }
30701 }
30702
30703 function rmdirSync (p, options, originalEr) {
30704   assert(p)
30705   assert(options)
30706   if (originalEr)
30707     assert(originalEr instanceof Error)
30708
30709   try {
30710     options.rmdirSync(p)
30711   } catch (er) {
30712     if (er.code === "ENOENT")
30713       return
30714     if (er.code === "ENOTDIR")
30715       throw originalEr
30716     if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
30717       rmkidsSync(p, options)
30718   }
30719 }
30720
30721 function rmkidsSync (p, options) {
30722   assert(p)
30723   assert(options)
30724   options.readdirSync(p).forEach(function (f) {
30725     rimrafSync(path.join(p, f), options)
30726   })
30727
30728   // We only end up here once we got ENOTEMPTY at least once, and
30729   // at this point, we are guaranteed to have removed all the kids.
30730   // So, we know that it won't be ENOENT or ENOTDIR or anything else.
30731   // try really hard to delete stuff on windows, because it has a
30732   // PROFOUNDLY annoying habit of not closing handles promptly when
30733   // files are deleted, resulting in spurious ENOTEMPTY errors.
30734   var retries = isWindows ? 100 : 1
30735   var i = 0
30736   do {
30737     var threw = true
30738     try {
30739       var ret = options.rmdirSync(p, options)
30740       threw = false
30741       return ret
30742     } finally {
30743       if (++i < retries && threw)
30744         continue
30745     }
30746   } while (true)
30747 }
30748
30749
30750 /***/ }),
30751 /* 205 */
30752 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
30753
30754 var path = __webpack_require__(2);
30755 var fs = __webpack_require__(42);
30756 var _0777 = parseInt('0777', 8);
30757
30758 module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
30759
30760 function mkdirP (p, opts, f, made) {
30761     if (typeof opts === 'function') {
30762         f = opts;
30763         opts = {};
30764     }
30765     else if (!opts || typeof opts !== 'object') {
30766         opts = { mode: opts };
30767     }
30768     
30769     var mode = opts.mode;
30770     var xfs = opts.fs || fs;
30771     
30772     if (mode === undefined) {
30773         mode = _0777
30774     }
30775     if (!made) made = null;
30776     
30777     var cb = f || function () {};
30778     p = path.resolve(p);
30779     
30780     xfs.mkdir(p, mode, function (er) {
30781         if (!er) {
30782             made = made || p;
30783             return cb(null, made);
30784         }
30785         switch (er.code) {
30786             case 'ENOENT':
30787                 if (path.dirname(p) === p) return cb(er);
30788                 mkdirP(path.dirname(p), opts, function (er, made) {
30789                     if (er) cb(er, made);
30790                     else mkdirP(p, opts, cb, made);
30791                 });
30792                 break;
30793
30794             // In the case of any other error, just see if there's a dir
30795             // there already.  If so, then hooray!  If not, then something
30796             // is borked.
30797             default:
30798                 xfs.stat(p, function (er2, stat) {
30799                     // if the stat fails, then that's super weird.
30800                     // let the original error be the failure reason.
30801                     if (er2 || !stat.isDirectory()) cb(er, made)
30802                     else cb(null, made);
30803                 });
30804                 break;
30805         }
30806     });
30807 }
30808
30809 mkdirP.sync = function sync (p, opts, made) {
30810     if (!opts || typeof opts !== 'object') {
30811         opts = { mode: opts };
30812     }
30813     
30814     var mode = opts.mode;
30815     var xfs = opts.fs || fs;
30816     
30817     if (mode === undefined) {
30818         mode = _0777
30819     }
30820     if (!made) made = null;
30821
30822     p = path.resolve(p);
30823
30824     try {
30825         xfs.mkdirSync(p, mode);
30826         made = made || p;
30827     }
30828     catch (err0) {
30829         switch (err0.code) {
30830             case 'ENOENT' :
30831                 made = sync(path.dirname(p), opts, made);
30832                 sync(p, opts, made);
30833                 break;
30834
30835             // In the case of any other error, just see if there's a dir
30836             // there already.  If so, then hooray!  If not, then something
30837             // is borked.
30838             default:
30839                 var stat;
30840                 try {
30841                     stat = xfs.statSync(p);
30842                 }
30843                 catch (err1) {
30844                     throw err0;
30845                 }
30846                 if (!stat.isDirectory()) throw err0;
30847                 break;
30848         }
30849     }
30850
30851     return made;
30852 };
30853
30854
30855 /***/ }),
30856 /* 206 */
30857 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
30858
30859 // It is expected that, when .add() returns false, the consumer
30860 // of the DirWriter will pause until a "drain" event occurs. Note
30861 // that this is *almost always going to be the case*, unless the
30862 // thing being written is some sort of unsupported type, and thus
30863 // skipped over.
30864
30865 module.exports = DirWriter
30866
30867 var Writer = __webpack_require__(203)
30868 var inherits = __webpack_require__(66)
30869 var mkdir = __webpack_require__(205)
30870 var path = __webpack_require__(2)
30871 var collect = __webpack_require__(207)
30872
30873 inherits(DirWriter, Writer)
30874
30875 function DirWriter (props) {
30876   var self = this
30877   if (!(self instanceof DirWriter)) {
30878     self.error('DirWriter must be called as constructor.', null, true)
30879   }
30880
30881   // should already be established as a Directory type
30882   if (props.type !== 'Directory' || !props.Directory) {
30883     self.error('Non-directory type ' + props.type + ' ' +
30884       JSON.stringify(props), null, true)
30885   }
30886
30887   Writer.call(this, props)
30888 }
30889
30890 DirWriter.prototype._create = function () {
30891   var self = this
30892   mkdir(self._path, Writer.dirmode, function (er) {
30893     if (er) return self.error(er)
30894     // ready to start getting entries!
30895     self.ready = true
30896     self.emit('ready')
30897     self._process()
30898   })
30899 }
30900
30901 // a DirWriter has an add(entry) method, but its .write() doesn't
30902 // do anything.  Why a no-op rather than a throw?  Because this
30903 // leaves open the door for writing directory metadata for
30904 // gnu/solaris style dumpdirs.
30905 DirWriter.prototype.write = function () {
30906   return true
30907 }
30908
30909 DirWriter.prototype.end = function () {
30910   this._ended = true
30911   this._process()
30912 }
30913
30914 DirWriter.prototype.add = function (entry) {
30915   var self = this
30916
30917   // console.error('\tadd', entry._path, '->', self._path)
30918   collect(entry)
30919   if (!self.ready || self._currentEntry) {
30920     self._buffer.push(entry)
30921     return false
30922   }
30923
30924   // create a new writer, and pipe the incoming entry into it.
30925   if (self._ended) {
30926     return self.error('add after end')
30927   }
30928
30929   self._buffer.push(entry)
30930   self._process()
30931
30932   return this._buffer.length === 0
30933 }
30934
30935 DirWriter.prototype._process = function () {
30936   var self = this
30937
30938   // console.error('DW Process p=%j', self._processing, self.basename)
30939
30940   if (self._processing) return
30941
30942   var entry = self._buffer.shift()
30943   if (!entry) {
30944     // console.error("DW Drain")
30945     self.emit('drain')
30946     if (self._ended) self._finish()
30947     return
30948   }
30949
30950   self._processing = true
30951   // console.error("DW Entry", entry._path)
30952
30953   self.emit('entry', entry)
30954
30955   // ok, add this entry
30956   //
30957   // don't allow recursive copying
30958   var p = entry
30959   var pp
30960   do {
30961     pp = p._path || p.path
30962     if (pp === self.root._path || pp === self._path ||
30963       (pp && pp.indexOf(self._path) === 0)) {
30964       // console.error('DW Exit (recursive)', entry.basename, self._path)
30965       self._processing = false
30966       if (entry._collected) entry.pipe()
30967       return self._process()
30968     }
30969     p = p.parent
30970   } while (p)
30971
30972   // console.error("DW not recursive")
30973
30974   // chop off the entry's root dir, replace with ours
30975   var props = {
30976     parent: self,
30977     root: self.root || self,
30978     type: entry.type,
30979     depth: self.depth + 1
30980   }
30981
30982   pp = entry._path || entry.path || entry.props.path
30983   if (entry.parent) {
30984     pp = pp.substr(entry.parent._path.length + 1)
30985   }
30986   // get rid of any ../../ shenanigans
30987   props.path = path.join(self.path, path.join('/', pp))
30988
30989   // if i have a filter, the child should inherit it.
30990   props.filter = self.filter
30991
30992   // all the rest of the stuff, copy over from the source.
30993   Object.keys(entry.props).forEach(function (k) {
30994     if (!props.hasOwnProperty(k)) {
30995       props[k] = entry.props[k]
30996     }
30997   })
30998
30999   // not sure at this point what kind of writer this is.
31000   var child = self._currentChild = new Writer(props)
31001   child.on('ready', function () {
31002     // console.error("DW Child Ready", child.type, child._path)
31003     // console.error("  resuming", entry._path)
31004     entry.pipe(child)
31005     entry.resume()
31006   })
31007
31008   // XXX Make this work in node.
31009   // Long filenames should not break stuff.
31010   child.on('error', function (er) {
31011     if (child._swallowErrors) {
31012       self.warn(er)
31013       child.emit('end')
31014       child.emit('close')
31015     } else {
31016       self.emit('error', er)
31017     }
31018   })
31019
31020   // we fire _end internally *after* end, so that we don't move on
31021   // until any "end" listeners have had their chance to do stuff.
31022   child.on('close', onend)
31023   var ended = false
31024   function onend () {
31025     if (ended) return
31026     ended = true
31027     // console.error("* DW Child end", child.basename)
31028     self._currentChild = null
31029     self._processing = false
31030     self._process()
31031   }
31032 }
31033
31034
31035 /***/ }),
31036 /* 207 */
31037 /***/ ((module) => {
31038
31039 module.exports = collect
31040
31041 function collect (stream) {
31042   if (stream._collected) return
31043
31044   if (stream._paused) return stream.on('resume', collect.bind(null, stream))
31045
31046   stream._collected = true
31047   stream.pause()
31048
31049   stream.on('data', save)
31050   stream.on('end', save)
31051   var buf = []
31052   function save (b) {
31053     if (typeof b === 'string') b = new Buffer(b)
31054     if (Buffer.isBuffer(b) && !b.length) return
31055     buf.push(b)
31056   }
31057
31058   stream.on('entry', saveEntry)
31059   var entryBuffer = []
31060   function saveEntry (e) {
31061     collect(e)
31062     entryBuffer.push(e)
31063   }
31064
31065   stream.on('proxy', proxyPause)
31066   function proxyPause (p) {
31067     p.pause()
31068   }
31069
31070   // replace the pipe method with a new version that will
31071   // unlock the buffered stuff.  if you just call .pipe()
31072   // without a destination, then it'll re-play the events.
31073   stream.pipe = (function (orig) {
31074     return function (dest) {
31075       // console.error(' === open the pipes', dest && dest.path)
31076
31077       // let the entries flow through one at a time.
31078       // Once they're all done, then we can resume completely.
31079       var e = 0
31080       ;(function unblockEntry () {
31081         var entry = entryBuffer[e++]
31082         // console.error(" ==== unblock entry", entry && entry.path)
31083         if (!entry) return resume()
31084         entry.on('end', unblockEntry)
31085         if (dest) dest.add(entry)
31086         else stream.emit('entry', entry)
31087       })()
31088
31089       function resume () {
31090         stream.removeListener('entry', saveEntry)
31091         stream.removeListener('data', save)
31092         stream.removeListener('end', save)
31093
31094         stream.pipe = orig
31095         if (dest) stream.pipe(dest)
31096
31097         buf.forEach(function (b) {
31098           if (b) stream.emit('data', b)
31099           else stream.emit('end')
31100         })
31101
31102         stream.resume()
31103       }
31104
31105       return dest
31106     }
31107   })(stream.pipe)
31108 }
31109
31110
31111 /***/ }),
31112 /* 208 */
31113 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31114
31115 module.exports = LinkWriter
31116
31117 var fs = __webpack_require__(192)
31118 var Writer = __webpack_require__(203)
31119 var inherits = __webpack_require__(66)
31120 var path = __webpack_require__(2)
31121 var rimraf = __webpack_require__(204)
31122
31123 inherits(LinkWriter, Writer)
31124
31125 function LinkWriter (props) {
31126   var self = this
31127   if (!(self instanceof LinkWriter)) {
31128     throw new Error('LinkWriter must be called as constructor.')
31129   }
31130
31131   // should already be established as a Link type
31132   if (!((props.type === 'Link' && props.Link) ||
31133     (props.type === 'SymbolicLink' && props.SymbolicLink))) {
31134     throw new Error('Non-link type ' + props.type)
31135   }
31136
31137   if (props.linkpath === '') props.linkpath = '.'
31138   if (!props.linkpath) {
31139     self.error('Need linkpath property to create ' + props.type)
31140   }
31141
31142   Writer.call(this, props)
31143 }
31144
31145 LinkWriter.prototype._create = function () {
31146   // console.error(" LW _create")
31147   var self = this
31148   var hard = self.type === 'Link' || process.platform === 'win32'
31149   var link = hard ? 'link' : 'symlink'
31150   var lp = hard ? path.resolve(self.dirname, self.linkpath) : self.linkpath
31151
31152   // can only change the link path by clobbering
31153   // For hard links, let's just assume that's always the case, since
31154   // there's no good way to read them if we don't already know.
31155   if (hard) return clobber(self, lp, link)
31156
31157   fs.readlink(self._path, function (er, p) {
31158     // only skip creation if it's exactly the same link
31159     if (p && p === lp) return finish(self)
31160     clobber(self, lp, link)
31161   })
31162 }
31163
31164 function clobber (self, lp, link) {
31165   rimraf(self._path, function (er) {
31166     if (er) return self.error(er)
31167     create(self, lp, link)
31168   })
31169 }
31170
31171 function create (self, lp, link) {
31172   fs[link](lp, self._path, function (er) {
31173     // if this is a hard link, and we're in the process of writing out a
31174     // directory, it's very possible that the thing we're linking to
31175     // doesn't exist yet (especially if it was intended as a symlink),
31176     // so swallow ENOENT errors here and just soldier in.
31177     // Additionally, an EPERM or EACCES can happen on win32 if it's trying
31178     // to make a link to a directory.  Again, just skip it.
31179     // A better solution would be to have fs.symlink be supported on
31180     // windows in some nice fashion.
31181     if (er) {
31182       if ((er.code === 'ENOENT' ||
31183         er.code === 'EACCES' ||
31184         er.code === 'EPERM') && process.platform === 'win32') {
31185         self.ready = true
31186         self.emit('ready')
31187         self.emit('end')
31188         self.emit('close')
31189         self.end = self._finish = function () {}
31190       } else return self.error(er)
31191     }
31192     finish(self)
31193   })
31194 }
31195
31196 function finish (self) {
31197   self.ready = true
31198   self.emit('ready')
31199   if (self._ended && !self._finished) self._finish()
31200 }
31201
31202 LinkWriter.prototype.end = function () {
31203   // console.error("LW finish in end")
31204   this._ended = true
31205   if (this.ready) {
31206     this._finished = true
31207     this._finish()
31208   }
31209 }
31210
31211
31212 /***/ }),
31213 /* 209 */
31214 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31215
31216 module.exports = FileWriter
31217
31218 var fs = __webpack_require__(192)
31219 var Writer = __webpack_require__(203)
31220 var inherits = __webpack_require__(66)
31221 var EOF = {}
31222
31223 inherits(FileWriter, Writer)
31224
31225 function FileWriter (props) {
31226   var self = this
31227   if (!(self instanceof FileWriter)) {
31228     throw new Error('FileWriter must be called as constructor.')
31229   }
31230
31231   // should already be established as a File type
31232   if (props.type !== 'File' || !props.File) {
31233     throw new Error('Non-file type ' + props.type)
31234   }
31235
31236   self._buffer = []
31237   self._bytesWritten = 0
31238
31239   Writer.call(this, props)
31240 }
31241
31242 FileWriter.prototype._create = function () {
31243   var self = this
31244   if (self._stream) return
31245
31246   var so = {}
31247   if (self.props.flags) so.flags = self.props.flags
31248   so.mode = Writer.filemode
31249   if (self._old && self._old.blksize) so.bufferSize = self._old.blksize
31250
31251   self._stream = fs.createWriteStream(self._path, so)
31252
31253   self._stream.on('open', function () {
31254     // console.error("FW open", self._buffer, self._path)
31255     self.ready = true
31256     self._buffer.forEach(function (c) {
31257       if (c === EOF) self._stream.end()
31258       else self._stream.write(c)
31259     })
31260     self.emit('ready')
31261     // give this a kick just in case it needs it.
31262     self.emit('drain')
31263   })
31264
31265   self._stream.on('error', function (er) { self.emit('error', er) })
31266
31267   self._stream.on('drain', function () { self.emit('drain') })
31268
31269   self._stream.on('close', function () {
31270     // console.error('\n\nFW Stream Close', self._path, self.size)
31271     self._finish()
31272   })
31273 }
31274
31275 FileWriter.prototype.write = function (c) {
31276   var self = this
31277
31278   self._bytesWritten += c.length
31279
31280   if (!self.ready) {
31281     if (!Buffer.isBuffer(c) && typeof c !== 'string') {
31282       throw new Error('invalid write data')
31283     }
31284     self._buffer.push(c)
31285     return false
31286   }
31287
31288   var ret = self._stream.write(c)
31289   // console.error('\t-- fw wrote, _stream says', ret, self._stream._queue.length)
31290
31291   // allow 2 buffered writes, because otherwise there's just too
31292   // much stop and go bs.
31293   if (ret === false && self._stream._queue) {
31294     return self._stream._queue.length <= 2
31295   } else {
31296     return ret
31297   }
31298 }
31299
31300 FileWriter.prototype.end = function (c) {
31301   var self = this
31302
31303   if (c) self.write(c)
31304
31305   if (!self.ready) {
31306     self._buffer.push(EOF)
31307     return false
31308   }
31309
31310   return self._stream.end()
31311 }
31312
31313 FileWriter.prototype._finish = function () {
31314   var self = this
31315   if (typeof self.size === 'number' && self._bytesWritten !== self.size) {
31316     self.error(
31317       'Did not get expected byte count.\n' +
31318       'expect: ' + self.size + '\n' +
31319       'actual: ' + self._bytesWritten)
31320   }
31321   Writer.prototype._finish.call(self)
31322 }
31323
31324
31325 /***/ }),
31326 /* 210 */
31327 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31328
31329 // A writer for when we don't know what kind of thing
31330 // the thing is.  That is, it's not explicitly set,
31331 // so we're going to make it whatever the thing already
31332 // is, or "File"
31333 //
31334 // Until then, collect all events.
31335
31336 module.exports = ProxyWriter
31337
31338 var Writer = __webpack_require__(203)
31339 var getType = __webpack_require__(197)
31340 var inherits = __webpack_require__(66)
31341 var collect = __webpack_require__(207)
31342 var fs = __webpack_require__(42)
31343
31344 inherits(ProxyWriter, Writer)
31345
31346 function ProxyWriter (props) {
31347   var self = this
31348   if (!(self instanceof ProxyWriter)) {
31349     throw new Error('ProxyWriter must be called as constructor.')
31350   }
31351
31352   self.props = props
31353   self._needDrain = false
31354
31355   Writer.call(self, props)
31356 }
31357
31358 ProxyWriter.prototype._stat = function () {
31359   var self = this
31360   var props = self.props
31361   // stat the thing to see what the proxy should be.
31362   var stat = props.follow ? 'stat' : 'lstat'
31363
31364   fs[stat](props.path, function (er, current) {
31365     var type
31366     if (er || !current) {
31367       type = 'File'
31368     } else {
31369       type = getType(current)
31370     }
31371
31372     props[type] = true
31373     props.type = self.type = type
31374
31375     self._old = current
31376     self._addProxy(Writer(props, current))
31377   })
31378 }
31379
31380 ProxyWriter.prototype._addProxy = function (proxy) {
31381   // console.error("~~ set proxy", this.path)
31382   var self = this
31383   if (self._proxy) {
31384     return self.error('proxy already set')
31385   }
31386
31387   self._proxy = proxy
31388   ;[
31389     'ready',
31390     'error',
31391     'close',
31392     'pipe',
31393     'drain',
31394     'warn'
31395   ].forEach(function (ev) {
31396     proxy.on(ev, self.emit.bind(self, ev))
31397   })
31398
31399   self.emit('proxy', proxy)
31400
31401   var calls = self._buffer
31402   calls.forEach(function (c) {
31403     // console.error("~~ ~~ proxy buffered call", c[0], c[1])
31404     proxy[c[0]].apply(proxy, c[1])
31405   })
31406   self._buffer.length = 0
31407   if (self._needsDrain) self.emit('drain')
31408 }
31409
31410 ProxyWriter.prototype.add = function (entry) {
31411   // console.error("~~ proxy add")
31412   collect(entry)
31413
31414   if (!this._proxy) {
31415     this._buffer.push(['add', [entry]])
31416     this._needDrain = true
31417     return false
31418   }
31419   return this._proxy.add(entry)
31420 }
31421
31422 ProxyWriter.prototype.write = function (c) {
31423   // console.error('~~ proxy write')
31424   if (!this._proxy) {
31425     this._buffer.push(['write', [c]])
31426     this._needDrain = true
31427     return false
31428   }
31429   return this._proxy.write(c)
31430 }
31431
31432 ProxyWriter.prototype.end = function (c) {
31433   // console.error('~~ proxy end')
31434   if (!this._proxy) {
31435     this._buffer.push(['end', [c]])
31436     return false
31437   }
31438   return this._proxy.end(c)
31439 }
31440
31441
31442 /***/ }),
31443 /* 211 */
31444 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31445
31446 var fs = __webpack_require__(192);
31447 var Promise = __webpack_require__(128);
31448 var directory = __webpack_require__(212);
31449 var Stream = __webpack_require__(44);
31450
31451 // Backwards compatibility for node versions < 8
31452 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
31453   Stream = __webpack_require__(167);
31454
31455 module.exports = {
31456   buffer: function(buffer, options) {
31457     var source = {
31458       stream: function(offset, length) {
31459         var stream = Stream.PassThrough();
31460         stream.end(buffer.slice(offset, length));
31461         return stream;
31462       },
31463       size: function() {
31464         return Promise.resolve(buffer.length);
31465       }
31466     };
31467     return directory(source, options);
31468   },
31469   file: function(filename, options) {
31470     var source = {
31471       stream: function(offset,length) {
31472         return fs.createReadStream(filename,{start: offset, end: length && offset+length});
31473       },
31474       size: function() {
31475         return new Promise(function(resolve,reject) {
31476           fs.stat(filename,function(err,d) {
31477             if (err)
31478               reject(err);
31479             else
31480               resolve(d.size);
31481           });
31482         });
31483       }
31484     };
31485     return directory(source, options);
31486   },
31487
31488   url: function(request, params, options) {
31489     if (typeof params === 'string')
31490       params = {url: params};
31491     if (!params.url)
31492       throw 'URL missing';
31493     params.headers = params.headers || {};
31494
31495     var source = {
31496       stream : function(offset,length) {
31497         var options = Object.create(params);
31498         options.headers = Object.create(params.headers);
31499         options.headers.range = 'bytes='+offset+'-' + (length ? length : '');
31500         return request(options);
31501       },
31502       size: function() {
31503         return new Promise(function(resolve,reject) {
31504           var req = request(params);
31505           req.on('response',function(d) {
31506             req.abort();
31507             if (!d.headers['content-length'])
31508               reject(new Error('Missing content length header'));
31509             else
31510               resolve(d.headers['content-length']);
31511           }).on('error',reject);
31512         });
31513       }
31514     };
31515
31516     return directory(source, options);
31517   },
31518
31519   s3 : function(client,params, options) {
31520     var source = {
31521       size: function() {
31522         return new Promise(function(resolve,reject) {
31523           client.headObject(params, function(err,d) {
31524             if (err)
31525               reject(err);
31526             else
31527               resolve(d.ContentLength);
31528           });
31529         });
31530       },
31531       stream: function(offset,length) {
31532         var d = {};
31533         for (var key in params)
31534           d[key] = params[key];
31535         d.Range = 'bytes='+offset+'-' + (length ? length : '');
31536         return client.getObject(d).createReadStream();
31537       }
31538     };
31539
31540     return directory(source, options);
31541   }
31542 };
31543
31544
31545 /***/ }),
31546 /* 212 */
31547 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31548
31549 var binary = __webpack_require__(123);
31550 var PullStream = __webpack_require__(164);
31551 var unzip = __webpack_require__(213);
31552 var Promise = __webpack_require__(128);
31553 var BufferStream = __webpack_require__(183);
31554 var parseExtraField = __webpack_require__(184);
31555 var Buffer = __webpack_require__(165);
31556 var path = __webpack_require__(2);
31557 var Writer = __webpack_require__(189).Writer;
31558 var parseDateTime = __webpack_require__(185);
31559
31560 var signature = Buffer.alloc(4);
31561 signature.writeUInt32LE(0x06054b50,0);
31562
31563 function getCrxHeader(source) {
31564   var sourceStream = source.stream(0).pipe(PullStream());
31565
31566   return sourceStream.pull(4).then(function(data) {
31567     var signature = data.readUInt32LE(0);
31568     if (signature === 0x34327243) {
31569       var crxHeader;
31570       return sourceStream.pull(12).then(function(data) {
31571         crxHeader = binary.parse(data)
31572           .word32lu('version')
31573           .word32lu('pubKeyLength')
31574           .word32lu('signatureLength')
31575           .vars;
31576       }).then(function() {
31577         return sourceStream.pull(crxHeader.pubKeyLength +crxHeader.signatureLength);
31578       }).then(function(data) {
31579         crxHeader.publicKey = data.slice(0,crxHeader.pubKeyLength);
31580         crxHeader.signature = data.slice(crxHeader.pubKeyLength);
31581         crxHeader.size = 16 + crxHeader.pubKeyLength +crxHeader.signatureLength;
31582         return crxHeader;
31583       });
31584     }
31585   });
31586 }
31587
31588 // Zip64 File Format Notes: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
31589 function getZip64CentralDirectory(source, zip64CDL) {
31590   var d64loc = binary.parse(zip64CDL)
31591     .word32lu('signature')
31592     .word32lu('diskNumber')
31593     .word64lu('offsetToStartOfCentralDirectory')
31594     .word32lu('numberOfDisks')
31595     .vars;
31596
31597   if (d64loc.signature != 0x07064b50) {
31598     throw new Error('invalid zip64 end of central dir locator signature (0x07064b50): 0x' + d64loc.signature.toString(16));
31599   }
31600
31601   var dir64 = PullStream();
31602   source.stream(d64loc.offsetToStartOfCentralDirectory).pipe(dir64);
31603
31604   return dir64.pull(56)
31605 }
31606
31607 // Zip64 File Format Notes: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
31608 function parseZip64DirRecord (dir64record) {
31609   var vars = binary.parse(dir64record)
31610     .word32lu('signature')
31611     .word64lu('sizeOfCentralDirectory')
31612     .word16lu('version')
31613     .word16lu('versionsNeededToExtract')
31614     .word32lu('diskNumber')
31615     .word32lu('diskStart')
31616     .word64lu('numberOfRecordsOnDisk')
31617     .word64lu('numberOfRecords')
31618     .word64lu('sizeOfCentralDirectory')
31619     .word64lu('offsetToStartOfCentralDirectory')
31620     .vars;
31621
31622   if (vars.signature != 0x06064b50) {
31623     throw new Error('invalid zip64 end of central dir locator signature (0x06064b50): 0x0' + vars.signature.toString(16));
31624   }
31625
31626   return vars
31627 }
31628
31629 module.exports = function centralDirectory(source, options) {
31630   var endDir = PullStream(),
31631       records = PullStream(),
31632       tailSize = (options && options.tailSize) || 80,
31633       sourceSize,
31634       crxHeader,
31635       startOffset,
31636       vars;
31637
31638   if (options && options.crx)
31639     crxHeader = getCrxHeader(source);
31640
31641   return source.size()
31642     .then(function(size) {
31643       sourceSize = size;
31644
31645       source.stream(Math.max(0,size-tailSize))
31646         .on('error', function (error) { endDir.emit('error', error) })
31647         .pipe(endDir);
31648
31649       return endDir.pull(signature);
31650     })
31651     .then(function() {
31652       return Promise.props({directory: endDir.pull(22), crxHeader: crxHeader});
31653     })
31654     .then(function(d) {
31655       var data = d.directory;
31656       startOffset = d.crxHeader && d.crxHeader.size || 0;
31657
31658       vars = binary.parse(data)
31659         .word32lu('signature')
31660         .word16lu('diskNumber')
31661         .word16lu('diskStart')
31662         .word16lu('numberOfRecordsOnDisk')
31663         .word16lu('numberOfRecords')
31664         .word32lu('sizeOfCentralDirectory')
31665         .word32lu('offsetToStartOfCentralDirectory')
31666         .word16lu('commentLength')
31667         .vars;
31668
31669       // Is this zip file using zip64 format? Use same check as Go:
31670       // https://github.com/golang/go/blob/master/src/archive/zip/reader.go#L503
31671       // For zip64 files, need to find zip64 central directory locator header to extract
31672       // relative offset for zip64 central directory record.
31673       if (vars.numberOfRecords == 0xffff|| vars.numberOfRecords == 0xffff ||
31674         vars.offsetToStartOfCentralDirectory == 0xffffffff) {
31675
31676         // Offset to zip64 CDL is 20 bytes before normal CDR
31677         const zip64CDLSize = 20
31678         const zip64CDLOffset = sourceSize - (tailSize - endDir.match + zip64CDLSize)
31679         const zip64CDLStream = PullStream();
31680
31681         source.stream(zip64CDLOffset).pipe(zip64CDLStream);
31682
31683         return zip64CDLStream.pull(zip64CDLSize)
31684           .then(function (d) { return getZip64CentralDirectory(source, d) })
31685           .then(function (dir64record) {
31686             vars = parseZip64DirRecord(dir64record)
31687           })
31688       } else {
31689         vars.offsetToStartOfCentralDirectory += startOffset;
31690       }
31691     })
31692     .then(function() {
31693       source.stream(vars.offsetToStartOfCentralDirectory).pipe(records);
31694
31695       vars.extract = function(opts) {
31696         if (!opts || !opts.path) throw new Error('PATH_MISSING');
31697         return vars.files.then(function(files) {
31698           return Promise.map(files, function(entry) {
31699             if (entry.type == 'Directory') return;
31700
31701             // to avoid zip slip (writing outside of the destination), we resolve
31702             // the target path, and make sure it's nested in the intended
31703             // destination, or not extract it otherwise.
31704             var extractPath = path.join(opts.path, entry.path);
31705             if (extractPath.indexOf(opts.path) != 0) {
31706               return;
31707             }
31708             var writer = opts.getWriter ? opts.getWriter({path: extractPath}) :  Writer({ path: extractPath });
31709
31710             return new Promise(function(resolve, reject) {
31711               entry.stream(opts.password)
31712                 .on('error',reject)
31713                 .pipe(writer)
31714                 .on('close',resolve)
31715                 .on('error',reject);
31716             });
31717           }, opts.concurrency > 1 ? {concurrency: opts.concurrency || undefined} : undefined);
31718         });
31719       };
31720
31721       vars.files = Promise.mapSeries(Array(vars.numberOfRecords),function() {
31722         return records.pull(46).then(function(data) {    
31723           var vars = binary.parse(data)
31724             .word32lu('signature')
31725             .word16lu('versionMadeBy')
31726             .word16lu('versionsNeededToExtract')
31727             .word16lu('flags')
31728             .word16lu('compressionMethod')
31729             .word16lu('lastModifiedTime')
31730             .word16lu('lastModifiedDate')
31731             .word32lu('crc32')
31732             .word32lu('compressedSize')
31733             .word32lu('uncompressedSize')
31734             .word16lu('fileNameLength')
31735             .word16lu('extraFieldLength')
31736             .word16lu('fileCommentLength')
31737             .word16lu('diskNumber')
31738             .word16lu('internalFileAttributes')
31739             .word32lu('externalFileAttributes')
31740             .word32lu('offsetToLocalFileHeader')
31741             .vars;
31742
31743         vars.offsetToLocalFileHeader += startOffset;
31744         vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
31745
31746         return records.pull(vars.fileNameLength).then(function(fileNameBuffer) {
31747           vars.pathBuffer = fileNameBuffer;
31748           vars.path = fileNameBuffer.toString('utf8');
31749           vars.isUnicode = vars.flags & 0x11;
31750           return records.pull(vars.extraFieldLength);
31751         })
31752         .then(function(extraField) {
31753           vars.extra = parseExtraField(extraField, vars);
31754           return records.pull(vars.fileCommentLength);
31755         })
31756         .then(function(comment) {
31757           vars.comment = comment;
31758           vars.type = (vars.uncompressedSize === 0 && /[\/\\]$/.test(vars.path)) ? 'Directory' : 'File';
31759           vars.stream = function(_password) {
31760             return unzip(source, vars.offsetToLocalFileHeader,_password, vars);
31761           };
31762           vars.buffer = function(_password) {
31763             return BufferStream(vars.stream(_password));
31764           };
31765           return vars;
31766         });
31767       });
31768     });
31769
31770     return Promise.props(vars);
31771   });
31772 };
31773
31774
31775 /***/ }),
31776 /* 213 */
31777 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31778
31779 var Promise = __webpack_require__(128);
31780 var Decrypt = __webpack_require__(214);
31781 var PullStream = __webpack_require__(164);
31782 var Stream = __webpack_require__(44);
31783 var binary = __webpack_require__(123);
31784 var zlib = __webpack_require__(48);
31785 var parseExtraField = __webpack_require__(184);
31786 var Buffer = __webpack_require__(165);
31787 var parseDateTime = __webpack_require__(185);
31788
31789 // Backwards compatibility for node versions < 8
31790 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
31791   Stream = __webpack_require__(167);
31792
31793 module.exports = function unzip(source,offset,_password, directoryVars) {
31794   var file = PullStream(),
31795       entry = Stream.PassThrough();
31796
31797   var req = source.stream(offset);
31798   req.pipe(file).on('error', function(e) {
31799     entry.emit('error', e);
31800   });
31801
31802   entry.vars = file.pull(30)
31803     .then(function(data) {
31804       var vars = binary.parse(data)
31805         .word32lu('signature')
31806         .word16lu('versionsNeededToExtract')
31807         .word16lu('flags')
31808         .word16lu('compressionMethod')
31809         .word16lu('lastModifiedTime')
31810         .word16lu('lastModifiedDate')
31811         .word32lu('crc32')
31812         .word32lu('compressedSize')
31813         .word32lu('uncompressedSize')
31814         .word16lu('fileNameLength')
31815         .word16lu('extraFieldLength')
31816         .vars;
31817
31818       vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
31819
31820       return file.pull(vars.fileNameLength)
31821         .then(function(fileName) {
31822           vars.fileName = fileName.toString('utf8');
31823           return file.pull(vars.extraFieldLength);
31824         })
31825         .then(function(extraField) {
31826           var checkEncryption;
31827           vars.extra = parseExtraField(extraField, vars);
31828           // Ignore logal file header vars if the directory vars are available
31829           if (directoryVars && directoryVars.compressedSize) vars = directoryVars;
31830
31831           if (vars.flags & 0x01) checkEncryption = file.pull(12)
31832             .then(function(header) {
31833               if (!_password)
31834                 throw new Error('MISSING_PASSWORD');
31835
31836               var decrypt = Decrypt();
31837
31838               String(_password).split('').forEach(function(d) {
31839                 decrypt.update(d);
31840               });
31841
31842               for (var i=0; i < header.length; i++)
31843                 header[i] = decrypt.decryptByte(header[i]);
31844
31845               vars.decrypt = decrypt;
31846               vars.compressedSize -= 12;
31847
31848               var check = (vars.flags & 0x8) ? (vars.lastModifiedTime >> 8) & 0xff : (vars.crc32 >> 24) & 0xff;
31849               if (header[11] !== check)
31850                 throw new Error('BAD_PASSWORD');
31851
31852               return vars;
31853             });
31854
31855           return Promise.resolve(checkEncryption)
31856             .then(function() {
31857               entry.emit('vars',vars);
31858               return vars;
31859             });
31860         });
31861     });
31862
31863     entry.vars.then(function(vars) {
31864       var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0,
31865           eof;
31866
31867       var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough();
31868
31869       if (fileSizeKnown) {
31870         entry.size = vars.uncompressedSize;
31871         eof = vars.compressedSize;
31872       } else {
31873         eof = Buffer.alloc(4);
31874         eof.writeUInt32LE(0x08074b50, 0);
31875       }
31876
31877       var stream = file.stream(eof);
31878
31879       if (vars.decrypt)
31880         stream = stream.pipe(vars.decrypt.stream());
31881
31882       stream
31883         .pipe(inflater)
31884         .on('error',function(err) { entry.emit('error',err);})
31885         .pipe(entry)
31886         .on('finish', function() {
31887           if (req.abort)
31888             req.abort();
31889           else if (req.close)
31890             req.close();
31891           else if (req.push)
31892             req.push();
31893           else
31894             console.log('warning - unable to close stream');
31895         });
31896     })
31897     .catch(function(e) {
31898       entry.emit('error',e);
31899     });
31900
31901   return entry;
31902 };
31903
31904
31905 /***/ }),
31906 /* 214 */
31907 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31908
31909 var bigInt = __webpack_require__(215);
31910 var Stream = __webpack_require__(44);
31911
31912 // Backwards compatibility for node versions < 8
31913 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
31914   Stream = __webpack_require__(167);
31915
31916 var table;
31917
31918 function generateTable() {
31919   var poly = 0xEDB88320,c,n,k;
31920   table = [];
31921   for (n = 0; n < 256; n++) {
31922     c = n;
31923     for (k = 0; k < 8; k++)
31924       c = (c & 1) ? poly ^ (c >>> 1) :  c = c >>> 1;
31925     table[n] = c >>> 0;
31926   }
31927 }
31928
31929 function crc(ch,crc) {
31930   if (!table)
31931     generateTable();
31932
31933   if (ch.charCodeAt)
31934     ch = ch.charCodeAt(0);        
31935
31936   return (bigInt(crc).shiftRight(8).and(0xffffff)).xor(table[bigInt(crc).xor(ch).and(0xff)]).value;
31937 }
31938
31939 function Decrypt() {
31940   if (!(this instanceof Decrypt))
31941     return new Decrypt();
31942
31943   this.key0 = 305419896;
31944   this.key1 = 591751049;
31945   this.key2 = 878082192;
31946 }
31947
31948 Decrypt.prototype.update = function(h) {            
31949   this.key0 = crc(h,this.key0);
31950   this.key1 = bigInt(this.key0).and(255).and(4294967295).add(this.key1)
31951   this.key1 = bigInt(this.key1).multiply(134775813).add(1).and(4294967295).value;
31952   this.key2 = crc(bigInt(this.key1).shiftRight(24).and(255), this.key2);
31953 }
31954
31955
31956 Decrypt.prototype.decryptByte = function(c) {
31957   var k = bigInt(this.key2).or(2);
31958   c = c ^ bigInt(k).multiply(bigInt(k^1)).shiftRight(8).and(255);
31959   this.update(c);
31960   return c;
31961 };
31962
31963  Decrypt.prototype.stream = function() {
31964   var stream = Stream.Transform(),
31965       self = this;
31966
31967   stream._transform = function(d,e,cb) {
31968     for (var i = 0; i<d.length;i++) {
31969       d[i] = self.decryptByte(d[i]);
31970     }
31971     this.push(d);
31972     cb();
31973   };
31974   return stream;
31975 };
31976
31977
31978
31979
31980 module.exports = Decrypt;
31981
31982 /***/ }),
31983 /* 215 */
31984 /***/ ((module, exports, __webpack_require__) => {
31985
31986 /* module decorator */ module = __webpack_require__.nmd(module);
31987 var __WEBPACK_AMD_DEFINE_RESULT__;var bigInt = (function (undefined) {\r
31988     "use strict";\r
31989 \r
31990     var BASE = 1e7,\r
31991         LOG_BASE = 7,\r
31992         MAX_INT = 9007199254740992,\r
31993         MAX_INT_ARR = smallToArray(MAX_INT),\r
31994         DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";\r
31995 \r
31996     var supportsNativeBigInt = typeof BigInt === "function";\r
31997 \r
31998     function Integer(v, radix, alphabet, caseSensitive) {\r
31999         if (typeof v === "undefined") return Integer[0];\r
32000         if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);\r
32001         return parseValue(v);\r
32002     }\r
32003 \r
32004     function BigInteger(value, sign) {\r
32005         this.value = value;\r
32006         this.sign = sign;\r
32007         this.isSmall = false;\r
32008     }\r
32009     BigInteger.prototype = Object.create(Integer.prototype);\r
32010 \r
32011     function SmallInteger(value) {\r
32012         this.value = value;\r
32013         this.sign = value < 0;\r
32014         this.isSmall = true;\r
32015     }\r
32016     SmallInteger.prototype = Object.create(Integer.prototype);\r
32017 \r
32018     function NativeBigInt(value) {\r
32019         this.value = value;\r
32020     }\r
32021     NativeBigInt.prototype = Object.create(Integer.prototype);\r
32022 \r
32023     function isPrecise(n) {\r
32024         return -MAX_INT < n && n < MAX_INT;\r
32025     }\r
32026 \r
32027     function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes\r
32028         if (n < 1e7)\r
32029             return [n];\r
32030         if (n < 1e14)\r
32031             return [n % 1e7, Math.floor(n / 1e7)];\r
32032         return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\r
32033     }\r
32034 \r
32035     function arrayToSmall(arr) { // If BASE changes this function may need to change\r
32036         trim(arr);\r
32037         var length = arr.length;\r
32038         if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\r
32039             switch (length) {\r
32040                 case 0: return 0;\r
32041                 case 1: return arr[0];\r
32042                 case 2: return arr[0] + arr[1] * BASE;\r
32043                 default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\r
32044             }\r
32045         }\r
32046         return arr;\r
32047     }\r
32048 \r
32049     function trim(v) {\r
32050         var i = v.length;\r
32051         while (v[--i] === 0);\r
32052         v.length = i + 1;\r
32053     }\r
32054 \r
32055     function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger\r
32056         var x = new Array(length);\r
32057         var i = -1;\r
32058         while (++i < length) {\r
32059             x[i] = 0;\r
32060         }\r
32061         return x;\r
32062     }\r
32063 \r
32064     function truncate(n) {\r
32065         if (n > 0) return Math.floor(n);\r
32066         return Math.ceil(n);\r
32067     }\r
32068 \r
32069     function add(a, b) { // assumes a and b are arrays with a.length >= b.length\r
32070         var l_a = a.length,\r
32071             l_b = b.length,\r
32072             r = new Array(l_a),\r
32073             carry = 0,\r
32074             base = BASE,\r
32075             sum, i;\r
32076         for (i = 0; i < l_b; i++) {\r
32077             sum = a[i] + b[i] + carry;\r
32078             carry = sum >= base ? 1 : 0;\r
32079             r[i] = sum - carry * base;\r
32080         }\r
32081         while (i < l_a) {\r
32082             sum = a[i] + carry;\r
32083             carry = sum === base ? 1 : 0;\r
32084             r[i++] = sum - carry * base;\r
32085         }\r
32086         if (carry > 0) r.push(carry);\r
32087         return r;\r
32088     }\r
32089 \r
32090     function addAny(a, b) {\r
32091         if (a.length >= b.length) return add(a, b);\r
32092         return add(b, a);\r
32093     }\r
32094 \r
32095     function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT\r
32096         var l = a.length,\r
32097             r = new Array(l),\r
32098             base = BASE,\r
32099             sum, i;\r
32100         for (i = 0; i < l; i++) {\r
32101             sum = a[i] - base + carry;\r
32102             carry = Math.floor(sum / base);\r
32103             r[i] = sum - carry * base;\r
32104             carry += 1;\r
32105         }\r
32106         while (carry > 0) {\r
32107             r[i++] = carry % base;\r
32108             carry = Math.floor(carry / base);\r
32109         }\r
32110         return r;\r
32111     }\r
32112 \r
32113     BigInteger.prototype.add = function (v) {\r
32114         var n = parseValue(v);\r
32115         if (this.sign !== n.sign) {\r
32116             return this.subtract(n.negate());\r
32117         }\r
32118         var a = this.value, b = n.value;\r
32119         if (n.isSmall) {\r
32120             return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\r
32121         }\r
32122         return new BigInteger(addAny(a, b), this.sign);\r
32123     };\r
32124     BigInteger.prototype.plus = BigInteger.prototype.add;\r
32125 \r
32126     SmallInteger.prototype.add = function (v) {\r
32127         var n = parseValue(v);\r
32128         var a = this.value;\r
32129         if (a < 0 !== n.sign) {\r
32130             return this.subtract(n.negate());\r
32131         }\r
32132         var b = n.value;\r
32133         if (n.isSmall) {\r
32134             if (isPrecise(a + b)) return new SmallInteger(a + b);\r
32135             b = smallToArray(Math.abs(b));\r
32136         }\r
32137         return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\r
32138     };\r
32139     SmallInteger.prototype.plus = SmallInteger.prototype.add;\r
32140 \r
32141     NativeBigInt.prototype.add = function (v) {\r
32142         return new NativeBigInt(this.value + parseValue(v).value);\r
32143     }\r
32144     NativeBigInt.prototype.plus = NativeBigInt.prototype.add;\r
32145 \r
32146     function subtract(a, b) { // assumes a and b are arrays with a >= b\r
32147         var a_l = a.length,\r
32148             b_l = b.length,\r
32149             r = new Array(a_l),\r
32150             borrow = 0,\r
32151             base = BASE,\r
32152             i, difference;\r
32153         for (i = 0; i < b_l; i++) {\r
32154             difference = a[i] - borrow - b[i];\r
32155             if (difference < 0) {\r
32156                 difference += base;\r
32157                 borrow = 1;\r
32158             } else borrow = 0;\r
32159             r[i] = difference;\r
32160         }\r
32161         for (i = b_l; i < a_l; i++) {\r
32162             difference = a[i] - borrow;\r
32163             if (difference < 0) difference += base;\r
32164             else {\r
32165                 r[i++] = difference;\r
32166                 break;\r
32167             }\r
32168             r[i] = difference;\r
32169         }\r
32170         for (; i < a_l; i++) {\r
32171             r[i] = a[i];\r
32172         }\r
32173         trim(r);\r
32174         return r;\r
32175     }\r
32176 \r
32177     function subtractAny(a, b, sign) {\r
32178         var value;\r
32179         if (compareAbs(a, b) >= 0) {\r
32180             value = subtract(a, b);\r
32181         } else {\r
32182             value = subtract(b, a);\r
32183             sign = !sign;\r
32184         }\r
32185         value = arrayToSmall(value);\r
32186         if (typeof value === "number") {\r
32187             if (sign) value = -value;\r
32188             return new SmallInteger(value);\r
32189         }\r
32190         return new BigInteger(value, sign);\r
32191     }\r
32192 \r
32193     function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT\r
32194         var l = a.length,\r
32195             r = new Array(l),\r
32196             carry = -b,\r
32197             base = BASE,\r
32198             i, difference;\r
32199         for (i = 0; i < l; i++) {\r
32200             difference = a[i] + carry;\r
32201             carry = Math.floor(difference / base);\r
32202             difference %= base;\r
32203             r[i] = difference < 0 ? difference + base : difference;\r
32204         }\r
32205         r = arrayToSmall(r);\r
32206         if (typeof r === "number") {\r
32207             if (sign) r = -r;\r
32208             return new SmallInteger(r);\r
32209         } return new BigInteger(r, sign);\r
32210     }\r
32211 \r
32212     BigInteger.prototype.subtract = function (v) {\r
32213         var n = parseValue(v);\r
32214         if (this.sign !== n.sign) {\r
32215             return this.add(n.negate());\r
32216         }\r
32217         var a = this.value, b = n.value;\r
32218         if (n.isSmall)\r
32219             return subtractSmall(a, Math.abs(b), this.sign);\r
32220         return subtractAny(a, b, this.sign);\r
32221     };\r
32222     BigInteger.prototype.minus = BigInteger.prototype.subtract;\r
32223 \r
32224     SmallInteger.prototype.subtract = function (v) {\r
32225         var n = parseValue(v);\r
32226         var a = this.value;\r
32227         if (a < 0 !== n.sign) {\r
32228             return this.add(n.negate());\r
32229         }\r
32230         var b = n.value;\r
32231         if (n.isSmall) {\r
32232             return new SmallInteger(a - b);\r
32233         }\r
32234         return subtractSmall(b, Math.abs(a), a >= 0);\r
32235     };\r
32236     SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\r
32237 \r
32238     NativeBigInt.prototype.subtract = function (v) {\r
32239         return new NativeBigInt(this.value - parseValue(v).value);\r
32240     }\r
32241     NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;\r
32242 \r
32243     BigInteger.prototype.negate = function () {\r
32244         return new BigInteger(this.value, !this.sign);\r
32245     };\r
32246     SmallInteger.prototype.negate = function () {\r
32247         var sign = this.sign;\r
32248         var small = new SmallInteger(-this.value);\r
32249         small.sign = !sign;\r
32250         return small;\r
32251     };\r
32252     NativeBigInt.prototype.negate = function () {\r
32253         return new NativeBigInt(-this.value);\r
32254     }\r
32255 \r
32256     BigInteger.prototype.abs = function () {\r
32257         return new BigInteger(this.value, false);\r
32258     };\r
32259     SmallInteger.prototype.abs = function () {\r
32260         return new SmallInteger(Math.abs(this.value));\r
32261     };\r
32262     NativeBigInt.prototype.abs = function () {\r
32263         return new NativeBigInt(this.value >= 0 ? this.value : -this.value);\r
32264     }\r
32265 \r
32266 \r
32267     function multiplyLong(a, b) {\r
32268         var a_l = a.length,\r
32269             b_l = b.length,\r
32270             l = a_l + b_l,\r
32271             r = createArray(l),\r
32272             base = BASE,\r
32273             product, carry, i, a_i, b_j;\r
32274         for (i = 0; i < a_l; ++i) {\r
32275             a_i = a[i];\r
32276             for (var j = 0; j < b_l; ++j) {\r
32277                 b_j = b[j];\r
32278                 product = a_i * b_j + r[i + j];\r
32279                 carry = Math.floor(product / base);\r
32280                 r[i + j] = product - carry * base;\r
32281                 r[i + j + 1] += carry;\r
32282             }\r
32283         }\r
32284         trim(r);\r
32285         return r;\r
32286     }\r
32287 \r
32288     function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE\r
32289         var l = a.length,\r
32290             r = new Array(l),\r
32291             base = BASE,\r
32292             carry = 0,\r
32293             product, i;\r
32294         for (i = 0; i < l; i++) {\r
32295             product = a[i] * b + carry;\r
32296             carry = Math.floor(product / base);\r
32297             r[i] = product - carry * base;\r
32298         }\r
32299         while (carry > 0) {\r
32300             r[i++] = carry % base;\r
32301             carry = Math.floor(carry / base);\r
32302         }\r
32303         return r;\r
32304     }\r
32305 \r
32306     function shiftLeft(x, n) {\r
32307         var r = [];\r
32308         while (n-- > 0) r.push(0);\r
32309         return r.concat(x);\r
32310     }\r
32311 \r
32312     function multiplyKaratsuba(x, y) {\r
32313         var n = Math.max(x.length, y.length);\r
32314 \r
32315         if (n <= 30) return multiplyLong(x, y);\r
32316         n = Math.ceil(n / 2);\r
32317 \r
32318         var b = x.slice(n),\r
32319             a = x.slice(0, n),\r
32320             d = y.slice(n),\r
32321             c = y.slice(0, n);\r
32322 \r
32323         var ac = multiplyKaratsuba(a, c),\r
32324             bd = multiplyKaratsuba(b, d),\r
32325             abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\r
32326 \r
32327         var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));\r
32328         trim(product);\r
32329         return product;\r
32330     }\r
32331 \r
32332     // The following function is derived from a surface fit of a graph plotting the performance difference\r
32333     // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.\r
32334     function useKaratsuba(l1, l2) {\r
32335         return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;\r
32336     }\r
32337 \r
32338     BigInteger.prototype.multiply = function (v) {\r
32339         var n = parseValue(v),\r
32340             a = this.value, b = n.value,\r
32341             sign = this.sign !== n.sign,\r
32342             abs;\r
32343         if (n.isSmall) {\r
32344             if (b === 0) return Integer[0];\r
32345             if (b === 1) return this;\r
32346             if (b === -1) return this.negate();\r
32347             abs = Math.abs(b);\r
32348             if (abs < BASE) {\r
32349                 return new BigInteger(multiplySmall(a, abs), sign);\r
32350             }\r
32351             b = smallToArray(abs);\r
32352         }\r
32353         if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes\r
32354             return new BigInteger(multiplyKaratsuba(a, b), sign);\r
32355         return new BigInteger(multiplyLong(a, b), sign);\r
32356     };\r
32357 \r
32358     BigInteger.prototype.times = BigInteger.prototype.multiply;\r
32359 \r
32360     function multiplySmallAndArray(a, b, sign) { // a >= 0\r
32361         if (a < BASE) {\r
32362             return new BigInteger(multiplySmall(b, a), sign);\r
32363         }\r
32364         return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\r
32365     }\r
32366     SmallInteger.prototype._multiplyBySmall = function (a) {\r
32367         if (isPrecise(a.value * this.value)) {\r
32368             return new SmallInteger(a.value * this.value);\r
32369         }\r
32370         return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);\r
32371     };\r
32372     BigInteger.prototype._multiplyBySmall = function (a) {\r
32373         if (a.value === 0) return Integer[0];\r
32374         if (a.value === 1) return this;\r
32375         if (a.value === -1) return this.negate();\r
32376         return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);\r
32377     };\r
32378     SmallInteger.prototype.multiply = function (v) {\r
32379         return parseValue(v)._multiplyBySmall(this);\r
32380     };\r
32381     SmallInteger.prototype.times = SmallInteger.prototype.multiply;\r
32382 \r
32383     NativeBigInt.prototype.multiply = function (v) {\r
32384         return new NativeBigInt(this.value * parseValue(v).value);\r
32385     }\r
32386     NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;\r
32387 \r
32388     function square(a) {\r
32389         //console.assert(2 * BASE * BASE < MAX_INT);\r
32390         var l = a.length,\r
32391             r = createArray(l + l),\r
32392             base = BASE,\r
32393             product, carry, i, a_i, a_j;\r
32394         for (i = 0; i < l; i++) {\r
32395             a_i = a[i];\r
32396             carry = 0 - a_i * a_i;\r
32397             for (var j = i; j < l; j++) {\r
32398                 a_j = a[j];\r
32399                 product = 2 * (a_i * a_j) + r[i + j] + carry;\r
32400                 carry = Math.floor(product / base);\r
32401                 r[i + j] = product - carry * base;\r
32402             }\r
32403             r[i + l] = carry;\r
32404         }\r
32405         trim(r);\r
32406         return r;\r
32407     }\r
32408 \r
32409     BigInteger.prototype.square = function () {\r
32410         return new BigInteger(square(this.value), false);\r
32411     };\r
32412 \r
32413     SmallInteger.prototype.square = function () {\r
32414         var value = this.value * this.value;\r
32415         if (isPrecise(value)) return new SmallInteger(value);\r
32416         return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\r
32417     };\r
32418 \r
32419     NativeBigInt.prototype.square = function (v) {\r
32420         return new NativeBigInt(this.value * this.value);\r
32421     }\r
32422 \r
32423     function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.\r
32424         var a_l = a.length,\r
32425             b_l = b.length,\r
32426             base = BASE,\r
32427             result = createArray(b.length),\r
32428             divisorMostSignificantDigit = b[b_l - 1],\r
32429             // normalization\r
32430             lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\r
32431             remainder = multiplySmall(a, lambda),\r
32432             divisor = multiplySmall(b, lambda),\r
32433             quotientDigit, shift, carry, borrow, i, l, q;\r
32434         if (remainder.length <= a_l) remainder.push(0);\r
32435         divisor.push(0);\r
32436         divisorMostSignificantDigit = divisor[b_l - 1];\r
32437         for (shift = a_l - b_l; shift >= 0; shift--) {\r
32438             quotientDigit = base - 1;\r
32439             if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\r
32440                 quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);\r
32441             }\r
32442             // quotientDigit <= base - 1\r
32443             carry = 0;\r
32444             borrow = 0;\r
32445             l = divisor.length;\r
32446             for (i = 0; i < l; i++) {\r
32447                 carry += quotientDigit * divisor[i];\r
32448                 q = Math.floor(carry / base);\r
32449                 borrow += remainder[shift + i] - (carry - q * base);\r
32450                 carry = q;\r
32451                 if (borrow < 0) {\r
32452                     remainder[shift + i] = borrow + base;\r
32453                     borrow = -1;\r
32454                 } else {\r
32455                     remainder[shift + i] = borrow;\r
32456                     borrow = 0;\r
32457                 }\r
32458             }\r
32459             while (borrow !== 0) {\r
32460                 quotientDigit -= 1;\r
32461                 carry = 0;\r
32462                 for (i = 0; i < l; i++) {\r
32463                     carry += remainder[shift + i] - base + divisor[i];\r
32464                     if (carry < 0) {\r
32465                         remainder[shift + i] = carry + base;\r
32466                         carry = 0;\r
32467                     } else {\r
32468                         remainder[shift + i] = carry;\r
32469                         carry = 1;\r
32470                     }\r
32471                 }\r
32472                 borrow += carry;\r
32473             }\r
32474             result[shift] = quotientDigit;\r
32475         }\r
32476         // denormalization\r
32477         remainder = divModSmall(remainder, lambda)[0];\r
32478         return [arrayToSmall(result), arrayToSmall(remainder)];\r
32479     }\r
32480 \r
32481     function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/\r
32482         // Performs faster than divMod1 on larger input sizes.\r
32483         var a_l = a.length,\r
32484             b_l = b.length,\r
32485             result = [],\r
32486             part = [],\r
32487             base = BASE,\r
32488             guess, xlen, highx, highy, check;\r
32489         while (a_l) {\r
32490             part.unshift(a[--a_l]);\r
32491             trim(part);\r
32492             if (compareAbs(part, b) < 0) {\r
32493                 result.push(0);\r
32494                 continue;\r
32495             }\r
32496             xlen = part.length;\r
32497             highx = part[xlen - 1] * base + part[xlen - 2];\r
32498             highy = b[b_l - 1] * base + b[b_l - 2];\r
32499             if (xlen > b_l) {\r
32500                 highx = (highx + 1) * base;\r
32501             }\r
32502             guess = Math.ceil(highx / highy);\r
32503             do {\r
32504                 check = multiplySmall(b, guess);\r
32505                 if (compareAbs(check, part) <= 0) break;\r
32506                 guess--;\r
32507             } while (guess);\r
32508             result.push(guess);\r
32509             part = subtract(part, check);\r
32510         }\r
32511         result.reverse();\r
32512         return [arrayToSmall(result), arrayToSmall(part)];\r
32513     }\r
32514 \r
32515     function divModSmall(value, lambda) {\r
32516         var length = value.length,\r
32517             quotient = createArray(length),\r
32518             base = BASE,\r
32519             i, q, remainder, divisor;\r
32520         remainder = 0;\r
32521         for (i = length - 1; i >= 0; --i) {\r
32522             divisor = remainder * base + value[i];\r
32523             q = truncate(divisor / lambda);\r
32524             remainder = divisor - q * lambda;\r
32525             quotient[i] = q | 0;\r
32526         }\r
32527         return [quotient, remainder | 0];\r
32528     }\r
32529 \r
32530     function divModAny(self, v) {\r
32531         var value, n = parseValue(v);\r
32532         if (supportsNativeBigInt) {\r
32533             return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];\r
32534         }\r
32535         var a = self.value, b = n.value;\r
32536         var quotient;\r
32537         if (b === 0) throw new Error("Cannot divide by zero");\r
32538         if (self.isSmall) {\r
32539             if (n.isSmall) {\r
32540                 return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\r
32541             }\r
32542             return [Integer[0], self];\r
32543         }\r
32544         if (n.isSmall) {\r
32545             if (b === 1) return [self, Integer[0]];\r
32546             if (b == -1) return [self.negate(), Integer[0]];\r
32547             var abs = Math.abs(b);\r
32548             if (abs < BASE) {\r
32549                 value = divModSmall(a, abs);\r
32550                 quotient = arrayToSmall(value[0]);\r
32551                 var remainder = value[1];\r
32552                 if (self.sign) remainder = -remainder;\r
32553                 if (typeof quotient === "number") {\r
32554                     if (self.sign !== n.sign) quotient = -quotient;\r
32555                     return [new SmallInteger(quotient), new SmallInteger(remainder)];\r
32556                 }\r
32557                 return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];\r
32558             }\r
32559             b = smallToArray(abs);\r
32560         }\r
32561         var comparison = compareAbs(a, b);\r
32562         if (comparison === -1) return [Integer[0], self];\r
32563         if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\r
32564 \r
32565         // divMod1 is faster on smaller input sizes\r
32566         if (a.length + b.length <= 200)\r
32567             value = divMod1(a, b);\r
32568         else value = divMod2(a, b);\r
32569 \r
32570         quotient = value[0];\r
32571         var qSign = self.sign !== n.sign,\r
32572             mod = value[1],\r
32573             mSign = self.sign;\r
32574         if (typeof quotient === "number") {\r
32575             if (qSign) quotient = -quotient;\r
32576             quotient = new SmallInteger(quotient);\r
32577         } else quotient = new BigInteger(quotient, qSign);\r
32578         if (typeof mod === "number") {\r
32579             if (mSign) mod = -mod;\r
32580             mod = new SmallInteger(mod);\r
32581         } else mod = new BigInteger(mod, mSign);\r
32582         return [quotient, mod];\r
32583     }\r
32584 \r
32585     BigInteger.prototype.divmod = function (v) {\r
32586         var result = divModAny(this, v);\r
32587         return {\r
32588             quotient: result[0],\r
32589             remainder: result[1]\r
32590         };\r
32591     };\r
32592     NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\r
32593 \r
32594 \r
32595     BigInteger.prototype.divide = function (v) {\r
32596         return divModAny(this, v)[0];\r
32597     };\r
32598     NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {\r
32599         return new NativeBigInt(this.value / parseValue(v).value);\r
32600     };\r
32601     SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;\r
32602 \r
32603     BigInteger.prototype.mod = function (v) {\r
32604         return divModAny(this, v)[1];\r
32605     };\r
32606     NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {\r
32607         return new NativeBigInt(this.value % parseValue(v).value);\r
32608     };\r
32609     SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;\r
32610 \r
32611     BigInteger.prototype.pow = function (v) {\r
32612         var n = parseValue(v),\r
32613             a = this.value,\r
32614             b = n.value,\r
32615             value, x, y;\r
32616         if (b === 0) return Integer[1];\r
32617         if (a === 0) return Integer[0];\r
32618         if (a === 1) return Integer[1];\r
32619         if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\r
32620         if (n.sign) {\r
32621             return Integer[0];\r
32622         }\r
32623         if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");\r
32624         if (this.isSmall) {\r
32625             if (isPrecise(value = Math.pow(a, b)))\r
32626                 return new SmallInteger(truncate(value));\r
32627         }\r
32628         x = this;\r
32629         y = Integer[1];\r
32630         while (true) {\r
32631             if (b & 1 === 1) {\r
32632                 y = y.times(x);\r
32633                 --b;\r
32634             }\r
32635             if (b === 0) break;\r
32636             b /= 2;\r
32637             x = x.square();\r
32638         }\r
32639         return y;\r
32640     };\r
32641     SmallInteger.prototype.pow = BigInteger.prototype.pow;\r
32642 \r
32643     NativeBigInt.prototype.pow = function (v) {\r
32644         var n = parseValue(v);\r
32645         var a = this.value, b = n.value;\r
32646         var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);\r
32647         if (b === _0) return Integer[1];\r
32648         if (a === _0) return Integer[0];\r
32649         if (a === _1) return Integer[1];\r
32650         if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];\r
32651         if (n.isNegative()) return new NativeBigInt(_0);\r
32652         var x = this;\r
32653         var y = Integer[1];\r
32654         while (true) {\r
32655             if ((b & _1) === _1) {\r
32656                 y = y.times(x);\r
32657                 --b;\r
32658             }\r
32659             if (b === _0) break;\r
32660             b /= _2;\r
32661             x = x.square();\r
32662         }\r
32663         return y;\r
32664     }\r
32665 \r
32666     BigInteger.prototype.modPow = function (exp, mod) {\r
32667         exp = parseValue(exp);\r
32668         mod = parseValue(mod);\r
32669         if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");\r
32670         var r = Integer[1],\r
32671             base = this.mod(mod);\r
32672         if (exp.isNegative()) {\r
32673             exp = exp.multiply(Integer[-1]);\r
32674             base = base.modInv(mod);\r
32675         }\r
32676         while (exp.isPositive()) {\r
32677             if (base.isZero()) return Integer[0];\r
32678             if (exp.isOdd()) r = r.multiply(base).mod(mod);\r
32679             exp = exp.divide(2);\r
32680             base = base.square().mod(mod);\r
32681         }\r
32682         return r;\r
32683     };\r
32684     NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\r
32685 \r
32686     function compareAbs(a, b) {\r
32687         if (a.length !== b.length) {\r
32688             return a.length > b.length ? 1 : -1;\r
32689         }\r
32690         for (var i = a.length - 1; i >= 0; i--) {\r
32691             if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\r
32692         }\r
32693         return 0;\r
32694     }\r
32695 \r
32696     BigInteger.prototype.compareAbs = function (v) {\r
32697         var n = parseValue(v),\r
32698             a = this.value,\r
32699             b = n.value;\r
32700         if (n.isSmall) return 1;\r
32701         return compareAbs(a, b);\r
32702     };\r
32703     SmallInteger.prototype.compareAbs = function (v) {\r
32704         var n = parseValue(v),\r
32705             a = Math.abs(this.value),\r
32706             b = n.value;\r
32707         if (n.isSmall) {\r
32708             b = Math.abs(b);\r
32709             return a === b ? 0 : a > b ? 1 : -1;\r
32710         }\r
32711         return -1;\r
32712     };\r
32713     NativeBigInt.prototype.compareAbs = function (v) {\r
32714         var a = this.value;\r
32715         var b = parseValue(v).value;\r
32716         a = a >= 0 ? a : -a;\r
32717         b = b >= 0 ? b : -b;\r
32718         return a === b ? 0 : a > b ? 1 : -1;\r
32719     }\r
32720 \r
32721     BigInteger.prototype.compare = function (v) {\r
32722         // See discussion about comparison with Infinity:\r
32723         // https://github.com/peterolson/BigInteger.js/issues/61\r
32724         if (v === Infinity) {\r
32725             return -1;\r
32726         }\r
32727         if (v === -Infinity) {\r
32728             return 1;\r
32729         }\r
32730 \r
32731         var n = parseValue(v),\r
32732             a = this.value,\r
32733             b = n.value;\r
32734         if (this.sign !== n.sign) {\r
32735             return n.sign ? 1 : -1;\r
32736         }\r
32737         if (n.isSmall) {\r
32738             return this.sign ? -1 : 1;\r
32739         }\r
32740         return compareAbs(a, b) * (this.sign ? -1 : 1);\r
32741     };\r
32742     BigInteger.prototype.compareTo = BigInteger.prototype.compare;\r
32743 \r
32744     SmallInteger.prototype.compare = function (v) {\r
32745         if (v === Infinity) {\r
32746             return -1;\r
32747         }\r
32748         if (v === -Infinity) {\r
32749             return 1;\r
32750         }\r
32751 \r
32752         var n = parseValue(v),\r
32753             a = this.value,\r
32754             b = n.value;\r
32755         if (n.isSmall) {\r
32756             return a == b ? 0 : a > b ? 1 : -1;\r
32757         }\r
32758         if (a < 0 !== n.sign) {\r
32759             return a < 0 ? -1 : 1;\r
32760         }\r
32761         return a < 0 ? 1 : -1;\r
32762     };\r
32763     SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\r
32764 \r
32765     NativeBigInt.prototype.compare = function (v) {\r
32766         if (v === Infinity) {\r
32767             return -1;\r
32768         }\r
32769         if (v === -Infinity) {\r
32770             return 1;\r
32771         }\r
32772         var a = this.value;\r
32773         var b = parseValue(v).value;\r
32774         return a === b ? 0 : a > b ? 1 : -1;\r
32775     }\r
32776     NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;\r
32777 \r
32778     BigInteger.prototype.equals = function (v) {\r
32779         return this.compare(v) === 0;\r
32780     };\r
32781     NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;\r
32782 \r
32783     BigInteger.prototype.notEquals = function (v) {\r
32784         return this.compare(v) !== 0;\r
32785     };\r
32786     NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;\r
32787 \r
32788     BigInteger.prototype.greater = function (v) {\r
32789         return this.compare(v) > 0;\r
32790     };\r
32791     NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;\r
32792 \r
32793     BigInteger.prototype.lesser = function (v) {\r
32794         return this.compare(v) < 0;\r
32795     };\r
32796     NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;\r
32797 \r
32798     BigInteger.prototype.greaterOrEquals = function (v) {\r
32799         return this.compare(v) >= 0;\r
32800     };\r
32801     NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;\r
32802 \r
32803     BigInteger.prototype.lesserOrEquals = function (v) {\r
32804         return this.compare(v) <= 0;\r
32805     };\r
32806     NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;\r
32807 \r
32808     BigInteger.prototype.isEven = function () {\r
32809         return (this.value[0] & 1) === 0;\r
32810     };\r
32811     SmallInteger.prototype.isEven = function () {\r
32812         return (this.value & 1) === 0;\r
32813     };\r
32814     NativeBigInt.prototype.isEven = function () {\r
32815         return (this.value & BigInt(1)) === BigInt(0);\r
32816     }\r
32817 \r
32818     BigInteger.prototype.isOdd = function () {\r
32819         return (this.value[0] & 1) === 1;\r
32820     };\r
32821     SmallInteger.prototype.isOdd = function () {\r
32822         return (this.value & 1) === 1;\r
32823     };\r
32824     NativeBigInt.prototype.isOdd = function () {\r
32825         return (this.value & BigInt(1)) === BigInt(1);\r
32826     }\r
32827 \r
32828     BigInteger.prototype.isPositive = function () {\r
32829         return !this.sign;\r
32830     };\r
32831     SmallInteger.prototype.isPositive = function () {\r
32832         return this.value > 0;\r
32833     };\r
32834     NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;\r
32835 \r
32836     BigInteger.prototype.isNegative = function () {\r
32837         return this.sign;\r
32838     };\r
32839     SmallInteger.prototype.isNegative = function () {\r
32840         return this.value < 0;\r
32841     };\r
32842     NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;\r
32843 \r
32844     BigInteger.prototype.isUnit = function () {\r
32845         return false;\r
32846     };\r
32847     SmallInteger.prototype.isUnit = function () {\r
32848         return Math.abs(this.value) === 1;\r
32849     };\r
32850     NativeBigInt.prototype.isUnit = function () {\r
32851         return this.abs().value === BigInt(1);\r
32852     }\r
32853 \r
32854     BigInteger.prototype.isZero = function () {\r
32855         return false;\r
32856     };\r
32857     SmallInteger.prototype.isZero = function () {\r
32858         return this.value === 0;\r
32859     };\r
32860     NativeBigInt.prototype.isZero = function () {\r
32861         return this.value === BigInt(0);\r
32862     }\r
32863 \r
32864     BigInteger.prototype.isDivisibleBy = function (v) {\r
32865         var n = parseValue(v);\r
32866         if (n.isZero()) return false;\r
32867         if (n.isUnit()) return true;\r
32868         if (n.compareAbs(2) === 0) return this.isEven();\r
32869         return this.mod(n).isZero();\r
32870     };\r
32871     NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\r
32872 \r
32873     function isBasicPrime(v) {\r
32874         var n = v.abs();\r
32875         if (n.isUnit()) return false;\r
32876         if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\r
32877         if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\r
32878         if (n.lesser(49)) return true;\r
32879         // we don't know if it's prime: let the other functions figure it out\r
32880     }\r
32881 \r
32882     function millerRabinTest(n, a) {\r
32883         var nPrev = n.prev(),\r
32884             b = nPrev,\r
32885             r = 0,\r
32886             d, t, i, x;\r
32887         while (b.isEven()) b = b.divide(2), r++;\r
32888         next: for (i = 0; i < a.length; i++) {\r
32889             if (n.lesser(a[i])) continue;\r
32890             x = bigInt(a[i]).modPow(b, n);\r
32891             if (x.isUnit() || x.equals(nPrev)) continue;\r
32892             for (d = r - 1; d != 0; d--) {\r
32893                 x = x.square().mod(n);\r
32894                 if (x.isUnit()) return false;\r
32895                 if (x.equals(nPrev)) continue next;\r
32896             }\r
32897             return false;\r
32898         }\r
32899         return true;\r
32900     }\r
32901 \r
32902     // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2\r
32903     BigInteger.prototype.isPrime = function (strict) {\r
32904         var isPrime = isBasicPrime(this);\r
32905         if (isPrime !== undefined) return isPrime;\r
32906         var n = this.abs();\r
32907         var bits = n.bitLength();\r
32908         if (bits <= 64)\r
32909             return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);\r
32910         var logN = Math.log(2) * bits.toJSNumber();\r
32911         var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);\r
32912         for (var a = [], i = 0; i < t; i++) {\r
32913             a.push(bigInt(i + 2));\r
32914         }\r
32915         return millerRabinTest(n, a);\r
32916     };\r
32917     NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\r
32918 \r
32919     BigInteger.prototype.isProbablePrime = function (iterations, rng) {\r
32920         var isPrime = isBasicPrime(this);\r
32921         if (isPrime !== undefined) return isPrime;\r
32922         var n = this.abs();\r
32923         var t = iterations === undefined ? 5 : iterations;\r
32924         for (var a = [], i = 0; i < t; i++) {\r
32925             a.push(bigInt.randBetween(2, n.minus(2), rng));\r
32926         }\r
32927         return millerRabinTest(n, a);\r
32928     };\r
32929     NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\r
32930 \r
32931     BigInteger.prototype.modInv = function (n) {\r
32932         var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;\r
32933         while (!newR.isZero()) {\r
32934             q = r.divide(newR);\r
32935             lastT = t;\r
32936             lastR = r;\r
32937             t = newT;\r
32938             r = newR;\r
32939             newT = lastT.subtract(q.multiply(newT));\r
32940             newR = lastR.subtract(q.multiply(newR));\r
32941         }\r
32942         if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");\r
32943         if (t.compare(0) === -1) {\r
32944             t = t.add(n);\r
32945         }\r
32946         if (this.isNegative()) {\r
32947             return t.negate();\r
32948         }\r
32949         return t;\r
32950     };\r
32951 \r
32952     NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\r
32953 \r
32954     BigInteger.prototype.next = function () {\r
32955         var value = this.value;\r
32956         if (this.sign) {\r
32957             return subtractSmall(value, 1, this.sign);\r
32958         }\r
32959         return new BigInteger(addSmall(value, 1), this.sign);\r
32960     };\r
32961     SmallInteger.prototype.next = function () {\r
32962         var value = this.value;\r
32963         if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\r
32964         return new BigInteger(MAX_INT_ARR, false);\r
32965     };\r
32966     NativeBigInt.prototype.next = function () {\r
32967         return new NativeBigInt(this.value + BigInt(1));\r
32968     }\r
32969 \r
32970     BigInteger.prototype.prev = function () {\r
32971         var value = this.value;\r
32972         if (this.sign) {\r
32973             return new BigInteger(addSmall(value, 1), true);\r
32974         }\r
32975         return subtractSmall(value, 1, this.sign);\r
32976     };\r
32977     SmallInteger.prototype.prev = function () {\r
32978         var value = this.value;\r
32979         if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\r
32980         return new BigInteger(MAX_INT_ARR, true);\r
32981     };\r
32982     NativeBigInt.prototype.prev = function () {\r
32983         return new NativeBigInt(this.value - BigInt(1));\r
32984     }\r
32985 \r
32986     var powersOfTwo = [1];\r
32987     while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\r
32988     var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];\r
32989 \r
32990     function shift_isSmall(n) {\r
32991         return Math.abs(n) <= BASE;\r
32992     }\r
32993 \r
32994     BigInteger.prototype.shiftLeft = function (v) {\r
32995         var n = parseValue(v).toJSNumber();\r
32996         if (!shift_isSmall(n)) {\r
32997             throw new Error(String(n) + " is too large for shifting.");\r
32998         }\r
32999         if (n < 0) return this.shiftRight(-n);\r
33000         var result = this;\r
33001         if (result.isZero()) return result;\r
33002         while (n >= powers2Length) {\r
33003             result = result.multiply(highestPower2);\r
33004             n -= powers2Length - 1;\r
33005         }\r
33006         return result.multiply(powersOfTwo[n]);\r
33007     };\r
33008     NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\r
33009 \r
33010     BigInteger.prototype.shiftRight = function (v) {\r
33011         var remQuo;\r
33012         var n = parseValue(v).toJSNumber();\r
33013         if (!shift_isSmall(n)) {\r
33014             throw new Error(String(n) + " is too large for shifting.");\r
33015         }\r
33016         if (n < 0) return this.shiftLeft(-n);\r
33017         var result = this;\r
33018         while (n >= powers2Length) {\r
33019             if (result.isZero() || (result.isNegative() && result.isUnit())) return result;\r
33020             remQuo = divModAny(result, highestPower2);\r
33021             result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r
33022             n -= powers2Length - 1;\r
33023         }\r
33024         remQuo = divModAny(result, powersOfTwo[n]);\r
33025         return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r
33026     };\r
33027     NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\r
33028 \r
33029     function bitwise(x, y, fn) {\r
33030         y = parseValue(y);\r
33031         var xSign = x.isNegative(), ySign = y.isNegative();\r
33032         var xRem = xSign ? x.not() : x,\r
33033             yRem = ySign ? y.not() : y;\r
33034         var xDigit = 0, yDigit = 0;\r
33035         var xDivMod = null, yDivMod = null;\r
33036         var result = [];\r
33037         while (!xRem.isZero() || !yRem.isZero()) {\r
33038             xDivMod = divModAny(xRem, highestPower2);\r
33039             xDigit = xDivMod[1].toJSNumber();\r
33040             if (xSign) {\r
33041                 xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers\r
33042             }\r
33043 \r
33044             yDivMod = divModAny(yRem, highestPower2);\r
33045             yDigit = yDivMod[1].toJSNumber();\r
33046             if (ySign) {\r
33047                 yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers\r
33048             }\r
33049 \r
33050             xRem = xDivMod[0];\r
33051             yRem = yDivMod[0];\r
33052             result.push(fn(xDigit, yDigit));\r
33053         }\r
33054         var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\r
33055         for (var i = result.length - 1; i >= 0; i -= 1) {\r
33056             sum = sum.multiply(highestPower2).add(bigInt(result[i]));\r
33057         }\r
33058         return sum;\r
33059     }\r
33060 \r
33061     BigInteger.prototype.not = function () {\r
33062         return this.negate().prev();\r
33063     };\r
33064     NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;\r
33065 \r
33066     BigInteger.prototype.and = function (n) {\r
33067         return bitwise(this, n, function (a, b) { return a & b; });\r
33068     };\r
33069     NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;\r
33070 \r
33071     BigInteger.prototype.or = function (n) {\r
33072         return bitwise(this, n, function (a, b) { return a | b; });\r
33073     };\r
33074     NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;\r
33075 \r
33076     BigInteger.prototype.xor = function (n) {\r
33077         return bitwise(this, n, function (a, b) { return a ^ b; });\r
33078     };\r
33079     NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;\r
33080 \r
33081     var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;\r
33082     function roughLOB(n) { // get lowestOneBit (rough)\r
33083         // SmallInteger: return Min(lowestOneBit(n), 1 << 30)\r
33084         // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]\r
33085         var v = n.value,\r
33086             x = typeof v === "number" ? v | LOBMASK_I :\r
33087                 typeof v === "bigint" ? v | BigInt(LOBMASK_I) :\r
33088                     v[0] + v[1] * BASE | LOBMASK_BI;\r
33089         return x & -x;\r
33090     }\r
33091 \r
33092     function integerLogarithm(value, base) {\r
33093         if (base.compareTo(value) <= 0) {\r
33094             var tmp = integerLogarithm(value, base.square(base));\r
33095             var p = tmp.p;\r
33096             var e = tmp.e;\r
33097             var t = p.multiply(base);\r
33098             return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };\r
33099         }\r
33100         return { p: bigInt(1), e: 0 };\r
33101     }\r
33102 \r
33103     BigInteger.prototype.bitLength = function () {\r
33104         var n = this;\r
33105         if (n.compareTo(bigInt(0)) < 0) {\r
33106             n = n.negate().subtract(bigInt(1));\r
33107         }\r
33108         if (n.compareTo(bigInt(0)) === 0) {\r
33109             return bigInt(0);\r
33110         }\r
33111         return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\r
33112     }\r
33113     NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\r
33114 \r
33115     function max(a, b) {\r
33116         a = parseValue(a);\r
33117         b = parseValue(b);\r
33118         return a.greater(b) ? a : b;\r
33119     }\r
33120     function min(a, b) {\r
33121         a = parseValue(a);\r
33122         b = parseValue(b);\r
33123         return a.lesser(b) ? a : b;\r
33124     }\r
33125     function gcd(a, b) {\r
33126         a = parseValue(a).abs();\r
33127         b = parseValue(b).abs();\r
33128         if (a.equals(b)) return a;\r
33129         if (a.isZero()) return b;\r
33130         if (b.isZero()) return a;\r
33131         var c = Integer[1], d, t;\r
33132         while (a.isEven() && b.isEven()) {\r
33133             d = min(roughLOB(a), roughLOB(b));\r
33134             a = a.divide(d);\r
33135             b = b.divide(d);\r
33136             c = c.multiply(d);\r
33137         }\r
33138         while (a.isEven()) {\r
33139             a = a.divide(roughLOB(a));\r
33140         }\r
33141         do {\r
33142             while (b.isEven()) {\r
33143                 b = b.divide(roughLOB(b));\r
33144             }\r
33145             if (a.greater(b)) {\r
33146                 t = b; b = a; a = t;\r
33147             }\r
33148             b = b.subtract(a);\r
33149         } while (!b.isZero());\r
33150         return c.isUnit() ? a : a.multiply(c);\r
33151     }\r
33152     function lcm(a, b) {\r
33153         a = parseValue(a).abs();\r
33154         b = parseValue(b).abs();\r
33155         return a.divide(gcd(a, b)).multiply(b);\r
33156     }\r
33157     function randBetween(a, b, rng) {\r
33158         a = parseValue(a);\r
33159         b = parseValue(b);\r
33160         var usedRNG = rng || Math.random;\r
33161         var low = min(a, b), high = max(a, b);\r
33162         var range = high.subtract(low).add(1);\r
33163         if (range.isSmall) return low.add(Math.floor(usedRNG() * range));\r
33164         var digits = toBase(range, BASE).value;\r
33165         var result = [], restricted = true;\r
33166         for (var i = 0; i < digits.length; i++) {\r
33167             var top = restricted ? digits[i] : BASE;\r
33168             var digit = truncate(usedRNG() * top);\r
33169             result.push(digit);\r
33170             if (digit < top) restricted = false;\r
33171         }\r
33172         return low.add(Integer.fromArray(result, BASE, false));\r
33173     }\r
33174 \r
33175     var parseBase = function (text, base, alphabet, caseSensitive) {\r
33176         alphabet = alphabet || DEFAULT_ALPHABET;\r
33177         text = String(text);\r
33178         if (!caseSensitive) {\r
33179             text = text.toLowerCase();\r
33180             alphabet = alphabet.toLowerCase();\r
33181         }\r
33182         var length = text.length;\r
33183         var i;\r
33184         var absBase = Math.abs(base);\r
33185         var alphabetValues = {};\r
33186         for (i = 0; i < alphabet.length; i++) {\r
33187             alphabetValues[alphabet[i]] = i;\r
33188         }\r
33189         for (i = 0; i < length; i++) {\r
33190             var c = text[i];\r
33191             if (c === "-") continue;\r
33192             if (c in alphabetValues) {\r
33193                 if (alphabetValues[c] >= absBase) {\r
33194                     if (c === "1" && absBase === 1) continue;\r
33195                     throw new Error(c + " is not a valid digit in base " + base + ".");\r
33196                 }\r
33197             }\r
33198         }\r
33199         base = parseValue(base);\r
33200         var digits = [];\r
33201         var isNegative = text[0] === "-";\r
33202         for (i = isNegative ? 1 : 0; i < text.length; i++) {\r
33203             var c = text[i];\r
33204             if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));\r
33205             else if (c === "<") {\r
33206                 var start = i;\r
33207                 do { i++; } while (text[i] !== ">" && i < text.length);\r
33208                 digits.push(parseValue(text.slice(start + 1, i)));\r
33209             }\r
33210             else throw new Error(c + " is not a valid character");\r
33211         }\r
33212         return parseBaseFromArray(digits, base, isNegative);\r
33213     };\r
33214 \r
33215     function parseBaseFromArray(digits, base, isNegative) {\r
33216         var val = Integer[0], pow = Integer[1], i;\r
33217         for (i = digits.length - 1; i >= 0; i--) {\r
33218             val = val.add(digits[i].times(pow));\r
33219             pow = pow.times(base);\r
33220         }\r
33221         return isNegative ? val.negate() : val;\r
33222     }\r
33223 \r
33224     function stringify(digit, alphabet) {\r
33225         alphabet = alphabet || DEFAULT_ALPHABET;\r
33226         if (digit < alphabet.length) {\r
33227             return alphabet[digit];\r
33228         }\r
33229         return "<" + digit + ">";\r
33230     }\r
33231 \r
33232     function toBase(n, base) {\r
33233         base = bigInt(base);\r
33234         if (base.isZero()) {\r
33235             if (n.isZero()) return { value: [0], isNegative: false };\r
33236             throw new Error("Cannot convert nonzero numbers to base 0.");\r
33237         }\r
33238         if (base.equals(-1)) {\r
33239             if (n.isZero()) return { value: [0], isNegative: false };\r
33240             if (n.isNegative())\r
33241                 return {\r
33242                     value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))\r
33243                         .map(Array.prototype.valueOf, [1, 0])\r
33244                     ),\r
33245                     isNegative: false\r
33246                 };\r
33247 \r
33248             var arr = Array.apply(null, Array(n.toJSNumber() - 1))\r
33249                 .map(Array.prototype.valueOf, [0, 1]);\r
33250             arr.unshift([1]);\r
33251             return {\r
33252                 value: [].concat.apply([], arr),\r
33253                 isNegative: false\r
33254             };\r
33255         }\r
33256 \r
33257         var neg = false;\r
33258         if (n.isNegative() && base.isPositive()) {\r
33259             neg = true;\r
33260             n = n.abs();\r
33261         }\r
33262         if (base.isUnit()) {\r
33263             if (n.isZero()) return { value: [0], isNegative: false };\r
33264 \r
33265             return {\r
33266                 value: Array.apply(null, Array(n.toJSNumber()))\r
33267                     .map(Number.prototype.valueOf, 1),\r
33268                 isNegative: neg\r
33269             };\r
33270         }\r
33271         var out = [];\r
33272         var left = n, divmod;\r
33273         while (left.isNegative() || left.compareAbs(base) >= 0) {\r
33274             divmod = left.divmod(base);\r
33275             left = divmod.quotient;\r
33276             var digit = divmod.remainder;\r
33277             if (digit.isNegative()) {\r
33278                 digit = base.minus(digit).abs();\r
33279                 left = left.next();\r
33280             }\r
33281             out.push(digit.toJSNumber());\r
33282         }\r
33283         out.push(left.toJSNumber());\r
33284         return { value: out.reverse(), isNegative: neg };\r
33285     }\r
33286 \r
33287     function toBaseString(n, base, alphabet) {\r
33288         var arr = toBase(n, base);\r
33289         return (arr.isNegative ? "-" : "") + arr.value.map(function (x) {\r
33290             return stringify(x, alphabet);\r
33291         }).join('');\r
33292     }\r
33293 \r
33294     BigInteger.prototype.toArray = function (radix) {\r
33295         return toBase(this, radix);\r
33296     };\r
33297 \r
33298     SmallInteger.prototype.toArray = function (radix) {\r
33299         return toBase(this, radix);\r
33300     };\r
33301 \r
33302     NativeBigInt.prototype.toArray = function (radix) {\r
33303         return toBase(this, radix);\r
33304     };\r
33305 \r
33306     BigInteger.prototype.toString = function (radix, alphabet) {\r
33307         if (radix === undefined) radix = 10;\r
33308         if (radix !== 10) return toBaseString(this, radix, alphabet);\r
33309         var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;\r
33310         while (--l >= 0) {\r
33311             digit = String(v[l]);\r
33312             str += zeros.slice(digit.length) + digit;\r
33313         }\r
33314         var sign = this.sign ? "-" : "";\r
33315         return sign + str;\r
33316     };\r
33317 \r
33318     SmallInteger.prototype.toString = function (radix, alphabet) {\r
33319         if (radix === undefined) radix = 10;\r
33320         if (radix != 10) return toBaseString(this, radix, alphabet);\r
33321         return String(this.value);\r
33322     };\r
33323 \r
33324     NativeBigInt.prototype.toString = SmallInteger.prototype.toString;\r
33325 \r
33326     NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }\r
33327 \r
33328     BigInteger.prototype.valueOf = function () {\r
33329         return parseInt(this.toString(), 10);\r
33330     };\r
33331     BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\r
33332 \r
33333     SmallInteger.prototype.valueOf = function () {\r
33334         return this.value;\r
33335     };\r
33336     SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\r
33337     NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {\r
33338         return parseInt(this.toString(), 10);\r
33339     }\r
33340 \r
33341     function parseStringValue(v) {\r
33342         if (isPrecise(+v)) {\r
33343             var x = +v;\r
33344             if (x === truncate(x))\r
33345                 return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);\r
33346             throw new Error("Invalid integer: " + v);\r
33347         }\r
33348         var sign = v[0] === "-";\r
33349         if (sign) v = v.slice(1);\r
33350         var split = v.split(/e/i);\r
33351         if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));\r
33352         if (split.length === 2) {\r
33353             var exp = split[1];\r
33354             if (exp[0] === "+") exp = exp.slice(1);\r
33355             exp = +exp;\r
33356             if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");\r
33357             var text = split[0];\r
33358             var decimalPlace = text.indexOf(".");\r
33359             if (decimalPlace >= 0) {\r
33360                 exp -= text.length - decimalPlace - 1;\r
33361                 text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\r
33362             }\r
33363             if (exp < 0) throw new Error("Cannot include negative exponent part for integers");\r
33364             text += (new Array(exp + 1)).join("0");\r
33365             v = text;\r
33366         }\r
33367         var isValid = /^([0-9][0-9]*)$/.test(v);\r
33368         if (!isValid) throw new Error("Invalid integer: " + v);\r
33369         if (supportsNativeBigInt) {\r
33370             return new NativeBigInt(BigInt(sign ? "-" + v : v));\r
33371         }\r
33372         var r = [], max = v.length, l = LOG_BASE, min = max - l;\r
33373         while (max > 0) {\r
33374             r.push(+v.slice(min, max));\r
33375             min -= l;\r
33376             if (min < 0) min = 0;\r
33377             max -= l;\r
33378         }\r
33379         trim(r);\r
33380         return new BigInteger(r, sign);\r
33381     }\r
33382 \r
33383     function parseNumberValue(v) {\r
33384         if (supportsNativeBigInt) {\r
33385             return new NativeBigInt(BigInt(v));\r
33386         }\r
33387         if (isPrecise(v)) {\r
33388             if (v !== truncate(v)) throw new Error(v + " is not an integer.");\r
33389             return new SmallInteger(v);\r
33390         }\r
33391         return parseStringValue(v.toString());\r
33392     }\r
33393 \r
33394     function parseValue(v) {\r
33395         if (typeof v === "number") {\r
33396             return parseNumberValue(v);\r
33397         }\r
33398         if (typeof v === "string") {\r
33399             return parseStringValue(v);\r
33400         }\r
33401         if (typeof v === "bigint") {\r
33402             return new NativeBigInt(v);\r
33403         }\r
33404         return v;\r
33405     }\r
33406     // Pre-define numbers in range [-999,999]\r
33407     for (var i = 0; i < 1000; i++) {\r
33408         Integer[i] = parseValue(i);\r
33409         if (i > 0) Integer[-i] = parseValue(-i);\r
33410     }\r
33411     // Backwards compatibility\r
33412     Integer.one = Integer[1];\r
33413     Integer.zero = Integer[0];\r
33414     Integer.minusOne = Integer[-1];\r
33415     Integer.max = max;\r
33416     Integer.min = min;\r
33417     Integer.gcd = gcd;\r
33418     Integer.lcm = lcm;\r
33419     Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };\r
33420     Integer.randBetween = randBetween;\r
33421 \r
33422     Integer.fromArray = function (digits, base, isNegative) {\r
33423         return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);\r
33424     };\r
33425 \r
33426     return Integer;\r
33427 })();\r
33428 \r
33429 // Node.js check\r
33430 if ( true && module.hasOwnProperty("exports")) {\r
33431     module.exports = bigInt;\r
33432 }\r
33433 \r
33434 //amd check\r
33435 if (true) {\r
33436     !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\r
33437         return bigInt;\r
33438     }).call(exports, __webpack_require__, exports, module),
33439                 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r
33440 }\r
33441
33442
33443 /***/ }),
33444 /* 216 */
33445 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33446
33447 const isWindows = process.platform === 'win32' ||
33448     process.env.OSTYPE === 'cygwin' ||
33449     process.env.OSTYPE === 'msys'
33450
33451 const path = __webpack_require__(2)
33452 const COLON = isWindows ? ';' : ':'
33453 const isexe = __webpack_require__(217)
33454
33455 const getNotFoundError = (cmd) =>
33456   Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
33457
33458 const getPathInfo = (cmd, opt) => {
33459   const colon = opt.colon || COLON
33460
33461   // If it has a slash, then we don't bother searching the pathenv.
33462   // just check the file itself, and that's it.
33463   const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
33464     : (
33465       [
33466         // windows always checks the cwd first
33467         ...(isWindows ? [process.cwd()] : []),
33468         ...(opt.path || process.env.PATH ||
33469           /* istanbul ignore next: very unusual */ '').split(colon),
33470       ]
33471     )
33472   const pathExtExe = isWindows
33473     ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
33474     : ''
33475   const pathExt = isWindows ? pathExtExe.split(colon) : ['']
33476
33477   if (isWindows) {
33478     if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
33479       pathExt.unshift('')
33480   }
33481
33482   return {
33483     pathEnv,
33484     pathExt,
33485     pathExtExe,
33486   }
33487 }
33488
33489 const which = (cmd, opt, cb) => {
33490   if (typeof opt === 'function') {
33491     cb = opt
33492     opt = {}
33493   }
33494   if (!opt)
33495     opt = {}
33496
33497   const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
33498   const found = []
33499
33500   const step = i => new Promise((resolve, reject) => {
33501     if (i === pathEnv.length)
33502       return opt.all && found.length ? resolve(found)
33503         : reject(getNotFoundError(cmd))
33504
33505     const ppRaw = pathEnv[i]
33506     const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
33507
33508     const pCmd = path.join(pathPart, cmd)
33509     const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
33510       : pCmd
33511
33512     resolve(subStep(p, i, 0))
33513   })
33514
33515   const subStep = (p, i, ii) => new Promise((resolve, reject) => {
33516     if (ii === pathExt.length)
33517       return resolve(step(i + 1))
33518     const ext = pathExt[ii]
33519     isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
33520       if (!er && is) {
33521         if (opt.all)
33522           found.push(p + ext)
33523         else
33524           return resolve(p + ext)
33525       }
33526       return resolve(subStep(p, i, ii + 1))
33527     })
33528   })
33529
33530   return cb ? step(0).then(res => cb(null, res), cb) : step(0)
33531 }
33532
33533 const whichSync = (cmd, opt) => {
33534   opt = opt || {}
33535
33536   const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
33537   const found = []
33538
33539   for (let i = 0; i < pathEnv.length; i ++) {
33540     const ppRaw = pathEnv[i]
33541     const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
33542
33543     const pCmd = path.join(pathPart, cmd)
33544     const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
33545       : pCmd
33546
33547     for (let j = 0; j < pathExt.length; j ++) {
33548       const cur = p + pathExt[j]
33549       try {
33550         const is = isexe.sync(cur, { pathExt: pathExtExe })
33551         if (is) {
33552           if (opt.all)
33553             found.push(cur)
33554           else
33555             return cur
33556         }
33557       } catch (ex) {}
33558     }
33559   }
33560
33561   if (opt.all && found.length)
33562     return found
33563
33564   if (opt.nothrow)
33565     return null
33566
33567   throw getNotFoundError(cmd)
33568 }
33569
33570 module.exports = which
33571 which.sync = whichSync
33572
33573
33574 /***/ }),
33575 /* 217 */
33576 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33577
33578 var fs = __webpack_require__(42)
33579 var core
33580 if (process.platform === 'win32' || global.TESTING_WINDOWS) {
33581   core = __webpack_require__(218)
33582 } else {
33583   core = __webpack_require__(219)
33584 }
33585
33586 module.exports = isexe
33587 isexe.sync = sync
33588
33589 function isexe (path, options, cb) {
33590   if (typeof options === 'function') {
33591     cb = options
33592     options = {}
33593   }
33594
33595   if (!cb) {
33596     if (typeof Promise !== 'function') {
33597       throw new TypeError('callback not provided')
33598     }
33599
33600     return new Promise(function (resolve, reject) {
33601       isexe(path, options || {}, function (er, is) {
33602         if (er) {
33603           reject(er)
33604         } else {
33605           resolve(is)
33606         }
33607       })
33608     })
33609   }
33610
33611   core(path, options || {}, function (er, is) {
33612     // ignore EACCES because that just means we aren't allowed to run it
33613     if (er) {
33614       if (er.code === 'EACCES' || options && options.ignoreErrors) {
33615         er = null
33616         is = false
33617       }
33618     }
33619     cb(er, is)
33620   })
33621 }
33622
33623 function sync (path, options) {
33624   // my kingdom for a filtered catch
33625   try {
33626     return core.sync(path, options || {})
33627   } catch (er) {
33628     if (options && options.ignoreErrors || er.code === 'EACCES') {
33629       return false
33630     } else {
33631       throw er
33632     }
33633   }
33634 }
33635
33636
33637 /***/ }),
33638 /* 218 */
33639 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33640
33641 module.exports = isexe
33642 isexe.sync = sync
33643
33644 var fs = __webpack_require__(42)
33645
33646 function checkPathExt (path, options) {
33647   var pathext = options.pathExt !== undefined ?
33648     options.pathExt : process.env.PATHEXT
33649
33650   if (!pathext) {
33651     return true
33652   }
33653
33654   pathext = pathext.split(';')
33655   if (pathext.indexOf('') !== -1) {
33656     return true
33657   }
33658   for (var i = 0; i < pathext.length; i++) {
33659     var p = pathext[i].toLowerCase()
33660     if (p && path.substr(-p.length).toLowerCase() === p) {
33661       return true
33662     }
33663   }
33664   return false
33665 }
33666
33667 function checkStat (stat, path, options) {
33668   if (!stat.isSymbolicLink() && !stat.isFile()) {
33669     return false
33670   }
33671   return checkPathExt(path, options)
33672 }
33673
33674 function isexe (path, options, cb) {
33675   fs.stat(path, function (er, stat) {
33676     cb(er, er ? false : checkStat(stat, path, options))
33677   })
33678 }
33679
33680 function sync (path, options) {
33681   return checkStat(fs.statSync(path), path, options)
33682 }
33683
33684
33685 /***/ }),
33686 /* 219 */
33687 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33688
33689 module.exports = isexe
33690 isexe.sync = sync
33691
33692 var fs = __webpack_require__(42)
33693
33694 function isexe (path, options, cb) {
33695   fs.stat(path, function (er, stat) {
33696     cb(er, er ? false : checkStat(stat, options))
33697   })
33698 }
33699
33700 function sync (path, options) {
33701   return checkStat(fs.statSync(path), options)
33702 }
33703
33704 function checkStat (stat, options) {
33705   return stat.isFile() && checkMode(stat, options)
33706 }
33707
33708 function checkMode (stat, options) {
33709   var mod = stat.mode
33710   var uid = stat.uid
33711   var gid = stat.gid
33712
33713   var myUid = options.uid !== undefined ?
33714     options.uid : process.getuid && process.getuid()
33715   var myGid = options.gid !== undefined ?
33716     options.gid : process.getgid && process.getgid()
33717
33718   var u = parseInt('100', 8)
33719   var g = parseInt('010', 8)
33720   var o = parseInt('001', 8)
33721   var ug = u | g
33722
33723   var ret = (mod & o) ||
33724     (mod & g) && gid === myGid ||
33725     (mod & u) && uid === myUid ||
33726     (mod & ug) && myUid === 0
33727
33728   return ret
33729 }
33730
33731
33732 /***/ })
33733 /******/        ]);
33734 /************************************************************************/
33735 /******/        // The module cache
33736 /******/        var __webpack_module_cache__ = {};
33737 /******/        
33738 /******/        // The require function
33739 /******/        function __webpack_require__(moduleId) {
33740 /******/                // Check if module is in cache
33741 /******/                if(__webpack_module_cache__[moduleId]) {
33742 /******/                        return __webpack_module_cache__[moduleId].exports;
33743 /******/                }
33744 /******/                // Create a new module (and put it into the cache)
33745 /******/                var module = __webpack_module_cache__[moduleId] = {
33746 /******/                        id: moduleId,
33747 /******/                        loaded: false,
33748 /******/                        exports: {}
33749 /******/                };
33750 /******/        
33751 /******/                // Execute the module function
33752 /******/                __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
33753 /******/        
33754 /******/                // Flag the module as loaded
33755 /******/                module.loaded = true;
33756 /******/        
33757 /******/                // Return the exports of the module
33758 /******/                return module.exports;
33759 /******/        }
33760 /******/        
33761 /************************************************************************/
33762 /******/        /* webpack/runtime/define property getters */
33763 /******/        (() => {
33764 /******/                // define getter functions for harmony exports
33765 /******/                __webpack_require__.d = (exports, definition) => {
33766 /******/                        for(var key in definition) {
33767 /******/                                if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
33768 /******/                                        Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
33769 /******/                                }
33770 /******/                        }
33771 /******/                };
33772 /******/        })();
33773 /******/        
33774 /******/        /* webpack/runtime/hasOwnProperty shorthand */
33775 /******/        (() => {
33776 /******/                __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
33777 /******/        })();
33778 /******/        
33779 /******/        /* webpack/runtime/make namespace object */
33780 /******/        (() => {
33781 /******/                // define __esModule on exports
33782 /******/                __webpack_require__.r = (exports) => {
33783 /******/                        if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
33784 /******/                                Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
33785 /******/                        }
33786 /******/                        Object.defineProperty(exports, '__esModule', { value: true });
33787 /******/                };
33788 /******/        })();
33789 /******/        
33790 /******/        /* webpack/runtime/node module decorator */
33791 /******/        (() => {
33792 /******/                __webpack_require__.nmd = (module) => {
33793 /******/                        module.paths = [];
33794 /******/                        if (!module.children) module.children = [];
33795 /******/                        return module;
33796 /******/                };
33797 /******/        })();
33798 /******/        
33799 /************************************************************************/
33800 /******/        // module exports must be returned from runtime so entry inlining is disabled
33801 /******/        // startup
33802 /******/        // Load entry module and return exports
33803 /******/        return __webpack_require__(0);
33804 /******/ })()
33805
33806 ));