f17a1ce67cb36b7affff4816d0750e7509e8145a
[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]; }(exports, /******/ (function(modules) { // webpackBootstrap
2 /******/        // The module cache
3 /******/        var installedModules = {};
4 /******/
5 /******/        // The require function
6 /******/        function __webpack_require__(moduleId) {
7 /******/
8 /******/                // Check if module is in cache
9 /******/                if(installedModules[moduleId]) {
10 /******/                        return installedModules[moduleId].exports;
11 /******/                }
12 /******/                // Create a new module (and put it into the cache)
13 /******/                var module = installedModules[moduleId] = {
14 /******/                        i: moduleId,
15 /******/                        l: false,
16 /******/                        exports: {}
17 /******/                };
18 /******/
19 /******/                // Execute the module function
20 /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 /******/
22 /******/                // Flag the module as loaded
23 /******/                module.l = true;
24 /******/
25 /******/                // Return the exports of the module
26 /******/                return module.exports;
27 /******/        }
28 /******/
29 /******/
30 /******/        // expose the modules object (__webpack_modules__)
31 /******/        __webpack_require__.m = modules;
32 /******/
33 /******/        // expose the module cache
34 /******/        __webpack_require__.c = installedModules;
35 /******/
36 /******/        // define getter function for harmony exports
37 /******/        __webpack_require__.d = function(exports, name, getter) {
38 /******/                if(!__webpack_require__.o(exports, name)) {
39 /******/                        Object.defineProperty(exports, name, { enumerable: true, get: getter });
40 /******/                }
41 /******/        };
42 /******/
43 /******/        // define __esModule on exports
44 /******/        __webpack_require__.r = function(exports) {
45 /******/                if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46 /******/                        Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47 /******/                }
48 /******/                Object.defineProperty(exports, '__esModule', { value: true });
49 /******/        };
50 /******/
51 /******/        // create a fake namespace object
52 /******/        // mode & 1: value is a module id, require it
53 /******/        // mode & 2: merge all properties of value into the ns
54 /******/        // mode & 4: return value when already ns object
55 /******/        // mode & 8|1: behave like require
56 /******/        __webpack_require__.t = function(value, mode) {
57 /******/                if(mode & 1) value = __webpack_require__(value);
58 /******/                if(mode & 8) return value;
59 /******/                if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60 /******/                var ns = Object.create(null);
61 /******/                __webpack_require__.r(ns);
62 /******/                Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63 /******/                if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64 /******/                return ns;
65 /******/        };
66 /******/
67 /******/        // getDefaultExport function for compatibility with non-harmony modules
68 /******/        __webpack_require__.n = function(module) {
69 /******/                var getter = module && module.__esModule ?
70 /******/                        function getDefault() { return module['default']; } :
71 /******/                        function getModuleExports() { return module; };
72 /******/                __webpack_require__.d(getter, 'a', getter);
73 /******/                return getter;
74 /******/        };
75 /******/
76 /******/        // Object.prototype.hasOwnProperty.call
77 /******/        __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78 /******/
79 /******/        // __webpack_public_path__
80 /******/        __webpack_require__.p = "";
81 /******/
82 /******/
83 /******/        // Load entry module and return exports
84 /******/        return __webpack_require__(__webpack_require__.s = 0);
85 /******/ })
86 /************************************************************************/
87 /******/ ([
88 /* 0 */
89 /***/ (function(module, exports, __webpack_require__) {
90
91 "use strict";
92
93 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
94     if (k2 === undefined) k2 = k;
95     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
96 }) : (function(o, m, k, k2) {
97     if (k2 === undefined) k2 = k;
98     o[k2] = m[k];
99 }));
100 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
101     Object.defineProperty(o, "default", { enumerable: true, value: v });
102 }) : function(o, v) {
103     o["default"] = v;
104 });
105 var __importStar = (this && this.__importStar) || function (mod) {
106     if (mod && mod.__esModule) return mod;
107     var result = {};
108     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
109     __setModuleDefault(result, mod);
110     return result;
111 };
112 Object.defineProperty(exports, "__esModule", { value: true });
113 exports.activate = void 0;
114 const coc_nvim_1 = __webpack_require__(1);
115 const path_1 = __webpack_require__(2);
116 const cmds = __importStar(__webpack_require__(3));
117 const ctx_1 = __webpack_require__(33);
118 const file_status_1 = __webpack_require__(36);
119 const install = __importStar(__webpack_require__(37));
120 async function activate(context) {
121     var _a;
122     const ctx = new ctx_1.Ctx(context);
123     if (!ctx.config.enabled) {
124         return;
125     }
126     for (const service of coc_nvim_1.services.getServiceStats()) {
127         if (service.id.includes('clangd')) {
128             coc_nvim_1.workspace.showMessage(`Looks like you've configured clangd in coc-settings.json, you should remove it to use coc-clangd`, 'warning');
129             return;
130         }
131     }
132     const clangdPath = await install.activate(context);
133     if (!clangdPath) {
134         return;
135     }
136     try {
137         await ctx.startServer(clangdPath);
138     }
139     catch (e) {
140         return;
141     }
142     const fileStatus = new file_status_1.FileStatus();
143     const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher('**/{compile_commands.json,compile_flags.txt,.clang-tidy}');
144     fileWatcher.onDidChange((e) => reload(e.fsPath, ctx, context));
145     fileWatcher.onDidCreate((e) => reload(e.fsPath, ctx, context));
146     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) => {
147         var _a;
148         if (e.newState === coc_nvim_1.State.Running) {
149             (_a = ctx.client) === null || _a === void 0 ? void 0 : _a.onNotification('textDocument/clangd.fileStatus', (status) => {
150                 status.onFileUpdated(status);
151             });
152         }
153         else if (e.newState === coc_nvim_1.State.Stopped) {
154             fileStatus.clear();
155         }
156     }), coc_nvim_1.workspace.onDidOpenTextDocument(() => {
157         fileStatus.updateStatus();
158     }));
159     (_a = ctx.client) === null || _a === void 0 ? void 0 : _a.onNotification('textDocument/clangd.fileStatus', (status) => {
160         fileStatus.onFileUpdated(status);
161     });
162 }
163 exports.activate = activate;
164 async function reload(url, ctx, context) {
165     const notification = ctx.config.showDBChangedNotification;
166     if (notification) {
167         const msg = `${path_1.basename(url)} has changed, clangd is reloading...`;
168         coc_nvim_1.workspace.showMessage(msg);
169     }
170     for (const sub of ctx.subscriptions) {
171         try {
172             sub.dispose();
173         }
174         catch (e) {
175             console.error(e);
176         }
177     }
178     await activate(context);
179     if (notification)
180         coc_nvim_1.workspace.showMessage(`clangd has reloaded`);
181 }
182
183
184 /***/ }),
185 /* 1 */
186 /***/ (function(module, exports) {
187
188 module.exports = require("coc.nvim");
189
190 /***/ }),
191 /* 2 */
192 /***/ (function(module, exports) {
193
194 module.exports = require("path");
195
196 /***/ }),
197 /* 3 */
198 /***/ (function(module, exports, __webpack_require__) {
199
200 "use strict";
201
202 Object.defineProperty(exports, "__esModule", { value: true });
203 exports.symbolInfo = exports.switchSourceHeader = void 0;
204 const coc_nvim_1 = __webpack_require__(1);
205 const vscode_languageserver_protocol_1 = __webpack_require__(4);
206 var SwitchSourceHeaderRequest;
207 (function (SwitchSourceHeaderRequest) {
208     SwitchSourceHeaderRequest.type = new vscode_languageserver_protocol_1.RequestType('textDocument/switchSourceHeader');
209 })(SwitchSourceHeaderRequest || (SwitchSourceHeaderRequest = {}));
210 var SymbolInfoRequest;
211 (function (SymbolInfoRequest) {
212     SymbolInfoRequest.type = new vscode_languageserver_protocol_1.RequestType('textDocument/symbolInfo');
213 })(SymbolInfoRequest || (SymbolInfoRequest = {}));
214 function switchSourceHeader(ctx) {
215     return async () => {
216         if (!ctx.client) {
217             return;
218         }
219         const doc = await coc_nvim_1.workspace.document;
220         if (!doc) {
221             return;
222         }
223         const params = {
224             uri: doc.uri,
225         };
226         const dest = await ctx.client.sendRequest(SwitchSourceHeaderRequest.type.method, params);
227         if (!dest) {
228             coc_nvim_1.workspace.showMessage(`Didn't find a corresponding file.`);
229             return;
230         }
231         await coc_nvim_1.workspace.jumpTo(dest);
232     };
233 }
234 exports.switchSourceHeader = switchSourceHeader;
235 function symbolInfo(ctx) {
236     return async () => {
237         if (!ctx.client) {
238             return;
239         }
240         const doc = await coc_nvim_1.workspace.document;
241         if (!doc) {
242             return;
243         }
244         const position = await coc_nvim_1.workspace.getCursorPosition();
245         const params = {
246             textDocument: { uri: doc.uri },
247             position,
248         };
249         const details = await ctx.client.sendRequest(SymbolInfoRequest.type.method, params);
250         if (!details.length) {
251             return;
252         }
253         // TODO
254         const detail = details[0];
255         coc_nvim_1.workspace.showMessage(`name: ${detail.name}, containerName: ${detail.containerName}, usr: ${detail.usr}`);
256     };
257 }
258 exports.symbolInfo = symbolInfo;
259
260
261 /***/ }),
262 /* 4 */
263 /***/ (function(module, exports, __webpack_require__) {
264
265 "use strict";
266 /* --------------------------------------------------------------------------------------------\r
267  * Copyright (c) Microsoft Corporation. All rights reserved.\r
268  * Licensed under the MIT License. See License.txt in the project root for license information.\r
269  * ------------------------------------------------------------------------------------------ */\r
270 \r
271 function __export(m) {\r
272     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
273 }\r
274 Object.defineProperty(exports, "__esModule", { value: true });\r
275 const vscode_jsonrpc_1 = __webpack_require__(5);\r
276 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
277 exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
278 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
279 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
280 exports.Disposable = vscode_jsonrpc_1.Disposable;\r
281 exports.Event = vscode_jsonrpc_1.Event;\r
282 exports.Emitter = vscode_jsonrpc_1.Emitter;\r
283 exports.Trace = vscode_jsonrpc_1.Trace;\r
284 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
285 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
286 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
287 exports.RequestType = vscode_jsonrpc_1.RequestType;\r
288 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
289 exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
290 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
291 exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
292 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
293 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
294 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
295 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
296 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
297 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
298 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
299 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
300 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
301 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
302 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
303 exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
304 __export(__webpack_require__(18));\r
305 __export(__webpack_require__(19));\r
306 const callHierarchy = __webpack_require__(31);\r
307 const st = __webpack_require__(32);\r
308 var Proposed;\r
309 (function (Proposed) {\r
310     let CallHierarchyPrepareRequest;\r
311     (function (CallHierarchyPrepareRequest) {\r
312         CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
313         CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
314     })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
315     let CallHierarchyIncomingCallsRequest;\r
316     (function (CallHierarchyIncomingCallsRequest) {\r
317         CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
318         CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;\r
319     })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
320     let CallHierarchyOutgoingCallsRequest;\r
321     (function (CallHierarchyOutgoingCallsRequest) {\r
322         CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
323         CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;\r
324     })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
325     Proposed.SemanticTokenTypes = st.SemanticTokenTypes;\r
326     Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;\r
327     Proposed.SemanticTokens = st.SemanticTokens;\r
328     let SemanticTokensRequest;\r
329     (function (SemanticTokensRequest) {\r
330         SemanticTokensRequest.method = st.SemanticTokensRequest.method;\r
331         SemanticTokensRequest.type = st.SemanticTokensRequest.type;\r
332     })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));\r
333     let SemanticTokensEditsRequest;\r
334     (function (SemanticTokensEditsRequest) {\r
335         SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;\r
336         SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;\r
337     })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));\r
338     let SemanticTokensRangeRequest;\r
339     (function (SemanticTokensRangeRequest) {\r
340         SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;\r
341         SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;\r
342     })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));\r
343 })(Proposed = exports.Proposed || (exports.Proposed = {}));\r
344 function createProtocolConnection(reader, writer, logger, strategy) {\r
345     return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
346 }\r
347 exports.createProtocolConnection = createProtocolConnection;\r
348
349
350 /***/ }),
351 /* 5 */
352 /***/ (function(module, exports, __webpack_require__) {
353
354 "use strict";
355 /* --------------------------------------------------------------------------------------------\r
356  * Copyright (c) Microsoft Corporation. All rights reserved.\r
357  * Licensed under the MIT License. See License.txt in the project root for license information.\r
358  * ------------------------------------------------------------------------------------------ */\r
359 /// <reference path="../typings/thenable.d.ts" />\r
360 \r
361 function __export(m) {\r
362     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
363 }\r
364 Object.defineProperty(exports, "__esModule", { value: true });\r
365 const Is = __webpack_require__(6);\r
366 const messages_1 = __webpack_require__(7);\r
367 exports.RequestType = messages_1.RequestType;\r
368 exports.RequestType0 = messages_1.RequestType0;\r
369 exports.RequestType1 = messages_1.RequestType1;\r
370 exports.RequestType2 = messages_1.RequestType2;\r
371 exports.RequestType3 = messages_1.RequestType3;\r
372 exports.RequestType4 = messages_1.RequestType4;\r
373 exports.RequestType5 = messages_1.RequestType5;\r
374 exports.RequestType6 = messages_1.RequestType6;\r
375 exports.RequestType7 = messages_1.RequestType7;\r
376 exports.RequestType8 = messages_1.RequestType8;\r
377 exports.RequestType9 = messages_1.RequestType9;\r
378 exports.ResponseError = messages_1.ResponseError;\r
379 exports.ErrorCodes = messages_1.ErrorCodes;\r
380 exports.NotificationType = messages_1.NotificationType;\r
381 exports.NotificationType0 = messages_1.NotificationType0;\r
382 exports.NotificationType1 = messages_1.NotificationType1;\r
383 exports.NotificationType2 = messages_1.NotificationType2;\r
384 exports.NotificationType3 = messages_1.NotificationType3;\r
385 exports.NotificationType4 = messages_1.NotificationType4;\r
386 exports.NotificationType5 = messages_1.NotificationType5;\r
387 exports.NotificationType6 = messages_1.NotificationType6;\r
388 exports.NotificationType7 = messages_1.NotificationType7;\r
389 exports.NotificationType8 = messages_1.NotificationType8;\r
390 exports.NotificationType9 = messages_1.NotificationType9;\r
391 const messageReader_1 = __webpack_require__(8);\r
392 exports.MessageReader = messageReader_1.MessageReader;\r
393 exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
394 exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
395 exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
396 const messageWriter_1 = __webpack_require__(10);\r
397 exports.MessageWriter = messageWriter_1.MessageWriter;\r
398 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
399 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
400 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
401 const events_1 = __webpack_require__(9);\r
402 exports.Disposable = events_1.Disposable;\r
403 exports.Event = events_1.Event;\r
404 exports.Emitter = events_1.Emitter;\r
405 const cancellation_1 = __webpack_require__(11);\r
406 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
407 exports.CancellationToken = cancellation_1.CancellationToken;\r
408 const linkedMap_1 = __webpack_require__(12);\r
409 __export(__webpack_require__(13));\r
410 __export(__webpack_require__(17));\r
411 var CancelNotification;\r
412 (function (CancelNotification) {\r
413     CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
414 })(CancelNotification || (CancelNotification = {}));\r
415 var ProgressNotification;\r
416 (function (ProgressNotification) {\r
417     ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
418 })(ProgressNotification || (ProgressNotification = {}));\r
419 class ProgressType {\r
420     constructor() {\r
421     }\r
422 }\r
423 exports.ProgressType = ProgressType;\r
424 exports.NullLogger = Object.freeze({\r
425     error: () => { },\r
426     warn: () => { },\r
427     info: () => { },\r
428     log: () => { }\r
429 });\r
430 var Trace;\r
431 (function (Trace) {\r
432     Trace[Trace["Off"] = 0] = "Off";\r
433     Trace[Trace["Messages"] = 1] = "Messages";\r
434     Trace[Trace["Verbose"] = 2] = "Verbose";\r
435 })(Trace = exports.Trace || (exports.Trace = {}));\r
436 (function (Trace) {\r
437     function fromString(value) {\r
438         if (!Is.string(value)) {\r
439             return Trace.Off;\r
440         }\r
441         value = value.toLowerCase();\r
442         switch (value) {\r
443             case 'off':\r
444                 return Trace.Off;\r
445             case 'messages':\r
446                 return Trace.Messages;\r
447             case 'verbose':\r
448                 return Trace.Verbose;\r
449             default:\r
450                 return Trace.Off;\r
451         }\r
452     }\r
453     Trace.fromString = fromString;\r
454     function toString(value) {\r
455         switch (value) {\r
456             case Trace.Off:\r
457                 return 'off';\r
458             case Trace.Messages:\r
459                 return 'messages';\r
460             case Trace.Verbose:\r
461                 return 'verbose';\r
462             default:\r
463                 return 'off';\r
464         }\r
465     }\r
466     Trace.toString = toString;\r
467 })(Trace = exports.Trace || (exports.Trace = {}));\r
468 var TraceFormat;\r
469 (function (TraceFormat) {\r
470     TraceFormat["Text"] = "text";\r
471     TraceFormat["JSON"] = "json";\r
472 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
473 (function (TraceFormat) {\r
474     function fromString(value) {\r
475         value = value.toLowerCase();\r
476         if (value === 'json') {\r
477             return TraceFormat.JSON;\r
478         }\r
479         else {\r
480             return TraceFormat.Text;\r
481         }\r
482     }\r
483     TraceFormat.fromString = fromString;\r
484 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
485 var SetTraceNotification;\r
486 (function (SetTraceNotification) {\r
487     SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
488 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
489 var LogTraceNotification;\r
490 (function (LogTraceNotification) {\r
491     LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
492 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
493 var ConnectionErrors;\r
494 (function (ConnectionErrors) {\r
495     /**\r
496      * The connection is closed.\r
497      */\r
498     ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
499     /**\r
500      * The connection got disposed.\r
501      */\r
502     ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
503     /**\r
504      * The connection is already in listening mode.\r
505      */\r
506     ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
507 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
508 class ConnectionError extends Error {\r
509     constructor(code, message) {\r
510         super(message);\r
511         this.code = code;\r
512         Object.setPrototypeOf(this, ConnectionError.prototype);\r
513     }\r
514 }\r
515 exports.ConnectionError = ConnectionError;\r
516 var ConnectionStrategy;\r
517 (function (ConnectionStrategy) {\r
518     function is(value) {\r
519         let candidate = value;\r
520         return candidate && Is.func(candidate.cancelUndispatched);\r
521     }\r
522     ConnectionStrategy.is = is;\r
523 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
524 var ConnectionState;\r
525 (function (ConnectionState) {\r
526     ConnectionState[ConnectionState["New"] = 1] = "New";\r
527     ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
528     ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
529     ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
530 })(ConnectionState || (ConnectionState = {}));\r
531 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
532     let sequenceNumber = 0;\r
533     let notificationSquenceNumber = 0;\r
534     let unknownResponseSquenceNumber = 0;\r
535     const version = '2.0';\r
536     let starRequestHandler = undefined;\r
537     let requestHandlers = Object.create(null);\r
538     let starNotificationHandler = undefined;\r
539     let notificationHandlers = Object.create(null);\r
540     let progressHandlers = new Map();\r
541     let timer;\r
542     let messageQueue = new linkedMap_1.LinkedMap();\r
543     let responsePromises = Object.create(null);\r
544     let requestTokens = Object.create(null);\r
545     let trace = Trace.Off;\r
546     let traceFormat = TraceFormat.Text;\r
547     let tracer;\r
548     let state = ConnectionState.New;\r
549     let errorEmitter = new events_1.Emitter();\r
550     let closeEmitter = new events_1.Emitter();\r
551     let unhandledNotificationEmitter = new events_1.Emitter();\r
552     let unhandledProgressEmitter = new events_1.Emitter();\r
553     let disposeEmitter = new events_1.Emitter();\r
554     function createRequestQueueKey(id) {\r
555         return 'req-' + id.toString();\r
556     }\r
557     function createResponseQueueKey(id) {\r
558         if (id === null) {\r
559             return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
560         }\r
561         else {\r
562             return 'res-' + id.toString();\r
563         }\r
564     }\r
565     function createNotificationQueueKey() {\r
566         return 'not-' + (++notificationSquenceNumber).toString();\r
567     }\r
568     function addMessageToQueue(queue, message) {\r
569         if (messages_1.isRequestMessage(message)) {\r
570             queue.set(createRequestQueueKey(message.id), message);\r
571         }\r
572         else if (messages_1.isResponseMessage(message)) {\r
573             queue.set(createResponseQueueKey(message.id), message);\r
574         }\r
575         else {\r
576             queue.set(createNotificationQueueKey(), message);\r
577         }\r
578     }\r
579     function cancelUndispatched(_message) {\r
580         return undefined;\r
581     }\r
582     function isListening() {\r
583         return state === ConnectionState.Listening;\r
584     }\r
585     function isClosed() {\r
586         return state === ConnectionState.Closed;\r
587     }\r
588     function isDisposed() {\r
589         return state === ConnectionState.Disposed;\r
590     }\r
591     function closeHandler() {\r
592         if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
593             state = ConnectionState.Closed;\r
594             closeEmitter.fire(undefined);\r
595         }\r
596         // If the connection is disposed don't sent close events.\r
597     }\r
598     function readErrorHandler(error) {\r
599         errorEmitter.fire([error, undefined, undefined]);\r
600     }\r
601     function writeErrorHandler(data) {\r
602         errorEmitter.fire(data);\r
603     }\r
604     messageReader.onClose(closeHandler);\r
605     messageReader.onError(readErrorHandler);\r
606     messageWriter.onClose(closeHandler);\r
607     messageWriter.onError(writeErrorHandler);\r
608     function triggerMessageQueue() {\r
609         if (timer || messageQueue.size === 0) {\r
610             return;\r
611         }\r
612         timer = setImmediate(() => {\r
613             timer = undefined;\r
614             processMessageQueue();\r
615         });\r
616     }\r
617     function processMessageQueue() {\r
618         if (messageQueue.size === 0) {\r
619             return;\r
620         }\r
621         let message = messageQueue.shift();\r
622         try {\r
623             if (messages_1.isRequestMessage(message)) {\r
624                 handleRequest(message);\r
625             }\r
626             else if (messages_1.isNotificationMessage(message)) {\r
627                 handleNotification(message);\r
628             }\r
629             else if (messages_1.isResponseMessage(message)) {\r
630                 handleResponse(message);\r
631             }\r
632             else {\r
633                 handleInvalidMessage(message);\r
634             }\r
635         }\r
636         finally {\r
637             triggerMessageQueue();\r
638         }\r
639     }\r
640     let callback = (message) => {\r
641         try {\r
642             // We have received a cancellation message. Check if the message is still in the queue\r
643             // and cancel it if allowed to do so.\r
644             if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
645                 let key = createRequestQueueKey(message.params.id);\r
646                 let toCancel = messageQueue.get(key);\r
647                 if (messages_1.isRequestMessage(toCancel)) {\r
648                     let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
649                     if (response && (response.error !== void 0 || response.result !== void 0)) {\r
650                         messageQueue.delete(key);\r
651                         response.id = toCancel.id;\r
652                         traceSendingResponse(response, message.method, Date.now());\r
653                         messageWriter.write(response);\r
654                         return;\r
655                     }\r
656                 }\r
657             }\r
658             addMessageToQueue(messageQueue, message);\r
659         }\r
660         finally {\r
661             triggerMessageQueue();\r
662         }\r
663     };\r
664     function handleRequest(requestMessage) {\r
665         if (isDisposed()) {\r
666             // we return here silently since we fired an event when the\r
667             // connection got disposed.\r
668             return;\r
669         }\r
670         function reply(resultOrError, method, startTime) {\r
671             let message = {\r
672                 jsonrpc: version,\r
673                 id: requestMessage.id\r
674             };\r
675             if (resultOrError instanceof messages_1.ResponseError) {\r
676                 message.error = resultOrError.toJson();\r
677             }\r
678             else {\r
679                 message.result = resultOrError === void 0 ? null : resultOrError;\r
680             }\r
681             traceSendingResponse(message, method, startTime);\r
682             messageWriter.write(message);\r
683         }\r
684         function replyError(error, method, startTime) {\r
685             let message = {\r
686                 jsonrpc: version,\r
687                 id: requestMessage.id,\r
688                 error: error.toJson()\r
689             };\r
690             traceSendingResponse(message, method, startTime);\r
691             messageWriter.write(message);\r
692         }\r
693         function replySuccess(result, method, startTime) {\r
694             // The JSON RPC defines that a response must either have a result or an error\r
695             // So we can't treat undefined as a valid response result.\r
696             if (result === void 0) {\r
697                 result = null;\r
698             }\r
699             let message = {\r
700                 jsonrpc: version,\r
701                 id: requestMessage.id,\r
702                 result: result\r
703             };\r
704             traceSendingResponse(message, method, startTime);\r
705             messageWriter.write(message);\r
706         }\r
707         traceReceivedRequest(requestMessage);\r
708         let element = requestHandlers[requestMessage.method];\r
709         let type;\r
710         let requestHandler;\r
711         if (element) {\r
712             type = element.type;\r
713             requestHandler = element.handler;\r
714         }\r
715         let startTime = Date.now();\r
716         if (requestHandler || starRequestHandler) {\r
717             let cancellationSource = new cancellation_1.CancellationTokenSource();\r
718             let tokenKey = String(requestMessage.id);\r
719             requestTokens[tokenKey] = cancellationSource;\r
720             try {\r
721                 let handlerResult;\r
722                 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
723                     handlerResult = requestHandler\r
724                         ? requestHandler(cancellationSource.token)\r
725                         : starRequestHandler(requestMessage.method, cancellationSource.token);\r
726                 }\r
727                 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
728                     handlerResult = requestHandler\r
729                         ? requestHandler(...requestMessage.params, cancellationSource.token)\r
730                         : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
731                 }\r
732                 else {\r
733                     handlerResult = requestHandler\r
734                         ? requestHandler(requestMessage.params, cancellationSource.token)\r
735                         : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
736                 }\r
737                 let promise = handlerResult;\r
738                 if (!handlerResult) {\r
739                     delete requestTokens[tokenKey];\r
740                     replySuccess(handlerResult, requestMessage.method, startTime);\r
741                 }\r
742                 else if (promise.then) {\r
743                     promise.then((resultOrError) => {\r
744                         delete requestTokens[tokenKey];\r
745                         reply(resultOrError, requestMessage.method, startTime);\r
746                     }, error => {\r
747                         delete requestTokens[tokenKey];\r
748                         if (error instanceof messages_1.ResponseError) {\r
749                             replyError(error, requestMessage.method, startTime);\r
750                         }\r
751                         else if (error && Is.string(error.message)) {\r
752                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
753                         }\r
754                         else {\r
755                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
756                         }\r
757                     });\r
758                 }\r
759                 else {\r
760                     delete requestTokens[tokenKey];\r
761                     reply(handlerResult, requestMessage.method, startTime);\r
762                 }\r
763             }\r
764             catch (error) {\r
765                 delete requestTokens[tokenKey];\r
766                 if (error instanceof messages_1.ResponseError) {\r
767                     reply(error, requestMessage.method, startTime);\r
768                 }\r
769                 else if (error && Is.string(error.message)) {\r
770                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
771                 }\r
772                 else {\r
773                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
774                 }\r
775             }\r
776         }\r
777         else {\r
778             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
779         }\r
780     }\r
781     function handleResponse(responseMessage) {\r
782         if (isDisposed()) {\r
783             // See handle request.\r
784             return;\r
785         }\r
786         if (responseMessage.id === null) {\r
787             if (responseMessage.error) {\r
788                 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
789             }\r
790             else {\r
791                 logger.error(`Received response message without id. No further error information provided.`);\r
792             }\r
793         }\r
794         else {\r
795             let key = String(responseMessage.id);\r
796             let responsePromise = responsePromises[key];\r
797             traceReceivedResponse(responseMessage, responsePromise);\r
798             if (responsePromise) {\r
799                 delete responsePromises[key];\r
800                 try {\r
801                     if (responseMessage.error) {\r
802                         let error = responseMessage.error;\r
803                         responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
804                     }\r
805                     else if (responseMessage.result !== void 0) {\r
806                         responsePromise.resolve(responseMessage.result);\r
807                     }\r
808                     else {\r
809                         throw new Error('Should never happen.');\r
810                     }\r
811                 }\r
812                 catch (error) {\r
813                     if (error.message) {\r
814                         logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
815                     }\r
816                     else {\r
817                         logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
818                     }\r
819                 }\r
820             }\r
821         }\r
822     }\r
823     function handleNotification(message) {\r
824         if (isDisposed()) {\r
825             // See handle request.\r
826             return;\r
827         }\r
828         let type = undefined;\r
829         let notificationHandler;\r
830         if (message.method === CancelNotification.type.method) {\r
831             notificationHandler = (params) => {\r
832                 let id = params.id;\r
833                 let source = requestTokens[String(id)];\r
834                 if (source) {\r
835                     source.cancel();\r
836                 }\r
837             };\r
838         }\r
839         else {\r
840             let element = notificationHandlers[message.method];\r
841             if (element) {\r
842                 notificationHandler = element.handler;\r
843                 type = element.type;\r
844             }\r
845         }\r
846         if (notificationHandler || starNotificationHandler) {\r
847             try {\r
848                 traceReceivedNotification(message);\r
849                 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
850                     notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
851                 }\r
852                 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
853                     notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
854                 }\r
855                 else {\r
856                     notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
857                 }\r
858             }\r
859             catch (error) {\r
860                 if (error.message) {\r
861                     logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
862                 }\r
863                 else {\r
864                     logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
865                 }\r
866             }\r
867         }\r
868         else {\r
869             unhandledNotificationEmitter.fire(message);\r
870         }\r
871     }\r
872     function handleInvalidMessage(message) {\r
873         if (!message) {\r
874             logger.error('Received empty message.');\r
875             return;\r
876         }\r
877         logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
878         // Test whether we find an id to reject the promise\r
879         let responseMessage = message;\r
880         if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
881             let key = String(responseMessage.id);\r
882             let responseHandler = responsePromises[key];\r
883             if (responseHandler) {\r
884                 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
885             }\r
886         }\r
887     }\r
888     function traceSendingRequest(message) {\r
889         if (trace === Trace.Off || !tracer) {\r
890             return;\r
891         }\r
892         if (traceFormat === TraceFormat.Text) {\r
893             let data = undefined;\r
894             if (trace === Trace.Verbose && message.params) {\r
895                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
896             }\r
897             tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
898         }\r
899         else {\r
900             logLSPMessage('send-request', message);\r
901         }\r
902     }\r
903     function traceSendingNotification(message) {\r
904         if (trace === Trace.Off || !tracer) {\r
905             return;\r
906         }\r
907         if (traceFormat === TraceFormat.Text) {\r
908             let data = undefined;\r
909             if (trace === Trace.Verbose) {\r
910                 if (message.params) {\r
911                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
912                 }\r
913                 else {\r
914                     data = 'No parameters provided.\n\n';\r
915                 }\r
916             }\r
917             tracer.log(`Sending notification '${message.method}'.`, data);\r
918         }\r
919         else {\r
920             logLSPMessage('send-notification', message);\r
921         }\r
922     }\r
923     function traceSendingResponse(message, method, startTime) {\r
924         if (trace === Trace.Off || !tracer) {\r
925             return;\r
926         }\r
927         if (traceFormat === TraceFormat.Text) {\r
928             let data = undefined;\r
929             if (trace === Trace.Verbose) {\r
930                 if (message.error && message.error.data) {\r
931                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
932                 }\r
933                 else {\r
934                     if (message.result) {\r
935                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
936                     }\r
937                     else if (message.error === void 0) {\r
938                         data = 'No result returned.\n\n';\r
939                     }\r
940                 }\r
941             }\r
942             tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
943         }\r
944         else {\r
945             logLSPMessage('send-response', message);\r
946         }\r
947     }\r
948     function traceReceivedRequest(message) {\r
949         if (trace === Trace.Off || !tracer) {\r
950             return;\r
951         }\r
952         if (traceFormat === TraceFormat.Text) {\r
953             let data = undefined;\r
954             if (trace === Trace.Verbose && message.params) {\r
955                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
956             }\r
957             tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
958         }\r
959         else {\r
960             logLSPMessage('receive-request', message);\r
961         }\r
962     }\r
963     function traceReceivedNotification(message) {\r
964         if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
965             return;\r
966         }\r
967         if (traceFormat === TraceFormat.Text) {\r
968             let data = undefined;\r
969             if (trace === Trace.Verbose) {\r
970                 if (message.params) {\r
971                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
972                 }\r
973                 else {\r
974                     data = 'No parameters provided.\n\n';\r
975                 }\r
976             }\r
977             tracer.log(`Received notification '${message.method}'.`, data);\r
978         }\r
979         else {\r
980             logLSPMessage('receive-notification', message);\r
981         }\r
982     }\r
983     function traceReceivedResponse(message, responsePromise) {\r
984         if (trace === Trace.Off || !tracer) {\r
985             return;\r
986         }\r
987         if (traceFormat === TraceFormat.Text) {\r
988             let data = undefined;\r
989             if (trace === Trace.Verbose) {\r
990                 if (message.error && message.error.data) {\r
991                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
992                 }\r
993                 else {\r
994                     if (message.result) {\r
995                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
996                     }\r
997                     else if (message.error === void 0) {\r
998                         data = 'No result returned.\n\n';\r
999                     }\r
1000                 }\r
1001             }\r
1002             if (responsePromise) {\r
1003                 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
1004                 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
1005             }\r
1006             else {\r
1007                 tracer.log(`Received response ${message.id} without active response promise.`, data);\r
1008             }\r
1009         }\r
1010         else {\r
1011             logLSPMessage('receive-response', message);\r
1012         }\r
1013     }\r
1014     function logLSPMessage(type, message) {\r
1015         if (!tracer || trace === Trace.Off) {\r
1016             return;\r
1017         }\r
1018         const lspMessage = {\r
1019             isLSPMessage: true,\r
1020             type,\r
1021             message,\r
1022             timestamp: Date.now()\r
1023         };\r
1024         tracer.log(lspMessage);\r
1025     }\r
1026     function throwIfClosedOrDisposed() {\r
1027         if (isClosed()) {\r
1028             throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
1029         }\r
1030         if (isDisposed()) {\r
1031             throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
1032         }\r
1033     }\r
1034     function throwIfListening() {\r
1035         if (isListening()) {\r
1036             throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
1037         }\r
1038     }\r
1039     function throwIfNotListening() {\r
1040         if (!isListening()) {\r
1041             throw new Error('Call listen() first.');\r
1042         }\r
1043     }\r
1044     function undefinedToNull(param) {\r
1045         if (param === void 0) {\r
1046             return null;\r
1047         }\r
1048         else {\r
1049             return param;\r
1050         }\r
1051     }\r
1052     function computeMessageParams(type, params) {\r
1053         let result;\r
1054         let numberOfParams = type.numberOfParams;\r
1055         switch (numberOfParams) {\r
1056             case 0:\r
1057                 result = null;\r
1058                 break;\r
1059             case 1:\r
1060                 result = undefinedToNull(params[0]);\r
1061                 break;\r
1062             default:\r
1063                 result = [];\r
1064                 for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
1065                     result.push(undefinedToNull(params[i]));\r
1066                 }\r
1067                 if (params.length < numberOfParams) {\r
1068                     for (let i = params.length; i < numberOfParams; i++) {\r
1069                         result.push(null);\r
1070                     }\r
1071                 }\r
1072                 break;\r
1073         }\r
1074         return result;\r
1075     }\r
1076     let connection = {\r
1077         sendNotification: (type, ...params) => {\r
1078             throwIfClosedOrDisposed();\r
1079             let method;\r
1080             let messageParams;\r
1081             if (Is.string(type)) {\r
1082                 method = type;\r
1083                 switch (params.length) {\r
1084                     case 0:\r
1085                         messageParams = null;\r
1086                         break;\r
1087                     case 1:\r
1088                         messageParams = params[0];\r
1089                         break;\r
1090                     default:\r
1091                         messageParams = params;\r
1092                         break;\r
1093                 }\r
1094             }\r
1095             else {\r
1096                 method = type.method;\r
1097                 messageParams = computeMessageParams(type, params);\r
1098             }\r
1099             let notificationMessage = {\r
1100                 jsonrpc: version,\r
1101                 method: method,\r
1102                 params: messageParams\r
1103             };\r
1104             traceSendingNotification(notificationMessage);\r
1105             messageWriter.write(notificationMessage);\r
1106         },\r
1107         onNotification: (type, handler) => {\r
1108             throwIfClosedOrDisposed();\r
1109             if (Is.func(type)) {\r
1110                 starNotificationHandler = type;\r
1111             }\r
1112             else if (handler) {\r
1113                 if (Is.string(type)) {\r
1114                     notificationHandlers[type] = { type: undefined, handler };\r
1115                 }\r
1116                 else {\r
1117                     notificationHandlers[type.method] = { type, handler };\r
1118                 }\r
1119             }\r
1120         },\r
1121         onProgress: (_type, token, handler) => {\r
1122             if (progressHandlers.has(token)) {\r
1123                 throw new Error(`Progress handler for token ${token} already registered`);\r
1124             }\r
1125             progressHandlers.set(token, handler);\r
1126             return {\r
1127                 dispose: () => {\r
1128                     progressHandlers.delete(token);\r
1129                 }\r
1130             };\r
1131         },\r
1132         sendProgress: (_type, token, value) => {\r
1133             connection.sendNotification(ProgressNotification.type, { token, value });\r
1134         },\r
1135         onUnhandledProgress: unhandledProgressEmitter.event,\r
1136         sendRequest: (type, ...params) => {\r
1137             throwIfClosedOrDisposed();\r
1138             throwIfNotListening();\r
1139             let method;\r
1140             let messageParams;\r
1141             let token = undefined;\r
1142             if (Is.string(type)) {\r
1143                 method = type;\r
1144                 switch (params.length) {\r
1145                     case 0:\r
1146                         messageParams = null;\r
1147                         break;\r
1148                     case 1:\r
1149                         // The cancellation token is optional so it can also be undefined.\r
1150                         if (cancellation_1.CancellationToken.is(params[0])) {\r
1151                             messageParams = null;\r
1152                             token = params[0];\r
1153                         }\r
1154                         else {\r
1155                             messageParams = undefinedToNull(params[0]);\r
1156                         }\r
1157                         break;\r
1158                     default:\r
1159                         const last = params.length - 1;\r
1160                         if (cancellation_1.CancellationToken.is(params[last])) {\r
1161                             token = params[last];\r
1162                             if (params.length === 2) {\r
1163                                 messageParams = undefinedToNull(params[0]);\r
1164                             }\r
1165                             else {\r
1166                                 messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
1167                             }\r
1168                         }\r
1169                         else {\r
1170                             messageParams = params.map(value => undefinedToNull(value));\r
1171                         }\r
1172                         break;\r
1173                 }\r
1174             }\r
1175             else {\r
1176                 method = type.method;\r
1177                 messageParams = computeMessageParams(type, params);\r
1178                 let numberOfParams = type.numberOfParams;\r
1179                 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
1180             }\r
1181             let id = sequenceNumber++;\r
1182             let result = new Promise((resolve, reject) => {\r
1183                 let requestMessage = {\r
1184                     jsonrpc: version,\r
1185                     id: id,\r
1186                     method: method,\r
1187                     params: messageParams\r
1188                 };\r
1189                 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
1190                 traceSendingRequest(requestMessage);\r
1191                 try {\r
1192                     messageWriter.write(requestMessage);\r
1193                 }\r
1194                 catch (e) {\r
1195                     // Writing the message failed. So we need to reject the promise.\r
1196                     responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
1197                     responsePromise = null;\r
1198                 }\r
1199                 if (responsePromise) {\r
1200                     responsePromises[String(id)] = responsePromise;\r
1201                 }\r
1202             });\r
1203             if (token) {\r
1204                 token.onCancellationRequested(() => {\r
1205                     connection.sendNotification(CancelNotification.type, { id });\r
1206                 });\r
1207             }\r
1208             return result;\r
1209         },\r
1210         onRequest: (type, handler) => {\r
1211             throwIfClosedOrDisposed();\r
1212             if (Is.func(type)) {\r
1213                 starRequestHandler = type;\r
1214             }\r
1215             else if (handler) {\r
1216                 if (Is.string(type)) {\r
1217                     requestHandlers[type] = { type: undefined, handler };\r
1218                 }\r
1219                 else {\r
1220                     requestHandlers[type.method] = { type, handler };\r
1221                 }\r
1222             }\r
1223         },\r
1224         trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
1225             let _sendNotification = false;\r
1226             let _traceFormat = TraceFormat.Text;\r
1227             if (sendNotificationOrTraceOptions !== void 0) {\r
1228                 if (Is.boolean(sendNotificationOrTraceOptions)) {\r
1229                     _sendNotification = sendNotificationOrTraceOptions;\r
1230                 }\r
1231                 else {\r
1232                     _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
1233                     _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
1234                 }\r
1235             }\r
1236             trace = _value;\r
1237             traceFormat = _traceFormat;\r
1238             if (trace === Trace.Off) {\r
1239                 tracer = undefined;\r
1240             }\r
1241             else {\r
1242                 tracer = _tracer;\r
1243             }\r
1244             if (_sendNotification && !isClosed() && !isDisposed()) {\r
1245                 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
1246             }\r
1247         },\r
1248         onError: errorEmitter.event,\r
1249         onClose: closeEmitter.event,\r
1250         onUnhandledNotification: unhandledNotificationEmitter.event,\r
1251         onDispose: disposeEmitter.event,\r
1252         dispose: () => {\r
1253             if (isDisposed()) {\r
1254                 return;\r
1255             }\r
1256             state = ConnectionState.Disposed;\r
1257             disposeEmitter.fire(undefined);\r
1258             let error = new Error('Connection got disposed.');\r
1259             Object.keys(responsePromises).forEach((key) => {\r
1260                 responsePromises[key].reject(error);\r
1261             });\r
1262             responsePromises = Object.create(null);\r
1263             requestTokens = Object.create(null);\r
1264             messageQueue = new linkedMap_1.LinkedMap();\r
1265             // Test for backwards compatibility\r
1266             if (Is.func(messageWriter.dispose)) {\r
1267                 messageWriter.dispose();\r
1268             }\r
1269             if (Is.func(messageReader.dispose)) {\r
1270                 messageReader.dispose();\r
1271             }\r
1272         },\r
1273         listen: () => {\r
1274             throwIfClosedOrDisposed();\r
1275             throwIfListening();\r
1276             state = ConnectionState.Listening;\r
1277             messageReader.listen(callback);\r
1278         },\r
1279         inspect: () => {\r
1280             // eslint-disable-next-line no-console\r
1281             console.log('inspect');\r
1282         }\r
1283     };\r
1284     connection.onNotification(LogTraceNotification.type, (params) => {\r
1285         if (trace === Trace.Off || !tracer) {\r
1286             return;\r
1287         }\r
1288         tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
1289     });\r
1290     connection.onNotification(ProgressNotification.type, (params) => {\r
1291         const handler = progressHandlers.get(params.token);\r
1292         if (handler) {\r
1293             handler(params.value);\r
1294         }\r
1295         else {\r
1296             unhandledProgressEmitter.fire(params);\r
1297         }\r
1298     });\r
1299     return connection;\r
1300 }\r
1301 function isMessageReader(value) {\r
1302     return value.listen !== void 0 && value.read === void 0;\r
1303 }\r
1304 function isMessageWriter(value) {\r
1305     return value.write !== void 0 && value.end === void 0;\r
1306 }\r
1307 function createMessageConnection(input, output, logger, strategy) {\r
1308     if (!logger) {\r
1309         logger = exports.NullLogger;\r
1310     }\r
1311     let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
1312     let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
1313     return _createMessageConnection(reader, writer, logger, strategy);\r
1314 }\r
1315 exports.createMessageConnection = createMessageConnection;\r
1316
1317
1318 /***/ }),
1319 /* 6 */
1320 /***/ (function(module, exports, __webpack_require__) {
1321
1322 "use strict";
1323 /* --------------------------------------------------------------------------------------------\r
1324  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1325  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1326  * ------------------------------------------------------------------------------------------ */\r
1327 \r
1328 Object.defineProperty(exports, "__esModule", { value: true });\r
1329 function boolean(value) {\r
1330     return value === true || value === false;\r
1331 }\r
1332 exports.boolean = boolean;\r
1333 function string(value) {\r
1334     return typeof value === 'string' || value instanceof String;\r
1335 }\r
1336 exports.string = string;\r
1337 function number(value) {\r
1338     return typeof value === 'number' || value instanceof Number;\r
1339 }\r
1340 exports.number = number;\r
1341 function error(value) {\r
1342     return value instanceof Error;\r
1343 }\r
1344 exports.error = error;\r
1345 function func(value) {\r
1346     return typeof value === 'function';\r
1347 }\r
1348 exports.func = func;\r
1349 function array(value) {\r
1350     return Array.isArray(value);\r
1351 }\r
1352 exports.array = array;\r
1353 function stringArray(value) {\r
1354     return array(value) && value.every(elem => string(elem));\r
1355 }\r
1356 exports.stringArray = stringArray;\r
1357
1358
1359 /***/ }),
1360 /* 7 */
1361 /***/ (function(module, exports, __webpack_require__) {
1362
1363 "use strict";
1364 /* --------------------------------------------------------------------------------------------\r
1365  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1366  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1367  * ------------------------------------------------------------------------------------------ */\r
1368 \r
1369 Object.defineProperty(exports, "__esModule", { value: true });\r
1370 const is = __webpack_require__(6);\r
1371 /**\r
1372  * Predefined error codes.\r
1373  */\r
1374 var ErrorCodes;\r
1375 (function (ErrorCodes) {\r
1376     // Defined by JSON RPC\r
1377     ErrorCodes.ParseError = -32700;\r
1378     ErrorCodes.InvalidRequest = -32600;\r
1379     ErrorCodes.MethodNotFound = -32601;\r
1380     ErrorCodes.InvalidParams = -32602;\r
1381     ErrorCodes.InternalError = -32603;\r
1382     ErrorCodes.serverErrorStart = -32099;\r
1383     ErrorCodes.serverErrorEnd = -32000;\r
1384     ErrorCodes.ServerNotInitialized = -32002;\r
1385     ErrorCodes.UnknownErrorCode = -32001;\r
1386     // Defined by the protocol.\r
1387     ErrorCodes.RequestCancelled = -32800;\r
1388     ErrorCodes.ContentModified = -32801;\r
1389     // Defined by VSCode library.\r
1390     ErrorCodes.MessageWriteError = 1;\r
1391     ErrorCodes.MessageReadError = 2;\r
1392 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
1393 /**\r
1394  * An error object return in a response in case a request\r
1395  * has failed.\r
1396  */\r
1397 class ResponseError extends Error {\r
1398     constructor(code, message, data) {\r
1399         super(message);\r
1400         this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
1401         this.data = data;\r
1402         Object.setPrototypeOf(this, ResponseError.prototype);\r
1403     }\r
1404     toJson() {\r
1405         return {\r
1406             code: this.code,\r
1407             message: this.message,\r
1408             data: this.data,\r
1409         };\r
1410     }\r
1411 }\r
1412 exports.ResponseError = ResponseError;\r
1413 /**\r
1414  * An abstract implementation of a MessageType.\r
1415  */\r
1416 class AbstractMessageType {\r
1417     constructor(_method, _numberOfParams) {\r
1418         this._method = _method;\r
1419         this._numberOfParams = _numberOfParams;\r
1420     }\r
1421     get method() {\r
1422         return this._method;\r
1423     }\r
1424     get numberOfParams() {\r
1425         return this._numberOfParams;\r
1426     }\r
1427 }\r
1428 exports.AbstractMessageType = AbstractMessageType;\r
1429 /**\r
1430  * Classes to type request response pairs\r
1431  *\r
1432  * The type parameter RO will be removed in the next major version\r
1433  * of the JSON RPC library since it is a LSP concept and doesn't\r
1434  * belong here. For now it is tagged as default never.\r
1435  */\r
1436 class RequestType0 extends AbstractMessageType {\r
1437     constructor(method) {\r
1438         super(method, 0);\r
1439     }\r
1440 }\r
1441 exports.RequestType0 = RequestType0;\r
1442 class RequestType extends AbstractMessageType {\r
1443     constructor(method) {\r
1444         super(method, 1);\r
1445     }\r
1446 }\r
1447 exports.RequestType = RequestType;\r
1448 class RequestType1 extends AbstractMessageType {\r
1449     constructor(method) {\r
1450         super(method, 1);\r
1451     }\r
1452 }\r
1453 exports.RequestType1 = RequestType1;\r
1454 class RequestType2 extends AbstractMessageType {\r
1455     constructor(method) {\r
1456         super(method, 2);\r
1457     }\r
1458 }\r
1459 exports.RequestType2 = RequestType2;\r
1460 class RequestType3 extends AbstractMessageType {\r
1461     constructor(method) {\r
1462         super(method, 3);\r
1463     }\r
1464 }\r
1465 exports.RequestType3 = RequestType3;\r
1466 class RequestType4 extends AbstractMessageType {\r
1467     constructor(method) {\r
1468         super(method, 4);\r
1469     }\r
1470 }\r
1471 exports.RequestType4 = RequestType4;\r
1472 class RequestType5 extends AbstractMessageType {\r
1473     constructor(method) {\r
1474         super(method, 5);\r
1475     }\r
1476 }\r
1477 exports.RequestType5 = RequestType5;\r
1478 class RequestType6 extends AbstractMessageType {\r
1479     constructor(method) {\r
1480         super(method, 6);\r
1481     }\r
1482 }\r
1483 exports.RequestType6 = RequestType6;\r
1484 class RequestType7 extends AbstractMessageType {\r
1485     constructor(method) {\r
1486         super(method, 7);\r
1487     }\r
1488 }\r
1489 exports.RequestType7 = RequestType7;\r
1490 class RequestType8 extends AbstractMessageType {\r
1491     constructor(method) {\r
1492         super(method, 8);\r
1493     }\r
1494 }\r
1495 exports.RequestType8 = RequestType8;\r
1496 class RequestType9 extends AbstractMessageType {\r
1497     constructor(method) {\r
1498         super(method, 9);\r
1499     }\r
1500 }\r
1501 exports.RequestType9 = RequestType9;\r
1502 /**\r
1503  * The type parameter RO will be removed in the next major version\r
1504  * of the JSON RPC library since it is a LSP concept and doesn't\r
1505  * belong here. For now it is tagged as default never.\r
1506  */\r
1507 class NotificationType extends AbstractMessageType {\r
1508     constructor(method) {\r
1509         super(method, 1);\r
1510         this._ = undefined;\r
1511     }\r
1512 }\r
1513 exports.NotificationType = NotificationType;\r
1514 class NotificationType0 extends AbstractMessageType {\r
1515     constructor(method) {\r
1516         super(method, 0);\r
1517     }\r
1518 }\r
1519 exports.NotificationType0 = NotificationType0;\r
1520 class NotificationType1 extends AbstractMessageType {\r
1521     constructor(method) {\r
1522         super(method, 1);\r
1523     }\r
1524 }\r
1525 exports.NotificationType1 = NotificationType1;\r
1526 class NotificationType2 extends AbstractMessageType {\r
1527     constructor(method) {\r
1528         super(method, 2);\r
1529     }\r
1530 }\r
1531 exports.NotificationType2 = NotificationType2;\r
1532 class NotificationType3 extends AbstractMessageType {\r
1533     constructor(method) {\r
1534         super(method, 3);\r
1535     }\r
1536 }\r
1537 exports.NotificationType3 = NotificationType3;\r
1538 class NotificationType4 extends AbstractMessageType {\r
1539     constructor(method) {\r
1540         super(method, 4);\r
1541     }\r
1542 }\r
1543 exports.NotificationType4 = NotificationType4;\r
1544 class NotificationType5 extends AbstractMessageType {\r
1545     constructor(method) {\r
1546         super(method, 5);\r
1547     }\r
1548 }\r
1549 exports.NotificationType5 = NotificationType5;\r
1550 class NotificationType6 extends AbstractMessageType {\r
1551     constructor(method) {\r
1552         super(method, 6);\r
1553     }\r
1554 }\r
1555 exports.NotificationType6 = NotificationType6;\r
1556 class NotificationType7 extends AbstractMessageType {\r
1557     constructor(method) {\r
1558         super(method, 7);\r
1559     }\r
1560 }\r
1561 exports.NotificationType7 = NotificationType7;\r
1562 class NotificationType8 extends AbstractMessageType {\r
1563     constructor(method) {\r
1564         super(method, 8);\r
1565     }\r
1566 }\r
1567 exports.NotificationType8 = NotificationType8;\r
1568 class NotificationType9 extends AbstractMessageType {\r
1569     constructor(method) {\r
1570         super(method, 9);\r
1571     }\r
1572 }\r
1573 exports.NotificationType9 = NotificationType9;\r
1574 /**\r
1575  * Tests if the given message is a request message\r
1576  */\r
1577 function isRequestMessage(message) {\r
1578     let candidate = message;\r
1579     return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
1580 }\r
1581 exports.isRequestMessage = isRequestMessage;\r
1582 /**\r
1583  * Tests if the given message is a notification message\r
1584  */\r
1585 function isNotificationMessage(message) {\r
1586     let candidate = message;\r
1587     return candidate && is.string(candidate.method) && message.id === void 0;\r
1588 }\r
1589 exports.isNotificationMessage = isNotificationMessage;\r
1590 /**\r
1591  * Tests if the given message is a response message\r
1592  */\r
1593 function isResponseMessage(message) {\r
1594     let candidate = message;\r
1595     return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
1596 }\r
1597 exports.isResponseMessage = isResponseMessage;\r
1598
1599
1600 /***/ }),
1601 /* 8 */
1602 /***/ (function(module, exports, __webpack_require__) {
1603
1604 "use strict";
1605 /* --------------------------------------------------------------------------------------------\r
1606  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1607  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1608  * ------------------------------------------------------------------------------------------ */\r
1609 \r
1610 Object.defineProperty(exports, "__esModule", { value: true });\r
1611 const events_1 = __webpack_require__(9);\r
1612 const Is = __webpack_require__(6);\r
1613 let DefaultSize = 8192;\r
1614 let CR = Buffer.from('\r', 'ascii')[0];\r
1615 let LF = Buffer.from('\n', 'ascii')[0];\r
1616 let CRLF = '\r\n';\r
1617 class MessageBuffer {\r
1618     constructor(encoding = 'utf8') {\r
1619         this.encoding = encoding;\r
1620         this.index = 0;\r
1621         this.buffer = Buffer.allocUnsafe(DefaultSize);\r
1622     }\r
1623     append(chunk) {\r
1624         var toAppend = chunk;\r
1625         if (typeof (chunk) === 'string') {\r
1626             var str = chunk;\r
1627             var bufferLen = Buffer.byteLength(str, this.encoding);\r
1628             toAppend = Buffer.allocUnsafe(bufferLen);\r
1629             toAppend.write(str, 0, bufferLen, this.encoding);\r
1630         }\r
1631         if (this.buffer.length - this.index >= toAppend.length) {\r
1632             toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
1633         }\r
1634         else {\r
1635             var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
1636             if (this.index === 0) {\r
1637                 this.buffer = Buffer.allocUnsafe(newSize);\r
1638                 toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
1639             }\r
1640             else {\r
1641                 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
1642             }\r
1643         }\r
1644         this.index += toAppend.length;\r
1645     }\r
1646     tryReadHeaders() {\r
1647         let result = undefined;\r
1648         let current = 0;\r
1649         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
1650             current++;\r
1651         }\r
1652         // No header / body separator found (e.g CRLFCRLF)\r
1653         if (current + 3 >= this.index) {\r
1654             return result;\r
1655         }\r
1656         result = Object.create(null);\r
1657         let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
1658         headers.forEach((header) => {\r
1659             let index = header.indexOf(':');\r
1660             if (index === -1) {\r
1661                 throw new Error('Message header must separate key and value using :');\r
1662             }\r
1663             let key = header.substr(0, index);\r
1664             let value = header.substr(index + 1).trim();\r
1665             result[key] = value;\r
1666         });\r
1667         let nextStart = current + 4;\r
1668         this.buffer = this.buffer.slice(nextStart);\r
1669         this.index = this.index - nextStart;\r
1670         return result;\r
1671     }\r
1672     tryReadContent(length) {\r
1673         if (this.index < length) {\r
1674             return null;\r
1675         }\r
1676         let result = this.buffer.toString(this.encoding, 0, length);\r
1677         let nextStart = length;\r
1678         this.buffer.copy(this.buffer, 0, nextStart);\r
1679         this.index = this.index - nextStart;\r
1680         return result;\r
1681     }\r
1682     get numberOfBytes() {\r
1683         return this.index;\r
1684     }\r
1685 }\r
1686 var MessageReader;\r
1687 (function (MessageReader) {\r
1688     function is(value) {\r
1689         let candidate = value;\r
1690         return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
1691             Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
1692     }\r
1693     MessageReader.is = is;\r
1694 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
1695 class AbstractMessageReader {\r
1696     constructor() {\r
1697         this.errorEmitter = new events_1.Emitter();\r
1698         this.closeEmitter = new events_1.Emitter();\r
1699         this.partialMessageEmitter = new events_1.Emitter();\r
1700     }\r
1701     dispose() {\r
1702         this.errorEmitter.dispose();\r
1703         this.closeEmitter.dispose();\r
1704     }\r
1705     get onError() {\r
1706         return this.errorEmitter.event;\r
1707     }\r
1708     fireError(error) {\r
1709         this.errorEmitter.fire(this.asError(error));\r
1710     }\r
1711     get onClose() {\r
1712         return this.closeEmitter.event;\r
1713     }\r
1714     fireClose() {\r
1715         this.closeEmitter.fire(undefined);\r
1716     }\r
1717     get onPartialMessage() {\r
1718         return this.partialMessageEmitter.event;\r
1719     }\r
1720     firePartialMessage(info) {\r
1721         this.partialMessageEmitter.fire(info);\r
1722     }\r
1723     asError(error) {\r
1724         if (error instanceof Error) {\r
1725             return error;\r
1726         }\r
1727         else {\r
1728             return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1729         }\r
1730     }\r
1731 }\r
1732 exports.AbstractMessageReader = AbstractMessageReader;\r
1733 class StreamMessageReader extends AbstractMessageReader {\r
1734     constructor(readable, encoding = 'utf8') {\r
1735         super();\r
1736         this.readable = readable;\r
1737         this.buffer = new MessageBuffer(encoding);\r
1738         this._partialMessageTimeout = 10000;\r
1739     }\r
1740     set partialMessageTimeout(timeout) {\r
1741         this._partialMessageTimeout = timeout;\r
1742     }\r
1743     get partialMessageTimeout() {\r
1744         return this._partialMessageTimeout;\r
1745     }\r
1746     listen(callback) {\r
1747         this.nextMessageLength = -1;\r
1748         this.messageToken = 0;\r
1749         this.partialMessageTimer = undefined;\r
1750         this.callback = callback;\r
1751         this.readable.on('data', (data) => {\r
1752             this.onData(data);\r
1753         });\r
1754         this.readable.on('error', (error) => this.fireError(error));\r
1755         this.readable.on('close', () => this.fireClose());\r
1756     }\r
1757     onData(data) {\r
1758         this.buffer.append(data);\r
1759         while (true) {\r
1760             if (this.nextMessageLength === -1) {\r
1761                 let headers = this.buffer.tryReadHeaders();\r
1762                 if (!headers) {\r
1763                     return;\r
1764                 }\r
1765                 let contentLength = headers['Content-Length'];\r
1766                 if (!contentLength) {\r
1767                     throw new Error('Header must provide a Content-Length property.');\r
1768                 }\r
1769                 let length = parseInt(contentLength);\r
1770                 if (isNaN(length)) {\r
1771                     throw new Error('Content-Length value must be a number.');\r
1772                 }\r
1773                 this.nextMessageLength = length;\r
1774                 // Take the encoding form the header. For compatibility\r
1775                 // treat both utf-8 and utf8 as node utf8\r
1776             }\r
1777             var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
1778             if (msg === null) {\r
1779                 /** We haven't received the full message yet. */\r
1780                 this.setPartialMessageTimer();\r
1781                 return;\r
1782             }\r
1783             this.clearPartialMessageTimer();\r
1784             this.nextMessageLength = -1;\r
1785             this.messageToken++;\r
1786             var json = JSON.parse(msg);\r
1787             this.callback(json);\r
1788         }\r
1789     }\r
1790     clearPartialMessageTimer() {\r
1791         if (this.partialMessageTimer) {\r
1792             clearTimeout(this.partialMessageTimer);\r
1793             this.partialMessageTimer = undefined;\r
1794         }\r
1795     }\r
1796     setPartialMessageTimer() {\r
1797         this.clearPartialMessageTimer();\r
1798         if (this._partialMessageTimeout <= 0) {\r
1799             return;\r
1800         }\r
1801         this.partialMessageTimer = setTimeout((token, timeout) => {\r
1802             this.partialMessageTimer = undefined;\r
1803             if (token === this.messageToken) {\r
1804                 this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
1805                 this.setPartialMessageTimer();\r
1806             }\r
1807         }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
1808     }\r
1809 }\r
1810 exports.StreamMessageReader = StreamMessageReader;\r
1811 class IPCMessageReader extends AbstractMessageReader {\r
1812     constructor(process) {\r
1813         super();\r
1814         this.process = process;\r
1815         let eventEmitter = this.process;\r
1816         eventEmitter.on('error', (error) => this.fireError(error));\r
1817         eventEmitter.on('close', () => this.fireClose());\r
1818     }\r
1819     listen(callback) {\r
1820         this.process.on('message', callback);\r
1821     }\r
1822 }\r
1823 exports.IPCMessageReader = IPCMessageReader;\r
1824 class SocketMessageReader extends StreamMessageReader {\r
1825     constructor(socket, encoding = 'utf-8') {\r
1826         super(socket, encoding);\r
1827     }\r
1828 }\r
1829 exports.SocketMessageReader = SocketMessageReader;\r
1830
1831
1832 /***/ }),
1833 /* 9 */
1834 /***/ (function(module, exports, __webpack_require__) {
1835
1836 "use strict";
1837 /* --------------------------------------------------------------------------------------------\r
1838  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1839  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1840  * ------------------------------------------------------------------------------------------ */\r
1841 \r
1842 Object.defineProperty(exports, "__esModule", { value: true });\r
1843 var Disposable;\r
1844 (function (Disposable) {\r
1845     function create(func) {\r
1846         return {\r
1847             dispose: func\r
1848         };\r
1849     }\r
1850     Disposable.create = create;\r
1851 })(Disposable = exports.Disposable || (exports.Disposable = {}));\r
1852 var Event;\r
1853 (function (Event) {\r
1854     const _disposable = { dispose() { } };\r
1855     Event.None = function () { return _disposable; };\r
1856 })(Event = exports.Event || (exports.Event = {}));\r
1857 class CallbackList {\r
1858     add(callback, context = null, bucket) {\r
1859         if (!this._callbacks) {\r
1860             this._callbacks = [];\r
1861             this._contexts = [];\r
1862         }\r
1863         this._callbacks.push(callback);\r
1864         this._contexts.push(context);\r
1865         if (Array.isArray(bucket)) {\r
1866             bucket.push({ dispose: () => this.remove(callback, context) });\r
1867         }\r
1868     }\r
1869     remove(callback, context = null) {\r
1870         if (!this._callbacks) {\r
1871             return;\r
1872         }\r
1873         var foundCallbackWithDifferentContext = false;\r
1874         for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
1875             if (this._callbacks[i] === callback) {\r
1876                 if (this._contexts[i] === context) {\r
1877                     // callback & context match => remove it\r
1878                     this._callbacks.splice(i, 1);\r
1879                     this._contexts.splice(i, 1);\r
1880                     return;\r
1881                 }\r
1882                 else {\r
1883                     foundCallbackWithDifferentContext = true;\r
1884                 }\r
1885             }\r
1886         }\r
1887         if (foundCallbackWithDifferentContext) {\r
1888             throw new Error('When adding a listener with a context, you should remove it with the same context');\r
1889         }\r
1890     }\r
1891     invoke(...args) {\r
1892         if (!this._callbacks) {\r
1893             return [];\r
1894         }\r
1895         var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
1896         for (var i = 0, len = callbacks.length; i < len; i++) {\r
1897             try {\r
1898                 ret.push(callbacks[i].apply(contexts[i], args));\r
1899             }\r
1900             catch (e) {\r
1901                 // eslint-disable-next-line no-console\r
1902                 console.error(e);\r
1903             }\r
1904         }\r
1905         return ret;\r
1906     }\r
1907     isEmpty() {\r
1908         return !this._callbacks || this._callbacks.length === 0;\r
1909     }\r
1910     dispose() {\r
1911         this._callbacks = undefined;\r
1912         this._contexts = undefined;\r
1913     }\r
1914 }\r
1915 class Emitter {\r
1916     constructor(_options) {\r
1917         this._options = _options;\r
1918     }\r
1919     /**\r
1920      * For the public to allow to subscribe\r
1921      * to events from this Emitter\r
1922      */\r
1923     get event() {\r
1924         if (!this._event) {\r
1925             this._event = (listener, thisArgs, disposables) => {\r
1926                 if (!this._callbacks) {\r
1927                     this._callbacks = new CallbackList();\r
1928                 }\r
1929                 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
1930                     this._options.onFirstListenerAdd(this);\r
1931                 }\r
1932                 this._callbacks.add(listener, thisArgs);\r
1933                 let result;\r
1934                 result = {\r
1935                     dispose: () => {\r
1936                         this._callbacks.remove(listener, thisArgs);\r
1937                         result.dispose = Emitter._noop;\r
1938                         if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
1939                             this._options.onLastListenerRemove(this);\r
1940                         }\r
1941                     }\r
1942                 };\r
1943                 if (Array.isArray(disposables)) {\r
1944                     disposables.push(result);\r
1945                 }\r
1946                 return result;\r
1947             };\r
1948         }\r
1949         return this._event;\r
1950     }\r
1951     /**\r
1952      * To be kept private to fire an event to\r
1953      * subscribers\r
1954      */\r
1955     fire(event) {\r
1956         if (this._callbacks) {\r
1957             this._callbacks.invoke.call(this._callbacks, event);\r
1958         }\r
1959     }\r
1960     dispose() {\r
1961         if (this._callbacks) {\r
1962             this._callbacks.dispose();\r
1963             this._callbacks = undefined;\r
1964         }\r
1965     }\r
1966 }\r
1967 exports.Emitter = Emitter;\r
1968 Emitter._noop = function () { };\r
1969
1970
1971 /***/ }),
1972 /* 10 */
1973 /***/ (function(module, exports, __webpack_require__) {
1974
1975 "use strict";
1976 /* --------------------------------------------------------------------------------------------\r
1977  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1978  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1979  * ------------------------------------------------------------------------------------------ */\r
1980 \r
1981 Object.defineProperty(exports, "__esModule", { value: true });\r
1982 const events_1 = __webpack_require__(9);\r
1983 const Is = __webpack_require__(6);\r
1984 let ContentLength = 'Content-Length: ';\r
1985 let CRLF = '\r\n';\r
1986 var MessageWriter;\r
1987 (function (MessageWriter) {\r
1988     function is(value) {\r
1989         let candidate = value;\r
1990         return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
1991             Is.func(candidate.onError) && Is.func(candidate.write);\r
1992     }\r
1993     MessageWriter.is = is;\r
1994 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
1995 class AbstractMessageWriter {\r
1996     constructor() {\r
1997         this.errorEmitter = new events_1.Emitter();\r
1998         this.closeEmitter = new events_1.Emitter();\r
1999     }\r
2000     dispose() {\r
2001         this.errorEmitter.dispose();\r
2002         this.closeEmitter.dispose();\r
2003     }\r
2004     get onError() {\r
2005         return this.errorEmitter.event;\r
2006     }\r
2007     fireError(error, message, count) {\r
2008         this.errorEmitter.fire([this.asError(error), message, count]);\r
2009     }\r
2010     get onClose() {\r
2011         return this.closeEmitter.event;\r
2012     }\r
2013     fireClose() {\r
2014         this.closeEmitter.fire(undefined);\r
2015     }\r
2016     asError(error) {\r
2017         if (error instanceof Error) {\r
2018             return error;\r
2019         }\r
2020         else {\r
2021             return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
2022         }\r
2023     }\r
2024 }\r
2025 exports.AbstractMessageWriter = AbstractMessageWriter;\r
2026 class StreamMessageWriter extends AbstractMessageWriter {\r
2027     constructor(writable, encoding = 'utf8') {\r
2028         super();\r
2029         this.writable = writable;\r
2030         this.encoding = encoding;\r
2031         this.errorCount = 0;\r
2032         this.writable.on('error', (error) => this.fireError(error));\r
2033         this.writable.on('close', () => this.fireClose());\r
2034     }\r
2035     write(msg) {\r
2036         let json = JSON.stringify(msg);\r
2037         let contentLength = Buffer.byteLength(json, this.encoding);\r
2038         let headers = [\r
2039             ContentLength, contentLength.toString(), CRLF,\r
2040             CRLF\r
2041         ];\r
2042         try {\r
2043             // Header must be written in ASCII encoding\r
2044             this.writable.write(headers.join(''), 'ascii');\r
2045             // Now write the content. This can be written in any encoding\r
2046             this.writable.write(json, this.encoding);\r
2047             this.errorCount = 0;\r
2048         }\r
2049         catch (error) {\r
2050             this.errorCount++;\r
2051             this.fireError(error, msg, this.errorCount);\r
2052         }\r
2053     }\r
2054 }\r
2055 exports.StreamMessageWriter = StreamMessageWriter;\r
2056 class IPCMessageWriter extends AbstractMessageWriter {\r
2057     constructor(process) {\r
2058         super();\r
2059         this.process = process;\r
2060         this.errorCount = 0;\r
2061         this.queue = [];\r
2062         this.sending = false;\r
2063         let eventEmitter = this.process;\r
2064         eventEmitter.on('error', (error) => this.fireError(error));\r
2065         eventEmitter.on('close', () => this.fireClose);\r
2066     }\r
2067     write(msg) {\r
2068         if (!this.sending && this.queue.length === 0) {\r
2069             // See https://github.com/nodejs/node/issues/7657\r
2070             this.doWriteMessage(msg);\r
2071         }\r
2072         else {\r
2073             this.queue.push(msg);\r
2074         }\r
2075     }\r
2076     doWriteMessage(msg) {\r
2077         try {\r
2078             if (this.process.send) {\r
2079                 this.sending = true;\r
2080                 this.process.send(msg, undefined, undefined, (error) => {\r
2081                     this.sending = false;\r
2082                     if (error) {\r
2083                         this.errorCount++;\r
2084                         this.fireError(error, msg, this.errorCount);\r
2085                     }\r
2086                     else {\r
2087                         this.errorCount = 0;\r
2088                     }\r
2089                     if (this.queue.length > 0) {\r
2090                         this.doWriteMessage(this.queue.shift());\r
2091                     }\r
2092                 });\r
2093             }\r
2094         }\r
2095         catch (error) {\r
2096             this.errorCount++;\r
2097             this.fireError(error, msg, this.errorCount);\r
2098         }\r
2099     }\r
2100 }\r
2101 exports.IPCMessageWriter = IPCMessageWriter;\r
2102 class SocketMessageWriter extends AbstractMessageWriter {\r
2103     constructor(socket, encoding = 'utf8') {\r
2104         super();\r
2105         this.socket = socket;\r
2106         this.queue = [];\r
2107         this.sending = false;\r
2108         this.encoding = encoding;\r
2109         this.errorCount = 0;\r
2110         this.socket.on('error', (error) => this.fireError(error));\r
2111         this.socket.on('close', () => this.fireClose());\r
2112     }\r
2113     dispose() {\r
2114         super.dispose();\r
2115         this.socket.destroy();\r
2116     }\r
2117     write(msg) {\r
2118         if (!this.sending && this.queue.length === 0) {\r
2119             // See https://github.com/nodejs/node/issues/7657\r
2120             this.doWriteMessage(msg);\r
2121         }\r
2122         else {\r
2123             this.queue.push(msg);\r
2124         }\r
2125     }\r
2126     doWriteMessage(msg) {\r
2127         let json = JSON.stringify(msg);\r
2128         let contentLength = Buffer.byteLength(json, this.encoding);\r
2129         let headers = [\r
2130             ContentLength, contentLength.toString(), CRLF,\r
2131             CRLF\r
2132         ];\r
2133         try {\r
2134             // Header must be written in ASCII encoding\r
2135             this.sending = true;\r
2136             this.socket.write(headers.join(''), 'ascii', (error) => {\r
2137                 if (error) {\r
2138                     this.handleError(error, msg);\r
2139                 }\r
2140                 try {\r
2141                     // Now write the content. This can be written in any encoding\r
2142                     this.socket.write(json, this.encoding, (error) => {\r
2143                         this.sending = false;\r
2144                         if (error) {\r
2145                             this.handleError(error, msg);\r
2146                         }\r
2147                         else {\r
2148                             this.errorCount = 0;\r
2149                         }\r
2150                         if (this.queue.length > 0) {\r
2151                             this.doWriteMessage(this.queue.shift());\r
2152                         }\r
2153                     });\r
2154                 }\r
2155                 catch (error) {\r
2156                     this.handleError(error, msg);\r
2157                 }\r
2158             });\r
2159         }\r
2160         catch (error) {\r
2161             this.handleError(error, msg);\r
2162         }\r
2163     }\r
2164     handleError(error, msg) {\r
2165         this.errorCount++;\r
2166         this.fireError(error, msg, this.errorCount);\r
2167     }\r
2168 }\r
2169 exports.SocketMessageWriter = SocketMessageWriter;\r
2170
2171
2172 /***/ }),
2173 /* 11 */
2174 /***/ (function(module, exports, __webpack_require__) {
2175
2176 "use strict";
2177 /*---------------------------------------------------------------------------------------------\r
2178  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2179  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2180  *--------------------------------------------------------------------------------------------*/\r
2181 \r
2182 Object.defineProperty(exports, "__esModule", { value: true });\r
2183 const events_1 = __webpack_require__(9);\r
2184 const Is = __webpack_require__(6);\r
2185 var CancellationToken;\r
2186 (function (CancellationToken) {\r
2187     CancellationToken.None = Object.freeze({\r
2188         isCancellationRequested: false,\r
2189         onCancellationRequested: events_1.Event.None\r
2190     });\r
2191     CancellationToken.Cancelled = Object.freeze({\r
2192         isCancellationRequested: true,\r
2193         onCancellationRequested: events_1.Event.None\r
2194     });\r
2195     function is(value) {\r
2196         let candidate = value;\r
2197         return candidate && (candidate === CancellationToken.None\r
2198             || candidate === CancellationToken.Cancelled\r
2199             || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
2200     }\r
2201     CancellationToken.is = is;\r
2202 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
2203 const shortcutEvent = Object.freeze(function (callback, context) {\r
2204     let handle = setTimeout(callback.bind(context), 0);\r
2205     return { dispose() { clearTimeout(handle); } };\r
2206 });\r
2207 class MutableToken {\r
2208     constructor() {\r
2209         this._isCancelled = false;\r
2210     }\r
2211     cancel() {\r
2212         if (!this._isCancelled) {\r
2213             this._isCancelled = true;\r
2214             if (this._emitter) {\r
2215                 this._emitter.fire(undefined);\r
2216                 this.dispose();\r
2217             }\r
2218         }\r
2219     }\r
2220     get isCancellationRequested() {\r
2221         return this._isCancelled;\r
2222     }\r
2223     get onCancellationRequested() {\r
2224         if (this._isCancelled) {\r
2225             return shortcutEvent;\r
2226         }\r
2227         if (!this._emitter) {\r
2228             this._emitter = new events_1.Emitter();\r
2229         }\r
2230         return this._emitter.event;\r
2231     }\r
2232     dispose() {\r
2233         if (this._emitter) {\r
2234             this._emitter.dispose();\r
2235             this._emitter = undefined;\r
2236         }\r
2237     }\r
2238 }\r
2239 class CancellationTokenSource {\r
2240     get token() {\r
2241         if (!this._token) {\r
2242             // be lazy and create the token only when\r
2243             // actually needed\r
2244             this._token = new MutableToken();\r
2245         }\r
2246         return this._token;\r
2247     }\r
2248     cancel() {\r
2249         if (!this._token) {\r
2250             // save an object by returning the default\r
2251             // cancelled token when cancellation happens\r
2252             // before someone asks for the token\r
2253             this._token = CancellationToken.Cancelled;\r
2254         }\r
2255         else {\r
2256             this._token.cancel();\r
2257         }\r
2258     }\r
2259     dispose() {\r
2260         if (!this._token) {\r
2261             // ensure to initialize with an empty token if we had none\r
2262             this._token = CancellationToken.None;\r
2263         }\r
2264         else if (this._token instanceof MutableToken) {\r
2265             // actually dispose\r
2266             this._token.dispose();\r
2267         }\r
2268     }\r
2269 }\r
2270 exports.CancellationTokenSource = CancellationTokenSource;\r
2271
2272
2273 /***/ }),
2274 /* 12 */
2275 /***/ (function(module, exports, __webpack_require__) {
2276
2277 "use strict";
2278 \r
2279 /*---------------------------------------------------------------------------------------------\r
2280  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2281  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2282  *--------------------------------------------------------------------------------------------*/\r
2283 Object.defineProperty(exports, "__esModule", { value: true });\r
2284 var Touch;\r
2285 (function (Touch) {\r
2286     Touch.None = 0;\r
2287     Touch.First = 1;\r
2288     Touch.Last = 2;\r
2289 })(Touch = exports.Touch || (exports.Touch = {}));\r
2290 class LinkedMap {\r
2291     constructor() {\r
2292         this._map = new Map();\r
2293         this._head = undefined;\r
2294         this._tail = undefined;\r
2295         this._size = 0;\r
2296     }\r
2297     clear() {\r
2298         this._map.clear();\r
2299         this._head = undefined;\r
2300         this._tail = undefined;\r
2301         this._size = 0;\r
2302     }\r
2303     isEmpty() {\r
2304         return !this._head && !this._tail;\r
2305     }\r
2306     get size() {\r
2307         return this._size;\r
2308     }\r
2309     has(key) {\r
2310         return this._map.has(key);\r
2311     }\r
2312     get(key) {\r
2313         const item = this._map.get(key);\r
2314         if (!item) {\r
2315             return undefined;\r
2316         }\r
2317         return item.value;\r
2318     }\r
2319     set(key, value, touch = Touch.None) {\r
2320         let item = this._map.get(key);\r
2321         if (item) {\r
2322             item.value = value;\r
2323             if (touch !== Touch.None) {\r
2324                 this.touch(item, touch);\r
2325             }\r
2326         }\r
2327         else {\r
2328             item = { key, value, next: undefined, previous: undefined };\r
2329             switch (touch) {\r
2330                 case Touch.None:\r
2331                     this.addItemLast(item);\r
2332                     break;\r
2333                 case Touch.First:\r
2334                     this.addItemFirst(item);\r
2335                     break;\r
2336                 case Touch.Last:\r
2337                     this.addItemLast(item);\r
2338                     break;\r
2339                 default:\r
2340                     this.addItemLast(item);\r
2341                     break;\r
2342             }\r
2343             this._map.set(key, item);\r
2344             this._size++;\r
2345         }\r
2346     }\r
2347     delete(key) {\r
2348         const item = this._map.get(key);\r
2349         if (!item) {\r
2350             return false;\r
2351         }\r
2352         this._map.delete(key);\r
2353         this.removeItem(item);\r
2354         this._size--;\r
2355         return true;\r
2356     }\r
2357     shift() {\r
2358         if (!this._head && !this._tail) {\r
2359             return undefined;\r
2360         }\r
2361         if (!this._head || !this._tail) {\r
2362             throw new Error('Invalid list');\r
2363         }\r
2364         const item = this._head;\r
2365         this._map.delete(item.key);\r
2366         this.removeItem(item);\r
2367         this._size--;\r
2368         return item.value;\r
2369     }\r
2370     forEach(callbackfn, thisArg) {\r
2371         let current = this._head;\r
2372         while (current) {\r
2373             if (thisArg) {\r
2374                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2375             }\r
2376             else {\r
2377                 callbackfn(current.value, current.key, this);\r
2378             }\r
2379             current = current.next;\r
2380         }\r
2381     }\r
2382     forEachReverse(callbackfn, thisArg) {\r
2383         let current = this._tail;\r
2384         while (current) {\r
2385             if (thisArg) {\r
2386                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2387             }\r
2388             else {\r
2389                 callbackfn(current.value, current.key, this);\r
2390             }\r
2391             current = current.previous;\r
2392         }\r
2393     }\r
2394     values() {\r
2395         let result = [];\r
2396         let current = this._head;\r
2397         while (current) {\r
2398             result.push(current.value);\r
2399             current = current.next;\r
2400         }\r
2401         return result;\r
2402     }\r
2403     keys() {\r
2404         let result = [];\r
2405         let current = this._head;\r
2406         while (current) {\r
2407             result.push(current.key);\r
2408             current = current.next;\r
2409         }\r
2410         return result;\r
2411     }\r
2412     /* JSON RPC run on es5 which has no Symbol.iterator\r
2413     public keys(): IterableIterator<K> {\r
2414         let current = this._head;\r
2415         let iterator: IterableIterator<K> = {\r
2416             [Symbol.iterator]() {\r
2417                 return iterator;\r
2418             },\r
2419             next():IteratorResult<K> {\r
2420                 if (current) {\r
2421                     let result = { value: current.key, done: false };\r
2422                     current = current.next;\r
2423                     return result;\r
2424                 } else {\r
2425                     return { value: undefined, done: true };\r
2426                 }\r
2427             }\r
2428         };\r
2429         return iterator;\r
2430     }\r
2431 \r
2432     public values(): IterableIterator<V> {\r
2433         let current = this._head;\r
2434         let iterator: IterableIterator<V> = {\r
2435             [Symbol.iterator]() {\r
2436                 return iterator;\r
2437             },\r
2438             next():IteratorResult<V> {\r
2439                 if (current) {\r
2440                     let result = { value: current.value, done: false };\r
2441                     current = current.next;\r
2442                     return result;\r
2443                 } else {\r
2444                     return { value: undefined, done: true };\r
2445                 }\r
2446             }\r
2447         };\r
2448         return iterator;\r
2449     }\r
2450     */\r
2451     addItemFirst(item) {\r
2452         // First time Insert\r
2453         if (!this._head && !this._tail) {\r
2454             this._tail = item;\r
2455         }\r
2456         else if (!this._head) {\r
2457             throw new Error('Invalid list');\r
2458         }\r
2459         else {\r
2460             item.next = this._head;\r
2461             this._head.previous = item;\r
2462         }\r
2463         this._head = item;\r
2464     }\r
2465     addItemLast(item) {\r
2466         // First time Insert\r
2467         if (!this._head && !this._tail) {\r
2468             this._head = item;\r
2469         }\r
2470         else if (!this._tail) {\r
2471             throw new Error('Invalid list');\r
2472         }\r
2473         else {\r
2474             item.previous = this._tail;\r
2475             this._tail.next = item;\r
2476         }\r
2477         this._tail = item;\r
2478     }\r
2479     removeItem(item) {\r
2480         if (item === this._head && item === this._tail) {\r
2481             this._head = undefined;\r
2482             this._tail = undefined;\r
2483         }\r
2484         else if (item === this._head) {\r
2485             this._head = item.next;\r
2486         }\r
2487         else if (item === this._tail) {\r
2488             this._tail = item.previous;\r
2489         }\r
2490         else {\r
2491             const next = item.next;\r
2492             const previous = item.previous;\r
2493             if (!next || !previous) {\r
2494                 throw new Error('Invalid list');\r
2495             }\r
2496             next.previous = previous;\r
2497             previous.next = next;\r
2498         }\r
2499     }\r
2500     touch(item, touch) {\r
2501         if (!this._head || !this._tail) {\r
2502             throw new Error('Invalid list');\r
2503         }\r
2504         if ((touch !== Touch.First && touch !== Touch.Last)) {\r
2505             return;\r
2506         }\r
2507         if (touch === Touch.First) {\r
2508             if (item === this._head) {\r
2509                 return;\r
2510             }\r
2511             const next = item.next;\r
2512             const previous = item.previous;\r
2513             // Unlink the item\r
2514             if (item === this._tail) {\r
2515                 // previous must be defined since item was not head but is tail\r
2516                 // So there are more than on item in the map\r
2517                 previous.next = undefined;\r
2518                 this._tail = previous;\r
2519             }\r
2520             else {\r
2521                 // Both next and previous are not undefined since item was neither head nor tail.\r
2522                 next.previous = previous;\r
2523                 previous.next = next;\r
2524             }\r
2525             // Insert the node at head\r
2526             item.previous = undefined;\r
2527             item.next = this._head;\r
2528             this._head.previous = item;\r
2529             this._head = item;\r
2530         }\r
2531         else if (touch === Touch.Last) {\r
2532             if (item === this._tail) {\r
2533                 return;\r
2534             }\r
2535             const next = item.next;\r
2536             const previous = item.previous;\r
2537             // Unlink the item.\r
2538             if (item === this._head) {\r
2539                 // next must be defined since item was not tail but is head\r
2540                 // So there are more than on item in the map\r
2541                 next.previous = undefined;\r
2542                 this._head = next;\r
2543             }\r
2544             else {\r
2545                 // Both next and previous are not undefined since item was neither head nor tail.\r
2546                 next.previous = previous;\r
2547                 previous.next = next;\r
2548             }\r
2549             item.next = undefined;\r
2550             item.previous = this._tail;\r
2551             this._tail.next = item;\r
2552             this._tail = item;\r
2553         }\r
2554     }\r
2555 }\r
2556 exports.LinkedMap = LinkedMap;\r
2557
2558
2559 /***/ }),
2560 /* 13 */
2561 /***/ (function(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 path_1 = __webpack_require__(2);\r
2571 const os_1 = __webpack_require__(14);\r
2572 const crypto_1 = __webpack_require__(15);\r
2573 const net_1 = __webpack_require__(16);\r
2574 const messageReader_1 = __webpack_require__(8);\r
2575 const messageWriter_1 = __webpack_require__(10);\r
2576 function generateRandomPipeName() {\r
2577     const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
2578     if (process.platform === 'win32') {\r
2579         return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
2580     }\r
2581     else {\r
2582         // Mac/Unix: use socket file\r
2583         return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
2584     }\r
2585 }\r
2586 exports.generateRandomPipeName = generateRandomPipeName;\r
2587 function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
2588     let connectResolve;\r
2589     let connected = new Promise((resolve, _reject) => {\r
2590         connectResolve = resolve;\r
2591     });\r
2592     return new Promise((resolve, reject) => {\r
2593         let server = net_1.createServer((socket) => {\r
2594             server.close();\r
2595             connectResolve([\r
2596                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2597                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2598             ]);\r
2599         });\r
2600         server.on('error', reject);\r
2601         server.listen(pipeName, () => {\r
2602             server.removeListener('error', reject);\r
2603             resolve({\r
2604                 onConnected: () => { return connected; }\r
2605             });\r
2606         });\r
2607     });\r
2608 }\r
2609 exports.createClientPipeTransport = createClientPipeTransport;\r
2610 function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
2611     const socket = net_1.createConnection(pipeName);\r
2612     return [\r
2613         new messageReader_1.SocketMessageReader(socket, encoding),\r
2614         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2615     ];\r
2616 }\r
2617 exports.createServerPipeTransport = createServerPipeTransport;\r
2618
2619
2620 /***/ }),
2621 /* 14 */
2622 /***/ (function(module, exports) {
2623
2624 module.exports = require("os");
2625
2626 /***/ }),
2627 /* 15 */
2628 /***/ (function(module, exports) {
2629
2630 module.exports = require("crypto");
2631
2632 /***/ }),
2633 /* 16 */
2634 /***/ (function(module, exports) {
2635
2636 module.exports = require("net");
2637
2638 /***/ }),
2639 /* 17 */
2640 /***/ (function(module, exports, __webpack_require__) {
2641
2642 "use strict";
2643 /* --------------------------------------------------------------------------------------------\r
2644  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2645  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2646  * ------------------------------------------------------------------------------------------ */\r
2647 \r
2648 Object.defineProperty(exports, "__esModule", { value: true });\r
2649 const net_1 = __webpack_require__(16);\r
2650 const messageReader_1 = __webpack_require__(8);\r
2651 const messageWriter_1 = __webpack_require__(10);\r
2652 function createClientSocketTransport(port, encoding = 'utf-8') {\r
2653     let connectResolve;\r
2654     let connected = new Promise((resolve, _reject) => {\r
2655         connectResolve = resolve;\r
2656     });\r
2657     return new Promise((resolve, reject) => {\r
2658         let server = net_1.createServer((socket) => {\r
2659             server.close();\r
2660             connectResolve([\r
2661                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2662                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2663             ]);\r
2664         });\r
2665         server.on('error', reject);\r
2666         server.listen(port, '127.0.0.1', () => {\r
2667             server.removeListener('error', reject);\r
2668             resolve({\r
2669                 onConnected: () => { return connected; }\r
2670             });\r
2671         });\r
2672     });\r
2673 }\r
2674 exports.createClientSocketTransport = createClientSocketTransport;\r
2675 function createServerSocketTransport(port, encoding = 'utf-8') {\r
2676     const socket = net_1.createConnection(port, '127.0.0.1');\r
2677     return [\r
2678         new messageReader_1.SocketMessageReader(socket, encoding),\r
2679         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2680     ];\r
2681 }\r
2682 exports.createServerSocketTransport = createServerSocketTransport;\r
2683
2684
2685 /***/ }),
2686 /* 18 */
2687 /***/ (function(module, __webpack_exports__, __webpack_require__) {
2688
2689 "use strict";
2690 __webpack_require__.r(__webpack_exports__);
2691 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return Position; });
2692 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return Range; });
2693 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; });
2694 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return LocationLink; });
2695 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; });
2696 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return ColorInformation; });
2697 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return ColorPresentation; });
2698 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return FoldingRangeKind; });
2699 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return FoldingRange; });
2700 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return DiagnosticRelatedInformation; });
2701 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return DiagnosticSeverity; });
2702 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return DiagnosticTag; });
2703 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return Diagnostic; });
2704 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
2705 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return TextEdit; });
2706 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return TextDocumentEdit; });
2707 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return CreateFile; });
2708 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return RenameFile; });
2709 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return DeleteFile; });
2710 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return WorkspaceEdit; });
2711 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return WorkspaceChange; });
2712 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return TextDocumentIdentifier; });
2713 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return VersionedTextDocumentIdentifier; });
2714 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return TextDocumentItem; });
2715 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return MarkupKind; });
2716 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return MarkupContent; });
2717 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return CompletionItemKind; });
2718 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return InsertTextFormat; });
2719 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return CompletionItemTag; });
2720 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return CompletionItem; });
2721 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return CompletionList; });
2722 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return MarkedString; });
2723 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return Hover; });
2724 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return ParameterInformation; });
2725 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return SignatureInformation; });
2726 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return DocumentHighlightKind; });
2727 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return DocumentHighlight; });
2728 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return SymbolKind; });
2729 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return SymbolTag; });
2730 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return SymbolInformation; });
2731 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return DocumentSymbol; });
2732 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return CodeActionKind; });
2733 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return CodeActionContext; });
2734 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return CodeAction; });
2735 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return CodeLens; });
2736 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return FormattingOptions; });
2737 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return DocumentLink; });
2738 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return SelectionRange; });
2739 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return EOL; });
2740 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; });
2741 /* --------------------------------------------------------------------------------------------\r
2742  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2743  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2744  * ------------------------------------------------------------------------------------------ */\r
2745 \r
2746 /**\r
2747  * The Position namespace provides helper functions to work with\r
2748  * [Position](#Position) literals.\r
2749  */\r
2750 var Position;\r
2751 (function (Position) {\r
2752     /**\r
2753      * Creates a new Position literal from the given line and character.\r
2754      * @param line The position's line.\r
2755      * @param character The position's character.\r
2756      */\r
2757     function create(line, character) {\r
2758         return { line: line, character: character };\r
2759     }\r
2760     Position.create = create;\r
2761     /**\r
2762      * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
2763      */\r
2764     function is(value) {\r
2765         var candidate = value;\r
2766         return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
2767     }\r
2768     Position.is = is;\r
2769 })(Position || (Position = {}));\r
2770 /**\r
2771  * The Range namespace provides helper functions to work with\r
2772  * [Range](#Range) literals.\r
2773  */\r
2774 var Range;\r
2775 (function (Range) {\r
2776     function create(one, two, three, four) {\r
2777         if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
2778             return { start: Position.create(one, two), end: Position.create(three, four) };\r
2779         }\r
2780         else if (Position.is(one) && Position.is(two)) {\r
2781             return { start: one, end: two };\r
2782         }\r
2783         else {\r
2784             throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
2785         }\r
2786     }\r
2787     Range.create = create;\r
2788     /**\r
2789      * Checks whether the given literal conforms to the [Range](#Range) interface.\r
2790      */\r
2791     function is(value) {\r
2792         var candidate = value;\r
2793         return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
2794     }\r
2795     Range.is = is;\r
2796 })(Range || (Range = {}));\r
2797 /**\r
2798  * The Location namespace provides helper functions to work with\r
2799  * [Location](#Location) literals.\r
2800  */\r
2801 var Location;\r
2802 (function (Location) {\r
2803     /**\r
2804      * Creates a Location literal.\r
2805      * @param uri The location's uri.\r
2806      * @param range The location's range.\r
2807      */\r
2808     function create(uri, range) {\r
2809         return { uri: uri, range: range };\r
2810     }\r
2811     Location.create = create;\r
2812     /**\r
2813      * Checks whether the given literal conforms to the [Location](#Location) interface.\r
2814      */\r
2815     function is(value) {\r
2816         var candidate = value;\r
2817         return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
2818     }\r
2819     Location.is = is;\r
2820 })(Location || (Location = {}));\r
2821 /**\r
2822  * The LocationLink namespace provides helper functions to work with\r
2823  * [LocationLink](#LocationLink) literals.\r
2824  */\r
2825 var LocationLink;\r
2826 (function (LocationLink) {\r
2827     /**\r
2828      * Creates a LocationLink literal.\r
2829      * @param targetUri The definition's uri.\r
2830      * @param targetRange The full range of the definition.\r
2831      * @param targetSelectionRange The span of the symbol definition at the target.\r
2832      * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
2833      */\r
2834     function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
2835         return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
2836     }\r
2837     LocationLink.create = create;\r
2838     /**\r
2839      * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
2840      */\r
2841     function is(value) {\r
2842         var candidate = value;\r
2843         return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
2844             && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
2845             && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
2846     }\r
2847     LocationLink.is = is;\r
2848 })(LocationLink || (LocationLink = {}));\r
2849 /**\r
2850  * The Color namespace provides helper functions to work with\r
2851  * [Color](#Color) literals.\r
2852  */\r
2853 var Color;\r
2854 (function (Color) {\r
2855     /**\r
2856      * Creates a new Color literal.\r
2857      */\r
2858     function create(red, green, blue, alpha) {\r
2859         return {\r
2860             red: red,\r
2861             green: green,\r
2862             blue: blue,\r
2863             alpha: alpha,\r
2864         };\r
2865     }\r
2866     Color.create = create;\r
2867     /**\r
2868      * Checks whether the given literal conforms to the [Color](#Color) interface.\r
2869      */\r
2870     function is(value) {\r
2871         var candidate = value;\r
2872         return Is.number(candidate.red)\r
2873             && Is.number(candidate.green)\r
2874             && Is.number(candidate.blue)\r
2875             && Is.number(candidate.alpha);\r
2876     }\r
2877     Color.is = is;\r
2878 })(Color || (Color = {}));\r
2879 /**\r
2880  * The ColorInformation namespace provides helper functions to work with\r
2881  * [ColorInformation](#ColorInformation) literals.\r
2882  */\r
2883 var ColorInformation;\r
2884 (function (ColorInformation) {\r
2885     /**\r
2886      * Creates a new ColorInformation literal.\r
2887      */\r
2888     function create(range, color) {\r
2889         return {\r
2890             range: range,\r
2891             color: color,\r
2892         };\r
2893     }\r
2894     ColorInformation.create = create;\r
2895     /**\r
2896      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2897      */\r
2898     function is(value) {\r
2899         var candidate = value;\r
2900         return Range.is(candidate.range) && Color.is(candidate.color);\r
2901     }\r
2902     ColorInformation.is = is;\r
2903 })(ColorInformation || (ColorInformation = {}));\r
2904 /**\r
2905  * The Color namespace provides helper functions to work with\r
2906  * [ColorPresentation](#ColorPresentation) literals.\r
2907  */\r
2908 var ColorPresentation;\r
2909 (function (ColorPresentation) {\r
2910     /**\r
2911      * Creates a new ColorInformation literal.\r
2912      */\r
2913     function create(label, textEdit, additionalTextEdits) {\r
2914         return {\r
2915             label: label,\r
2916             textEdit: textEdit,\r
2917             additionalTextEdits: additionalTextEdits,\r
2918         };\r
2919     }\r
2920     ColorPresentation.create = create;\r
2921     /**\r
2922      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2923      */\r
2924     function is(value) {\r
2925         var candidate = value;\r
2926         return Is.string(candidate.label)\r
2927             && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
2928             && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
2929     }\r
2930     ColorPresentation.is = is;\r
2931 })(ColorPresentation || (ColorPresentation = {}));\r
2932 /**\r
2933  * Enum of known range kinds\r
2934  */\r
2935 var FoldingRangeKind;\r
2936 (function (FoldingRangeKind) {\r
2937     /**\r
2938      * Folding range for a comment\r
2939      */\r
2940     FoldingRangeKind["Comment"] = "comment";\r
2941     /**\r
2942      * Folding range for a imports or includes\r
2943      */\r
2944     FoldingRangeKind["Imports"] = "imports";\r
2945     /**\r
2946      * Folding range for a region (e.g. `#region`)\r
2947      */\r
2948     FoldingRangeKind["Region"] = "region";\r
2949 })(FoldingRangeKind || (FoldingRangeKind = {}));\r
2950 /**\r
2951  * The folding range namespace provides helper functions to work with\r
2952  * [FoldingRange](#FoldingRange) literals.\r
2953  */\r
2954 var FoldingRange;\r
2955 (function (FoldingRange) {\r
2956     /**\r
2957      * Creates a new FoldingRange literal.\r
2958      */\r
2959     function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
2960         var result = {\r
2961             startLine: startLine,\r
2962             endLine: endLine\r
2963         };\r
2964         if (Is.defined(startCharacter)) {\r
2965             result.startCharacter = startCharacter;\r
2966         }\r
2967         if (Is.defined(endCharacter)) {\r
2968             result.endCharacter = endCharacter;\r
2969         }\r
2970         if (Is.defined(kind)) {\r
2971             result.kind = kind;\r
2972         }\r
2973         return result;\r
2974     }\r
2975     FoldingRange.create = create;\r
2976     /**\r
2977      * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
2978      */\r
2979     function is(value) {\r
2980         var candidate = value;\r
2981         return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
2982             && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
2983             && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
2984             && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
2985     }\r
2986     FoldingRange.is = is;\r
2987 })(FoldingRange || (FoldingRange = {}));\r
2988 /**\r
2989  * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
2990  * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
2991  */\r
2992 var DiagnosticRelatedInformation;\r
2993 (function (DiagnosticRelatedInformation) {\r
2994     /**\r
2995      * Creates a new DiagnosticRelatedInformation literal.\r
2996      */\r
2997     function create(location, message) {\r
2998         return {\r
2999             location: location,\r
3000             message: message\r
3001         };\r
3002     }\r
3003     DiagnosticRelatedInformation.create = create;\r
3004     /**\r
3005      * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
3006      */\r
3007     function is(value) {\r
3008         var candidate = value;\r
3009         return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
3010     }\r
3011     DiagnosticRelatedInformation.is = is;\r
3012 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
3013 /**\r
3014  * The diagnostic's severity.\r
3015  */\r
3016 var DiagnosticSeverity;\r
3017 (function (DiagnosticSeverity) {\r
3018     /**\r
3019      * Reports an error.\r
3020      */\r
3021     DiagnosticSeverity.Error = 1;\r
3022     /**\r
3023      * Reports a warning.\r
3024      */\r
3025     DiagnosticSeverity.Warning = 2;\r
3026     /**\r
3027      * Reports an information.\r
3028      */\r
3029     DiagnosticSeverity.Information = 3;\r
3030     /**\r
3031      * Reports a hint.\r
3032      */\r
3033     DiagnosticSeverity.Hint = 4;\r
3034 })(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
3035 /**\r
3036  * The diagnostic tags.\r
3037  *\r
3038  * @since 3.15.0\r
3039  */\r
3040 var DiagnosticTag;\r
3041 (function (DiagnosticTag) {\r
3042     /**\r
3043      * Unused or unnecessary code.\r
3044      *\r
3045      * Clients are allowed to render diagnostics with this tag faded out instead of having\r
3046      * an error squiggle.\r
3047      */\r
3048     DiagnosticTag.Unnecessary = 1;\r
3049     /**\r
3050      * Deprecated or obsolete code.\r
3051      *\r
3052      * Clients are allowed to rendered diagnostics with this tag strike through.\r
3053      */\r
3054     DiagnosticTag.Deprecated = 2;\r
3055 })(DiagnosticTag || (DiagnosticTag = {}));\r
3056 /**\r
3057  * The Diagnostic namespace provides helper functions to work with\r
3058  * [Diagnostic](#Diagnostic) literals.\r
3059  */\r
3060 var Diagnostic;\r
3061 (function (Diagnostic) {\r
3062     /**\r
3063      * Creates a new Diagnostic literal.\r
3064      */\r
3065     function create(range, message, severity, code, source, relatedInformation) {\r
3066         var result = { range: range, message: message };\r
3067         if (Is.defined(severity)) {\r
3068             result.severity = severity;\r
3069         }\r
3070         if (Is.defined(code)) {\r
3071             result.code = code;\r
3072         }\r
3073         if (Is.defined(source)) {\r
3074             result.source = source;\r
3075         }\r
3076         if (Is.defined(relatedInformation)) {\r
3077             result.relatedInformation = relatedInformation;\r
3078         }\r
3079         return result;\r
3080     }\r
3081     Diagnostic.create = create;\r
3082     /**\r
3083      * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
3084      */\r
3085     function is(value) {\r
3086         var candidate = value;\r
3087         return Is.defined(candidate)\r
3088             && Range.is(candidate.range)\r
3089             && Is.string(candidate.message)\r
3090             && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
3091             && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
3092             && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
3093             && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
3094     }\r
3095     Diagnostic.is = is;\r
3096 })(Diagnostic || (Diagnostic = {}));\r
3097 /**\r
3098  * The Command namespace provides helper functions to work with\r
3099  * [Command](#Command) literals.\r
3100  */\r
3101 var Command;\r
3102 (function (Command) {\r
3103     /**\r
3104      * Creates a new Command literal.\r
3105      */\r
3106     function create(title, command) {\r
3107         var args = [];\r
3108         for (var _i = 2; _i < arguments.length; _i++) {\r
3109             args[_i - 2] = arguments[_i];\r
3110         }\r
3111         var result = { title: title, command: command };\r
3112         if (Is.defined(args) && args.length > 0) {\r
3113             result.arguments = args;\r
3114         }\r
3115         return result;\r
3116     }\r
3117     Command.create = create;\r
3118     /**\r
3119      * Checks whether the given literal conforms to the [Command](#Command) interface.\r
3120      */\r
3121     function is(value) {\r
3122         var candidate = value;\r
3123         return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
3124     }\r
3125     Command.is = is;\r
3126 })(Command || (Command = {}));\r
3127 /**\r
3128  * The TextEdit namespace provides helper function to create replace,\r
3129  * insert and delete edits more easily.\r
3130  */\r
3131 var TextEdit;\r
3132 (function (TextEdit) {\r
3133     /**\r
3134      * Creates a replace text edit.\r
3135      * @param range The range of text to be replaced.\r
3136      * @param newText The new text.\r
3137      */\r
3138     function replace(range, newText) {\r
3139         return { range: range, newText: newText };\r
3140     }\r
3141     TextEdit.replace = replace;\r
3142     /**\r
3143      * Creates a insert text edit.\r
3144      * @param position The position to insert the text at.\r
3145      * @param newText The text to be inserted.\r
3146      */\r
3147     function insert(position, newText) {\r
3148         return { range: { start: position, end: position }, newText: newText };\r
3149     }\r
3150     TextEdit.insert = insert;\r
3151     /**\r
3152      * Creates a delete text edit.\r
3153      * @param range The range of text to be deleted.\r
3154      */\r
3155     function del(range) {\r
3156         return { range: range, newText: '' };\r
3157     }\r
3158     TextEdit.del = del;\r
3159     function is(value) {\r
3160         var candidate = value;\r
3161         return Is.objectLiteral(candidate)\r
3162             && Is.string(candidate.newText)\r
3163             && Range.is(candidate.range);\r
3164     }\r
3165     TextEdit.is = is;\r
3166 })(TextEdit || (TextEdit = {}));\r
3167 /**\r
3168  * The TextDocumentEdit namespace provides helper function to create\r
3169  * an edit that manipulates a text document.\r
3170  */\r
3171 var TextDocumentEdit;\r
3172 (function (TextDocumentEdit) {\r
3173     /**\r
3174      * Creates a new `TextDocumentEdit`\r
3175      */\r
3176     function create(textDocument, edits) {\r
3177         return { textDocument: textDocument, edits: edits };\r
3178     }\r
3179     TextDocumentEdit.create = create;\r
3180     function is(value) {\r
3181         var candidate = value;\r
3182         return Is.defined(candidate)\r
3183             && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
3184             && Array.isArray(candidate.edits);\r
3185     }\r
3186     TextDocumentEdit.is = is;\r
3187 })(TextDocumentEdit || (TextDocumentEdit = {}));\r
3188 var CreateFile;\r
3189 (function (CreateFile) {\r
3190     function create(uri, options) {\r
3191         var result = {\r
3192             kind: 'create',\r
3193             uri: uri\r
3194         };\r
3195         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3196             result.options = options;\r
3197         }\r
3198         return result;\r
3199     }\r
3200     CreateFile.create = create;\r
3201     function is(value) {\r
3202         var candidate = value;\r
3203         return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
3204             (candidate.options === void 0 ||\r
3205                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3206     }\r
3207     CreateFile.is = is;\r
3208 })(CreateFile || (CreateFile = {}));\r
3209 var RenameFile;\r
3210 (function (RenameFile) {\r
3211     function create(oldUri, newUri, options) {\r
3212         var result = {\r
3213             kind: 'rename',\r
3214             oldUri: oldUri,\r
3215             newUri: newUri\r
3216         };\r
3217         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3218             result.options = options;\r
3219         }\r
3220         return result;\r
3221     }\r
3222     RenameFile.create = create;\r
3223     function is(value) {\r
3224         var candidate = value;\r
3225         return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
3226             (candidate.options === void 0 ||\r
3227                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3228     }\r
3229     RenameFile.is = is;\r
3230 })(RenameFile || (RenameFile = {}));\r
3231 var DeleteFile;\r
3232 (function (DeleteFile) {\r
3233     function create(uri, options) {\r
3234         var result = {\r
3235             kind: 'delete',\r
3236             uri: uri\r
3237         };\r
3238         if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
3239             result.options = options;\r
3240         }\r
3241         return result;\r
3242     }\r
3243     DeleteFile.create = create;\r
3244     function is(value) {\r
3245         var candidate = value;\r
3246         return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
3247             (candidate.options === void 0 ||\r
3248                 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
3249     }\r
3250     DeleteFile.is = is;\r
3251 })(DeleteFile || (DeleteFile = {}));\r
3252 var WorkspaceEdit;\r
3253 (function (WorkspaceEdit) {\r
3254     function is(value) {\r
3255         var candidate = value;\r
3256         return candidate &&\r
3257             (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
3258             (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
3259                 if (Is.string(change.kind)) {\r
3260                     return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
3261                 }\r
3262                 else {\r
3263                     return TextDocumentEdit.is(change);\r
3264                 }\r
3265             }));\r
3266     }\r
3267     WorkspaceEdit.is = is;\r
3268 })(WorkspaceEdit || (WorkspaceEdit = {}));\r
3269 var TextEditChangeImpl = /** @class */ (function () {\r
3270     function TextEditChangeImpl(edits) {\r
3271         this.edits = edits;\r
3272     }\r
3273     TextEditChangeImpl.prototype.insert = function (position, newText) {\r
3274         this.edits.push(TextEdit.insert(position, newText));\r
3275     };\r
3276     TextEditChangeImpl.prototype.replace = function (range, newText) {\r
3277         this.edits.push(TextEdit.replace(range, newText));\r
3278     };\r
3279     TextEditChangeImpl.prototype.delete = function (range) {\r
3280         this.edits.push(TextEdit.del(range));\r
3281     };\r
3282     TextEditChangeImpl.prototype.add = function (edit) {\r
3283         this.edits.push(edit);\r
3284     };\r
3285     TextEditChangeImpl.prototype.all = function () {\r
3286         return this.edits;\r
3287     };\r
3288     TextEditChangeImpl.prototype.clear = function () {\r
3289         this.edits.splice(0, this.edits.length);\r
3290     };\r
3291     return TextEditChangeImpl;\r
3292 }());\r
3293 /**\r
3294  * A workspace change helps constructing changes to a workspace.\r
3295  */\r
3296 var WorkspaceChange = /** @class */ (function () {\r
3297     function WorkspaceChange(workspaceEdit) {\r
3298         var _this = this;\r
3299         this._textEditChanges = Object.create(null);\r
3300         if (workspaceEdit) {\r
3301             this._workspaceEdit = workspaceEdit;\r
3302             if (workspaceEdit.documentChanges) {\r
3303                 workspaceEdit.documentChanges.forEach(function (change) {\r
3304                     if (TextDocumentEdit.is(change)) {\r
3305                         var textEditChange = new TextEditChangeImpl(change.edits);\r
3306                         _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
3307                     }\r
3308                 });\r
3309             }\r
3310             else if (workspaceEdit.changes) {\r
3311                 Object.keys(workspaceEdit.changes).forEach(function (key) {\r
3312                     var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
3313                     _this._textEditChanges[key] = textEditChange;\r
3314                 });\r
3315             }\r
3316         }\r
3317     }\r
3318     Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
3319         /**\r
3320          * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
3321          * use to be returned from a workspace edit operation like rename.\r
3322          */\r
3323         get: function () {\r
3324             return this._workspaceEdit;\r
3325         },\r
3326         enumerable: true,\r
3327         configurable: true\r
3328     });\r
3329     WorkspaceChange.prototype.getTextEditChange = function (key) {\r
3330         if (VersionedTextDocumentIdentifier.is(key)) {\r
3331             if (!this._workspaceEdit) {\r
3332                 this._workspaceEdit = {\r
3333                     documentChanges: []\r
3334                 };\r
3335             }\r
3336             if (!this._workspaceEdit.documentChanges) {\r
3337                 throw new Error('Workspace edit is not configured for document changes.');\r
3338             }\r
3339             var textDocument = key;\r
3340             var result = this._textEditChanges[textDocument.uri];\r
3341             if (!result) {\r
3342                 var edits = [];\r
3343                 var textDocumentEdit = {\r
3344                     textDocument: textDocument,\r
3345                     edits: edits\r
3346                 };\r
3347                 this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
3348                 result = new TextEditChangeImpl(edits);\r
3349                 this._textEditChanges[textDocument.uri] = result;\r
3350             }\r
3351             return result;\r
3352         }\r
3353         else {\r
3354             if (!this._workspaceEdit) {\r
3355                 this._workspaceEdit = {\r
3356                     changes: Object.create(null)\r
3357                 };\r
3358             }\r
3359             if (!this._workspaceEdit.changes) {\r
3360                 throw new Error('Workspace edit is not configured for normal text edit changes.');\r
3361             }\r
3362             var result = this._textEditChanges[key];\r
3363             if (!result) {\r
3364                 var edits = [];\r
3365                 this._workspaceEdit.changes[key] = edits;\r
3366                 result = new TextEditChangeImpl(edits);\r
3367                 this._textEditChanges[key] = result;\r
3368             }\r
3369             return result;\r
3370         }\r
3371     };\r
3372     WorkspaceChange.prototype.createFile = function (uri, options) {\r
3373         this.checkDocumentChanges();\r
3374         this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
3375     };\r
3376     WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
3377         this.checkDocumentChanges();\r
3378         this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
3379     };\r
3380     WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
3381         this.checkDocumentChanges();\r
3382         this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
3383     };\r
3384     WorkspaceChange.prototype.checkDocumentChanges = function () {\r
3385         if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
3386             throw new Error('Workspace edit is not configured for document changes.');\r
3387         }\r
3388     };\r
3389     return WorkspaceChange;\r
3390 }());\r
3391 \r
3392 /**\r
3393  * The TextDocumentIdentifier namespace provides helper functions to work with\r
3394  * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
3395  */\r
3396 var TextDocumentIdentifier;\r
3397 (function (TextDocumentIdentifier) {\r
3398     /**\r
3399      * Creates a new TextDocumentIdentifier literal.\r
3400      * @param uri The document's uri.\r
3401      */\r
3402     function create(uri) {\r
3403         return { uri: uri };\r
3404     }\r
3405     TextDocumentIdentifier.create = create;\r
3406     /**\r
3407      * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
3408      */\r
3409     function is(value) {\r
3410         var candidate = value;\r
3411         return Is.defined(candidate) && Is.string(candidate.uri);\r
3412     }\r
3413     TextDocumentIdentifier.is = is;\r
3414 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
3415 /**\r
3416  * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
3417  * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
3418  */\r
3419 var VersionedTextDocumentIdentifier;\r
3420 (function (VersionedTextDocumentIdentifier) {\r
3421     /**\r
3422      * Creates a new VersionedTextDocumentIdentifier literal.\r
3423      * @param uri The document's uri.\r
3424      * @param uri The document's text.\r
3425      */\r
3426     function create(uri, version) {\r
3427         return { uri: uri, version: version };\r
3428     }\r
3429     VersionedTextDocumentIdentifier.create = create;\r
3430     /**\r
3431      * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
3432      */\r
3433     function is(value) {\r
3434         var candidate = value;\r
3435         return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
3436     }\r
3437     VersionedTextDocumentIdentifier.is = is;\r
3438 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
3439 /**\r
3440  * The TextDocumentItem namespace provides helper functions to work with\r
3441  * [TextDocumentItem](#TextDocumentItem) literals.\r
3442  */\r
3443 var TextDocumentItem;\r
3444 (function (TextDocumentItem) {\r
3445     /**\r
3446      * Creates a new TextDocumentItem literal.\r
3447      * @param uri The document's uri.\r
3448      * @param languageId The document's language identifier.\r
3449      * @param version The document's version number.\r
3450      * @param text The document's text.\r
3451      */\r
3452     function create(uri, languageId, version, text) {\r
3453         return { uri: uri, languageId: languageId, version: version, text: text };\r
3454     }\r
3455     TextDocumentItem.create = create;\r
3456     /**\r
3457      * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
3458      */\r
3459     function is(value) {\r
3460         var candidate = value;\r
3461         return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
3462     }\r
3463     TextDocumentItem.is = is;\r
3464 })(TextDocumentItem || (TextDocumentItem = {}));\r
3465 /**\r
3466  * Describes the content type that a client supports in various\r
3467  * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
3468  *\r
3469  * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
3470  * are reserved for internal usage.\r
3471  */\r
3472 var MarkupKind;\r
3473 (function (MarkupKind) {\r
3474     /**\r
3475      * Plain text is supported as a content format\r
3476      */\r
3477     MarkupKind.PlainText = 'plaintext';\r
3478     /**\r
3479      * Markdown is supported as a content format\r
3480      */\r
3481     MarkupKind.Markdown = 'markdown';\r
3482 })(MarkupKind || (MarkupKind = {}));\r
3483 (function (MarkupKind) {\r
3484     /**\r
3485      * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
3486      */\r
3487     function is(value) {\r
3488         var candidate = value;\r
3489         return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
3490     }\r
3491     MarkupKind.is = is;\r
3492 })(MarkupKind || (MarkupKind = {}));\r
3493 var MarkupContent;\r
3494 (function (MarkupContent) {\r
3495     /**\r
3496      * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
3497      */\r
3498     function is(value) {\r
3499         var candidate = value;\r
3500         return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
3501     }\r
3502     MarkupContent.is = is;\r
3503 })(MarkupContent || (MarkupContent = {}));\r
3504 /**\r
3505  * The kind of a completion entry.\r
3506  */\r
3507 var CompletionItemKind;\r
3508 (function (CompletionItemKind) {\r
3509     CompletionItemKind.Text = 1;\r
3510     CompletionItemKind.Method = 2;\r
3511     CompletionItemKind.Function = 3;\r
3512     CompletionItemKind.Constructor = 4;\r
3513     CompletionItemKind.Field = 5;\r
3514     CompletionItemKind.Variable = 6;\r
3515     CompletionItemKind.Class = 7;\r
3516     CompletionItemKind.Interface = 8;\r
3517     CompletionItemKind.Module = 9;\r
3518     CompletionItemKind.Property = 10;\r
3519     CompletionItemKind.Unit = 11;\r
3520     CompletionItemKind.Value = 12;\r
3521     CompletionItemKind.Enum = 13;\r
3522     CompletionItemKind.Keyword = 14;\r
3523     CompletionItemKind.Snippet = 15;\r
3524     CompletionItemKind.Color = 16;\r
3525     CompletionItemKind.File = 17;\r
3526     CompletionItemKind.Reference = 18;\r
3527     CompletionItemKind.Folder = 19;\r
3528     CompletionItemKind.EnumMember = 20;\r
3529     CompletionItemKind.Constant = 21;\r
3530     CompletionItemKind.Struct = 22;\r
3531     CompletionItemKind.Event = 23;\r
3532     CompletionItemKind.Operator = 24;\r
3533     CompletionItemKind.TypeParameter = 25;\r
3534 })(CompletionItemKind || (CompletionItemKind = {}));\r
3535 /**\r
3536  * Defines whether the insert text in a completion item should be interpreted as\r
3537  * plain text or a snippet.\r
3538  */\r
3539 var InsertTextFormat;\r
3540 (function (InsertTextFormat) {\r
3541     /**\r
3542      * The primary text to be inserted is treated as a plain string.\r
3543      */\r
3544     InsertTextFormat.PlainText = 1;\r
3545     /**\r
3546      * The primary text to be inserted is treated as a snippet.\r
3547      *\r
3548      * A snippet can define tab stops and placeholders with `$1`, `$2`\r
3549      * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
3550      * the end of the snippet. Placeholders with equal identifiers are linked,\r
3551      * that is typing in one will update others too.\r
3552      *\r
3553      * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
3554      */\r
3555     InsertTextFormat.Snippet = 2;\r
3556 })(InsertTextFormat || (InsertTextFormat = {}));\r
3557 /**\r
3558  * Completion item tags are extra annotations that tweak the rendering of a completion\r
3559  * item.\r
3560  *\r
3561  * @since 3.15.0\r
3562  */\r
3563 var CompletionItemTag;\r
3564 (function (CompletionItemTag) {\r
3565     /**\r
3566      * Render a completion as obsolete, usually using a strike-out.\r
3567      */\r
3568     CompletionItemTag.Deprecated = 1;\r
3569 })(CompletionItemTag || (CompletionItemTag = {}));\r
3570 /**\r
3571  * The CompletionItem namespace provides functions to deal with\r
3572  * completion items.\r
3573  */\r
3574 var CompletionItem;\r
3575 (function (CompletionItem) {\r
3576     /**\r
3577      * Create a completion item and seed it with a label.\r
3578      * @param label The completion item's label\r
3579      */\r
3580     function create(label) {\r
3581         return { label: label };\r
3582     }\r
3583     CompletionItem.create = create;\r
3584 })(CompletionItem || (CompletionItem = {}));\r
3585 /**\r
3586  * The CompletionList namespace provides functions to deal with\r
3587  * completion lists.\r
3588  */\r
3589 var CompletionList;\r
3590 (function (CompletionList) {\r
3591     /**\r
3592      * Creates a new completion list.\r
3593      *\r
3594      * @param items The completion items.\r
3595      * @param isIncomplete The list is not complete.\r
3596      */\r
3597     function create(items, isIncomplete) {\r
3598         return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
3599     }\r
3600     CompletionList.create = create;\r
3601 })(CompletionList || (CompletionList = {}));\r
3602 var MarkedString;\r
3603 (function (MarkedString) {\r
3604     /**\r
3605      * Creates a marked string from plain text.\r
3606      *\r
3607      * @param plainText The plain text.\r
3608      */\r
3609     function fromPlainText(plainText) {\r
3610         return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
3611     }\r
3612     MarkedString.fromPlainText = fromPlainText;\r
3613     /**\r
3614      * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
3615      */\r
3616     function is(value) {\r
3617         var candidate = value;\r
3618         return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
3619     }\r
3620     MarkedString.is = is;\r
3621 })(MarkedString || (MarkedString = {}));\r
3622 var Hover;\r
3623 (function (Hover) {\r
3624     /**\r
3625      * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
3626      */\r
3627     function is(value) {\r
3628         var candidate = value;\r
3629         return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
3630             MarkedString.is(candidate.contents) ||\r
3631             Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
3632     }\r
3633     Hover.is = is;\r
3634 })(Hover || (Hover = {}));\r
3635 /**\r
3636  * The ParameterInformation namespace provides helper functions to work with\r
3637  * [ParameterInformation](#ParameterInformation) literals.\r
3638  */\r
3639 var ParameterInformation;\r
3640 (function (ParameterInformation) {\r
3641     /**\r
3642      * Creates a new parameter information literal.\r
3643      *\r
3644      * @param label A label string.\r
3645      * @param documentation A doc string.\r
3646      */\r
3647     function create(label, documentation) {\r
3648         return documentation ? { label: label, documentation: documentation } : { label: label };\r
3649     }\r
3650     ParameterInformation.create = create;\r
3651 })(ParameterInformation || (ParameterInformation = {}));\r
3652 /**\r
3653  * The SignatureInformation namespace provides helper functions to work with\r
3654  * [SignatureInformation](#SignatureInformation) literals.\r
3655  */\r
3656 var SignatureInformation;\r
3657 (function (SignatureInformation) {\r
3658     function create(label, documentation) {\r
3659         var parameters = [];\r
3660         for (var _i = 2; _i < arguments.length; _i++) {\r
3661             parameters[_i - 2] = arguments[_i];\r
3662         }\r
3663         var result = { label: label };\r
3664         if (Is.defined(documentation)) {\r
3665             result.documentation = documentation;\r
3666         }\r
3667         if (Is.defined(parameters)) {\r
3668             result.parameters = parameters;\r
3669         }\r
3670         else {\r
3671             result.parameters = [];\r
3672         }\r
3673         return result;\r
3674     }\r
3675     SignatureInformation.create = create;\r
3676 })(SignatureInformation || (SignatureInformation = {}));\r
3677 /**\r
3678  * A document highlight kind.\r
3679  */\r
3680 var DocumentHighlightKind;\r
3681 (function (DocumentHighlightKind) {\r
3682     /**\r
3683      * A textual occurrence.\r
3684      */\r
3685     DocumentHighlightKind.Text = 1;\r
3686     /**\r
3687      * Read-access of a symbol, like reading a variable.\r
3688      */\r
3689     DocumentHighlightKind.Read = 2;\r
3690     /**\r
3691      * Write-access of a symbol, like writing to a variable.\r
3692      */\r
3693     DocumentHighlightKind.Write = 3;\r
3694 })(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
3695 /**\r
3696  * DocumentHighlight namespace to provide helper functions to work with\r
3697  * [DocumentHighlight](#DocumentHighlight) literals.\r
3698  */\r
3699 var DocumentHighlight;\r
3700 (function (DocumentHighlight) {\r
3701     /**\r
3702      * Create a DocumentHighlight object.\r
3703      * @param range The range the highlight applies to.\r
3704      */\r
3705     function create(range, kind) {\r
3706         var result = { range: range };\r
3707         if (Is.number(kind)) {\r
3708             result.kind = kind;\r
3709         }\r
3710         return result;\r
3711     }\r
3712     DocumentHighlight.create = create;\r
3713 })(DocumentHighlight || (DocumentHighlight = {}));\r
3714 /**\r
3715  * A symbol kind.\r
3716  */\r
3717 var SymbolKind;\r
3718 (function (SymbolKind) {\r
3719     SymbolKind.File = 1;\r
3720     SymbolKind.Module = 2;\r
3721     SymbolKind.Namespace = 3;\r
3722     SymbolKind.Package = 4;\r
3723     SymbolKind.Class = 5;\r
3724     SymbolKind.Method = 6;\r
3725     SymbolKind.Property = 7;\r
3726     SymbolKind.Field = 8;\r
3727     SymbolKind.Constructor = 9;\r
3728     SymbolKind.Enum = 10;\r
3729     SymbolKind.Interface = 11;\r
3730     SymbolKind.Function = 12;\r
3731     SymbolKind.Variable = 13;\r
3732     SymbolKind.Constant = 14;\r
3733     SymbolKind.String = 15;\r
3734     SymbolKind.Number = 16;\r
3735     SymbolKind.Boolean = 17;\r
3736     SymbolKind.Array = 18;\r
3737     SymbolKind.Object = 19;\r
3738     SymbolKind.Key = 20;\r
3739     SymbolKind.Null = 21;\r
3740     SymbolKind.EnumMember = 22;\r
3741     SymbolKind.Struct = 23;\r
3742     SymbolKind.Event = 24;\r
3743     SymbolKind.Operator = 25;\r
3744     SymbolKind.TypeParameter = 26;\r
3745 })(SymbolKind || (SymbolKind = {}));\r
3746 /**\r
3747  * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
3748  * @since 3.15\r
3749  */\r
3750 var SymbolTag;\r
3751 (function (SymbolTag) {\r
3752     /**\r
3753      * Render a symbol as obsolete, usually using a strike-out.\r
3754      */\r
3755     SymbolTag.Deprecated = 1;\r
3756 })(SymbolTag || (SymbolTag = {}));\r
3757 var SymbolInformation;\r
3758 (function (SymbolInformation) {\r
3759     /**\r
3760      * Creates a new symbol information literal.\r
3761      *\r
3762      * @param name The name of the symbol.\r
3763      * @param kind The kind of the symbol.\r
3764      * @param range The range of the location of the symbol.\r
3765      * @param uri The resource of the location of symbol, defaults to the current document.\r
3766      * @param containerName The name of the symbol containing the symbol.\r
3767      */\r
3768     function create(name, kind, range, uri, containerName) {\r
3769         var result = {\r
3770             name: name,\r
3771             kind: kind,\r
3772             location: { uri: uri, range: range }\r
3773         };\r
3774         if (containerName) {\r
3775             result.containerName = containerName;\r
3776         }\r
3777         return result;\r
3778     }\r
3779     SymbolInformation.create = create;\r
3780 })(SymbolInformation || (SymbolInformation = {}));\r
3781 var DocumentSymbol;\r
3782 (function (DocumentSymbol) {\r
3783     /**\r
3784      * Creates a new symbol information literal.\r
3785      *\r
3786      * @param name The name of the symbol.\r
3787      * @param detail The detail of the symbol.\r
3788      * @param kind The kind of the symbol.\r
3789      * @param range The range of the symbol.\r
3790      * @param selectionRange The selectionRange of the symbol.\r
3791      * @param children Children of the symbol.\r
3792      */\r
3793     function create(name, detail, kind, range, selectionRange, children) {\r
3794         var result = {\r
3795             name: name,\r
3796             detail: detail,\r
3797             kind: kind,\r
3798             range: range,\r
3799             selectionRange: selectionRange\r
3800         };\r
3801         if (children !== void 0) {\r
3802             result.children = children;\r
3803         }\r
3804         return result;\r
3805     }\r
3806     DocumentSymbol.create = create;\r
3807     /**\r
3808      * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
3809      */\r
3810     function is(value) {\r
3811         var candidate = value;\r
3812         return candidate &&\r
3813             Is.string(candidate.name) && Is.number(candidate.kind) &&\r
3814             Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
3815             (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
3816             (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
3817             (candidate.children === void 0 || Array.isArray(candidate.children));\r
3818     }\r
3819     DocumentSymbol.is = is;\r
3820 })(DocumentSymbol || (DocumentSymbol = {}));\r
3821 /**\r
3822  * A set of predefined code action kinds\r
3823  */\r
3824 var CodeActionKind;\r
3825 (function (CodeActionKind) {\r
3826     /**\r
3827      * Empty kind.\r
3828      */\r
3829     CodeActionKind.Empty = '';\r
3830     /**\r
3831      * Base kind for quickfix actions: 'quickfix'\r
3832      */\r
3833     CodeActionKind.QuickFix = 'quickfix';\r
3834     /**\r
3835      * Base kind for refactoring actions: 'refactor'\r
3836      */\r
3837     CodeActionKind.Refactor = 'refactor';\r
3838     /**\r
3839      * Base kind for refactoring extraction actions: 'refactor.extract'\r
3840      *\r
3841      * Example extract actions:\r
3842      *\r
3843      * - Extract method\r
3844      * - Extract function\r
3845      * - Extract variable\r
3846      * - Extract interface from class\r
3847      * - ...\r
3848      */\r
3849     CodeActionKind.RefactorExtract = 'refactor.extract';\r
3850     /**\r
3851      * Base kind for refactoring inline actions: 'refactor.inline'\r
3852      *\r
3853      * Example inline actions:\r
3854      *\r
3855      * - Inline function\r
3856      * - Inline variable\r
3857      * - Inline constant\r
3858      * - ...\r
3859      */\r
3860     CodeActionKind.RefactorInline = 'refactor.inline';\r
3861     /**\r
3862      * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
3863      *\r
3864      * Example rewrite actions:\r
3865      *\r
3866      * - Convert JavaScript function to class\r
3867      * - Add or remove parameter\r
3868      * - Encapsulate field\r
3869      * - Make method static\r
3870      * - Move method to base class\r
3871      * - ...\r
3872      */\r
3873     CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
3874     /**\r
3875      * Base kind for source actions: `source`\r
3876      *\r
3877      * Source code actions apply to the entire file.\r
3878      */\r
3879     CodeActionKind.Source = 'source';\r
3880     /**\r
3881      * Base kind for an organize imports source action: `source.organizeImports`\r
3882      */\r
3883     CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
3884     /**\r
3885      * Base kind for auto-fix source actions: `source.fixAll`.\r
3886      *\r
3887      * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
3888      * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
3889      *\r
3890      * @since 3.15.0\r
3891      */\r
3892     CodeActionKind.SourceFixAll = 'source.fixAll';\r
3893 })(CodeActionKind || (CodeActionKind = {}));\r
3894 /**\r
3895  * The CodeActionContext namespace provides helper functions to work with\r
3896  * [CodeActionContext](#CodeActionContext) literals.\r
3897  */\r
3898 var CodeActionContext;\r
3899 (function (CodeActionContext) {\r
3900     /**\r
3901      * Creates a new CodeActionContext literal.\r
3902      */\r
3903     function create(diagnostics, only) {\r
3904         var result = { diagnostics: diagnostics };\r
3905         if (only !== void 0 && only !== null) {\r
3906             result.only = only;\r
3907         }\r
3908         return result;\r
3909     }\r
3910     CodeActionContext.create = create;\r
3911     /**\r
3912      * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
3913      */\r
3914     function is(value) {\r
3915         var candidate = value;\r
3916         return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
3917     }\r
3918     CodeActionContext.is = is;\r
3919 })(CodeActionContext || (CodeActionContext = {}));\r
3920 var CodeAction;\r
3921 (function (CodeAction) {\r
3922     function create(title, commandOrEdit, kind) {\r
3923         var result = { title: title };\r
3924         if (Command.is(commandOrEdit)) {\r
3925             result.command = commandOrEdit;\r
3926         }\r
3927         else {\r
3928             result.edit = commandOrEdit;\r
3929         }\r
3930         if (kind !== void 0) {\r
3931             result.kind = kind;\r
3932         }\r
3933         return result;\r
3934     }\r
3935     CodeAction.create = create;\r
3936     function is(value) {\r
3937         var candidate = value;\r
3938         return candidate && Is.string(candidate.title) &&\r
3939             (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
3940             (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
3941             (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
3942             (candidate.command === void 0 || Command.is(candidate.command)) &&\r
3943             (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
3944             (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
3945     }\r
3946     CodeAction.is = is;\r
3947 })(CodeAction || (CodeAction = {}));\r
3948 /**\r
3949  * The CodeLens namespace provides helper functions to work with\r
3950  * [CodeLens](#CodeLens) literals.\r
3951  */\r
3952 var CodeLens;\r
3953 (function (CodeLens) {\r
3954     /**\r
3955      * Creates a new CodeLens literal.\r
3956      */\r
3957     function create(range, data) {\r
3958         var result = { range: range };\r
3959         if (Is.defined(data)) {\r
3960             result.data = data;\r
3961         }\r
3962         return result;\r
3963     }\r
3964     CodeLens.create = create;\r
3965     /**\r
3966      * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
3967      */\r
3968     function is(value) {\r
3969         var candidate = value;\r
3970         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
3971     }\r
3972     CodeLens.is = is;\r
3973 })(CodeLens || (CodeLens = {}));\r
3974 /**\r
3975  * The FormattingOptions namespace provides helper functions to work with\r
3976  * [FormattingOptions](#FormattingOptions) literals.\r
3977  */\r
3978 var FormattingOptions;\r
3979 (function (FormattingOptions) {\r
3980     /**\r
3981      * Creates a new FormattingOptions literal.\r
3982      */\r
3983     function create(tabSize, insertSpaces) {\r
3984         return { tabSize: tabSize, insertSpaces: insertSpaces };\r
3985     }\r
3986     FormattingOptions.create = create;\r
3987     /**\r
3988      * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
3989      */\r
3990     function is(value) {\r
3991         var candidate = value;\r
3992         return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
3993     }\r
3994     FormattingOptions.is = is;\r
3995 })(FormattingOptions || (FormattingOptions = {}));\r
3996 /**\r
3997  * The DocumentLink namespace provides helper functions to work with\r
3998  * [DocumentLink](#DocumentLink) literals.\r
3999  */\r
4000 var DocumentLink;\r
4001 (function (DocumentLink) {\r
4002     /**\r
4003      * Creates a new DocumentLink literal.\r
4004      */\r
4005     function create(range, target, data) {\r
4006         return { range: range, target: target, data: data };\r
4007     }\r
4008     DocumentLink.create = create;\r
4009     /**\r
4010      * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
4011      */\r
4012     function is(value) {\r
4013         var candidate = value;\r
4014         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
4015     }\r
4016     DocumentLink.is = is;\r
4017 })(DocumentLink || (DocumentLink = {}));\r
4018 /**\r
4019  * The SelectionRange namespace provides helper function to work with\r
4020  * SelectionRange literals.\r
4021  */\r
4022 var SelectionRange;\r
4023 (function (SelectionRange) {\r
4024     /**\r
4025      * Creates a new SelectionRange\r
4026      * @param range the range.\r
4027      * @param parent an optional parent.\r
4028      */\r
4029     function create(range, parent) {\r
4030         return { range: range, parent: parent };\r
4031     }\r
4032     SelectionRange.create = create;\r
4033     function is(value) {\r
4034         var candidate = value;\r
4035         return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
4036     }\r
4037     SelectionRange.is = is;\r
4038 })(SelectionRange || (SelectionRange = {}));\r
4039 var EOL = ['\n', '\r\n', '\r'];\r
4040 /**\r
4041  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
4042  */\r
4043 var TextDocument;\r
4044 (function (TextDocument) {\r
4045     /**\r
4046      * Creates a new ITextDocument literal from the given uri and content.\r
4047      * @param uri The document's uri.\r
4048      * @param languageId  The document's language Id.\r
4049      * @param content The document's content.\r
4050      */\r
4051     function create(uri, languageId, version, content) {\r
4052         return new FullTextDocument(uri, languageId, version, content);\r
4053     }\r
4054     TextDocument.create = create;\r
4055     /**\r
4056      * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
4057      */\r
4058     function is(value) {\r
4059         var candidate = value;\r
4060         return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
4061             && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
4062     }\r
4063     TextDocument.is = is;\r
4064     function applyEdits(document, edits) {\r
4065         var text = document.getText();\r
4066         var sortedEdits = mergeSort(edits, function (a, b) {\r
4067             var diff = a.range.start.line - b.range.start.line;\r
4068             if (diff === 0) {\r
4069                 return a.range.start.character - b.range.start.character;\r
4070             }\r
4071             return diff;\r
4072         });\r
4073         var lastModifiedOffset = text.length;\r
4074         for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
4075             var e = sortedEdits[i];\r
4076             var startOffset = document.offsetAt(e.range.start);\r
4077             var endOffset = document.offsetAt(e.range.end);\r
4078             if (endOffset <= lastModifiedOffset) {\r
4079                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
4080             }\r
4081             else {\r
4082                 throw new Error('Overlapping edit');\r
4083             }\r
4084             lastModifiedOffset = startOffset;\r
4085         }\r
4086         return text;\r
4087     }\r
4088     TextDocument.applyEdits = applyEdits;\r
4089     function mergeSort(data, compare) {\r
4090         if (data.length <= 1) {\r
4091             // sorted\r
4092             return data;\r
4093         }\r
4094         var p = (data.length / 2) | 0;\r
4095         var left = data.slice(0, p);\r
4096         var right = data.slice(p);\r
4097         mergeSort(left, compare);\r
4098         mergeSort(right, compare);\r
4099         var leftIdx = 0;\r
4100         var rightIdx = 0;\r
4101         var i = 0;\r
4102         while (leftIdx < left.length && rightIdx < right.length) {\r
4103             var ret = compare(left[leftIdx], right[rightIdx]);\r
4104             if (ret <= 0) {\r
4105                 // smaller_equal -> take left to preserve order\r
4106                 data[i++] = left[leftIdx++];\r
4107             }\r
4108             else {\r
4109                 // greater -> take right\r
4110                 data[i++] = right[rightIdx++];\r
4111             }\r
4112         }\r
4113         while (leftIdx < left.length) {\r
4114             data[i++] = left[leftIdx++];\r
4115         }\r
4116         while (rightIdx < right.length) {\r
4117             data[i++] = right[rightIdx++];\r
4118         }\r
4119         return data;\r
4120     }\r
4121 })(TextDocument || (TextDocument = {}));\r
4122 var FullTextDocument = /** @class */ (function () {\r
4123     function FullTextDocument(uri, languageId, version, content) {\r
4124         this._uri = uri;\r
4125         this._languageId = languageId;\r
4126         this._version = version;\r
4127         this._content = content;\r
4128         this._lineOffsets = undefined;\r
4129     }\r
4130     Object.defineProperty(FullTextDocument.prototype, "uri", {\r
4131         get: function () {\r
4132             return this._uri;\r
4133         },\r
4134         enumerable: true,\r
4135         configurable: true\r
4136     });\r
4137     Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
4138         get: function () {\r
4139             return this._languageId;\r
4140         },\r
4141         enumerable: true,\r
4142         configurable: true\r
4143     });\r
4144     Object.defineProperty(FullTextDocument.prototype, "version", {\r
4145         get: function () {\r
4146             return this._version;\r
4147         },\r
4148         enumerable: true,\r
4149         configurable: true\r
4150     });\r
4151     FullTextDocument.prototype.getText = function (range) {\r
4152         if (range) {\r
4153             var start = this.offsetAt(range.start);\r
4154             var end = this.offsetAt(range.end);\r
4155             return this._content.substring(start, end);\r
4156         }\r
4157         return this._content;\r
4158     };\r
4159     FullTextDocument.prototype.update = function (event, version) {\r
4160         this._content = event.text;\r
4161         this._version = version;\r
4162         this._lineOffsets = undefined;\r
4163     };\r
4164     FullTextDocument.prototype.getLineOffsets = function () {\r
4165         if (this._lineOffsets === undefined) {\r
4166             var lineOffsets = [];\r
4167             var text = this._content;\r
4168             var isLineStart = true;\r
4169             for (var i = 0; i < text.length; i++) {\r
4170                 if (isLineStart) {\r
4171                     lineOffsets.push(i);\r
4172                     isLineStart = false;\r
4173                 }\r
4174                 var ch = text.charAt(i);\r
4175                 isLineStart = (ch === '\r' || ch === '\n');\r
4176                 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
4177                     i++;\r
4178                 }\r
4179             }\r
4180             if (isLineStart && text.length > 0) {\r
4181                 lineOffsets.push(text.length);\r
4182             }\r
4183             this._lineOffsets = lineOffsets;\r
4184         }\r
4185         return this._lineOffsets;\r
4186     };\r
4187     FullTextDocument.prototype.positionAt = function (offset) {\r
4188         offset = Math.max(Math.min(offset, this._content.length), 0);\r
4189         var lineOffsets = this.getLineOffsets();\r
4190         var low = 0, high = lineOffsets.length;\r
4191         if (high === 0) {\r
4192             return Position.create(0, offset);\r
4193         }\r
4194         while (low < high) {\r
4195             var mid = Math.floor((low + high) / 2);\r
4196             if (lineOffsets[mid] > offset) {\r
4197                 high = mid;\r
4198             }\r
4199             else {\r
4200                 low = mid + 1;\r
4201             }\r
4202         }\r
4203         // low is the least x for which the line offset is larger than the current offset\r
4204         // or array.length if no line offset is larger than the current offset\r
4205         var line = low - 1;\r
4206         return Position.create(line, offset - lineOffsets[line]);\r
4207     };\r
4208     FullTextDocument.prototype.offsetAt = function (position) {\r
4209         var lineOffsets = this.getLineOffsets();\r
4210         if (position.line >= lineOffsets.length) {\r
4211             return this._content.length;\r
4212         }\r
4213         else if (position.line < 0) {\r
4214             return 0;\r
4215         }\r
4216         var lineOffset = lineOffsets[position.line];\r
4217         var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
4218         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
4219     };\r
4220     Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
4221         get: function () {\r
4222             return this.getLineOffsets().length;\r
4223         },\r
4224         enumerable: true,\r
4225         configurable: true\r
4226     });\r
4227     return FullTextDocument;\r
4228 }());\r
4229 var Is;\r
4230 (function (Is) {\r
4231     var toString = Object.prototype.toString;\r
4232     function defined(value) {\r
4233         return typeof value !== 'undefined';\r
4234     }\r
4235     Is.defined = defined;\r
4236     function undefined(value) {\r
4237         return typeof value === 'undefined';\r
4238     }\r
4239     Is.undefined = undefined;\r
4240     function boolean(value) {\r
4241         return value === true || value === false;\r
4242     }\r
4243     Is.boolean = boolean;\r
4244     function string(value) {\r
4245         return toString.call(value) === '[object String]';\r
4246     }\r
4247     Is.string = string;\r
4248     function number(value) {\r
4249         return toString.call(value) === '[object Number]';\r
4250     }\r
4251     Is.number = number;\r
4252     function func(value) {\r
4253         return toString.call(value) === '[object Function]';\r
4254     }\r
4255     Is.func = func;\r
4256     function objectLiteral(value) {\r
4257         // Strictly speaking class instances pass this check as well. Since the LSP\r
4258         // doesn't use classes we ignore this for now. If we do we need to add something\r
4259         // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4260         return value !== null && typeof value === 'object';\r
4261     }\r
4262     Is.objectLiteral = objectLiteral;\r
4263     function typedArray(value, check) {\r
4264         return Array.isArray(value) && value.every(check);\r
4265     }\r
4266     Is.typedArray = typedArray;\r
4267 })(Is || (Is = {}));\r
4268
4269
4270 /***/ }),
4271 /* 19 */
4272 /***/ (function(module, exports, __webpack_require__) {
4273
4274 "use strict";
4275 /* --------------------------------------------------------------------------------------------\r
4276  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4277  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4278  * ------------------------------------------------------------------------------------------ */\r
4279 \r
4280 Object.defineProperty(exports, "__esModule", { value: true });\r
4281 const Is = __webpack_require__(20);\r
4282 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4283 const messages_1 = __webpack_require__(21);\r
4284 const protocol_implementation_1 = __webpack_require__(22);\r
4285 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
4286 const protocol_typeDefinition_1 = __webpack_require__(23);\r
4287 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
4288 const protocol_workspaceFolders_1 = __webpack_require__(24);\r
4289 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
4290 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
4291 const protocol_configuration_1 = __webpack_require__(25);\r
4292 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
4293 const protocol_colorProvider_1 = __webpack_require__(26);\r
4294 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
4295 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
4296 const protocol_foldingRange_1 = __webpack_require__(27);\r
4297 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
4298 const protocol_declaration_1 = __webpack_require__(28);\r
4299 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
4300 const protocol_selectionRange_1 = __webpack_require__(29);\r
4301 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
4302 const protocol_progress_1 = __webpack_require__(30);\r
4303 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
4304 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
4305 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
4306 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4307 let __noDynamicImport;\r
4308 /**\r
4309  * The DocumentFilter namespace provides helper functions to work with\r
4310  * [DocumentFilter](#DocumentFilter) literals.\r
4311  */\r
4312 var DocumentFilter;\r
4313 (function (DocumentFilter) {\r
4314     function is(value) {\r
4315         const candidate = value;\r
4316         return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
4317     }\r
4318     DocumentFilter.is = is;\r
4319 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
4320 /**\r
4321  * The DocumentSelector namespace provides helper functions to work with\r
4322  * [DocumentSelector](#DocumentSelector)s.\r
4323  */\r
4324 var DocumentSelector;\r
4325 (function (DocumentSelector) {\r
4326     function is(value) {\r
4327         if (!Array.isArray(value)) {\r
4328             return false;\r
4329         }\r
4330         for (let elem of value) {\r
4331             if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
4332                 return false;\r
4333             }\r
4334         }\r
4335         return true;\r
4336     }\r
4337     DocumentSelector.is = is;\r
4338 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
4339 /**\r
4340  * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
4341  * handler on the client side.\r
4342  */\r
4343 var RegistrationRequest;\r
4344 (function (RegistrationRequest) {\r
4345     RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');\r
4346 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
4347 /**\r
4348  * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
4349  * handler on the client side.\r
4350  */\r
4351 var UnregistrationRequest;\r
4352 (function (UnregistrationRequest) {\r
4353     UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');\r
4354 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
4355 var ResourceOperationKind;\r
4356 (function (ResourceOperationKind) {\r
4357     /**\r
4358      * Supports creating new files and folders.\r
4359      */\r
4360     ResourceOperationKind.Create = 'create';\r
4361     /**\r
4362      * Supports renaming existing files and folders.\r
4363      */\r
4364     ResourceOperationKind.Rename = 'rename';\r
4365     /**\r
4366      * Supports deleting existing files and folders.\r
4367      */\r
4368     ResourceOperationKind.Delete = 'delete';\r
4369 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
4370 var FailureHandlingKind;\r
4371 (function (FailureHandlingKind) {\r
4372     /**\r
4373      * Applying the workspace change is simply aborted if one of the changes provided\r
4374      * fails. All operations executed before the failing operation stay executed.\r
4375      */\r
4376     FailureHandlingKind.Abort = 'abort';\r
4377     /**\r
4378      * All operations are executed transactional. That means they either all\r
4379      * succeed or no changes at all are applied to the workspace.\r
4380      */\r
4381     FailureHandlingKind.Transactional = 'transactional';\r
4382     /**\r
4383      * If the workspace edit contains only textual file changes they are executed transactional.\r
4384      * If resource changes (create, rename or delete file) are part of the change the failure\r
4385      * handling startegy is abort.\r
4386      */\r
4387     FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
4388     /**\r
4389      * The client tries to undo the operations already executed. But there is no\r
4390      * guarantee that this is succeeding.\r
4391      */\r
4392     FailureHandlingKind.Undo = 'undo';\r
4393 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
4394 /**\r
4395  * The StaticRegistrationOptions namespace provides helper functions to work with\r
4396  * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
4397  */\r
4398 var StaticRegistrationOptions;\r
4399 (function (StaticRegistrationOptions) {\r
4400     function hasId(value) {\r
4401         const candidate = value;\r
4402         return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
4403     }\r
4404     StaticRegistrationOptions.hasId = hasId;\r
4405 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
4406 /**\r
4407  * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
4408  * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
4409  */\r
4410 var TextDocumentRegistrationOptions;\r
4411 (function (TextDocumentRegistrationOptions) {\r
4412     function is(value) {\r
4413         const candidate = value;\r
4414         return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
4415     }\r
4416     TextDocumentRegistrationOptions.is = is;\r
4417 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
4418 /**\r
4419  * The WorkDoneProgressOptions namespace provides helper functions to work with\r
4420  * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
4421  */\r
4422 var WorkDoneProgressOptions;\r
4423 (function (WorkDoneProgressOptions) {\r
4424     function is(value) {\r
4425         const candidate = value;\r
4426         return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
4427     }\r
4428     WorkDoneProgressOptions.is = is;\r
4429     function hasWorkDoneProgress(value) {\r
4430         const candidate = value;\r
4431         return candidate && Is.boolean(candidate.workDoneProgress);\r
4432     }\r
4433     WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
4434 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
4435 /**\r
4436  * The initialize request is sent from the client to the server.\r
4437  * It is sent once as the request after starting up the server.\r
4438  * The requests parameter is of type [InitializeParams](#InitializeParams)\r
4439  * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
4440  * resolves to such.\r
4441  */\r
4442 var InitializeRequest;\r
4443 (function (InitializeRequest) {\r
4444     InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');\r
4445 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
4446 /**\r
4447  * Known error codes for an `InitializeError`;\r
4448  */\r
4449 var InitializeError;\r
4450 (function (InitializeError) {\r
4451     /**\r
4452      * If the protocol version provided by the client can't be handled by the server.\r
4453      * @deprecated This initialize error got replaced by client capabilities. There is\r
4454      * no version handshake in version 3.0x\r
4455      */\r
4456     InitializeError.unknownProtocolVersion = 1;\r
4457 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
4458 /**\r
4459  * The intialized notification is sent from the client to the\r
4460  * server after the client is fully initialized and the server\r
4461  * is allowed to send requests from the server to the client.\r
4462  */\r
4463 var InitializedNotification;\r
4464 (function (InitializedNotification) {\r
4465     InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');\r
4466 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
4467 //---- Shutdown Method ----\r
4468 /**\r
4469  * A shutdown request is sent from the client to the server.\r
4470  * It is sent once when the client decides to shutdown the\r
4471  * server. The only notification that is sent after a shutdown request\r
4472  * is the exit event.\r
4473  */\r
4474 var ShutdownRequest;\r
4475 (function (ShutdownRequest) {\r
4476     ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');\r
4477 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
4478 //---- Exit Notification ----\r
4479 /**\r
4480  * The exit event is sent from the client to the server to\r
4481  * ask the server to exit its process.\r
4482  */\r
4483 var ExitNotification;\r
4484 (function (ExitNotification) {\r
4485     ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');\r
4486 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
4487 /**\r
4488  * The configuration change notification is sent from the client to the server\r
4489  * when the client's configuration has changed. The notification contains\r
4490  * the changed configuration as defined by the language client.\r
4491  */\r
4492 var DidChangeConfigurationNotification;\r
4493 (function (DidChangeConfigurationNotification) {\r
4494     DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');\r
4495 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
4496 //---- Message show and log notifications ----\r
4497 /**\r
4498  * The message type\r
4499  */\r
4500 var MessageType;\r
4501 (function (MessageType) {\r
4502     /**\r
4503      * An error message.\r
4504      */\r
4505     MessageType.Error = 1;\r
4506     /**\r
4507      * A warning message.\r
4508      */\r
4509     MessageType.Warning = 2;\r
4510     /**\r
4511      * An information message.\r
4512      */\r
4513     MessageType.Info = 3;\r
4514     /**\r
4515      * A log message.\r
4516      */\r
4517     MessageType.Log = 4;\r
4518 })(MessageType = exports.MessageType || (exports.MessageType = {}));\r
4519 /**\r
4520  * The show message notification is sent from a server to a client to ask\r
4521  * the client to display a particular message in the user interface.\r
4522  */\r
4523 var ShowMessageNotification;\r
4524 (function (ShowMessageNotification) {\r
4525     ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');\r
4526 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
4527 /**\r
4528  * The show message request is sent from the server to the client to show a message\r
4529  * and a set of options actions to the user.\r
4530  */\r
4531 var ShowMessageRequest;\r
4532 (function (ShowMessageRequest) {\r
4533     ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');\r
4534 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
4535 /**\r
4536  * The log message notification is sent from the server to the client to ask\r
4537  * the client to log a particular message.\r
4538  */\r
4539 var LogMessageNotification;\r
4540 (function (LogMessageNotification) {\r
4541     LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');\r
4542 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
4543 //---- Telemetry notification\r
4544 /**\r
4545  * The telemetry event notification is sent from the server to the client to ask\r
4546  * the client to log telemetry data.\r
4547  */\r
4548 var TelemetryEventNotification;\r
4549 (function (TelemetryEventNotification) {\r
4550     TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');\r
4551 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
4552 /**\r
4553  * Defines how the host (editor) should sync\r
4554  * document changes to the language server.\r
4555  */\r
4556 var TextDocumentSyncKind;\r
4557 (function (TextDocumentSyncKind) {\r
4558     /**\r
4559      * Documents should not be synced at all.\r
4560      */\r
4561     TextDocumentSyncKind.None = 0;\r
4562     /**\r
4563      * Documents are synced by always sending the full content\r
4564      * of the document.\r
4565      */\r
4566     TextDocumentSyncKind.Full = 1;\r
4567     /**\r
4568      * Documents are synced by sending the full content on open.\r
4569      * After that only incremental updates to the document are\r
4570      * send.\r
4571      */\r
4572     TextDocumentSyncKind.Incremental = 2;\r
4573 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
4574 /**\r
4575  * The document open notification is sent from the client to the server to signal\r
4576  * newly opened text documents. The document's truth is now managed by the client\r
4577  * and the server must not try to read the document's truth using the document's\r
4578  * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
4579  * mean that its content is presented in an editor. An open notification must not\r
4580  * be sent more than once without a corresponding close notification send before.\r
4581  * This means open and close notification must be balanced and the max open count\r
4582  * is one.\r
4583  */\r
4584 var DidOpenTextDocumentNotification;\r
4585 (function (DidOpenTextDocumentNotification) {\r
4586     DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
4587     DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\r
4588 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
4589 /**\r
4590  * The document change notification is sent from the client to the server to signal\r
4591  * changes to a text document.\r
4592  */\r
4593 var DidChangeTextDocumentNotification;\r
4594 (function (DidChangeTextDocumentNotification) {\r
4595     DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
4596     DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\r
4597 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
4598 /**\r
4599  * The document close notification is sent from the client to the server when\r
4600  * the document got closed in the client. The document's truth now exists where\r
4601  * the document's uri points to (e.g. if the document's uri is a file uri the\r
4602  * truth now exists on disk). As with the open notification the close notification\r
4603  * is about managing the document's content. Receiving a close notification\r
4604  * doesn't mean that the document was open in an editor before. A close\r
4605  * notification requires a previous open notification to be sent.\r
4606  */\r
4607 var DidCloseTextDocumentNotification;\r
4608 (function (DidCloseTextDocumentNotification) {\r
4609     DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
4610     DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\r
4611 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
4612 /**\r
4613  * The document save notification is sent from the client to the server when\r
4614  * the document got saved in the client.\r
4615  */\r
4616 var DidSaveTextDocumentNotification;\r
4617 (function (DidSaveTextDocumentNotification) {\r
4618     DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
4619     DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\r
4620 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
4621 /**\r
4622  * Represents reasons why a text document is saved.\r
4623  */\r
4624 var TextDocumentSaveReason;\r
4625 (function (TextDocumentSaveReason) {\r
4626     /**\r
4627      * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
4628      * or by an API call.\r
4629      */\r
4630     TextDocumentSaveReason.Manual = 1;\r
4631     /**\r
4632      * Automatic after a delay.\r
4633      */\r
4634     TextDocumentSaveReason.AfterDelay = 2;\r
4635     /**\r
4636      * When the editor lost focus.\r
4637      */\r
4638     TextDocumentSaveReason.FocusOut = 3;\r
4639 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
4640 /**\r
4641  * A document will save notification is sent from the client to the server before\r
4642  * the document is actually saved.\r
4643  */\r
4644 var WillSaveTextDocumentNotification;\r
4645 (function (WillSaveTextDocumentNotification) {\r
4646     WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
4647     WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\r
4648 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
4649 /**\r
4650  * A document will save request is sent from the client to the server before\r
4651  * the document is actually saved. The request can return an array of TextEdits\r
4652  * which will be applied to the text document before it is saved. Please note that\r
4653  * clients might drop results if computing the text edits took too long or if a\r
4654  * server constantly fails on this request. This is done to keep the save fast and\r
4655  * reliable.\r
4656  */\r
4657 var WillSaveTextDocumentWaitUntilRequest;\r
4658 (function (WillSaveTextDocumentWaitUntilRequest) {\r
4659     WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
4660     WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
4661 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
4662 /**\r
4663  * The watched files notification is sent from the client to the server when\r
4664  * the client detects changes to file watched by the language client.\r
4665  */\r
4666 var DidChangeWatchedFilesNotification;\r
4667 (function (DidChangeWatchedFilesNotification) {\r
4668     DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');\r
4669 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
4670 /**\r
4671  * The file event type\r
4672  */\r
4673 var FileChangeType;\r
4674 (function (FileChangeType) {\r
4675     /**\r
4676      * The file got created.\r
4677      */\r
4678     FileChangeType.Created = 1;\r
4679     /**\r
4680      * The file got changed.\r
4681      */\r
4682     FileChangeType.Changed = 2;\r
4683     /**\r
4684      * The file got deleted.\r
4685      */\r
4686     FileChangeType.Deleted = 3;\r
4687 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
4688 var WatchKind;\r
4689 (function (WatchKind) {\r
4690     /**\r
4691      * Interested in create events.\r
4692      */\r
4693     WatchKind.Create = 1;\r
4694     /**\r
4695      * Interested in change events\r
4696      */\r
4697     WatchKind.Change = 2;\r
4698     /**\r
4699      * Interested in delete events\r
4700      */\r
4701     WatchKind.Delete = 4;\r
4702 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
4703 /**\r
4704  * Diagnostics notification are sent from the server to the client to signal\r
4705  * results of validation runs.\r
4706  */\r
4707 var PublishDiagnosticsNotification;\r
4708 (function (PublishDiagnosticsNotification) {\r
4709     PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');\r
4710 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
4711 /**\r
4712  * How a completion was triggered\r
4713  */\r
4714 var CompletionTriggerKind;\r
4715 (function (CompletionTriggerKind) {\r
4716     /**\r
4717      * Completion was triggered by typing an identifier (24x7 code\r
4718      * complete), manual invocation (e.g Ctrl+Space) or via API.\r
4719      */\r
4720     CompletionTriggerKind.Invoked = 1;\r
4721     /**\r
4722      * Completion was triggered by a trigger character specified by\r
4723      * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
4724      */\r
4725     CompletionTriggerKind.TriggerCharacter = 2;\r
4726     /**\r
4727      * Completion was re-triggered as current completion list is incomplete\r
4728      */\r
4729     CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
4730 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
4731 /**\r
4732  * Request to request completion at a given text document position. The request's\r
4733  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
4734  * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
4735  * or a Thenable that resolves to such.\r
4736  *\r
4737  * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
4738  * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
4739  * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
4740  * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
4741  */\r
4742 var CompletionRequest;\r
4743 (function (CompletionRequest) {\r
4744     CompletionRequest.method = 'textDocument/completion';\r
4745     CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\r
4746     /** @deprecated Use CompletionRequest.type */\r
4747     CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4748 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
4749 /**\r
4750  * Request to resolve additional information for a given completion item.The request's\r
4751  * parameter is of type [CompletionItem](#CompletionItem) the response\r
4752  * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
4753  */\r
4754 var CompletionResolveRequest;\r
4755 (function (CompletionResolveRequest) {\r
4756     CompletionResolveRequest.method = 'completionItem/resolve';\r
4757     CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\r
4758 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
4759 /**\r
4760  * Request to request hover information at a given text document position. The request's\r
4761  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
4762  * type [Hover](#Hover) or a Thenable that resolves to such.\r
4763  */\r
4764 var HoverRequest;\r
4765 (function (HoverRequest) {\r
4766     HoverRequest.method = 'textDocument/hover';\r
4767     HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\r
4768 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
4769 /**\r
4770  * How a signature help was triggered.\r
4771  *\r
4772  * @since 3.15.0\r
4773  */\r
4774 var SignatureHelpTriggerKind;\r
4775 (function (SignatureHelpTriggerKind) {\r
4776     /**\r
4777      * Signature help was invoked manually by the user or by a command.\r
4778      */\r
4779     SignatureHelpTriggerKind.Invoked = 1;\r
4780     /**\r
4781      * Signature help was triggered by a trigger character.\r
4782      */\r
4783     SignatureHelpTriggerKind.TriggerCharacter = 2;\r
4784     /**\r
4785      * Signature help was triggered by the cursor moving or by the document content changing.\r
4786      */\r
4787     SignatureHelpTriggerKind.ContentChange = 3;\r
4788 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
4789 var SignatureHelpRequest;\r
4790 (function (SignatureHelpRequest) {\r
4791     SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
4792     SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\r
4793 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
4794 /**\r
4795  * A request to resolve the definition location of a symbol at a given text\r
4796  * document position. The request's parameter is of type [TextDocumentPosition]\r
4797  * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
4798  * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
4799  * to such.\r
4800  */\r
4801 var DefinitionRequest;\r
4802 (function (DefinitionRequest) {\r
4803     DefinitionRequest.method = 'textDocument/definition';\r
4804     DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\r
4805     /** @deprecated Use DefinitionRequest.type */\r
4806     DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4807 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
4808 /**\r
4809  * A request to resolve project-wide references for the symbol denoted\r
4810  * by the given text document position. The request's parameter is of\r
4811  * type [ReferenceParams](#ReferenceParams) the response is of type\r
4812  * [Location[]](#Location) or a Thenable that resolves to such.\r
4813  */\r
4814 var ReferencesRequest;\r
4815 (function (ReferencesRequest) {\r
4816     ReferencesRequest.method = 'textDocument/references';\r
4817     ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\r
4818     /** @deprecated Use ReferencesRequest.type */\r
4819     ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4820 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
4821 /**\r
4822  * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
4823  * text document position. The request's parameter is of type [TextDocumentPosition]\r
4824  * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
4825  * (#DocumentHighlight) or a Thenable that resolves to such.\r
4826  */\r
4827 var DocumentHighlightRequest;\r
4828 (function (DocumentHighlightRequest) {\r
4829     DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
4830     DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\r
4831     /** @deprecated Use DocumentHighlightRequest.type */\r
4832     DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4833 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
4834 /**\r
4835  * A request to list all symbols found in a given text document. The request's\r
4836  * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
4837  * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
4838  * that resolves to such.\r
4839  */\r
4840 var DocumentSymbolRequest;\r
4841 (function (DocumentSymbolRequest) {\r
4842     DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
4843     DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\r
4844     /** @deprecated Use DocumentSymbolRequest.type */\r
4845     DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4846 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
4847 /**\r
4848  * A request to provide commands for the given text document and range.\r
4849  */\r
4850 var CodeActionRequest;\r
4851 (function (CodeActionRequest) {\r
4852     CodeActionRequest.method = 'textDocument/codeAction';\r
4853     CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\r
4854     /** @deprecated Use CodeActionRequest.type */\r
4855     CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4856 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
4857 /**\r
4858  * A request to list project-wide symbols matching the query string given\r
4859  * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
4860  * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
4861  * resolves to such.\r
4862  */\r
4863 var WorkspaceSymbolRequest;\r
4864 (function (WorkspaceSymbolRequest) {\r
4865     WorkspaceSymbolRequest.method = 'workspace/symbol';\r
4866     WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\r
4867     /** @deprecated Use WorkspaceSymbolRequest.type */\r
4868     WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4869 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
4870 /**\r
4871  * A request to provide code lens for the given text document.\r
4872  */\r
4873 var CodeLensRequest;\r
4874 (function (CodeLensRequest) {\r
4875     CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');\r
4876     /** @deprecated Use CodeLensRequest.type */\r
4877     CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4878 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
4879 /**\r
4880  * A request to resolve a command for a given code lens.\r
4881  */\r
4882 var CodeLensResolveRequest;\r
4883 (function (CodeLensResolveRequest) {\r
4884     CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');\r
4885 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
4886 /**\r
4887  * A request to provide document links\r
4888  */\r
4889 var DocumentLinkRequest;\r
4890 (function (DocumentLinkRequest) {\r
4891     DocumentLinkRequest.method = 'textDocument/documentLink';\r
4892     DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\r
4893     /** @deprecated Use DocumentLinkRequest.type */\r
4894     DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4895 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
4896 /**\r
4897  * Request to resolve additional information for a given document link. The request's\r
4898  * parameter is of type [DocumentLink](#DocumentLink) the response\r
4899  * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
4900  */\r
4901 var DocumentLinkResolveRequest;\r
4902 (function (DocumentLinkResolveRequest) {\r
4903     DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');\r
4904 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
4905 /**\r
4906  * A request to to format a whole document.\r
4907  */\r
4908 var DocumentFormattingRequest;\r
4909 (function (DocumentFormattingRequest) {\r
4910     DocumentFormattingRequest.method = 'textDocument/formatting';\r
4911     DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\r
4912 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
4913 /**\r
4914  * A request to to format a range in a document.\r
4915  */\r
4916 var DocumentRangeFormattingRequest;\r
4917 (function (DocumentRangeFormattingRequest) {\r
4918     DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
4919     DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\r
4920 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
4921 /**\r
4922  * A request to format a document on type.\r
4923  */\r
4924 var DocumentOnTypeFormattingRequest;\r
4925 (function (DocumentOnTypeFormattingRequest) {\r
4926     DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
4927     DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\r
4928 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
4929 /**\r
4930  * A request to rename a symbol.\r
4931  */\r
4932 var RenameRequest;\r
4933 (function (RenameRequest) {\r
4934     RenameRequest.method = 'textDocument/rename';\r
4935     RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\r
4936 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
4937 /**\r
4938  * A request to test and perform the setup necessary for a rename.\r
4939  */\r
4940 var PrepareRenameRequest;\r
4941 (function (PrepareRenameRequest) {\r
4942     PrepareRenameRequest.method = 'textDocument/prepareRename';\r
4943     PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\r
4944 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
4945 /**\r
4946  * A request send from the client to the server to execute a command. The request might return\r
4947  * a workspace edit which the client will apply to the workspace.\r
4948  */\r
4949 var ExecuteCommandRequest;\r
4950 (function (ExecuteCommandRequest) {\r
4951     ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');\r
4952 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
4953 /**\r
4954  * A request sent from the server to the client to modified certain resources.\r
4955  */\r
4956 var ApplyWorkspaceEditRequest;\r
4957 (function (ApplyWorkspaceEditRequest) {\r
4958     ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\r
4959 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
4960
4961
4962 /***/ }),
4963 /* 20 */
4964 /***/ (function(module, exports, __webpack_require__) {
4965
4966 "use strict";
4967 /* --------------------------------------------------------------------------------------------\r
4968  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4969  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4970  * ------------------------------------------------------------------------------------------ */\r
4971 \r
4972 Object.defineProperty(exports, "__esModule", { value: true });\r
4973 function boolean(value) {\r
4974     return value === true || value === false;\r
4975 }\r
4976 exports.boolean = boolean;\r
4977 function string(value) {\r
4978     return typeof value === 'string' || value instanceof String;\r
4979 }\r
4980 exports.string = string;\r
4981 function number(value) {\r
4982     return typeof value === 'number' || value instanceof Number;\r
4983 }\r
4984 exports.number = number;\r
4985 function error(value) {\r
4986     return value instanceof Error;\r
4987 }\r
4988 exports.error = error;\r
4989 function func(value) {\r
4990     return typeof value === 'function';\r
4991 }\r
4992 exports.func = func;\r
4993 function array(value) {\r
4994     return Array.isArray(value);\r
4995 }\r
4996 exports.array = array;\r
4997 function stringArray(value) {\r
4998     return array(value) && value.every(elem => string(elem));\r
4999 }\r
5000 exports.stringArray = stringArray;\r
5001 function typedArray(value, check) {\r
5002     return Array.isArray(value) && value.every(check);\r
5003 }\r
5004 exports.typedArray = typedArray;\r
5005 function objectLiteral(value) {\r
5006     // Strictly speaking class instances pass this check as well. Since the LSP\r
5007     // doesn't use classes we ignore this for now. If we do we need to add something\r
5008     // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
5009     return value !== null && typeof value === 'object';\r
5010 }\r
5011 exports.objectLiteral = objectLiteral;\r
5012
5013
5014 /***/ }),
5015 /* 21 */
5016 /***/ (function(module, exports, __webpack_require__) {
5017
5018 "use strict";
5019 /* --------------------------------------------------------------------------------------------\r
5020  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5021  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5022  * ------------------------------------------------------------------------------------------ */\r
5023 \r
5024 Object.defineProperty(exports, "__esModule", { value: true });\r
5025 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5026 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\r
5027     constructor(method) {\r
5028         super(method);\r
5029     }\r
5030 }\r
5031 exports.ProtocolRequestType0 = ProtocolRequestType0;\r
5032 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\r
5033     constructor(method) {\r
5034         super(method);\r
5035     }\r
5036 }\r
5037 exports.ProtocolRequestType = ProtocolRequestType;\r
5038 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\r
5039     constructor(method) {\r
5040         super(method);\r
5041     }\r
5042 }\r
5043 exports.ProtocolNotificationType = ProtocolNotificationType;\r
5044 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\r
5045     constructor(method) {\r
5046         super(method);\r
5047     }\r
5048 }\r
5049 exports.ProtocolNotificationType0 = ProtocolNotificationType0;\r
5050
5051
5052 /***/ }),
5053 /* 22 */
5054 /***/ (function(module, exports, __webpack_require__) {
5055
5056 "use strict";
5057 /* --------------------------------------------------------------------------------------------\r
5058  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5059  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5060  * ------------------------------------------------------------------------------------------ */\r
5061 \r
5062 Object.defineProperty(exports, "__esModule", { value: true });\r
5063 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5064 const messages_1 = __webpack_require__(21);\r
5065 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5066 let __noDynamicImport;\r
5067 /**\r
5068  * A request to resolve the implementation locations of a symbol at a given text\r
5069  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5070  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
5071  * Thenable that resolves to such.\r
5072  */\r
5073 var ImplementationRequest;\r
5074 (function (ImplementationRequest) {\r
5075     ImplementationRequest.method = 'textDocument/implementation';\r
5076     ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\r
5077     /** @deprecated Use ImplementationRequest.type */\r
5078     ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5079 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
5080
5081
5082 /***/ }),
5083 /* 23 */
5084 /***/ (function(module, exports, __webpack_require__) {
5085
5086 "use strict";
5087 /* --------------------------------------------------------------------------------------------\r
5088  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5089  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5090  * ------------------------------------------------------------------------------------------ */\r
5091 \r
5092 Object.defineProperty(exports, "__esModule", { value: true });\r
5093 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5094 const messages_1 = __webpack_require__(21);\r
5095 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5096 let __noDynamicImport;\r
5097 /**\r
5098  * A request to resolve the type definition locations of a symbol at a given text\r
5099  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5100  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
5101  * Thenable that resolves to such.\r
5102  */\r
5103 var TypeDefinitionRequest;\r
5104 (function (TypeDefinitionRequest) {\r
5105     TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
5106     TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\r
5107     /** @deprecated Use TypeDefinitionRequest.type */\r
5108     TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5109 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
5110
5111
5112 /***/ }),
5113 /* 24 */
5114 /***/ (function(module, exports, __webpack_require__) {
5115
5116 "use strict";
5117 /* --------------------------------------------------------------------------------------------\r
5118  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5119  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5120  * ------------------------------------------------------------------------------------------ */\r
5121 \r
5122 Object.defineProperty(exports, "__esModule", { value: true });\r
5123 const messages_1 = __webpack_require__(21);\r
5124 /**\r
5125  * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
5126  */\r
5127 var WorkspaceFoldersRequest;\r
5128 (function (WorkspaceFoldersRequest) {\r
5129     WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');\r
5130 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
5131 /**\r
5132  * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
5133  * folder configuration changes.\r
5134  */\r
5135 var DidChangeWorkspaceFoldersNotification;\r
5136 (function (DidChangeWorkspaceFoldersNotification) {\r
5137     DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');\r
5138 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
5139
5140
5141 /***/ }),
5142 /* 25 */
5143 /***/ (function(module, exports, __webpack_require__) {
5144
5145 "use strict";
5146 /* --------------------------------------------------------------------------------------------\r
5147  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5148  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5149  * ------------------------------------------------------------------------------------------ */\r
5150 \r
5151 Object.defineProperty(exports, "__esModule", { value: true });\r
5152 const messages_1 = __webpack_require__(21);\r
5153 /**\r
5154  * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
5155  * configuration setting.\r
5156  *\r
5157  * This pull model replaces the old push model were the client signaled configuration change via an\r
5158  * event. If the server still needs to react to configuration changes (since the server caches the\r
5159  * result of `workspace/configuration` requests) the server should register for an empty configuration\r
5160  * change event and empty the cache if such an event is received.\r
5161  */\r
5162 var ConfigurationRequest;\r
5163 (function (ConfigurationRequest) {\r
5164     ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');\r
5165 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
5166
5167
5168 /***/ }),
5169 /* 26 */
5170 /***/ (function(module, exports, __webpack_require__) {
5171
5172 "use strict";
5173 /* --------------------------------------------------------------------------------------------\r
5174  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5175  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5176  * ------------------------------------------------------------------------------------------ */\r
5177 \r
5178 Object.defineProperty(exports, "__esModule", { value: true });\r
5179 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5180 const messages_1 = __webpack_require__(21);\r
5181 /**\r
5182  * A request to list all color symbols found in a given text document. The request's\r
5183  * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
5184  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5185  * that resolves to such.\r
5186  */\r
5187 var DocumentColorRequest;\r
5188 (function (DocumentColorRequest) {\r
5189     DocumentColorRequest.method = 'textDocument/documentColor';\r
5190     DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\r
5191     /** @deprecated Use DocumentColorRequest.type */\r
5192     DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5193 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
5194 /**\r
5195  * A request to list all presentation for a color. The request's\r
5196  * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
5197  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5198  * that resolves to such.\r
5199  */\r
5200 var ColorPresentationRequest;\r
5201 (function (ColorPresentationRequest) {\r
5202     ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');\r
5203 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
5204
5205
5206 /***/ }),
5207 /* 27 */
5208 /***/ (function(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  * Enum of known range kinds\r
5221  */\r
5222 var FoldingRangeKind;\r
5223 (function (FoldingRangeKind) {\r
5224     /**\r
5225      * Folding range for a comment\r
5226      */\r
5227     FoldingRangeKind["Comment"] = "comment";\r
5228     /**\r
5229      * Folding range for a imports or includes\r
5230      */\r
5231     FoldingRangeKind["Imports"] = "imports";\r
5232     /**\r
5233      * Folding range for a region (e.g. `#region`)\r
5234      */\r
5235     FoldingRangeKind["Region"] = "region";\r
5236 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
5237 /**\r
5238  * A request to provide folding ranges in a document. The request's\r
5239  * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
5240  * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
5241  * that resolves to such.\r
5242  */\r
5243 var FoldingRangeRequest;\r
5244 (function (FoldingRangeRequest) {\r
5245     FoldingRangeRequest.method = 'textDocument/foldingRange';\r
5246     FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\r
5247     /** @deprecated Use FoldingRangeRequest.type */\r
5248     FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5249 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
5250
5251
5252 /***/ }),
5253 /* 28 */
5254 /***/ (function(module, exports, __webpack_require__) {
5255
5256 "use strict";
5257 /* --------------------------------------------------------------------------------------------\r
5258  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5259  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5260  * ------------------------------------------------------------------------------------------ */\r
5261 \r
5262 Object.defineProperty(exports, "__esModule", { value: true });\r
5263 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5264 const messages_1 = __webpack_require__(21);\r
5265 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5266 let __noDynamicImport;\r
5267 /**\r
5268  * A request to resolve the type definition locations of a symbol at a given text\r
5269  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5270  * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
5271  * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
5272  * to such.\r
5273  */\r
5274 var DeclarationRequest;\r
5275 (function (DeclarationRequest) {\r
5276     DeclarationRequest.method = 'textDocument/declaration';\r
5277     DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\r
5278     /** @deprecated Use DeclarationRequest.type */\r
5279     DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5280 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
5281
5282
5283 /***/ }),
5284 /* 29 */
5285 /***/ (function(module, exports, __webpack_require__) {
5286
5287 "use strict";
5288 \r
5289 /*---------------------------------------------------------------------------------------------\r
5290  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5291  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5292  *--------------------------------------------------------------------------------------------*/\r
5293 Object.defineProperty(exports, "__esModule", { value: true });\r
5294 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5295 const messages_1 = __webpack_require__(21);\r
5296 /**\r
5297  * A request to provide selection ranges in a document. The request's\r
5298  * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
5299  * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
5300  * that resolves to such.\r
5301  */\r
5302 var SelectionRangeRequest;\r
5303 (function (SelectionRangeRequest) {\r
5304     SelectionRangeRequest.method = 'textDocument/selectionRange';\r
5305     SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\r
5306     /** @deprecated  Use SelectionRangeRequest.type */\r
5307     SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5308 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
5309
5310
5311 /***/ }),
5312 /* 30 */
5313 /***/ (function(module, exports, __webpack_require__) {
5314
5315 "use strict";
5316 /* --------------------------------------------------------------------------------------------\r
5317  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5318  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5319  * ------------------------------------------------------------------------------------------ */\r
5320 \r
5321 Object.defineProperty(exports, "__esModule", { value: true });\r
5322 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5323 const messages_1 = __webpack_require__(21);\r
5324 var WorkDoneProgress;\r
5325 (function (WorkDoneProgress) {\r
5326     WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
5327 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
5328 /**\r
5329  * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
5330  * reporting from the server.\r
5331  */\r
5332 var WorkDoneProgressCreateRequest;\r
5333 (function (WorkDoneProgressCreateRequest) {\r
5334     WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');\r
5335 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
5336 /**\r
5337  * The `window/workDoneProgress/cancel` notification is sent from  the client to the server to cancel a progress\r
5338  * initiated on the server side.\r
5339  */\r
5340 var WorkDoneProgressCancelNotification;\r
5341 (function (WorkDoneProgressCancelNotification) {\r
5342     WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');\r
5343 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
5344
5345
5346 /***/ }),
5347 /* 31 */
5348 /***/ (function(module, exports, __webpack_require__) {
5349
5350 "use strict";
5351 /* --------------------------------------------------------------------------------------------\r
5352  * Copyright (c) TypeFox and others. All rights reserved.\r
5353  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5354  * ------------------------------------------------------------------------------------------ */\r
5355 \r
5356 Object.defineProperty(exports, "__esModule", { value: true });\r
5357 const messages_1 = __webpack_require__(21);\r
5358 /**\r
5359  * A request to result a `CallHierarchyItem` in a document at a given position.\r
5360  * Can be used as an input to a incoming or outgoing call hierarchy.\r
5361  *\r
5362  * @since 3.16.0 - Proposed state\r
5363  */\r
5364 var CallHierarchyPrepareRequest;\r
5365 (function (CallHierarchyPrepareRequest) {\r
5366     CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
5367     CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\r
5368 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
5369 /**\r
5370  * A request to resolve the incoming calls for a given `CallHierarchyItem`.\r
5371  *\r
5372  * @since 3.16.0 - Proposed state\r
5373  */\r
5374 var CallHierarchyIncomingCallsRequest;\r
5375 (function (CallHierarchyIncomingCallsRequest) {\r
5376     CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
5377     CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\r
5378 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
5379 /**\r
5380  * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\r
5381  *\r
5382  * @since 3.16.0 - Proposed state\r
5383  */\r
5384 var CallHierarchyOutgoingCallsRequest;\r
5385 (function (CallHierarchyOutgoingCallsRequest) {\r
5386     CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
5387     CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\r
5388 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
5389
5390
5391 /***/ }),
5392 /* 32 */
5393 /***/ (function(module, exports, __webpack_require__) {
5394
5395 "use strict";
5396 /* --------------------------------------------------------------------------------------------\r
5397  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5398  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5399  * ------------------------------------------------------------------------------------------ */\r
5400 \r
5401 Object.defineProperty(exports, "__esModule", { value: true });\r
5402 const messages_1 = __webpack_require__(21);\r
5403 /**\r
5404  * A set of predefined token types. This set is not fixed\r
5405  * an clients can specify additional token types via the\r
5406  * corresponding client capabilities.\r
5407  *\r
5408  * @since 3.16.0 - Proposed state\r
5409  */\r
5410 var SemanticTokenTypes;\r
5411 (function (SemanticTokenTypes) {\r
5412     SemanticTokenTypes["comment"] = "comment";\r
5413     SemanticTokenTypes["keyword"] = "keyword";\r
5414     SemanticTokenTypes["string"] = "string";\r
5415     SemanticTokenTypes["number"] = "number";\r
5416     SemanticTokenTypes["regexp"] = "regexp";\r
5417     SemanticTokenTypes["operator"] = "operator";\r
5418     SemanticTokenTypes["namespace"] = "namespace";\r
5419     SemanticTokenTypes["type"] = "type";\r
5420     SemanticTokenTypes["struct"] = "struct";\r
5421     SemanticTokenTypes["class"] = "class";\r
5422     SemanticTokenTypes["interface"] = "interface";\r
5423     SemanticTokenTypes["enum"] = "enum";\r
5424     SemanticTokenTypes["typeParameter"] = "typeParameter";\r
5425     SemanticTokenTypes["function"] = "function";\r
5426     SemanticTokenTypes["member"] = "member";\r
5427     SemanticTokenTypes["property"] = "property";\r
5428     SemanticTokenTypes["macro"] = "macro";\r
5429     SemanticTokenTypes["variable"] = "variable";\r
5430     SemanticTokenTypes["parameter"] = "parameter";\r
5431     SemanticTokenTypes["label"] = "label";\r
5432 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));\r
5433 /**\r
5434  * A set of predefined token modifiers. This set is not fixed\r
5435  * an clients can specify additional token types via the\r
5436  * corresponding client capabilities.\r
5437  *\r
5438  * @since 3.16.0 - Proposed state\r
5439  */\r
5440 var SemanticTokenModifiers;\r
5441 (function (SemanticTokenModifiers) {\r
5442     SemanticTokenModifiers["documentation"] = "documentation";\r
5443     SemanticTokenModifiers["declaration"] = "declaration";\r
5444     SemanticTokenModifiers["definition"] = "definition";\r
5445     SemanticTokenModifiers["reference"] = "reference";\r
5446     SemanticTokenModifiers["static"] = "static";\r
5447     SemanticTokenModifiers["abstract"] = "abstract";\r
5448     SemanticTokenModifiers["deprecated"] = "deprecated";\r
5449     SemanticTokenModifiers["async"] = "async";\r
5450     SemanticTokenModifiers["volatile"] = "volatile";\r
5451     SemanticTokenModifiers["readonly"] = "readonly";\r
5452 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));\r
5453 /**\r
5454  * @since 3.16.0 - Proposed state\r
5455  */\r
5456 var SemanticTokens;\r
5457 (function (SemanticTokens) {\r
5458     function is(value) {\r
5459         const candidate = value;\r
5460         return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\r
5461             Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\r
5462     }\r
5463     SemanticTokens.is = is;\r
5464 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));\r
5465 /**\r
5466  * @since 3.16.0 - Proposed state\r
5467  */\r
5468 var SemanticTokensRequest;\r
5469 (function (SemanticTokensRequest) {\r
5470     SemanticTokensRequest.method = 'textDocument/semanticTokens';\r
5471     SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\r
5472 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));\r
5473 /**\r
5474  * @since 3.16.0 - Proposed state\r
5475  */\r
5476 var SemanticTokensEditsRequest;\r
5477 (function (SemanticTokensEditsRequest) {\r
5478     SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';\r
5479     SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);\r
5480 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));\r
5481 /**\r
5482  * @since 3.16.0 - Proposed state\r
5483  */\r
5484 var SemanticTokensRangeRequest;\r
5485 (function (SemanticTokensRangeRequest) {\r
5486     SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\r
5487     SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\r
5488 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));\r
5489
5490
5491 /***/ }),
5492 /* 33 */
5493 /***/ (function(module, exports, __webpack_require__) {
5494
5495 "use strict";
5496
5497 Object.defineProperty(exports, "__esModule", { value: true });
5498 exports.Ctx = void 0;
5499 const coc_nvim_1 = __webpack_require__(1);
5500 const config_1 = __webpack_require__(34);
5501 const semantic_highlighting_1 = __webpack_require__(35);
5502 class ClangdExtensionFeature {
5503     constructor() { }
5504     initialize() { }
5505     fillClientCapabilities(capabilities) {
5506         var _a;
5507         const textDocument = capabilities.textDocument;
5508         // @ts-ignore: clangd extension
5509         (_a = textDocument.completion) === null || _a === void 0 ? void 0 : _a.editsNearCursor = true;
5510     }
5511 }
5512 class Ctx {
5513     constructor(context) {
5514         this.context = context;
5515         this.client = null;
5516         this.config = new config_1.Config();
5517     }
5518     async startServer(bin) {
5519         const old = this.client;
5520         if (old) {
5521             await old.stop();
5522         }
5523         const exec = {
5524             command: bin,
5525             args: this.config.arguments,
5526         };
5527         const serverOptions = exec;
5528         const outputChannel = coc_nvim_1.workspace.createOutputChannel('clangd log');
5529         const clientOptions = {
5530             documentSelector: [
5531                 { scheme: 'file', language: 'c' },
5532                 { scheme: 'file', language: 'cpp' },
5533                 { scheme: 'file', language: 'objc' },
5534                 { scheme: 'file', language: 'objcpp' },
5535                 { scheme: 'file', language: 'objective-c' },
5536                 { scheme: 'file', language: 'objective-cpp' },
5537                 { scheme: 'file', language: 'cuda' },
5538                 { scheme: 'file', language: 'arduino' },
5539             ],
5540             initializationOptions: { clangdFileStatus: true, fallbackFlags: this.config.fallbackFlags },
5541             disableDiagnostics: this.config.disableDiagnostics,
5542             // @ts-ignore
5543             disableSnippetCompletion: this.config.disableSnippetCompletion,
5544             outputChannel,
5545             middleware: {
5546                 provideOnTypeFormattingEdits: (document, position, ch, options, token, next) => {
5547                     // coc sends "\n" when exiting insert mode, when there is no newline added to the doc.
5548                     if (ch === '\n')
5549                         ch = '';
5550                     return next(document, position, ch, options, token);
5551                 },
5552                 provideWorkspaceSymbols: async (query, token, next) => {
5553                     const symbols = await next(query, token);
5554                     if (!symbols)
5555                         return;
5556                     return symbols.map((symbol) => {
5557                         if (symbol.containerName) {
5558                             symbol.name = `${symbol.containerName}::${symbol.name}`;
5559                         }
5560                         symbol.containerName = '';
5561                         return symbol;
5562                     });
5563                 },
5564             },
5565         };
5566         const client = new coc_nvim_1.LanguageClient('clangd', serverOptions, clientOptions);
5567         client.registerFeature(new ClangdExtensionFeature());
5568         if (this.config.semanticHighlighting) {
5569             const lspCxx = await coc_nvim_1.workspace.nvim.call('exists', 'g:lsp_cxx_hl_loaded');
5570             if (lspCxx === 1) {
5571                 client.registerFeature(new semantic_highlighting_1.SemanticHighlightingFeature(client, this.context));
5572             }
5573         }
5574         this.context.subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
5575         await client.onReady();
5576         this.client = client;
5577     }
5578     get subscriptions() {
5579         return this.context.subscriptions;
5580     }
5581 }
5582 exports.Ctx = Ctx;
5583
5584
5585 /***/ }),
5586 /* 34 */
5587 /***/ (function(module, exports, __webpack_require__) {
5588
5589 "use strict";
5590
5591 Object.defineProperty(exports, "__esModule", { value: true });
5592 exports.Config = void 0;
5593 const coc_nvim_1 = __webpack_require__(1);
5594 class Config {
5595     constructor() {
5596         this.cfg = coc_nvim_1.workspace.getConfiguration('clangd');
5597     }
5598     get enabled() {
5599         return this.cfg.get('enabled');
5600     }
5601     get disableDiagnostics() {
5602         return this.cfg.get('disableDiagnostics');
5603     }
5604     get disableSnippetCompletion() {
5605         return this.cfg.get('disableSnippetCompletion');
5606     }
5607     get arguments() {
5608         return this.cfg.get('arguments', []);
5609     }
5610     get fallbackFlags() {
5611         return this.cfg.get('fallbackFlags', []);
5612     }
5613     get semanticHighlighting() {
5614         return this.cfg.get('semanticHighlighting');
5615     }
5616     get showDBChangedNotification() {
5617         return this.cfg.get('showDBChangedNotification');
5618     }
5619 }
5620 exports.Config = Config;
5621
5622
5623 /***/ }),
5624 /* 35 */
5625 /***/ (function(module, exports, __webpack_require__) {
5626
5627 "use strict";
5628
5629 Object.defineProperty(exports, "__esModule", { value: true });
5630 exports.SemanticHighlightingFeature = void 0;
5631 const coc_nvim_1 = __webpack_require__(1);
5632 const vscode_languageserver_protocol_1 = __webpack_require__(4);
5633 class SemanticHighlightingFeature {
5634     constructor(client, context) {
5635         this.scopeTable = [];
5636         // Last tokens seen: bufTokens[bufnr][linenr] = [tokens...]
5637         this.bufTokens = {};
5638         context.subscriptions.push(client.onDidChangeState(({ newState }) => {
5639             if (newState === coc_nvim_1.State.Running) {
5640                 const notification = new vscode_languageserver_protocol_1.NotificationType('textDocument/semanticHighlighting');
5641                 client.onNotification(notification, this.handleNotification.bind(this));
5642             }
5643         }));
5644     }
5645     initialize(capabilities) {
5646         const serverCapabilities = capabilities;
5647         if (!serverCapabilities.semanticHighlighting)
5648             return;
5649         this.scopeTable = serverCapabilities.semanticHighlighting.scopes;
5650     }
5651     fillClientCapabilities(capabilities) {
5652         const textDocumentCapabilities = capabilities.textDocument;
5653         textDocumentCapabilities.semanticHighlightingCapabilities = {
5654             semanticHighlighting: true,
5655         };
5656     }
5657     async handleNotification(params) {
5658         // use https://github.com/jackguo380/vim-lsp-cxx-highlight to do highlighting
5659         // first, assemble the full list of tokens.
5660         const doc = coc_nvim_1.workspace.getDocument(params.textDocument.uri);
5661         // Create implicit previous state if it doesn't exist.
5662         if (!(doc.bufnr in this.bufTokens))
5663             this.bufTokens[doc.bufnr] = [];
5664         const lines = this.bufTokens[doc.bufnr];
5665         // Update changed lines in place.
5666         for (const line of params.lines) {
5667             while (line.line >= lines.length)
5668                 lines.push([]);
5669             lines[line.line] = this.decodeTokens(line.tokens);
5670         }
5671         const symbols = [];
5672         const skipped = [];
5673         for (const [line, tokens] of lines.entries()) {
5674             for (const token of tokens) {
5675                 if (token.kind === 'InactiveCode') {
5676                     skipped.push(vscode_languageserver_protocol_1.Range.create(line, token.character, line, token.character + token.length));
5677                 }
5678                 else {
5679                     symbols.push({
5680                         id: 0,
5681                         kind: token.kind,
5682                         ranges: [vscode_languageserver_protocol_1.Range.create(line, token.character, line, token.character + token.length)],
5683                         parentKind: 'Unknown',
5684                         storage: 'None',
5685                     });
5686                 }
5687             }
5688         }
5689         await coc_nvim_1.workspace.nvim.call('lsp_cxx_hl#hl#notify_symbols', [doc.bufnr, symbols]);
5690         if (skipped.length) {
5691             await coc_nvim_1.workspace.nvim.call('lsp_cxx_hl#hl#notify_skipped', [doc.bufnr, skipped]);
5692         }
5693     }
5694     // Converts a string of base64 encoded tokens into the corresponding array of SemanticHighlightingToken.
5695     decodeTokens(tokens) {
5696         const scopeMask = 0xffff;
5697         const lenShift = 0x10;
5698         const uint32Size = 4;
5699         const buf = Buffer.from(tokens, 'base64');
5700         const retTokens = [];
5701         for (let i = 0, end = buf.length / uint32Size; i < end; i += 2) {
5702             const start = buf.readUInt32BE(i * uint32Size);
5703             const lenKind = buf.readUInt32BE((i + 1) * uint32Size);
5704             const scopeIndex = lenKind & scopeMask;
5705             const len = lenKind >>> lenShift;
5706             const kind = this.scopeTable[scopeIndex][0];
5707             retTokens.push({ character: start, scopeIndex: scopeIndex, length: len, kind: this.decodeKind(kind) });
5708         }
5709         return retTokens;
5710     }
5711     decodeKind(kind) {
5712         // https://github.com/llvm/llvm-project/blob/9adc7fc3cdf571bd70d5f8bda4e2e9c233c5fd63/clang-tools-extra/clangd/SemanticHighlighting.cpp#L477
5713         switch (kind) {
5714             case 'entity.name.function.cpp':
5715                 return 'Function';
5716             case 'entity.name.function.method.cpp':
5717                 return 'Method';
5718             case 'entity.name.function.method.static.cpp':
5719                 return 'StaticMethod';
5720             case 'variable.other.cpp':
5721                 return 'Variable';
5722             case 'variable.other.local.cpp':
5723                 return 'LocalVariable';
5724             case 'variable.parameter.cpp':
5725                 return 'Parameter';
5726             case 'variable.other.field.cpp':
5727                 return 'Field';
5728             case 'variable.other.field.static.cpp':
5729                 return 'StaticField';
5730             case 'entity.name.type.class.cpp':
5731                 return 'Class';
5732             case 'entity.name.type.enum.cpp':
5733                 return 'Enum';
5734             case 'variable.other.enummember.cpp':
5735                 return 'EnumConstant';
5736             case 'entity.name.type.typedef.cpp':
5737                 return 'Typedef';
5738             case 'entity.name.type.dependent.cpp':
5739                 return 'DependentType';
5740             case 'entity.name.other.dependent.cpp':
5741                 return 'DependentName';
5742             case 'entity.name.namespace.cpp':
5743                 return 'Namespace';
5744             case 'entity.name.type.template.cpp':
5745                 return 'TemplateParameter';
5746             case 'entity.name.type.concept.cpp':
5747                 return 'Concept';
5748             case 'storage.type.primitive.cpp':
5749                 return 'Primitive';
5750             case 'entity.name.function.preprocessor.cpp':
5751                 return 'Macro';
5752             case 'meta.disabled':
5753                 return 'InactiveCode';
5754             default:
5755                 return 'Unknown';
5756         }
5757     }
5758 }
5759 exports.SemanticHighlightingFeature = SemanticHighlightingFeature;
5760
5761
5762 /***/ }),
5763 /* 36 */
5764 /***/ (function(module, exports, __webpack_require__) {
5765
5766 "use strict";
5767
5768 Object.defineProperty(exports, "__esModule", { value: true });
5769 exports.FileStatus = void 0;
5770 const coc_nvim_1 = __webpack_require__(1);
5771 class FileStatus {
5772     constructor() {
5773         this.statuses = new Map();
5774         this.statusBarItem = coc_nvim_1.workspace.createStatusBarItem(0);
5775     }
5776     onFileUpdated(status) {
5777         this.statuses.set(status.uri, status);
5778         this.updateStatus();
5779     }
5780     async updateStatus() {
5781         const doc = await coc_nvim_1.workspace.document;
5782         if (!doc) {
5783             return;
5784         }
5785         const status = this.statuses.get(doc.uri);
5786         if (!status) {
5787             this.statusBarItem.hide();
5788             return;
5789         }
5790         this.statusBarItem.text = `clangd: ` + status.state;
5791         this.statusBarItem.show();
5792     }
5793     clear() {
5794         this.statuses.clear();
5795         this.statusBarItem.hide();
5796     }
5797     dispose() {
5798         this.statusBarItem.dispose();
5799     }
5800 }
5801 exports.FileStatus = FileStatus;
5802
5803
5804 /***/ }),
5805 /* 37 */
5806 /***/ (function(module, exports, __webpack_require__) {
5807
5808 "use strict";
5809
5810 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5811     if (k2 === undefined) k2 = k;
5812     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5813 }) : (function(o, m, k, k2) {
5814     if (k2 === undefined) k2 = k;
5815     o[k2] = m[k];
5816 }));
5817 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5818     Object.defineProperty(o, "default", { enumerable: true, value: v });
5819 }) : function(o, v) {
5820     o["default"] = v;
5821 });
5822 var __importStar = (this && this.__importStar) || function (mod) {
5823     if (mod && mod.__esModule) return mod;
5824     var result = {};
5825     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5826     __setModuleDefault(result, mod);
5827     return result;
5828 };
5829 Object.defineProperty(exports, "__esModule", { value: true });
5830 exports.activate = void 0;
5831 const coc = __importStar(__webpack_require__(1));
5832 const common = __importStar(__webpack_require__(38));
5833 class UI {
5834     constructor(context, config) {
5835         this.context = context;
5836         this.config = config;
5837     }
5838     get storagePath() {
5839         return this.context.storagePath;
5840     }
5841     slow(title, result) {
5842         coc.workspace.showMessage(title + '...');
5843         return result;
5844     }
5845     error(s) {
5846         coc.workspace.showMessage(s, 'error');
5847     }
5848     info(s) {
5849         coc.workspace.showMessage(s);
5850     }
5851     progress(title, _cancel, body) {
5852         return this.slow(title, body(() => { }));
5853     }
5854     async shouldReuse(release) {
5855         coc.workspace.showMessage(`Reusing existing ${release} installation in ${this.storagePath}`);
5856         return true;
5857     }
5858     async promptReload() {
5859         await coc.commands.executeCommand('editor.action.restart');
5860     }
5861     showHelp(message, url) {
5862         message += ` See ${url}.`;
5863         coc.workspace.showMessage(message);
5864     }
5865     async promptUpdate(oldVersion, newVersion) {
5866         const message = `clangd ${newVersion} is available (you have ${oldVersion}). :CocCommand clangd.install, or :CocSettings to disable clangd.checkUpdates.`;
5867         coc.workspace.showMessage(message);
5868     }
5869     async promptInstall(version) {
5870         const message = `clangd was not found on your PATH. :CocCommand clangd.install will install ${version}.`;
5871         coc.workspace.showMessage(message);
5872     }
5873     get clangdPath() {
5874         return this.config.get('path');
5875     }
5876     set clangdPath(p) {
5877         this.config.update('path', p, /*isUser=*/ true);
5878     }
5879 }
5880 // Returns the clangd path to use, or null if clangd is not installed.
5881 async function activate(context) {
5882     const cfg = coc.workspace.getConfiguration('clangd');
5883     const ui = new UI(context, cfg);
5884     context.subscriptions.push(coc.commands.registerCommand('clangd.install', async () => common.installLatest(ui)));
5885     context.subscriptions.push(coc.commands.registerCommand('clangd.update', async () => common.checkUpdates(true, ui)));
5886     const status = await common.prepare(ui, cfg.get('checkUpdates', false));
5887     return status.clangdPath;
5888 }
5889 exports.activate = activate;
5890
5891
5892 /***/ }),
5893 /* 38 */
5894 /***/ (function(module, exports, __webpack_require__) {
5895
5896 "use strict";
5897
5898 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5899     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5900     return new (P || (P = Promise))(function (resolve, reject) {
5901         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5902         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5903         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5904         step((generator = generator.apply(thisArg, _arguments || [])).next());
5905     });
5906 };
5907 var __asyncValues = (this && this.__asyncValues) || function (o) {
5908     if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5909     var m = o[Symbol.asyncIterator], i;
5910     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);
5911     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); }); }; }
5912     function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
5913 };
5914 Object.defineProperty(exports, "__esModule", { value: true });
5915 // Automatically install clangd binary releases from GitHub.
5916 //
5917 // We don't bundle them with the package because they're big; we'd have to
5918 // include all OS versions, and download them again with every extension update.
5919 //
5920 // There are several entry points:
5921 //  - installation explicitly requested
5922 //  - checking for updates (manual or automatic)
5923 //  - no usable clangd found, try to recover
5924 // These have different flows, but the same underlying mechanisms.
5925 const abort_controller_1 = __webpack_require__(39);
5926 const child_process = __webpack_require__(41);
5927 const fs = __webpack_require__(42);
5928 const node_fetch_1 = __webpack_require__(43);
5929 const os = __webpack_require__(14);
5930 const path = __webpack_require__(2);
5931 const readdirp = __webpack_require__(49);
5932 const rimraf = __webpack_require__(57);
5933 const semver = __webpack_require__(75);
5934 const stream = __webpack_require__(44);
5935 const unzipper = __webpack_require__(118);
5936 const util_1 = __webpack_require__(50);
5937 const which = __webpack_require__(221);
5938 // Main startup workflow: check whether the configured clangd binary us usable.
5939 // If not, offer to install one. If so, check for updates.
5940 function prepare(ui, checkUpdate) {
5941     return __awaiter(this, void 0, void 0, function* () {
5942         try {
5943             var absPath = yield util_1.promisify(which)(ui.clangdPath);
5944         }
5945         catch (e) {
5946             // Couldn't find clangd - start recovery flow and stop extension
5947             // loading.
5948             return { clangdPath: null, background: recover(ui) };
5949         }
5950         // Allow extension to load, asynchronously check for updates.
5951         return {
5952             clangdPath: absPath,
5953             background: checkUpdate ? checkUpdates(/*requested=*/ false, ui)
5954                 : Promise.resolve()
5955         };
5956     });
5957 }
5958 exports.prepare = prepare;
5959 // The user has explicitly asked to install the latest clangd.
5960 // Do so without further prompting, or report an error.
5961 function installLatest(ui) {
5962     return __awaiter(this, void 0, void 0, function* () {
5963         const abort = new abort_controller_1.AbortController();
5964         try {
5965             const release = yield Github.latestRelease();
5966             const asset = yield Github.chooseAsset(release);
5967             ui.clangdPath = yield Install.install(release, asset, abort, ui);
5968             ui.promptReload(`clangd ${release.name} is now installed.`);
5969         }
5970         catch (e) {
5971             if (!abort.signal.aborted) {
5972                 console.error('Failed to install clangd: ', e);
5973                 const message = `Failed to install clangd language server: ${e}\n` +
5974                     'You may want to install it manually.';
5975                 ui.showHelp(message, installURL);
5976             }
5977         }
5978     });
5979 }
5980 exports.installLatest = installLatest;
5981 // We have an apparently-valid clangd (`clangdPath`), check for updates.
5982 function checkUpdates(requested, ui) {
5983     return __awaiter(this, void 0, void 0, function* () {
5984         // Gather all the version information to see if there's an upgrade.
5985         try {
5986             var release = yield Github.latestRelease();
5987             yield Github.chooseAsset(release); // Ensure a binary for this platform.
5988             var upgrade = yield Version.upgrade(release, ui.clangdPath);
5989         }
5990         catch (e) {
5991             console.log('Failed to check for clangd update: ', e);
5992             // We're not sure whether there's an upgrade: stay quiet unless asked.
5993             if (requested)
5994                 ui.error(`Failed to check for clangd update: ${e}`);
5995             return;
5996         }
5997         console.log('Checking for clangd update: available=', upgrade.new, ' installed=', upgrade.old);
5998         // Bail out if the new version is better or comparable.
5999         if (!upgrade.upgrade) {
6000             if (requested)
6001                 ui.info(`clangd is up-to-date (you have ${upgrade.old}, latest is ${upgrade.new})`);
6002             return;
6003         }
6004         ui.promptUpdate(upgrade.old, upgrade.new);
6005     });
6006 }
6007 exports.checkUpdates = checkUpdates;
6008 // The extension has detected clangd isn't available.
6009 // Inform the user, and if possible offer to install or adjust the path.
6010 // Unlike installLatest(), we've had no explicit user request or consent yet.
6011 function recover(ui) {
6012     return __awaiter(this, void 0, void 0, function* () {
6013         try {
6014             const release = yield Github.latestRelease();
6015             yield Github.chooseAsset(release); // Ensure a binary for this platform.
6016             ui.promptInstall(release.name);
6017         }
6018         catch (e) {
6019             console.error('Auto-install failed: ', e);
6020             ui.showHelp('The clangd language server is not installed.', installURL);
6021         }
6022     });
6023 }
6024 const installURL = 'https://clangd.llvm.org/installation.html';
6025 // The GitHub API endpoint for the latest binary clangd release.
6026 let githubReleaseURL = 'https://api.github.com/repos/clangd/clangd/releases/latest';
6027 // Set a fake URL for testing.
6028 function fakeGitHubReleaseURL(u) { githubReleaseURL = u; }
6029 exports.fakeGitHubReleaseURL = fakeGitHubReleaseURL;
6030 let lddCommand = 'ldd';
6031 function fakeLddCommand(l) { lddCommand = l; }
6032 exports.fakeLddCommand = fakeLddCommand;
6033 // Bits for talking to github's release API
6034 var Github;
6035 (function (Github) {
6036     // Fetch the metadata for the latest stable clangd release.
6037     function latestRelease() {
6038         return __awaiter(this, void 0, void 0, function* () {
6039             const response = yield node_fetch_1.default(githubReleaseURL);
6040             if (!response.ok) {
6041                 console.log(response.url, response.status, response.statusText);
6042                 throw new Error(`Can't fetch release: ${response.statusText}`);
6043             }
6044             return yield response.json();
6045         });
6046     }
6047     Github.latestRelease = latestRelease;
6048     // Determine which release asset should be installed for this machine.
6049     function chooseAsset(release) {
6050         return __awaiter(this, void 0, void 0, function* () {
6051             const variants = {
6052                 'win32': 'windows',
6053                 'linux': 'linux',
6054                 'darwin': 'mac',
6055             };
6056             const variant = variants[os.platform()];
6057             if (variant == 'linux') {
6058                 // Hardcoding this here is sad, but we'd like to offer a nice error message
6059                 // without making the user download the package first.
6060                 const minGlibc = new semver.Range('2.18');
6061                 const oldGlibc = yield Version.oldGlibc(minGlibc);
6062                 if (oldGlibc) {
6063                     throw new Error('The clangd release is not compatible with your system ' +
6064                         `(glibc ${oldGlibc.raw} < ${minGlibc.raw}). ` +
6065                         'Try to install it using your package manager instead.');
6066                 }
6067             }
6068             // 32-bit vscode is still common on 64-bit windows, so don't reject that.
6069             if (variant && (os.arch() == 'x64' || variant == 'windows')) {
6070                 const asset = release.assets.find(a => a.name.indexOf(variant) >= 0);
6071                 if (asset)
6072                     return asset;
6073             }
6074             throw new Error(`No clangd ${release.name} binary available for ${os.platform()}/${os.arch()}`);
6075         });
6076     }
6077     Github.chooseAsset = chooseAsset;
6078 })(Github || (Github = {}));
6079 // Functions to download and install the releases, and manage the files on disk.
6080 //
6081 // File layout:
6082 //  <ui.storagePath>/
6083 //    install/
6084 //      <version>/
6085 //        clangd_<version>/            (outer director from zip file)
6086 //          bin/clangd
6087 //          lib/clang/...
6088 //    download/
6089 //      clangd-platform-<version>.zip  (deleted after extraction)
6090 var Install;
6091 (function (Install) {
6092     // Download the binary archive `asset` from a github `release` and extract it
6093     // to the extension's global storage location.
6094     // The `abort` controller is signaled if the user cancels the installation.
6095     // Returns the absolute path to the installed clangd executable.
6096     function install(release, asset, abort, ui) {
6097         return __awaiter(this, void 0, void 0, function* () {
6098             const dirs = yield createDirs(ui);
6099             const extractRoot = path.join(dirs.install, release.tag_name);
6100             if (yield util_1.promisify(fs.exists)(extractRoot)) {
6101                 const reuse = yield ui.shouldReuse(release.name);
6102                 if (reuse === undefined) {
6103                     // User dismissed prompt, bail out.
6104                     abort.abort();
6105                     throw new Error(`clangd ${release.name} already installed!`);
6106                 }
6107                 if (reuse) {
6108                     // Find clangd within the existing directory.
6109                     let files = (yield readdirp.promise(extractRoot)).map(e => e.fullPath);
6110                     return findExecutable(files);
6111                 }
6112                 else {
6113                     // Delete the old version.
6114                     yield util_1.promisify(rimraf)(extractRoot);
6115                     // continue with installation.
6116                 }
6117             }
6118             const zipFile = path.join(dirs.download, asset.name);
6119             yield download(asset.browser_download_url, zipFile, abort, ui);
6120             const archive = yield unzipper.Open.file(zipFile);
6121             const executable = findExecutable(archive.files.map(f => f.path));
6122             yield ui.slow(`Extracting ${asset.name}`, archive.extract({ path: extractRoot }));
6123             const clangdPath = path.join(extractRoot, executable);
6124             yield fs.promises.chmod(clangdPath, 0o755);
6125             yield fs.promises.unlink(zipFile);
6126             return clangdPath;
6127         });
6128     }
6129     Install.install = install;
6130     // Create the 'install' and 'download' directories, and return absolute paths.
6131     function createDirs(ui) {
6132         return __awaiter(this, void 0, void 0, function* () {
6133             const install = path.join(ui.storagePath, 'install');
6134             const download = path.join(ui.storagePath, 'download');
6135             for (const dir of [install, download])
6136                 yield fs.promises.mkdir(dir, { 'recursive': true });
6137             return { install: install, download: download };
6138         });
6139     }
6140     // Find the clangd executable within a set of files.
6141     function findExecutable(paths) {
6142         const filename = os.platform() == 'win32' ? 'clangd.exe' : 'clangd';
6143         const entry = paths.find(f => path.posix.basename(f) == filename ||
6144             path.win32.basename(f) == filename);
6145         if (entry == null)
6146             throw new Error('Didn\'t find a clangd executable!');
6147         return entry;
6148     }
6149     // Downloads `url` to a local file `dest` (whose parent should exist).
6150     // A progress dialog is shown, if it is cancelled then `abort` is signaled.
6151     function download(url, dest, abort, ui) {
6152         return __awaiter(this, void 0, void 0, function* () {
6153             console.log('Downloading ', url, ' to ', dest);
6154             return ui.progress(`Downloading ${path.basename(dest)}`, abort, (progress) => __awaiter(this, void 0, void 0, function* () {
6155                 const response = yield node_fetch_1.default(url, { signal: abort.signal });
6156                 if (!response.ok)
6157                     throw new Error(`Failed to download $url`);
6158                 const size = Number(response.headers.get('content-length'));
6159                 let read = 0;
6160                 response.body.on('data', (chunk) => {
6161                     read += chunk.length;
6162                     progress(read / size);
6163                 });
6164                 const out = fs.createWriteStream(dest);
6165                 yield util_1.promisify(stream.pipeline)(response.body, out).catch(e => {
6166                     // Clean up the partial file if the download failed.
6167                     fs.unlink(dest, (_) => null); // Don't wait, and ignore error.
6168                     throw e;
6169                 });
6170             }));
6171         });
6172     }
6173 })(Install || (Install = {}));
6174 // Functions dealing with clangd versions.
6175 //
6176 // We parse both github release numbers and installed `clangd --version` output
6177 // by treating them as SemVer ranges, and offer an upgrade if the version
6178 // is unambiguously newer.
6179 //
6180 // These functions throw if versions can't be parsed (e.g. installed clangd
6181 // is a vendor-modified version).
6182 var Version;
6183 (function (Version) {
6184     function upgrade(release, clangdPath) {
6185         return __awaiter(this, void 0, void 0, function* () {
6186             const releasedVer = released(release);
6187             const installedVer = yield installed(clangdPath);
6188             return {
6189                 old: installedVer.raw,
6190                 new: releasedVer.raw,
6191                 upgrade: rangeGreater(releasedVer, installedVer)
6192             };
6193         });
6194     }
6195     Version.upgrade = upgrade;
6196     const loose = {
6197         'loose': true
6198     };
6199     // Get the version of an installed clangd binary using `clangd --version`.
6200     function installed(clangdPath) {
6201         return __awaiter(this, void 0, void 0, function* () {
6202             const output = yield run(clangdPath, ['--version']);
6203             console.log(clangdPath, ' --version output: ', output);
6204             const prefix = 'clangd version ';
6205             if (!output.startsWith(prefix))
6206                 throw new Error(`Couldn't parse clangd --version output: ${output}`);
6207             const rawVersion = output.substr(prefix.length).split(' ', 1)[0];
6208             return new semver.Range(rawVersion, loose);
6209         });
6210     }
6211     // Get the version of a github release, by parsing the tag or name.
6212     function released(release) {
6213         // Prefer the tag name, but fall back to the release name.
6214         return (!semver.validRange(release.tag_name, loose) &&
6215             semver.validRange(release.name, loose))
6216             ? new semver.Range(release.name, loose)
6217             : new semver.Range(release.tag_name, loose);
6218     }
6219     // Detect the (linux) system's glibc version. If older than `min`, return it.
6220     function oldGlibc(min) {
6221         return __awaiter(this, void 0, void 0, function* () {
6222             // ldd is distributed with glibc, so ldd --version should be a good proxy.
6223             const output = yield run(lddCommand, ['--version']);
6224             // The first line is e.g. "ldd (Debian GLIBC 2.29-9) 2.29".
6225             const line = output.split('\n', 1)[0];
6226             // Require some confirmation this is [e]glibc, and a plausible
6227             // version number.
6228             const match = line.match(/^ldd .*glibc.* (\d+(?:\.\d+)+)[^ ]*$/i);
6229             if (!match || !semver.validRange(match[1], loose)) {
6230                 console.error(`Can't glibc version from ldd --version output: ${line}`);
6231                 return null;
6232             }
6233             const version = new semver.Range(match[1], loose);
6234             console.log('glibc is', version.raw, 'min is', min.raw);
6235             return rangeGreater(min, version) ? version : null;
6236         });
6237     }
6238     Version.oldGlibc = oldGlibc;
6239     // Run a system command and capture any stdout produced.
6240     function run(command, flags) {
6241         var e_1, _a;
6242         return __awaiter(this, void 0, void 0, function* () {
6243             const child = child_process.spawn(command, flags, { stdio: ['ignore', 'pipe', 'ignore'] });
6244             let output = '';
6245             try {
6246                 for (var _b = __asyncValues(child.stdout), _c; _c = yield _b.next(), !_c.done;) {
6247                     const chunk = _c.value;
6248                     output += chunk;
6249                 }
6250             }
6251             catch (e_1_1) { e_1 = { error: e_1_1 }; }
6252             finally {
6253                 try {
6254                     if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
6255                 }
6256                 finally { if (e_1) throw e_1.error; }
6257             }
6258             return output;
6259         });
6260     }
6261     function rangeGreater(newVer, oldVer) {
6262         return semver.gtr(semver.minVersion(newVer), oldVer);
6263     }
6264 })(Version || (Version = {}));
6265 //# sourceMappingURL=index.js.map
6266
6267 /***/ }),
6268 /* 39 */
6269 /***/ (function(module, exports, __webpack_require__) {
6270
6271 "use strict";
6272 /**
6273  * @author Toru Nagashima <https://github.com/mysticatea>
6274  * See LICENSE file in root directory for full license.
6275  */
6276
6277
6278 Object.defineProperty(exports, '__esModule', { value: true });
6279
6280 var eventTargetShim = __webpack_require__(40);
6281
6282 /**
6283  * The signal class.
6284  * @see https://dom.spec.whatwg.org/#abortsignal
6285  */
6286 class AbortSignal extends eventTargetShim.EventTarget {
6287     /**
6288      * AbortSignal cannot be constructed directly.
6289      */
6290     constructor() {
6291         super();
6292         throw new TypeError("AbortSignal cannot be constructed directly");
6293     }
6294     /**
6295      * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
6296      */
6297     get aborted() {
6298         const aborted = abortedFlags.get(this);
6299         if (typeof aborted !== "boolean") {
6300             throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
6301         }
6302         return aborted;
6303     }
6304 }
6305 eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
6306 /**
6307  * Create an AbortSignal object.
6308  */
6309 function createAbortSignal() {
6310     const signal = Object.create(AbortSignal.prototype);
6311     eventTargetShim.EventTarget.call(signal);
6312     abortedFlags.set(signal, false);
6313     return signal;
6314 }
6315 /**
6316  * Abort a given signal.
6317  */
6318 function abortSignal(signal) {
6319     if (abortedFlags.get(signal) !== false) {
6320         return;
6321     }
6322     abortedFlags.set(signal, true);
6323     signal.dispatchEvent({ type: "abort" });
6324 }
6325 /**
6326  * Aborted flag for each instances.
6327  */
6328 const abortedFlags = new WeakMap();
6329 // Properties should be enumerable.
6330 Object.defineProperties(AbortSignal.prototype, {
6331     aborted: { enumerable: true },
6332 });
6333 // `toString()` should return `"[object AbortSignal]"`
6334 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
6335     Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
6336         configurable: true,
6337         value: "AbortSignal",
6338     });
6339 }
6340
6341 /**
6342  * The AbortController.
6343  * @see https://dom.spec.whatwg.org/#abortcontroller
6344  */
6345 class AbortController {
6346     /**
6347      * Initialize this controller.
6348      */
6349     constructor() {
6350         signals.set(this, createAbortSignal());
6351     }
6352     /**
6353      * Returns the `AbortSignal` object associated with this object.
6354      */
6355     get signal() {
6356         return getSignal(this);
6357     }
6358     /**
6359      * Abort and signal to any observers that the associated activity is to be aborted.
6360      */
6361     abort() {
6362         abortSignal(getSignal(this));
6363     }
6364 }
6365 /**
6366  * Associated signals.
6367  */
6368 const signals = new WeakMap();
6369 /**
6370  * Get the associated signal of a given controller.
6371  */
6372 function getSignal(controller) {
6373     const signal = signals.get(controller);
6374     if (signal == null) {
6375         throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
6376     }
6377     return signal;
6378 }
6379 // Properties should be enumerable.
6380 Object.defineProperties(AbortController.prototype, {
6381     signal: { enumerable: true },
6382     abort: { enumerable: true },
6383 });
6384 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
6385     Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
6386         configurable: true,
6387         value: "AbortController",
6388     });
6389 }
6390
6391 exports.AbortController = AbortController;
6392 exports.AbortSignal = AbortSignal;
6393 exports.default = AbortController;
6394
6395 module.exports = AbortController
6396 module.exports.AbortController = module.exports["default"] = AbortController
6397 module.exports.AbortSignal = AbortSignal
6398 //# sourceMappingURL=abort-controller.js.map
6399
6400
6401 /***/ }),
6402 /* 40 */
6403 /***/ (function(module, exports, __webpack_require__) {
6404
6405 "use strict";
6406 /**
6407  * @author Toru Nagashima <https://github.com/mysticatea>
6408  * @copyright 2015 Toru Nagashima. All rights reserved.
6409  * See LICENSE file in root directory for full license.
6410  */
6411
6412
6413 Object.defineProperty(exports, '__esModule', { value: true });
6414
6415 /**
6416  * @typedef {object} PrivateData
6417  * @property {EventTarget} eventTarget The event target.
6418  * @property {{type:string}} event The original event object.
6419  * @property {number} eventPhase The current event phase.
6420  * @property {EventTarget|null} currentTarget The current event target.
6421  * @property {boolean} canceled The flag to prevent default.
6422  * @property {boolean} stopped The flag to stop propagation.
6423  * @property {boolean} immediateStopped The flag to stop propagation immediately.
6424  * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
6425  * @property {number} timeStamp The unix time.
6426  * @private
6427  */
6428
6429 /**
6430  * Private data for event wrappers.
6431  * @type {WeakMap<Event, PrivateData>}
6432  * @private
6433  */
6434 const privateData = new WeakMap();
6435
6436 /**
6437  * Cache for wrapper classes.
6438  * @type {WeakMap<Object, Function>}
6439  * @private
6440  */
6441 const wrappers = new WeakMap();
6442
6443 /**
6444  * Get private data.
6445  * @param {Event} event The event object to get private data.
6446  * @returns {PrivateData} The private data of the event.
6447  * @private
6448  */
6449 function pd(event) {
6450     const retv = privateData.get(event);
6451     console.assert(
6452         retv != null,
6453         "'this' is expected an Event object, but got",
6454         event
6455     );
6456     return retv
6457 }
6458
6459 /**
6460  * https://dom.spec.whatwg.org/#set-the-canceled-flag
6461  * @param data {PrivateData} private data.
6462  */
6463 function setCancelFlag(data) {
6464     if (data.passiveListener != null) {
6465         if (
6466             typeof console !== "undefined" &&
6467             typeof console.error === "function"
6468         ) {
6469             console.error(
6470                 "Unable to preventDefault inside passive event listener invocation.",
6471                 data.passiveListener
6472             );
6473         }
6474         return
6475     }
6476     if (!data.event.cancelable) {
6477         return
6478     }
6479
6480     data.canceled = true;
6481     if (typeof data.event.preventDefault === "function") {
6482         data.event.preventDefault();
6483     }
6484 }
6485
6486 /**
6487  * @see https://dom.spec.whatwg.org/#interface-event
6488  * @private
6489  */
6490 /**
6491  * The event wrapper.
6492  * @constructor
6493  * @param {EventTarget} eventTarget The event target of this dispatching.
6494  * @param {Event|{type:string}} event The original event to wrap.
6495  */
6496 function Event(eventTarget, event) {
6497     privateData.set(this, {
6498         eventTarget,
6499         event,
6500         eventPhase: 2,
6501         currentTarget: eventTarget,
6502         canceled: false,
6503         stopped: false,
6504         immediateStopped: false,
6505         passiveListener: null,
6506         timeStamp: event.timeStamp || Date.now(),
6507     });
6508
6509     // https://heycam.github.io/webidl/#Unforgeable
6510     Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
6511
6512     // Define accessors
6513     const keys = Object.keys(event);
6514     for (let i = 0; i < keys.length; ++i) {
6515         const key = keys[i];
6516         if (!(key in this)) {
6517             Object.defineProperty(this, key, defineRedirectDescriptor(key));
6518         }
6519     }
6520 }
6521
6522 // Should be enumerable, but class methods are not enumerable.
6523 Event.prototype = {
6524     /**
6525      * The type of this event.
6526      * @type {string}
6527      */
6528     get type() {
6529         return pd(this).event.type
6530     },
6531
6532     /**
6533      * The target of this event.
6534      * @type {EventTarget}
6535      */
6536     get target() {
6537         return pd(this).eventTarget
6538     },
6539
6540     /**
6541      * The target of this event.
6542      * @type {EventTarget}
6543      */
6544     get currentTarget() {
6545         return pd(this).currentTarget
6546     },
6547
6548     /**
6549      * @returns {EventTarget[]} The composed path of this event.
6550      */
6551     composedPath() {
6552         const currentTarget = pd(this).currentTarget;
6553         if (currentTarget == null) {
6554             return []
6555         }
6556         return [currentTarget]
6557     },
6558
6559     /**
6560      * Constant of NONE.
6561      * @type {number}
6562      */
6563     get NONE() {
6564         return 0
6565     },
6566
6567     /**
6568      * Constant of CAPTURING_PHASE.
6569      * @type {number}
6570      */
6571     get CAPTURING_PHASE() {
6572         return 1
6573     },
6574
6575     /**
6576      * Constant of AT_TARGET.
6577      * @type {number}
6578      */
6579     get AT_TARGET() {
6580         return 2
6581     },
6582
6583     /**
6584      * Constant of BUBBLING_PHASE.
6585      * @type {number}
6586      */
6587     get BUBBLING_PHASE() {
6588         return 3
6589     },
6590
6591     /**
6592      * The target of this event.
6593      * @type {number}
6594      */
6595     get eventPhase() {
6596         return pd(this).eventPhase
6597     },
6598
6599     /**
6600      * Stop event bubbling.
6601      * @returns {void}
6602      */
6603     stopPropagation() {
6604         const data = pd(this);
6605
6606         data.stopped = true;
6607         if (typeof data.event.stopPropagation === "function") {
6608             data.event.stopPropagation();
6609         }
6610     },
6611
6612     /**
6613      * Stop event bubbling.
6614      * @returns {void}
6615      */
6616     stopImmediatePropagation() {
6617         const data = pd(this);
6618
6619         data.stopped = true;
6620         data.immediateStopped = true;
6621         if (typeof data.event.stopImmediatePropagation === "function") {
6622             data.event.stopImmediatePropagation();
6623         }
6624     },
6625
6626     /**
6627      * The flag to be bubbling.
6628      * @type {boolean}
6629      */
6630     get bubbles() {
6631         return Boolean(pd(this).event.bubbles)
6632     },
6633
6634     /**
6635      * The flag to be cancelable.
6636      * @type {boolean}
6637      */
6638     get cancelable() {
6639         return Boolean(pd(this).event.cancelable)
6640     },
6641
6642     /**
6643      * Cancel this event.
6644      * @returns {void}
6645      */
6646     preventDefault() {
6647         setCancelFlag(pd(this));
6648     },
6649
6650     /**
6651      * The flag to indicate cancellation state.
6652      * @type {boolean}
6653      */
6654     get defaultPrevented() {
6655         return pd(this).canceled
6656     },
6657
6658     /**
6659      * The flag to be composed.
6660      * @type {boolean}
6661      */
6662     get composed() {
6663         return Boolean(pd(this).event.composed)
6664     },
6665
6666     /**
6667      * The unix time of this event.
6668      * @type {number}
6669      */
6670     get timeStamp() {
6671         return pd(this).timeStamp
6672     },
6673
6674     /**
6675      * The target of this event.
6676      * @type {EventTarget}
6677      * @deprecated
6678      */
6679     get srcElement() {
6680         return pd(this).eventTarget
6681     },
6682
6683     /**
6684      * The flag to stop event bubbling.
6685      * @type {boolean}
6686      * @deprecated
6687      */
6688     get cancelBubble() {
6689         return pd(this).stopped
6690     },
6691     set cancelBubble(value) {
6692         if (!value) {
6693             return
6694         }
6695         const data = pd(this);
6696
6697         data.stopped = true;
6698         if (typeof data.event.cancelBubble === "boolean") {
6699             data.event.cancelBubble = true;
6700         }
6701     },
6702
6703     /**
6704      * The flag to indicate cancellation state.
6705      * @type {boolean}
6706      * @deprecated
6707      */
6708     get returnValue() {
6709         return !pd(this).canceled
6710     },
6711     set returnValue(value) {
6712         if (!value) {
6713             setCancelFlag(pd(this));
6714         }
6715     },
6716
6717     /**
6718      * Initialize this event object. But do nothing under event dispatching.
6719      * @param {string} type The event type.
6720      * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
6721      * @param {boolean} [cancelable=false] The flag to be possible to cancel.
6722      * @deprecated
6723      */
6724     initEvent() {
6725         // Do nothing.
6726     },
6727 };
6728
6729 // `constructor` is not enumerable.
6730 Object.defineProperty(Event.prototype, "constructor", {
6731     value: Event,
6732     configurable: true,
6733     writable: true,
6734 });
6735
6736 // Ensure `event instanceof window.Event` is `true`.
6737 if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
6738     Object.setPrototypeOf(Event.prototype, window.Event.prototype);
6739
6740     // Make association for wrappers.
6741     wrappers.set(window.Event.prototype, Event);
6742 }
6743
6744 /**
6745  * Get the property descriptor to redirect a given property.
6746  * @param {string} key Property name to define property descriptor.
6747  * @returns {PropertyDescriptor} The property descriptor to redirect the property.
6748  * @private
6749  */
6750 function defineRedirectDescriptor(key) {
6751     return {
6752         get() {
6753             return pd(this).event[key]
6754         },
6755         set(value) {
6756             pd(this).event[key] = value;
6757         },
6758         configurable: true,
6759         enumerable: true,
6760     }
6761 }
6762
6763 /**
6764  * Get the property descriptor to call a given method property.
6765  * @param {string} key Property name to define property descriptor.
6766  * @returns {PropertyDescriptor} The property descriptor to call the method property.
6767  * @private
6768  */
6769 function defineCallDescriptor(key) {
6770     return {
6771         value() {
6772             const event = pd(this).event;
6773             return event[key].apply(event, arguments)
6774         },
6775         configurable: true,
6776         enumerable: true,
6777     }
6778 }
6779
6780 /**
6781  * Define new wrapper class.
6782  * @param {Function} BaseEvent The base wrapper class.
6783  * @param {Object} proto The prototype of the original event.
6784  * @returns {Function} The defined wrapper class.
6785  * @private
6786  */
6787 function defineWrapper(BaseEvent, proto) {
6788     const keys = Object.keys(proto);
6789     if (keys.length === 0) {
6790         return BaseEvent
6791     }
6792
6793     /** CustomEvent */
6794     function CustomEvent(eventTarget, event) {
6795         BaseEvent.call(this, eventTarget, event);
6796     }
6797
6798     CustomEvent.prototype = Object.create(BaseEvent.prototype, {
6799         constructor: { value: CustomEvent, configurable: true, writable: true },
6800     });
6801
6802     // Define accessors.
6803     for (let i = 0; i < keys.length; ++i) {
6804         const key = keys[i];
6805         if (!(key in BaseEvent.prototype)) {
6806             const descriptor = Object.getOwnPropertyDescriptor(proto, key);
6807             const isFunc = typeof descriptor.value === "function";
6808             Object.defineProperty(
6809                 CustomEvent.prototype,
6810                 key,
6811                 isFunc
6812                     ? defineCallDescriptor(key)
6813                     : defineRedirectDescriptor(key)
6814             );
6815         }
6816     }
6817
6818     return CustomEvent
6819 }
6820
6821 /**
6822  * Get the wrapper class of a given prototype.
6823  * @param {Object} proto The prototype of the original event to get its wrapper.
6824  * @returns {Function} The wrapper class.
6825  * @private
6826  */
6827 function getWrapper(proto) {
6828     if (proto == null || proto === Object.prototype) {
6829         return Event
6830     }
6831
6832     let wrapper = wrappers.get(proto);
6833     if (wrapper == null) {
6834         wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
6835         wrappers.set(proto, wrapper);
6836     }
6837     return wrapper
6838 }
6839
6840 /**
6841  * Wrap a given event to management a dispatching.
6842  * @param {EventTarget} eventTarget The event target of this dispatching.
6843  * @param {Object} event The event to wrap.
6844  * @returns {Event} The wrapper instance.
6845  * @private
6846  */
6847 function wrapEvent(eventTarget, event) {
6848     const Wrapper = getWrapper(Object.getPrototypeOf(event));
6849     return new Wrapper(eventTarget, event)
6850 }
6851
6852 /**
6853  * Get the immediateStopped flag of a given event.
6854  * @param {Event} event The event to get.
6855  * @returns {boolean} The flag to stop propagation immediately.
6856  * @private
6857  */
6858 function isStopped(event) {
6859     return pd(event).immediateStopped
6860 }
6861
6862 /**
6863  * Set the current event phase of a given event.
6864  * @param {Event} event The event to set current target.
6865  * @param {number} eventPhase New event phase.
6866  * @returns {void}
6867  * @private
6868  */
6869 function setEventPhase(event, eventPhase) {
6870     pd(event).eventPhase = eventPhase;
6871 }
6872
6873 /**
6874  * Set the current target of a given event.
6875  * @param {Event} event The event to set current target.
6876  * @param {EventTarget|null} currentTarget New current target.
6877  * @returns {void}
6878  * @private
6879  */
6880 function setCurrentTarget(event, currentTarget) {
6881     pd(event).currentTarget = currentTarget;
6882 }
6883
6884 /**
6885  * Set a passive listener of a given event.
6886  * @param {Event} event The event to set current target.
6887  * @param {Function|null} passiveListener New passive listener.
6888  * @returns {void}
6889  * @private
6890  */
6891 function setPassiveListener(event, passiveListener) {
6892     pd(event).passiveListener = passiveListener;
6893 }
6894
6895 /**
6896  * @typedef {object} ListenerNode
6897  * @property {Function} listener
6898  * @property {1|2|3} listenerType
6899  * @property {boolean} passive
6900  * @property {boolean} once
6901  * @property {ListenerNode|null} next
6902  * @private
6903  */
6904
6905 /**
6906  * @type {WeakMap<object, Map<string, ListenerNode>>}
6907  * @private
6908  */
6909 const listenersMap = new WeakMap();
6910
6911 // Listener types
6912 const CAPTURE = 1;
6913 const BUBBLE = 2;
6914 const ATTRIBUTE = 3;
6915
6916 /**
6917  * Check whether a given value is an object or not.
6918  * @param {any} x The value to check.
6919  * @returns {boolean} `true` if the value is an object.
6920  */
6921 function isObject(x) {
6922     return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
6923 }
6924
6925 /**
6926  * Get listeners.
6927  * @param {EventTarget} eventTarget The event target to get.
6928  * @returns {Map<string, ListenerNode>} The listeners.
6929  * @private
6930  */
6931 function getListeners(eventTarget) {
6932     const listeners = listenersMap.get(eventTarget);
6933     if (listeners == null) {
6934         throw new TypeError(
6935             "'this' is expected an EventTarget object, but got another value."
6936         )
6937     }
6938     return listeners
6939 }
6940
6941 /**
6942  * Get the property descriptor for the event attribute of a given event.
6943  * @param {string} eventName The event name to get property descriptor.
6944  * @returns {PropertyDescriptor} The property descriptor.
6945  * @private
6946  */
6947 function defineEventAttributeDescriptor(eventName) {
6948     return {
6949         get() {
6950             const listeners = getListeners(this);
6951             let node = listeners.get(eventName);
6952             while (node != null) {
6953                 if (node.listenerType === ATTRIBUTE) {
6954                     return node.listener
6955                 }
6956                 node = node.next;
6957             }
6958             return null
6959         },
6960
6961         set(listener) {
6962             if (typeof listener !== "function" && !isObject(listener)) {
6963                 listener = null; // eslint-disable-line no-param-reassign
6964             }
6965             const listeners = getListeners(this);
6966
6967             // Traverse to the tail while removing old value.
6968             let prev = null;
6969             let node = listeners.get(eventName);
6970             while (node != null) {
6971                 if (node.listenerType === ATTRIBUTE) {
6972                     // Remove old value.
6973                     if (prev !== null) {
6974                         prev.next = node.next;
6975                     } else if (node.next !== null) {
6976                         listeners.set(eventName, node.next);
6977                     } else {
6978                         listeners.delete(eventName);
6979                     }
6980                 } else {
6981                     prev = node;
6982                 }
6983
6984                 node = node.next;
6985             }
6986
6987             // Add new value.
6988             if (listener !== null) {
6989                 const newNode = {
6990                     listener,
6991                     listenerType: ATTRIBUTE,
6992                     passive: false,
6993                     once: false,
6994                     next: null,
6995                 };
6996                 if (prev === null) {
6997                     listeners.set(eventName, newNode);
6998                 } else {
6999                     prev.next = newNode;
7000                 }
7001             }
7002         },
7003         configurable: true,
7004         enumerable: true,
7005     }
7006 }
7007
7008 /**
7009  * Define an event attribute (e.g. `eventTarget.onclick`).
7010  * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
7011  * @param {string} eventName The event name to define.
7012  * @returns {void}
7013  */
7014 function defineEventAttribute(eventTargetPrototype, eventName) {
7015     Object.defineProperty(
7016         eventTargetPrototype,
7017         `on${eventName}`,
7018         defineEventAttributeDescriptor(eventName)
7019     );
7020 }
7021
7022 /**
7023  * Define a custom EventTarget with event attributes.
7024  * @param {string[]} eventNames Event names for event attributes.
7025  * @returns {EventTarget} The custom EventTarget.
7026  * @private
7027  */
7028 function defineCustomEventTarget(eventNames) {
7029     /** CustomEventTarget */
7030     function CustomEventTarget() {
7031         EventTarget.call(this);
7032     }
7033
7034     CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
7035         constructor: {
7036             value: CustomEventTarget,
7037             configurable: true,
7038             writable: true,
7039         },
7040     });
7041
7042     for (let i = 0; i < eventNames.length; ++i) {
7043         defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
7044     }
7045
7046     return CustomEventTarget
7047 }
7048
7049 /**
7050  * EventTarget.
7051  *
7052  * - This is constructor if no arguments.
7053  * - This is a function which returns a CustomEventTarget constructor if there are arguments.
7054  *
7055  * For example:
7056  *
7057  *     class A extends EventTarget {}
7058  *     class B extends EventTarget("message") {}
7059  *     class C extends EventTarget("message", "error") {}
7060  *     class D extends EventTarget(["message", "error"]) {}
7061  */
7062 function EventTarget() {
7063     /*eslint-disable consistent-return */
7064     if (this instanceof EventTarget) {
7065         listenersMap.set(this, new Map());
7066         return
7067     }
7068     if (arguments.length === 1 && Array.isArray(arguments[0])) {
7069         return defineCustomEventTarget(arguments[0])
7070     }
7071     if (arguments.length > 0) {
7072         const types = new Array(arguments.length);
7073         for (let i = 0; i < arguments.length; ++i) {
7074             types[i] = arguments[i];
7075         }
7076         return defineCustomEventTarget(types)
7077     }
7078     throw new TypeError("Cannot call a class as a function")
7079     /*eslint-enable consistent-return */
7080 }
7081
7082 // Should be enumerable, but class methods are not enumerable.
7083 EventTarget.prototype = {
7084     /**
7085      * Add a given listener to this event target.
7086      * @param {string} eventName The event name to add.
7087      * @param {Function} listener The listener to add.
7088      * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
7089      * @returns {void}
7090      */
7091     addEventListener(eventName, listener, options) {
7092         if (listener == null) {
7093             return
7094         }
7095         if (typeof listener !== "function" && !isObject(listener)) {
7096             throw new TypeError("'listener' should be a function or an object.")
7097         }
7098
7099         const listeners = getListeners(this);
7100         const optionsIsObj = isObject(options);
7101         const capture = optionsIsObj
7102             ? Boolean(options.capture)
7103             : Boolean(options);
7104         const listenerType = capture ? CAPTURE : BUBBLE;
7105         const newNode = {
7106             listener,
7107             listenerType,
7108             passive: optionsIsObj && Boolean(options.passive),
7109             once: optionsIsObj && Boolean(options.once),
7110             next: null,
7111         };
7112
7113         // Set it as the first node if the first node is null.
7114         let node = listeners.get(eventName);
7115         if (node === undefined) {
7116             listeners.set(eventName, newNode);
7117             return
7118         }
7119
7120         // Traverse to the tail while checking duplication..
7121         let prev = null;
7122         while (node != null) {
7123             if (
7124                 node.listener === listener &&
7125                 node.listenerType === listenerType
7126             ) {
7127                 // Should ignore duplication.
7128                 return
7129             }
7130             prev = node;
7131             node = node.next;
7132         }
7133
7134         // Add it.
7135         prev.next = newNode;
7136     },
7137
7138     /**
7139      * Remove a given listener from this event target.
7140      * @param {string} eventName The event name to remove.
7141      * @param {Function} listener The listener to remove.
7142      * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
7143      * @returns {void}
7144      */
7145     removeEventListener(eventName, listener, options) {
7146         if (listener == null) {
7147             return
7148         }
7149
7150         const listeners = getListeners(this);
7151         const capture = isObject(options)
7152             ? Boolean(options.capture)
7153             : Boolean(options);
7154         const listenerType = capture ? CAPTURE : BUBBLE;
7155
7156         let prev = null;
7157         let node = listeners.get(eventName);
7158         while (node != null) {
7159             if (
7160                 node.listener === listener &&
7161                 node.listenerType === listenerType
7162             ) {
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                 return
7171             }
7172
7173             prev = node;
7174             node = node.next;
7175         }
7176     },
7177
7178     /**
7179      * Dispatch a given event.
7180      * @param {Event|{type:string}} event The event to dispatch.
7181      * @returns {boolean} `false` if canceled.
7182      */
7183     dispatchEvent(event) {
7184         if (event == null || typeof event.type !== "string") {
7185             throw new TypeError('"event.type" should be a string.')
7186         }
7187
7188         // If listeners aren't registered, terminate.
7189         const listeners = getListeners(this);
7190         const eventName = event.type;
7191         let node = listeners.get(eventName);
7192         if (node == null) {
7193             return true
7194         }
7195
7196         // Since we cannot rewrite several properties, so wrap object.
7197         const wrappedEvent = wrapEvent(this, event);
7198
7199         // This doesn't process capturing phase and bubbling phase.
7200         // This isn't participating in a tree.
7201         let prev = null;
7202         while (node != null) {
7203             // Remove this listener if it's once
7204             if (node.once) {
7205                 if (prev !== null) {
7206                     prev.next = node.next;
7207                 } else if (node.next !== null) {
7208                     listeners.set(eventName, node.next);
7209                 } else {
7210                     listeners.delete(eventName);
7211                 }
7212             } else {
7213                 prev = node;
7214             }
7215
7216             // Call this listener
7217             setPassiveListener(
7218                 wrappedEvent,
7219                 node.passive ? node.listener : null
7220             );
7221             if (typeof node.listener === "function") {
7222                 try {
7223                     node.listener.call(this, wrappedEvent);
7224                 } catch (err) {
7225                     if (
7226                         typeof console !== "undefined" &&
7227                         typeof console.error === "function"
7228                     ) {
7229                         console.error(err);
7230                     }
7231                 }
7232             } else if (
7233                 node.listenerType !== ATTRIBUTE &&
7234                 typeof node.listener.handleEvent === "function"
7235             ) {
7236                 node.listener.handleEvent(wrappedEvent);
7237             }
7238
7239             // Break if `event.stopImmediatePropagation` was called.
7240             if (isStopped(wrappedEvent)) {
7241                 break
7242             }
7243
7244             node = node.next;
7245         }
7246         setPassiveListener(wrappedEvent, null);
7247         setEventPhase(wrappedEvent, 0);
7248         setCurrentTarget(wrappedEvent, null);
7249
7250         return !wrappedEvent.defaultPrevented
7251     },
7252 };
7253
7254 // `constructor` is not enumerable.
7255 Object.defineProperty(EventTarget.prototype, "constructor", {
7256     value: EventTarget,
7257     configurable: true,
7258     writable: true,
7259 });
7260
7261 // Ensure `eventTarget instanceof window.EventTarget` is `true`.
7262 if (
7263     typeof window !== "undefined" &&
7264     typeof window.EventTarget !== "undefined"
7265 ) {
7266     Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
7267 }
7268
7269 exports.defineEventAttribute = defineEventAttribute;
7270 exports.EventTarget = EventTarget;
7271 exports.default = EventTarget;
7272
7273 module.exports = EventTarget
7274 module.exports.EventTarget = module.exports["default"] = EventTarget
7275 module.exports.defineEventAttribute = defineEventAttribute
7276 //# sourceMappingURL=event-target-shim.js.map
7277
7278
7279 /***/ }),
7280 /* 41 */
7281 /***/ (function(module, exports) {
7282
7283 module.exports = require("child_process");
7284
7285 /***/ }),
7286 /* 42 */
7287 /***/ (function(module, exports) {
7288
7289 module.exports = require("fs");
7290
7291 /***/ }),
7292 /* 43 */
7293 /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
7294
7295 "use strict";
7296 __webpack_require__.r(__webpack_exports__);
7297 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Headers", function() { return Headers; });
7298 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Request", function() { return Request; });
7299 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Response", function() { return Response; });
7300 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FetchError", function() { return FetchError; });
7301 /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44);
7302 /* harmony import */ var http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45);
7303 /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46);
7304 /* harmony import */ var https__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47);
7305 /* harmony import */ var zlib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(48);
7306
7307
7308
7309
7310
7311
7312 // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
7313
7314 // fix for "Readable" isn't a named export issue
7315 const Readable = stream__WEBPACK_IMPORTED_MODULE_0__.Readable;
7316
7317 const BUFFER = Symbol('buffer');
7318 const TYPE = Symbol('type');
7319
7320 class Blob {
7321         constructor() {
7322                 this[TYPE] = '';
7323
7324                 const blobParts = arguments[0];
7325                 const options = arguments[1];
7326
7327                 const buffers = [];
7328                 let size = 0;
7329
7330                 if (blobParts) {
7331                         const a = blobParts;
7332                         const length = Number(a.length);
7333                         for (let i = 0; i < length; i++) {
7334                                 const element = a[i];
7335                                 let buffer;
7336                                 if (element instanceof Buffer) {
7337                                         buffer = element;
7338                                 } else if (ArrayBuffer.isView(element)) {
7339                                         buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
7340                                 } else if (element instanceof ArrayBuffer) {
7341                                         buffer = Buffer.from(element);
7342                                 } else if (element instanceof Blob) {
7343                                         buffer = element[BUFFER];
7344                                 } else {
7345                                         buffer = Buffer.from(typeof element === 'string' ? element : String(element));
7346                                 }
7347                                 size += buffer.length;
7348                                 buffers.push(buffer);
7349                         }
7350                 }
7351
7352                 this[BUFFER] = Buffer.concat(buffers);
7353
7354                 let type = options && options.type !== undefined && String(options.type).toLowerCase();
7355                 if (type && !/[^\u0020-\u007E]/.test(type)) {
7356                         this[TYPE] = type;
7357                 }
7358         }
7359         get size() {
7360                 return this[BUFFER].length;
7361         }
7362         get type() {
7363                 return this[TYPE];
7364         }
7365         text() {
7366                 return Promise.resolve(this[BUFFER].toString());
7367         }
7368         arrayBuffer() {
7369                 const buf = this[BUFFER];
7370                 const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
7371                 return Promise.resolve(ab);
7372         }
7373         stream() {
7374                 const readable = new Readable();
7375                 readable._read = function () {};
7376                 readable.push(this[BUFFER]);
7377                 readable.push(null);
7378                 return readable;
7379         }
7380         toString() {
7381                 return '[object Blob]';
7382         }
7383         slice() {
7384                 const size = this.size;
7385
7386                 const start = arguments[0];
7387                 const end = arguments[1];
7388                 let relativeStart, relativeEnd;
7389                 if (start === undefined) {
7390                         relativeStart = 0;
7391                 } else if (start < 0) {
7392                         relativeStart = Math.max(size + start, 0);
7393                 } else {
7394                         relativeStart = Math.min(start, size);
7395                 }
7396                 if (end === undefined) {
7397                         relativeEnd = size;
7398                 } else if (end < 0) {
7399                         relativeEnd = Math.max(size + end, 0);
7400                 } else {
7401                         relativeEnd = Math.min(end, size);
7402                 }
7403                 const span = Math.max(relativeEnd - relativeStart, 0);
7404
7405                 const buffer = this[BUFFER];
7406                 const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
7407                 const blob = new Blob([], { type: arguments[2] });
7408                 blob[BUFFER] = slicedBuffer;
7409                 return blob;
7410         }
7411 }
7412
7413 Object.defineProperties(Blob.prototype, {
7414         size: { enumerable: true },
7415         type: { enumerable: true },
7416         slice: { enumerable: true }
7417 });
7418
7419 Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
7420         value: 'Blob',
7421         writable: false,
7422         enumerable: false,
7423         configurable: true
7424 });
7425
7426 /**
7427  * fetch-error.js
7428  *
7429  * FetchError interface for operational errors
7430  */
7431
7432 /**
7433  * Create FetchError instance
7434  *
7435  * @param   String      message      Error message for human
7436  * @param   String      type         Error type for machine
7437  * @param   String      systemError  For Node.js system error
7438  * @return  FetchError
7439  */
7440 function FetchError(message, type, systemError) {
7441   Error.call(this, message);
7442
7443   this.message = message;
7444   this.type = type;
7445
7446   // when err.type is `system`, err.code contains system error code
7447   if (systemError) {
7448     this.code = this.errno = systemError.code;
7449   }
7450
7451   // hide custom error implementation details from end-users
7452   Error.captureStackTrace(this, this.constructor);
7453 }
7454
7455 FetchError.prototype = Object.create(Error.prototype);
7456 FetchError.prototype.constructor = FetchError;
7457 FetchError.prototype.name = 'FetchError';
7458
7459 let convert;
7460 try {
7461         convert = require('encoding').convert;
7462 } catch (e) {}
7463
7464 const INTERNALS = Symbol('Body internals');
7465
7466 // fix an issue where "PassThrough" isn't a named export for node <10
7467 const PassThrough = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
7468
7469 /**
7470  * Body mixin
7471  *
7472  * Ref: https://fetch.spec.whatwg.org/#body
7473  *
7474  * @param   Stream  body  Readable stream
7475  * @param   Object  opts  Response options
7476  * @return  Void
7477  */
7478 function Body(body) {
7479         var _this = this;
7480
7481         var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
7482             _ref$size = _ref.size;
7483
7484         let size = _ref$size === undefined ? 0 : _ref$size;
7485         var _ref$timeout = _ref.timeout;
7486         let timeout = _ref$timeout === undefined ? 0 : _ref$timeout;
7487
7488         if (body == null) {
7489                 // body is undefined or null
7490                 body = null;
7491         } else if (isURLSearchParams(body)) {
7492                 // body is a URLSearchParams
7493                 body = Buffer.from(body.toString());
7494         } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
7495                 // body is ArrayBuffer
7496                 body = Buffer.from(body);
7497         } else if (ArrayBuffer.isView(body)) {
7498                 // body is ArrayBufferView
7499                 body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
7500         } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) ; else {
7501                 // none of the above
7502                 // coerce to string then buffer
7503                 body = Buffer.from(String(body));
7504         }
7505         this[INTERNALS] = {
7506                 body,
7507                 disturbed: false,
7508                 error: null
7509         };
7510         this.size = size;
7511         this.timeout = timeout;
7512
7513         if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
7514                 body.on('error', function (err) {
7515                         const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);
7516                         _this[INTERNALS].error = error;
7517                 });
7518         }
7519 }
7520
7521 Body.prototype = {
7522         get body() {
7523                 return this[INTERNALS].body;
7524         },
7525
7526         get bodyUsed() {
7527                 return this[INTERNALS].disturbed;
7528         },
7529
7530         /**
7531   * Decode response as ArrayBuffer
7532   *
7533   * @return  Promise
7534   */
7535         arrayBuffer() {
7536                 return consumeBody.call(this).then(function (buf) {
7537                         return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
7538                 });
7539         },
7540
7541         /**
7542   * Return raw response as Blob
7543   *
7544   * @return Promise
7545   */
7546         blob() {
7547                 let ct = this.headers && this.headers.get('content-type') || '';
7548                 return consumeBody.call(this).then(function (buf) {
7549                         return Object.assign(
7550                         // Prevent copying
7551                         new Blob([], {
7552                                 type: ct.toLowerCase()
7553                         }), {
7554                                 [BUFFER]: buf
7555                         });
7556                 });
7557         },
7558
7559         /**
7560   * Decode response as json
7561   *
7562   * @return  Promise
7563   */
7564         json() {
7565                 var _this2 = this;
7566
7567                 return consumeBody.call(this).then(function (buffer) {
7568                         try {
7569                                 return JSON.parse(buffer.toString());
7570                         } catch (err) {
7571                                 return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
7572                         }
7573                 });
7574         },
7575
7576         /**
7577   * Decode response as text
7578   *
7579   * @return  Promise
7580   */
7581         text() {
7582                 return consumeBody.call(this).then(function (buffer) {
7583                         return buffer.toString();
7584                 });
7585         },
7586
7587         /**
7588   * Decode response as buffer (non-spec api)
7589   *
7590   * @return  Promise
7591   */
7592         buffer() {
7593                 return consumeBody.call(this);
7594         },
7595
7596         /**
7597   * Decode response as text, while automatically detecting the encoding and
7598   * trying to decode to UTF-8 (non-spec api)
7599   *
7600   * @return  Promise
7601   */
7602         textConverted() {
7603                 var _this3 = this;
7604
7605                 return consumeBody.call(this).then(function (buffer) {
7606                         return convertBody(buffer, _this3.headers);
7607                 });
7608         }
7609 };
7610
7611 // In browsers, all properties are enumerable.
7612 Object.defineProperties(Body.prototype, {
7613         body: { enumerable: true },
7614         bodyUsed: { enumerable: true },
7615         arrayBuffer: { enumerable: true },
7616         blob: { enumerable: true },
7617         json: { enumerable: true },
7618         text: { enumerable: true }
7619 });
7620
7621 Body.mixIn = function (proto) {
7622         for (const name of Object.getOwnPropertyNames(Body.prototype)) {
7623                 // istanbul ignore else: future proof
7624                 if (!(name in proto)) {
7625                         const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
7626                         Object.defineProperty(proto, name, desc);
7627                 }
7628         }
7629 };
7630
7631 /**
7632  * Consume and convert an entire Body to a Buffer.
7633  *
7634  * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body
7635  *
7636  * @return  Promise
7637  */
7638 function consumeBody() {
7639         var _this4 = this;
7640
7641         if (this[INTERNALS].disturbed) {
7642                 return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
7643         }
7644
7645         this[INTERNALS].disturbed = true;
7646
7647         if (this[INTERNALS].error) {
7648                 return Body.Promise.reject(this[INTERNALS].error);
7649         }
7650
7651         let body = this.body;
7652
7653         // body is null
7654         if (body === null) {
7655                 return Body.Promise.resolve(Buffer.alloc(0));
7656         }
7657
7658         // body is blob
7659         if (isBlob(body)) {
7660                 body = body.stream();
7661         }
7662
7663         // body is buffer
7664         if (Buffer.isBuffer(body)) {
7665                 return Body.Promise.resolve(body);
7666         }
7667
7668         // istanbul ignore if: should never happen
7669         if (!(body instanceof stream__WEBPACK_IMPORTED_MODULE_0__)) {
7670                 return Body.Promise.resolve(Buffer.alloc(0));
7671         }
7672
7673         // body is stream
7674         // get ready to actually consume the body
7675         let accum = [];
7676         let accumBytes = 0;
7677         let abort = false;
7678
7679         return new Body.Promise(function (resolve, reject) {
7680                 let resTimeout;
7681
7682                 // allow timeout on slow response body
7683                 if (_this4.timeout) {
7684                         resTimeout = setTimeout(function () {
7685                                 abort = true;
7686                                 reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));
7687                         }, _this4.timeout);
7688                 }
7689
7690                 // handle stream errors
7691                 body.on('error', function (err) {
7692                         if (err.name === 'AbortError') {
7693                                 // if the request was aborted, reject with this Error
7694                                 abort = true;
7695                                 reject(err);
7696                         } else {
7697                                 // other errors, such as incorrect content-encoding
7698                                 reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));
7699                         }
7700                 });
7701
7702                 body.on('data', function (chunk) {
7703                         if (abort || chunk === null) {
7704                                 return;
7705                         }
7706
7707                         if (_this4.size && accumBytes + chunk.length > _this4.size) {
7708                                 abort = true;
7709                                 reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));
7710                                 return;
7711                         }
7712
7713                         accumBytes += chunk.length;
7714                         accum.push(chunk);
7715                 });
7716
7717                 body.on('end', function () {
7718                         if (abort) {
7719                                 return;
7720                         }
7721
7722                         clearTimeout(resTimeout);
7723
7724                         try {
7725                                 resolve(Buffer.concat(accum, accumBytes));
7726                         } catch (err) {
7727                                 // handle streams that have accumulated too much data (issue #414)
7728                                 reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));
7729                         }
7730                 });
7731         });
7732 }
7733
7734 /**
7735  * Detect buffer encoding and convert to target encoding
7736  * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding
7737  *
7738  * @param   Buffer  buffer    Incoming buffer
7739  * @param   String  encoding  Target encoding
7740  * @return  String
7741  */
7742 function convertBody(buffer, headers) {
7743         if (typeof convert !== 'function') {
7744                 throw new Error('The package `encoding` must be installed to use the textConverted() function');
7745         }
7746
7747         const ct = headers.get('content-type');
7748         let charset = 'utf-8';
7749         let res, str;
7750
7751         // header
7752         if (ct) {
7753                 res = /charset=([^;]*)/i.exec(ct);
7754         }
7755
7756         // no charset in content type, peek at response body for at most 1024 bytes
7757         str = buffer.slice(0, 1024).toString();
7758
7759         // html5
7760         if (!res && str) {
7761                 res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
7762         }
7763
7764         // html4
7765         if (!res && str) {
7766                 res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
7767
7768                 if (res) {
7769                         res = /charset=(.*)/i.exec(res.pop());
7770                 }
7771         }
7772
7773         // xml
7774         if (!res && str) {
7775                 res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
7776         }
7777
7778         // found charset
7779         if (res) {
7780                 charset = res.pop();
7781
7782                 // prevent decode issues when sites use incorrect encoding
7783                 // ref: https://hsivonen.fi/encoding-menu/
7784                 if (charset === 'gb2312' || charset === 'gbk') {
7785                         charset = 'gb18030';
7786                 }
7787         }
7788
7789         // turn raw buffers into a single utf-8 buffer
7790         return convert(buffer, 'UTF-8', charset).toString();
7791 }
7792
7793 /**
7794  * Detect a URLSearchParams object
7795  * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143
7796  *
7797  * @param   Object  obj     Object to detect by type or brand
7798  * @return  String
7799  */
7800 function isURLSearchParams(obj) {
7801         // Duck-typing as a necessary condition.
7802         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') {
7803                 return false;
7804         }
7805
7806         // Brand-checking and more duck-typing as optional condition.
7807         return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function';
7808 }
7809
7810 /**
7811  * Check if `obj` is a W3C `Blob` object (which `File` inherits from)
7812  * @param  {*} obj
7813  * @return {boolean}
7814  */
7815 function isBlob(obj) {
7816         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]);
7817 }
7818
7819 /**
7820  * Clone body given Res/Req instance
7821  *
7822  * @param   Mixed  instance  Response or Request instance
7823  * @return  Mixed
7824  */
7825 function clone(instance) {
7826         let p1, p2;
7827         let body = instance.body;
7828
7829         // don't allow cloning a used body
7830         if (instance.bodyUsed) {
7831                 throw new Error('cannot clone body after it is used');
7832         }
7833
7834         // check that body is a stream and not form-data object
7835         // note: we can't clone the form-data object without having it as a dependency
7836         if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__ && typeof body.getBoundary !== 'function') {
7837                 // tee instance body
7838                 p1 = new PassThrough();
7839                 p2 = new PassThrough();
7840                 body.pipe(p1);
7841                 body.pipe(p2);
7842                 // set instance body to teed body and return the other teed body
7843                 instance[INTERNALS].body = p1;
7844                 body = p2;
7845         }
7846
7847         return body;
7848 }
7849
7850 /**
7851  * Performs the operation "extract a `Content-Type` value from |object|" as
7852  * specified in the specification:
7853  * https://fetch.spec.whatwg.org/#concept-bodyinit-extract
7854  *
7855  * This function assumes that instance.body is present.
7856  *
7857  * @param   Mixed  instance  Any options.body input
7858  */
7859 function extractContentType(body) {
7860         if (body === null) {
7861                 // body is null
7862                 return null;
7863         } else if (typeof body === 'string') {
7864                 // body is string
7865                 return 'text/plain;charset=UTF-8';
7866         } else if (isURLSearchParams(body)) {
7867                 // body is a URLSearchParams
7868                 return 'application/x-www-form-urlencoded;charset=UTF-8';
7869         } else if (isBlob(body)) {
7870                 // body is blob
7871                 return body.type || null;
7872         } else if (Buffer.isBuffer(body)) {
7873                 // body is buffer
7874                 return null;
7875         } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
7876                 // body is ArrayBuffer
7877                 return null;
7878         } else if (ArrayBuffer.isView(body)) {
7879                 // body is ArrayBufferView
7880                 return null;
7881         } else if (typeof body.getBoundary === 'function') {
7882                 // detect form data input from form-data module
7883                 return `multipart/form-data;boundary=${body.getBoundary()}`;
7884         } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
7885                 // body is stream
7886                 // can't really do much about this
7887                 return null;
7888         } else {
7889                 // Body constructor defaults other things to string
7890                 return 'text/plain;charset=UTF-8';
7891         }
7892 }
7893
7894 /**
7895  * The Fetch Standard treats this as if "total bytes" is a property on the body.
7896  * For us, we have to explicitly get it with a function.
7897  *
7898  * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes
7899  *
7900  * @param   Body    instance   Instance of Body
7901  * @return  Number?            Number of bytes, or null if not possible
7902  */
7903 function getTotalBytes(instance) {
7904         const body = instance.body;
7905
7906
7907         if (body === null) {
7908                 // body is null
7909                 return 0;
7910         } else if (isBlob(body)) {
7911                 return body.size;
7912         } else if (Buffer.isBuffer(body)) {
7913                 // body is buffer
7914                 return body.length;
7915         } else if (body && typeof body.getLengthSync === 'function') {
7916                 // detect form data input from form-data module
7917                 if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x
7918                 body.hasKnownLength && body.hasKnownLength()) {
7919                         // 2.x
7920                         return body.getLengthSync();
7921                 }
7922                 return null;
7923         } else {
7924                 // body is stream
7925                 return null;
7926         }
7927 }
7928
7929 /**
7930  * Write a Body to a Node.js WritableStream (e.g. http.Request) object.
7931  *
7932  * @param   Body    instance   Instance of Body
7933  * @return  Void
7934  */
7935 function writeToStream(dest, instance) {
7936         const body = instance.body;
7937
7938
7939         if (body === null) {
7940                 // body is null
7941                 dest.end();
7942         } else if (isBlob(body)) {
7943                 body.stream().pipe(dest);
7944         } else if (Buffer.isBuffer(body)) {
7945                 // body is buffer
7946                 dest.write(body);
7947                 dest.end();
7948         } else {
7949                 // body is stream
7950                 body.pipe(dest);
7951         }
7952 }
7953
7954 // expose Promise
7955 Body.Promise = global.Promise;
7956
7957 /**
7958  * headers.js
7959  *
7960  * Headers class offers convenient helpers
7961  */
7962
7963 const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
7964 const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
7965
7966 function validateName(name) {
7967         name = `${name}`;
7968         if (invalidTokenRegex.test(name) || name === '') {
7969                 throw new TypeError(`${name} is not a legal HTTP header name`);
7970         }
7971 }
7972
7973 function validateValue(value) {
7974         value = `${value}`;
7975         if (invalidHeaderCharRegex.test(value)) {
7976                 throw new TypeError(`${value} is not a legal HTTP header value`);
7977         }
7978 }
7979
7980 /**
7981  * Find the key in the map object given a header name.
7982  *
7983  * Returns undefined if not found.
7984  *
7985  * @param   String  name  Header name
7986  * @return  String|Undefined
7987  */
7988 function find(map, name) {
7989         name = name.toLowerCase();
7990         for (const key in map) {
7991                 if (key.toLowerCase() === name) {
7992                         return key;
7993                 }
7994         }
7995         return undefined;
7996 }
7997
7998 const MAP = Symbol('map');
7999 class Headers {
8000         /**
8001   * Headers class
8002   *
8003   * @param   Object  headers  Response headers
8004   * @return  Void
8005   */
8006         constructor() {
8007                 let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
8008
8009                 this[MAP] = Object.create(null);
8010
8011                 if (init instanceof Headers) {
8012                         const rawHeaders = init.raw();
8013                         const headerNames = Object.keys(rawHeaders);
8014
8015                         for (const headerName of headerNames) {
8016                                 for (const value of rawHeaders[headerName]) {
8017                                         this.append(headerName, value);
8018                                 }
8019                         }
8020
8021                         return;
8022                 }
8023
8024                 // We don't worry about converting prop to ByteString here as append()
8025                 // will handle it.
8026                 if (init == null) ; else if (typeof init === 'object') {
8027                         const method = init[Symbol.iterator];
8028                         if (method != null) {
8029                                 if (typeof method !== 'function') {
8030                                         throw new TypeError('Header pairs must be iterable');
8031                                 }
8032
8033                                 // sequence<sequence<ByteString>>
8034                                 // Note: per spec we have to first exhaust the lists then process them
8035                                 const pairs = [];
8036                                 for (const pair of init) {
8037                                         if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {
8038                                                 throw new TypeError('Each header pair must be iterable');
8039                                         }
8040                                         pairs.push(Array.from(pair));
8041                                 }
8042
8043                                 for (const pair of pairs) {
8044                                         if (pair.length !== 2) {
8045                                                 throw new TypeError('Each header pair must be a name/value tuple');
8046                                         }
8047                                         this.append(pair[0], pair[1]);
8048                                 }
8049                         } else {
8050                                 // record<ByteString, ByteString>
8051                                 for (const key of Object.keys(init)) {
8052                                         const value = init[key];
8053                                         this.append(key, value);
8054                                 }
8055                         }
8056                 } else {
8057                         throw new TypeError('Provided initializer must be an object');
8058                 }
8059         }
8060
8061         /**
8062   * Return combined header value given name
8063   *
8064   * @param   String  name  Header name
8065   * @return  Mixed
8066   */
8067         get(name) {
8068                 name = `${name}`;
8069                 validateName(name);
8070                 const key = find(this[MAP], name);
8071                 if (key === undefined) {
8072                         return null;
8073                 }
8074
8075                 return this[MAP][key].join(', ');
8076         }
8077
8078         /**
8079   * Iterate over all headers
8080   *
8081   * @param   Function  callback  Executed for each item with parameters (value, name, thisArg)
8082   * @param   Boolean   thisArg   `this` context for callback function
8083   * @return  Void
8084   */
8085         forEach(callback) {
8086                 let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
8087
8088                 let pairs = getHeaders(this);
8089                 let i = 0;
8090                 while (i < pairs.length) {
8091                         var _pairs$i = pairs[i];
8092                         const name = _pairs$i[0],
8093                               value = _pairs$i[1];
8094
8095                         callback.call(thisArg, value, name, this);
8096                         pairs = getHeaders(this);
8097                         i++;
8098                 }
8099         }
8100
8101         /**
8102   * Overwrite header values given name
8103   *
8104   * @param   String  name   Header name
8105   * @param   String  value  Header value
8106   * @return  Void
8107   */
8108         set(name, value) {
8109                 name = `${name}`;
8110                 value = `${value}`;
8111                 validateName(name);
8112                 validateValue(value);
8113                 const key = find(this[MAP], name);
8114                 this[MAP][key !== undefined ? key : name] = [value];
8115         }
8116
8117         /**
8118   * Append a value onto existing header
8119   *
8120   * @param   String  name   Header name
8121   * @param   String  value  Header value
8122   * @return  Void
8123   */
8124         append(name, value) {
8125                 name = `${name}`;
8126                 value = `${value}`;
8127                 validateName(name);
8128                 validateValue(value);
8129                 const key = find(this[MAP], name);
8130                 if (key !== undefined) {
8131                         this[MAP][key].push(value);
8132                 } else {
8133                         this[MAP][name] = [value];
8134                 }
8135         }
8136
8137         /**
8138   * Check for header name existence
8139   *
8140   * @param   String   name  Header name
8141   * @return  Boolean
8142   */
8143         has(name) {
8144                 name = `${name}`;
8145                 validateName(name);
8146                 return find(this[MAP], name) !== undefined;
8147         }
8148
8149         /**
8150   * Delete all header values given name
8151   *
8152   * @param   String  name  Header name
8153   * @return  Void
8154   */
8155         delete(name) {
8156                 name = `${name}`;
8157                 validateName(name);
8158                 const key = find(this[MAP], name);
8159                 if (key !== undefined) {
8160                         delete this[MAP][key];
8161                 }
8162         }
8163
8164         /**
8165   * Return raw headers (non-spec api)
8166   *
8167   * @return  Object
8168   */
8169         raw() {
8170                 return this[MAP];
8171         }
8172
8173         /**
8174   * Get an iterator on keys.
8175   *
8176   * @return  Iterator
8177   */
8178         keys() {
8179                 return createHeadersIterator(this, 'key');
8180         }
8181
8182         /**
8183   * Get an iterator on values.
8184   *
8185   * @return  Iterator
8186   */
8187         values() {
8188                 return createHeadersIterator(this, 'value');
8189         }
8190
8191         /**
8192   * Get an iterator on entries.
8193   *
8194   * This is the default iterator of the Headers object.
8195   *
8196   * @return  Iterator
8197   */
8198         [Symbol.iterator]() {
8199                 return createHeadersIterator(this, 'key+value');
8200         }
8201 }
8202 Headers.prototype.entries = Headers.prototype[Symbol.iterator];
8203
8204 Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
8205         value: 'Headers',
8206         writable: false,
8207         enumerable: false,
8208         configurable: true
8209 });
8210
8211 Object.defineProperties(Headers.prototype, {
8212         get: { enumerable: true },
8213         forEach: { enumerable: true },
8214         set: { enumerable: true },
8215         append: { enumerable: true },
8216         has: { enumerable: true },
8217         delete: { enumerable: true },
8218         keys: { enumerable: true },
8219         values: { enumerable: true },
8220         entries: { enumerable: true }
8221 });
8222
8223 function getHeaders(headers) {
8224         let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';
8225
8226         const keys = Object.keys(headers[MAP]).sort();
8227         return keys.map(kind === 'key' ? function (k) {
8228                 return k.toLowerCase();
8229         } : kind === 'value' ? function (k) {
8230                 return headers[MAP][k].join(', ');
8231         } : function (k) {
8232                 return [k.toLowerCase(), headers[MAP][k].join(', ')];
8233         });
8234 }
8235
8236 const INTERNAL = Symbol('internal');
8237
8238 function createHeadersIterator(target, kind) {
8239         const iterator = Object.create(HeadersIteratorPrototype);
8240         iterator[INTERNAL] = {
8241                 target,
8242                 kind,
8243                 index: 0
8244         };
8245         return iterator;
8246 }
8247
8248 const HeadersIteratorPrototype = Object.setPrototypeOf({
8249         next() {
8250                 // istanbul ignore if
8251                 if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
8252                         throw new TypeError('Value of `this` is not a HeadersIterator');
8253                 }
8254
8255                 var _INTERNAL = this[INTERNAL];
8256                 const target = _INTERNAL.target,
8257                       kind = _INTERNAL.kind,
8258                       index = _INTERNAL.index;
8259
8260                 const values = getHeaders(target, kind);
8261                 const len = values.length;
8262                 if (index >= len) {
8263                         return {
8264                                 value: undefined,
8265                                 done: true
8266                         };
8267                 }
8268
8269                 this[INTERNAL].index = index + 1;
8270
8271                 return {
8272                         value: values[index],
8273                         done: false
8274                 };
8275         }
8276 }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
8277
8278 Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
8279         value: 'HeadersIterator',
8280         writable: false,
8281         enumerable: false,
8282         configurable: true
8283 });
8284
8285 /**
8286  * Export the Headers object in a form that Node.js can consume.
8287  *
8288  * @param   Headers  headers
8289  * @return  Object
8290  */
8291 function exportNodeCompatibleHeaders(headers) {
8292         const obj = Object.assign({ __proto__: null }, headers[MAP]);
8293
8294         // http.request() only supports string as Host header. This hack makes
8295         // specifying custom Host header possible.
8296         const hostHeaderKey = find(headers[MAP], 'Host');
8297         if (hostHeaderKey !== undefined) {
8298                 obj[hostHeaderKey] = obj[hostHeaderKey][0];
8299         }
8300
8301         return obj;
8302 }
8303
8304 /**
8305  * Create a Headers object from an object of headers, ignoring those that do
8306  * not conform to HTTP grammar productions.
8307  *
8308  * @param   Object  obj  Object of headers
8309  * @return  Headers
8310  */
8311 function createHeadersLenient(obj) {
8312         const headers = new Headers();
8313         for (const name of Object.keys(obj)) {
8314                 if (invalidTokenRegex.test(name)) {
8315                         continue;
8316                 }
8317                 if (Array.isArray(obj[name])) {
8318                         for (const val of obj[name]) {
8319                                 if (invalidHeaderCharRegex.test(val)) {
8320                                         continue;
8321                                 }
8322                                 if (headers[MAP][name] === undefined) {
8323                                         headers[MAP][name] = [val];
8324                                 } else {
8325                                         headers[MAP][name].push(val);
8326                                 }
8327                         }
8328                 } else if (!invalidHeaderCharRegex.test(obj[name])) {
8329                         headers[MAP][name] = [obj[name]];
8330                 }
8331         }
8332         return headers;
8333 }
8334
8335 const INTERNALS$1 = Symbol('Response internals');
8336
8337 // fix an issue where "STATUS_CODES" aren't a named export for node <10
8338 const STATUS_CODES = http__WEBPACK_IMPORTED_MODULE_1__.STATUS_CODES;
8339
8340 /**
8341  * Response class
8342  *
8343  * @param   Stream  body  Readable stream
8344  * @param   Object  opts  Response options
8345  * @return  Void
8346  */
8347 class Response {
8348         constructor() {
8349                 let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
8350                 let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8351
8352                 Body.call(this, body, opts);
8353
8354                 const status = opts.status || 200;
8355                 const headers = new Headers(opts.headers);
8356
8357                 if (body != null && !headers.has('Content-Type')) {
8358                         const contentType = extractContentType(body);
8359                         if (contentType) {
8360                                 headers.append('Content-Type', contentType);
8361                         }
8362                 }
8363
8364                 this[INTERNALS$1] = {
8365                         url: opts.url,
8366                         status,
8367                         statusText: opts.statusText || STATUS_CODES[status],
8368                         headers,
8369                         counter: opts.counter
8370                 };
8371         }
8372
8373         get url() {
8374                 return this[INTERNALS$1].url || '';
8375         }
8376
8377         get status() {
8378                 return this[INTERNALS$1].status;
8379         }
8380
8381         /**
8382   * Convenience property representing if the request ended normally
8383   */
8384         get ok() {
8385                 return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
8386         }
8387
8388         get redirected() {
8389                 return this[INTERNALS$1].counter > 0;
8390         }
8391
8392         get statusText() {
8393                 return this[INTERNALS$1].statusText;
8394         }
8395
8396         get headers() {
8397                 return this[INTERNALS$1].headers;
8398         }
8399
8400         /**
8401   * Clone this response
8402   *
8403   * @return  Response
8404   */
8405         clone() {
8406                 return new Response(clone(this), {
8407                         url: this.url,
8408                         status: this.status,
8409                         statusText: this.statusText,
8410                         headers: this.headers,
8411                         ok: this.ok,
8412                         redirected: this.redirected
8413                 });
8414         }
8415 }
8416
8417 Body.mixIn(Response.prototype);
8418
8419 Object.defineProperties(Response.prototype, {
8420         url: { enumerable: true },
8421         status: { enumerable: true },
8422         ok: { enumerable: true },
8423         redirected: { enumerable: true },
8424         statusText: { enumerable: true },
8425         headers: { enumerable: true },
8426         clone: { enumerable: true }
8427 });
8428
8429 Object.defineProperty(Response.prototype, Symbol.toStringTag, {
8430         value: 'Response',
8431         writable: false,
8432         enumerable: false,
8433         configurable: true
8434 });
8435
8436 const INTERNALS$2 = Symbol('Request internals');
8437
8438 // fix an issue where "format", "parse" aren't a named export for node <10
8439 const parse_url = url__WEBPACK_IMPORTED_MODULE_2__.parse;
8440 const format_url = url__WEBPACK_IMPORTED_MODULE_2__.format;
8441
8442 const streamDestructionSupported = 'destroy' in stream__WEBPACK_IMPORTED_MODULE_0__.Readable.prototype;
8443
8444 /**
8445  * Check if a value is an instance of Request.
8446  *
8447  * @param   Mixed   input
8448  * @return  Boolean
8449  */
8450 function isRequest(input) {
8451         return typeof input === 'object' && typeof input[INTERNALS$2] === 'object';
8452 }
8453
8454 function isAbortSignal(signal) {
8455         const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);
8456         return !!(proto && proto.constructor.name === 'AbortSignal');
8457 }
8458
8459 /**
8460  * Request class
8461  *
8462  * @param   Mixed   input  Url or Request instance
8463  * @param   Object  init   Custom options
8464  * @return  Void
8465  */
8466 class Request {
8467         constructor(input) {
8468                 let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8469
8470                 let parsedURL;
8471
8472                 // normalize input
8473                 if (!isRequest(input)) {
8474                         if (input && input.href) {
8475                                 // in order to support Node.js' Url objects; though WHATWG's URL objects
8476                                 // will fall into this branch also (since their `toString()` will return
8477                                 // `href` property anyway)
8478                                 parsedURL = parse_url(input.href);
8479                         } else {
8480                                 // coerce input to a string before attempting to parse
8481                                 parsedURL = parse_url(`${input}`);
8482                         }
8483                         input = {};
8484                 } else {
8485                         parsedURL = parse_url(input.url);
8486                 }
8487
8488                 let method = init.method || input.method || 'GET';
8489                 method = method.toUpperCase();
8490
8491                 if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {
8492                         throw new TypeError('Request with GET/HEAD method cannot have body');
8493                 }
8494
8495                 let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
8496
8497                 Body.call(this, inputBody, {
8498                         timeout: init.timeout || input.timeout || 0,
8499                         size: init.size || input.size || 0
8500                 });
8501
8502                 const headers = new Headers(init.headers || input.headers || {});
8503
8504                 if (inputBody != null && !headers.has('Content-Type')) {
8505                         const contentType = extractContentType(inputBody);
8506                         if (contentType) {
8507                                 headers.append('Content-Type', contentType);
8508                         }
8509                 }
8510
8511                 let signal = isRequest(input) ? input.signal : null;
8512                 if ('signal' in init) signal = init.signal;
8513
8514                 if (signal != null && !isAbortSignal(signal)) {
8515                         throw new TypeError('Expected signal to be an instanceof AbortSignal');
8516                 }
8517
8518                 this[INTERNALS$2] = {
8519                         method,
8520                         redirect: init.redirect || input.redirect || 'follow',
8521                         headers,
8522                         parsedURL,
8523                         signal
8524                 };
8525
8526                 // node-fetch-only options
8527                 this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;
8528                 this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
8529                 this.counter = init.counter || input.counter || 0;
8530                 this.agent = init.agent || input.agent;
8531         }
8532
8533         get method() {
8534                 return this[INTERNALS$2].method;
8535         }
8536
8537         get url() {
8538                 return format_url(this[INTERNALS$2].parsedURL);
8539         }
8540
8541         get headers() {
8542                 return this[INTERNALS$2].headers;
8543         }
8544
8545         get redirect() {
8546                 return this[INTERNALS$2].redirect;
8547         }
8548
8549         get signal() {
8550                 return this[INTERNALS$2].signal;
8551         }
8552
8553         /**
8554   * Clone this request
8555   *
8556   * @return  Request
8557   */
8558         clone() {
8559                 return new Request(this);
8560         }
8561 }
8562
8563 Body.mixIn(Request.prototype);
8564
8565 Object.defineProperty(Request.prototype, Symbol.toStringTag, {
8566         value: 'Request',
8567         writable: false,
8568         enumerable: false,
8569         configurable: true
8570 });
8571
8572 Object.defineProperties(Request.prototype, {
8573         method: { enumerable: true },
8574         url: { enumerable: true },
8575         headers: { enumerable: true },
8576         redirect: { enumerable: true },
8577         clone: { enumerable: true },
8578         signal: { enumerable: true }
8579 });
8580
8581 /**
8582  * Convert a Request to Node.js http request options.
8583  *
8584  * @param   Request  A Request instance
8585  * @return  Object   The options object to be passed to http.request
8586  */
8587 function getNodeRequestOptions(request) {
8588         const parsedURL = request[INTERNALS$2].parsedURL;
8589         const headers = new Headers(request[INTERNALS$2].headers);
8590
8591         // fetch step 1.3
8592         if (!headers.has('Accept')) {
8593                 headers.set('Accept', '*/*');
8594         }
8595
8596         // Basic fetch
8597         if (!parsedURL.protocol || !parsedURL.hostname) {
8598                 throw new TypeError('Only absolute URLs are supported');
8599         }
8600
8601         if (!/^https?:$/.test(parsedURL.protocol)) {
8602                 throw new TypeError('Only HTTP(S) protocols are supported');
8603         }
8604
8605         if (request.signal && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable && !streamDestructionSupported) {
8606                 throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');
8607         }
8608
8609         // HTTP-network-or-cache fetch steps 2.4-2.7
8610         let contentLengthValue = null;
8611         if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
8612                 contentLengthValue = '0';
8613         }
8614         if (request.body != null) {
8615                 const totalBytes = getTotalBytes(request);
8616                 if (typeof totalBytes === 'number') {
8617                         contentLengthValue = String(totalBytes);
8618                 }
8619         }
8620         if (contentLengthValue) {
8621                 headers.set('Content-Length', contentLengthValue);
8622         }
8623
8624         // HTTP-network-or-cache fetch step 2.11
8625         if (!headers.has('User-Agent')) {
8626                 headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');
8627         }
8628
8629         // HTTP-network-or-cache fetch step 2.15
8630         if (request.compress && !headers.has('Accept-Encoding')) {
8631                 headers.set('Accept-Encoding', 'gzip,deflate');
8632         }
8633
8634         let agent = request.agent;
8635         if (typeof agent === 'function') {
8636                 agent = agent(parsedURL);
8637         }
8638
8639         if (!headers.has('Connection') && !agent) {
8640                 headers.set('Connection', 'close');
8641         }
8642
8643         // HTTP-network fetch step 4.2
8644         // chunked encoding is handled by Node.js
8645
8646         return Object.assign({}, parsedURL, {
8647                 method: request.method,
8648                 headers: exportNodeCompatibleHeaders(headers),
8649                 agent
8650         });
8651 }
8652
8653 /**
8654  * abort-error.js
8655  *
8656  * AbortError interface for cancelled requests
8657  */
8658
8659 /**
8660  * Create AbortError instance
8661  *
8662  * @param   String      message      Error message for human
8663  * @return  AbortError
8664  */
8665 function AbortError(message) {
8666   Error.call(this, message);
8667
8668   this.type = 'aborted';
8669   this.message = message;
8670
8671   // hide custom error implementation details from end-users
8672   Error.captureStackTrace(this, this.constructor);
8673 }
8674
8675 AbortError.prototype = Object.create(Error.prototype);
8676 AbortError.prototype.constructor = AbortError;
8677 AbortError.prototype.name = 'AbortError';
8678
8679 // fix an issue where "PassThrough", "resolve" aren't a named export for node <10
8680 const PassThrough$1 = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
8681 const resolve_url = url__WEBPACK_IMPORTED_MODULE_2__.resolve;
8682
8683 /**
8684  * Fetch function
8685  *
8686  * @param   Mixed    url   Absolute url or Request instance
8687  * @param   Object   opts  Fetch options
8688  * @return  Promise
8689  */
8690 function fetch(url, opts) {
8691
8692         // allow custom promise
8693         if (!fetch.Promise) {
8694                 throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
8695         }
8696
8697         Body.Promise = fetch.Promise;
8698
8699         // wrap http.request into fetch
8700         return new fetch.Promise(function (resolve, reject) {
8701                 // build request object
8702                 const request = new Request(url, opts);
8703                 const options = getNodeRequestOptions(request);
8704
8705                 const send = (options.protocol === 'https:' ? https__WEBPACK_IMPORTED_MODULE_3__ : http__WEBPACK_IMPORTED_MODULE_1__).request;
8706                 const signal = request.signal;
8707
8708                 let response = null;
8709
8710                 const abort = function abort() {
8711                         let error = new AbortError('The user aborted a request.');
8712                         reject(error);
8713                         if (request.body && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable) {
8714                                 request.body.destroy(error);
8715                         }
8716                         if (!response || !response.body) return;
8717                         response.body.emit('error', error);
8718                 };
8719
8720                 if (signal && signal.aborted) {
8721                         abort();
8722                         return;
8723                 }
8724
8725                 const abortAndFinalize = function abortAndFinalize() {
8726                         abort();
8727                         finalize();
8728                 };
8729
8730                 // send request
8731                 const req = send(options);
8732                 let reqTimeout;
8733
8734                 if (signal) {
8735                         signal.addEventListener('abort', abortAndFinalize);
8736                 }
8737
8738                 function finalize() {
8739                         req.abort();
8740                         if (signal) signal.removeEventListener('abort', abortAndFinalize);
8741                         clearTimeout(reqTimeout);
8742                 }
8743
8744                 if (request.timeout) {
8745                         req.once('socket', function (socket) {
8746                                 reqTimeout = setTimeout(function () {
8747                                         reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));
8748                                         finalize();
8749                                 }, request.timeout);
8750                         });
8751                 }
8752
8753                 req.on('error', function (err) {
8754                         reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
8755                         finalize();
8756                 });
8757
8758                 req.on('response', function (res) {
8759                         clearTimeout(reqTimeout);
8760
8761                         const headers = createHeadersLenient(res.headers);
8762
8763                         // HTTP fetch step 5
8764                         if (fetch.isRedirect(res.statusCode)) {
8765                                 // HTTP fetch step 5.2
8766                                 const location = headers.get('Location');
8767
8768                                 // HTTP fetch step 5.3
8769                                 const locationURL = location === null ? null : resolve_url(request.url, location);
8770
8771                                 // HTTP fetch step 5.5
8772                                 switch (request.redirect) {
8773                                         case 'error':
8774                                                 reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect'));
8775                                                 finalize();
8776                                                 return;
8777                                         case 'manual':
8778                                                 // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.
8779                                                 if (locationURL !== null) {
8780                                                         // handle corrupted header
8781                                                         try {
8782                                                                 headers.set('Location', locationURL);
8783                                                         } catch (err) {
8784                                                                 // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request
8785                                                                 reject(err);
8786                                                         }
8787                                                 }
8788                                                 break;
8789                                         case 'follow':
8790                                                 // HTTP-redirect fetch step 2
8791                                                 if (locationURL === null) {
8792                                                         break;
8793                                                 }
8794
8795                                                 // HTTP-redirect fetch step 5
8796                                                 if (request.counter >= request.follow) {
8797                                                         reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));
8798                                                         finalize();
8799                                                         return;
8800                                                 }
8801
8802                                                 // HTTP-redirect fetch step 6 (counter increment)
8803                                                 // Create a new Request object.
8804                                                 const requestOpts = {
8805                                                         headers: new Headers(request.headers),
8806                                                         follow: request.follow,
8807                                                         counter: request.counter + 1,
8808                                                         agent: request.agent,
8809                                                         compress: request.compress,
8810                                                         method: request.method,
8811                                                         body: request.body,
8812                                                         signal: request.signal,
8813                                                         timeout: request.timeout
8814                                                 };
8815
8816                                                 // HTTP-redirect fetch step 9
8817                                                 if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
8818                                                         reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
8819                                                         finalize();
8820                                                         return;
8821                                                 }
8822
8823                                                 // HTTP-redirect fetch step 11
8824                                                 if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {
8825                                                         requestOpts.method = 'GET';
8826                                                         requestOpts.body = undefined;
8827                                                         requestOpts.headers.delete('content-length');
8828                                                 }
8829
8830                                                 // HTTP-redirect fetch step 15
8831                                                 resolve(fetch(new Request(locationURL, requestOpts)));
8832                                                 finalize();
8833                                                 return;
8834                                 }
8835                         }
8836
8837                         // prepare response
8838                         res.once('end', function () {
8839                                 if (signal) signal.removeEventListener('abort', abortAndFinalize);
8840                         });
8841                         let body = res.pipe(new PassThrough$1());
8842
8843                         const response_options = {
8844                                 url: request.url,
8845                                 status: res.statusCode,
8846                                 statusText: res.statusMessage,
8847                                 headers: headers,
8848                                 size: request.size,
8849                                 timeout: request.timeout,
8850                                 counter: request.counter
8851                         };
8852
8853                         // HTTP-network fetch step 12.1.1.3
8854                         const codings = headers.get('Content-Encoding');
8855
8856                         // HTTP-network fetch step 12.1.1.4: handle content codings
8857
8858                         // in following scenarios we ignore compression support
8859                         // 1. compression support is disabled
8860                         // 2. HEAD request
8861                         // 3. no Content-Encoding header
8862                         // 4. no content response (204)
8863                         // 5. content not modified response (304)
8864                         if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {
8865                                 response = new Response(body, response_options);
8866                                 resolve(response);
8867                                 return;
8868                         }
8869
8870                         // For Node v6+
8871                         // Be less strict when decoding compressed responses, since sometimes
8872                         // servers send slightly invalid responses that are still accepted
8873                         // by common browsers.
8874                         // Always using Z_SYNC_FLUSH is what cURL does.
8875                         const zlibOptions = {
8876                                 flush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH,
8877                                 finishFlush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH
8878                         };
8879
8880                         // for gzip
8881                         if (codings == 'gzip' || codings == 'x-gzip') {
8882                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createGunzip(zlibOptions));
8883                                 response = new Response(body, response_options);
8884                                 resolve(response);
8885                                 return;
8886                         }
8887
8888                         // for deflate
8889                         if (codings == 'deflate' || codings == 'x-deflate') {
8890                                 // handle the infamous raw deflate response from old servers
8891                                 // a hack for old IIS and Apache servers
8892                                 const raw = res.pipe(new PassThrough$1());
8893                                 raw.once('data', function (chunk) {
8894                                         // see http://stackoverflow.com/questions/37519828
8895                                         if ((chunk[0] & 0x0F) === 0x08) {
8896                                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflate());
8897                                         } else {
8898                                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflateRaw());
8899                                         }
8900                                         response = new Response(body, response_options);
8901                                         resolve(response);
8902                                 });
8903                                 return;
8904                         }
8905
8906                         // for br
8907                         if (codings == 'br' && typeof zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress === 'function') {
8908                                 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress());
8909                                 response = new Response(body, response_options);
8910                                 resolve(response);
8911                                 return;
8912                         }
8913
8914                         // otherwise, use response as-is
8915                         response = new Response(body, response_options);
8916                         resolve(response);
8917                 });
8918
8919                 writeToStream(req, request);
8920         });
8921 }
8922 /**
8923  * Redirect code matching
8924  *
8925  * @param   Number   code  Status code
8926  * @return  Boolean
8927  */
8928 fetch.isRedirect = function (code) {
8929         return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
8930 };
8931
8932 // expose Promise
8933 fetch.Promise = global.Promise;
8934
8935 /* harmony default export */ __webpack_exports__["default"] = (fetch);
8936
8937
8938
8939 /***/ }),
8940 /* 44 */
8941 /***/ (function(module, exports) {
8942
8943 module.exports = require("stream");
8944
8945 /***/ }),
8946 /* 45 */
8947 /***/ (function(module, exports) {
8948
8949 module.exports = require("http");
8950
8951 /***/ }),
8952 /* 46 */
8953 /***/ (function(module, exports) {
8954
8955 module.exports = require("url");
8956
8957 /***/ }),
8958 /* 47 */
8959 /***/ (function(module, exports) {
8960
8961 module.exports = require("https");
8962
8963 /***/ }),
8964 /* 48 */
8965 /***/ (function(module, exports) {
8966
8967 module.exports = require("zlib");
8968
8969 /***/ }),
8970 /* 49 */
8971 /***/ (function(module, exports, __webpack_require__) {
8972
8973 "use strict";
8974
8975
8976 const fs = __webpack_require__(42);
8977 const { Readable } = __webpack_require__(44);
8978 const sysPath = __webpack_require__(2);
8979 const { promisify } = __webpack_require__(50);
8980 const picomatch = __webpack_require__(51);
8981
8982 const readdir = promisify(fs.readdir);
8983 const stat = promisify(fs.stat);
8984 const lstat = promisify(fs.lstat);
8985 const realpath = promisify(fs.realpath);
8986
8987 /**
8988  * @typedef {Object} EntryInfo
8989  * @property {String} path
8990  * @property {String} fullPath
8991  * @property {fs.Stats=} stats
8992  * @property {fs.Dirent=} dirent
8993  * @property {String} basename
8994  */
8995
8996 const BANG = '!';
8997 const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP']);
8998 const FILE_TYPE = 'files';
8999 const DIR_TYPE = 'directories';
9000 const FILE_DIR_TYPE = 'files_directories';
9001 const EVERYTHING_TYPE = 'all';
9002 const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
9003
9004 const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
9005
9006 const normalizeFilter = filter => {
9007   if (filter === undefined) return;
9008   if (typeof filter === 'function') return filter;
9009
9010   if (typeof filter === 'string') {
9011     const glob = picomatch(filter.trim());
9012     return entry => glob(entry.basename);
9013   }
9014
9015   if (Array.isArray(filter)) {
9016     const positive = [];
9017     const negative = [];
9018     for (const item of filter) {
9019       const trimmed = item.trim();
9020       if (trimmed.charAt(0) === BANG) {
9021         negative.push(picomatch(trimmed.slice(1)));
9022       } else {
9023         positive.push(picomatch(trimmed));
9024       }
9025     }
9026
9027     if (negative.length > 0) {
9028       if (positive.length > 0) {
9029         return entry =>
9030           positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename));
9031       }
9032       return entry => !negative.some(f => f(entry.basename));
9033     }
9034     return entry => positive.some(f => f(entry.basename));
9035   }
9036 };
9037
9038 class ReaddirpStream extends Readable {
9039   static get defaultOptions() {
9040     return {
9041       root: '.',
9042       /* eslint-disable no-unused-vars */
9043       fileFilter: (path) => true,
9044       directoryFilter: (path) => true,
9045       /* eslint-enable no-unused-vars */
9046       type: FILE_TYPE,
9047       lstat: false,
9048       depth: 2147483648,
9049       alwaysStat: false
9050     };
9051   }
9052
9053   constructor(options = {}) {
9054     super({
9055       objectMode: true,
9056       autoDestroy: true,
9057       highWaterMark: options.highWaterMark || 4096
9058     });
9059     const opts = { ...ReaddirpStream.defaultOptions, ...options };
9060     const { root, type } = opts;
9061
9062     this._fileFilter = normalizeFilter(opts.fileFilter);
9063     this._directoryFilter = normalizeFilter(opts.directoryFilter);
9064
9065     const statMethod = opts.lstat ? lstat : stat;
9066     // Use bigint stats if it's windows and stat() supports options (node 10+).
9067     if (process.platform === 'win32' && stat.length === 3) {
9068       this._stat = path => statMethod(path, { bigint: true });
9069     } else {
9070       this._stat = statMethod;
9071     }
9072
9073     this._maxDepth = opts.depth;
9074     this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
9075     this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
9076     this._wantsEverything = type === EVERYTHING_TYPE;
9077     this._root = sysPath.resolve(root);
9078     this._isDirent = ('Dirent' in fs) && !opts.alwaysStat;
9079     this._statsProp = this._isDirent ? 'dirent' : 'stats';
9080     this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };
9081
9082     // Launch stream with one parent, the root dir.
9083     this.parents = [this._exploreDir(root, 1)];
9084     this.reading = false;
9085     this.parent = undefined;
9086   }
9087
9088   async _read(batch) {
9089     if (this.reading) return;
9090     this.reading = true;
9091
9092     try {
9093       while (!this.destroyed && batch > 0) {
9094         const { path, depth, files = [] } = this.parent || {};
9095
9096         if (files.length > 0) {
9097           const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path));
9098           for (const entry of await Promise.all(slice)) {
9099             if (this.destroyed) return;
9100
9101             const entryType = await this._getEntryType(entry);
9102             if (entryType === 'directory' && this._directoryFilter(entry)) {
9103               if (depth <= this._maxDepth) {
9104                 this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
9105               }
9106
9107               if (this._wantsDir) {
9108                 this.push(entry);
9109                 batch--;
9110               }
9111             } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) {
9112               if (this._wantsFile) {
9113                 this.push(entry);
9114                 batch--;
9115               }
9116             }
9117           }
9118         } else {
9119           const parent = this.parents.pop();
9120           if (!parent) {
9121             this.push(null);
9122             break;
9123           }
9124           this.parent = await parent;
9125           if (this.destroyed) return;
9126         }
9127       }
9128     } catch (error) {
9129       this.destroy(error);
9130     } finally {
9131       this.reading = false;
9132     }
9133   }
9134
9135   async _exploreDir(path, depth) {
9136     let files;
9137     try {
9138       files = await readdir(path, this._rdOptions);
9139     } catch (error) {
9140       this._onError(error);
9141     }
9142     return {files, depth, path};
9143   }
9144
9145   async _formatEntry(dirent, path) {
9146     let entry;
9147     try {
9148       const basename = this._isDirent ? dirent.name : dirent;
9149       const fullPath = sysPath.resolve(sysPath.join(path, basename));
9150       entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename};
9151       entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
9152     } catch (err) {
9153       this._onError(err);
9154     }
9155     return entry;
9156   }
9157
9158   _onError(err) {
9159     if (isNormalFlowError(err) && !this.destroyed) {
9160       this.emit('warn', err);
9161     } else {
9162       this.destroy(err);
9163     }
9164   }
9165
9166   async _getEntryType(entry) {
9167     // entry may be undefined, because a warning or an error were emitted
9168     // and the statsProp is undefined
9169     const stats = entry && entry[this._statsProp];
9170     if (!stats) {
9171       return;
9172     }
9173     if (stats.isFile()) {
9174       return 'file';
9175     }
9176     if (stats.isDirectory()) {
9177       return 'directory';
9178     }
9179     if (stats && stats.isSymbolicLink()) {
9180       try {
9181         const entryRealPath = await realpath(entry.fullPath);
9182         const entryRealPathStats = await lstat(entryRealPath);
9183         if (entryRealPathStats.isFile()) {
9184           return 'file';
9185         }
9186         if (entryRealPathStats.isDirectory()) {
9187           return 'directory';
9188         }
9189       } catch (error) {
9190         this._onError(error);
9191       }
9192     }
9193   }
9194
9195   _includeAsFile(entry) {
9196     const stats = entry && entry[this._statsProp];
9197
9198     return stats && this._wantsEverything && !stats.isDirectory();
9199   }
9200 }
9201
9202 /**
9203  * @typedef {Object} ReaddirpArguments
9204  * @property {Function=} fileFilter
9205  * @property {Function=} directoryFilter
9206  * @property {String=} type
9207  * @property {Number=} depth
9208  * @property {String=} root
9209  * @property {Boolean=} lstat
9210  * @property {Boolean=} bigint
9211  */
9212
9213 /**
9214  * Main function which ends up calling readdirRec and reads all files and directories in given root recursively.
9215  * @param {String} root Root directory
9216  * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth
9217  */
9218 const readdirp = (root, options = {}) => {
9219   let type = options.entryType || options.type;
9220   if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility
9221   if (type) options.type = type;
9222   if (!root) {
9223     throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)');
9224   } else if (typeof root !== 'string') {
9225     throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)');
9226   } else if (type && !ALL_TYPES.includes(type)) {
9227     throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`);
9228   }
9229
9230   options.root = root;
9231   return new ReaddirpStream(options);
9232 };
9233
9234 const readdirpPromise = (root, options = {}) => {
9235   return new Promise((resolve, reject) => {
9236     const files = [];
9237     readdirp(root, options)
9238       .on('data', entry => files.push(entry))
9239       .on('end', () => resolve(files))
9240       .on('error', error => reject(error));
9241   });
9242 };
9243
9244 readdirp.promise = readdirpPromise;
9245 readdirp.ReaddirpStream = ReaddirpStream;
9246 readdirp.default = readdirp;
9247
9248 module.exports = readdirp;
9249
9250
9251 /***/ }),
9252 /* 50 */
9253 /***/ (function(module, exports) {
9254
9255 module.exports = require("util");
9256
9257 /***/ }),
9258 /* 51 */
9259 /***/ (function(module, exports, __webpack_require__) {
9260
9261 "use strict";
9262
9263
9264 module.exports = __webpack_require__(52);
9265
9266
9267 /***/ }),
9268 /* 52 */
9269 /***/ (function(module, exports, __webpack_require__) {
9270
9271 "use strict";
9272
9273
9274 const path = __webpack_require__(2);
9275 const scan = __webpack_require__(53);
9276 const parse = __webpack_require__(56);
9277 const utils = __webpack_require__(54);
9278 const constants = __webpack_require__(55);
9279 const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
9280
9281 /**
9282  * Creates a matcher function from one or more glob patterns. The
9283  * returned function takes a string to match as its first argument,
9284  * and returns true if the string is a match. The returned matcher
9285  * function also takes a boolean as the second argument that, when true,
9286  * returns an object with additional information.
9287  *
9288  * ```js
9289  * const picomatch = require('picomatch');
9290  * // picomatch(glob[, options]);
9291  *
9292  * const isMatch = picomatch('*.!(*a)');
9293  * console.log(isMatch('a.a')); //=> false
9294  * console.log(isMatch('a.b')); //=> true
9295  * ```
9296  * @name picomatch
9297  * @param {String|Array} `globs` One or more glob patterns.
9298  * @param {Object=} `options`
9299  * @return {Function=} Returns a matcher function.
9300  * @api public
9301  */
9302
9303 const picomatch = (glob, options, returnState = false) => {
9304   if (Array.isArray(glob)) {
9305     const fns = glob.map(input => picomatch(input, options, returnState));
9306     const arrayMatcher = str => {
9307       for (const isMatch of fns) {
9308         const state = isMatch(str);
9309         if (state) return state;
9310       }
9311       return false;
9312     };
9313     return arrayMatcher;
9314   }
9315
9316   const isState = isObject(glob) && glob.tokens && glob.input;
9317
9318   if (glob === '' || (typeof glob !== 'string' && !isState)) {
9319     throw new TypeError('Expected pattern to be a non-empty string');
9320   }
9321
9322   const opts = options || {};
9323   const posix = utils.isWindows(options);
9324   const regex = isState
9325     ? picomatch.compileRe(glob, options)
9326     : picomatch.makeRe(glob, options, false, true);
9327
9328   const state = regex.state;
9329   delete regex.state;
9330
9331   let isIgnored = () => false;
9332   if (opts.ignore) {
9333     const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
9334     isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
9335   }
9336
9337   const matcher = (input, returnObject = false) => {
9338     const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
9339     const result = { glob, state, regex, posix, input, output, match, isMatch };
9340
9341     if (typeof opts.onResult === 'function') {
9342       opts.onResult(result);
9343     }
9344
9345     if (isMatch === false) {
9346       result.isMatch = false;
9347       return returnObject ? result : false;
9348     }
9349
9350     if (isIgnored(input)) {
9351       if (typeof opts.onIgnore === 'function') {
9352         opts.onIgnore(result);
9353       }
9354       result.isMatch = false;
9355       return returnObject ? result : false;
9356     }
9357
9358     if (typeof opts.onMatch === 'function') {
9359       opts.onMatch(result);
9360     }
9361     return returnObject ? result : true;
9362   };
9363
9364   if (returnState) {
9365     matcher.state = state;
9366   }
9367
9368   return matcher;
9369 };
9370
9371 /**
9372  * Test `input` with the given `regex`. This is used by the main
9373  * `picomatch()` function to test the input string.
9374  *
9375  * ```js
9376  * const picomatch = require('picomatch');
9377  * // picomatch.test(input, regex[, options]);
9378  *
9379  * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
9380  * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
9381  * ```
9382  * @param {String} `input` String to test.
9383  * @param {RegExp} `regex`
9384  * @return {Object} Returns an object with matching info.
9385  * @api public
9386  */
9387
9388 picomatch.test = (input, regex, options, { glob, posix } = {}) => {
9389   if (typeof input !== 'string') {
9390     throw new TypeError('Expected input to be a string');
9391   }
9392
9393   if (input === '') {
9394     return { isMatch: false, output: '' };
9395   }
9396
9397   const opts = options || {};
9398   const format = opts.format || (posix ? utils.toPosixSlashes : null);
9399   let match = input === glob;
9400   let output = (match && format) ? format(input) : input;
9401
9402   if (match === false) {
9403     output = format ? format(input) : input;
9404     match = output === glob;
9405   }
9406
9407   if (match === false || opts.capture === true) {
9408     if (opts.matchBase === true || opts.basename === true) {
9409       match = picomatch.matchBase(input, regex, options, posix);
9410     } else {
9411       match = regex.exec(output);
9412     }
9413   }
9414
9415   return { isMatch: Boolean(match), match, output };
9416 };
9417
9418 /**
9419  * Match the basename of a filepath.
9420  *
9421  * ```js
9422  * const picomatch = require('picomatch');
9423  * // picomatch.matchBase(input, glob[, options]);
9424  * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
9425  * ```
9426  * @param {String} `input` String to test.
9427  * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
9428  * @return {Boolean}
9429  * @api public
9430  */
9431
9432 picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
9433   const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
9434   return regex.test(path.basename(input));
9435 };
9436
9437 /**
9438  * Returns true if **any** of the given glob `patterns` match the specified `string`.
9439  *
9440  * ```js
9441  * const picomatch = require('picomatch');
9442  * // picomatch.isMatch(string, patterns[, options]);
9443  *
9444  * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
9445  * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
9446  * ```
9447  * @param {String|Array} str The string to test.
9448  * @param {String|Array} patterns One or more glob patterns to use for matching.
9449  * @param {Object} [options] See available [options](#options).
9450  * @return {Boolean} Returns true if any patterns match `str`
9451  * @api public
9452  */
9453
9454 picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
9455
9456 /**
9457  * Parse a glob pattern to create the source string for a regular
9458  * expression.
9459  *
9460  * ```js
9461  * const picomatch = require('picomatch');
9462  * const result = picomatch.parse(pattern[, options]);
9463  * ```
9464  * @param {String} `pattern`
9465  * @param {Object} `options`
9466  * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
9467  * @api public
9468  */
9469
9470 picomatch.parse = (pattern, options) => {
9471   if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
9472   return parse(pattern, { ...options, fastpaths: false });
9473 };
9474
9475 /**
9476  * Scan a glob pattern to separate the pattern into segments.
9477  *
9478  * ```js
9479  * const picomatch = require('picomatch');
9480  * // picomatch.scan(input[, options]);
9481  *
9482  * const result = picomatch.scan('!./foo/*.js');
9483  * console.log(result);
9484  * { prefix: '!./',
9485  *   input: '!./foo/*.js',
9486  *   start: 3,
9487  *   base: 'foo',
9488  *   glob: '*.js',
9489  *   isBrace: false,
9490  *   isBracket: false,
9491  *   isGlob: true,
9492  *   isExtglob: false,
9493  *   isGlobstar: false,
9494  *   negated: true }
9495  * ```
9496  * @param {String} `input` Glob pattern to scan.
9497  * @param {Object} `options`
9498  * @return {Object} Returns an object with
9499  * @api public
9500  */
9501
9502 picomatch.scan = (input, options) => scan(input, options);
9503
9504 /**
9505  * Create a regular expression from a parsed glob pattern.
9506  *
9507  * ```js
9508  * const picomatch = require('picomatch');
9509  * const state = picomatch.parse('*.js');
9510  * // picomatch.compileRe(state[, options]);
9511  *
9512  * console.log(picomatch.compileRe(state));
9513  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
9514  * ```
9515  * @param {String} `state` The object returned from the `.parse` method.
9516  * @param {Object} `options`
9517  * @return {RegExp} Returns a regex created from the given pattern.
9518  * @api public
9519  */
9520
9521 picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => {
9522   if (returnOutput === true) {
9523     return parsed.output;
9524   }
9525
9526   const opts = options || {};
9527   const prepend = opts.contains ? '' : '^';
9528   const append = opts.contains ? '' : '$';
9529
9530   let source = `${prepend}(?:${parsed.output})${append}`;
9531   if (parsed && parsed.negated === true) {
9532     source = `^(?!${source}).*$`;
9533   }
9534
9535   const regex = picomatch.toRegex(source, options);
9536   if (returnState === true) {
9537     regex.state = parsed;
9538   }
9539
9540   return regex;
9541 };
9542
9543 picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => {
9544   if (!input || typeof input !== 'string') {
9545     throw new TypeError('Expected a non-empty string');
9546   }
9547
9548   const opts = options || {};
9549   let parsed = { negated: false, fastpaths: true };
9550   let prefix = '';
9551   let output;
9552
9553   if (input.startsWith('./')) {
9554     input = input.slice(2);
9555     prefix = parsed.prefix = './';
9556   }
9557
9558   if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
9559     output = parse.fastpaths(input, options);
9560   }
9561
9562   if (output === undefined) {
9563     parsed = parse(input, options);
9564     parsed.prefix = prefix + (parsed.prefix || '');
9565   } else {
9566     parsed.output = output;
9567   }
9568
9569   return picomatch.compileRe(parsed, options, returnOutput, returnState);
9570 };
9571
9572 /**
9573  * Create a regular expression from the given regex source string.
9574  *
9575  * ```js
9576  * const picomatch = require('picomatch');
9577  * // picomatch.toRegex(source[, options]);
9578  *
9579  * const { output } = picomatch.parse('*.js');
9580  * console.log(picomatch.toRegex(output));
9581  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
9582  * ```
9583  * @param {String} `source` Regular expression source string.
9584  * @param {Object} `options`
9585  * @return {RegExp}
9586  * @api public
9587  */
9588
9589 picomatch.toRegex = (source, options) => {
9590   try {
9591     const opts = options || {};
9592     return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
9593   } catch (err) {
9594     if (options && options.debug === true) throw err;
9595     return /$^/;
9596   }
9597 };
9598
9599 /**
9600  * Picomatch constants.
9601  * @return {Object}
9602  */
9603
9604 picomatch.constants = constants;
9605
9606 /**
9607  * Expose "picomatch"
9608  */
9609
9610 module.exports = picomatch;
9611
9612
9613 /***/ }),
9614 /* 53 */
9615 /***/ (function(module, exports, __webpack_require__) {
9616
9617 "use strict";
9618
9619
9620 const utils = __webpack_require__(54);
9621 const {
9622   CHAR_ASTERISK,             /* * */
9623   CHAR_AT,                   /* @ */
9624   CHAR_BACKWARD_SLASH,       /* \ */
9625   CHAR_COMMA,                /* , */
9626   CHAR_DOT,                  /* . */
9627   CHAR_EXCLAMATION_MARK,     /* ! */
9628   CHAR_FORWARD_SLASH,        /* / */
9629   CHAR_LEFT_CURLY_BRACE,     /* { */
9630   CHAR_LEFT_PARENTHESES,     /* ( */
9631   CHAR_LEFT_SQUARE_BRACKET,  /* [ */
9632   CHAR_PLUS,                 /* + */
9633   CHAR_QUESTION_MARK,        /* ? */
9634   CHAR_RIGHT_CURLY_BRACE,    /* } */
9635   CHAR_RIGHT_PARENTHESES,    /* ) */
9636   CHAR_RIGHT_SQUARE_BRACKET  /* ] */
9637 } = __webpack_require__(55);
9638
9639 const isPathSeparator = code => {
9640   return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
9641 };
9642
9643 const depth = token => {
9644   if (token.isPrefix !== true) {
9645     token.depth = token.isGlobstar ? Infinity : 1;
9646   }
9647 };
9648
9649 /**
9650  * Quickly scans a glob pattern and returns an object with a handful of
9651  * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
9652  * `glob` (the actual pattern), and `negated` (true if the path starts with `!`).
9653  *
9654  * ```js
9655  * const pm = require('picomatch');
9656  * console.log(pm.scan('foo/bar/*.js'));
9657  * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
9658  * ```
9659  * @param {String} `str`
9660  * @param {Object} `options`
9661  * @return {Object} Returns an object with tokens and regex source string.
9662  * @api public
9663  */
9664
9665 const scan = (input, options) => {
9666   const opts = options || {};
9667
9668   const length = input.length - 1;
9669   const scanToEnd = opts.parts === true || opts.scanToEnd === true;
9670   const slashes = [];
9671   const tokens = [];
9672   const parts = [];
9673
9674   let str = input;
9675   let index = -1;
9676   let start = 0;
9677   let lastIndex = 0;
9678   let isBrace = false;
9679   let isBracket = false;
9680   let isGlob = false;
9681   let isExtglob = false;
9682   let isGlobstar = false;
9683   let braceEscaped = false;
9684   let backslashes = false;
9685   let negated = false;
9686   let finished = false;
9687   let braces = 0;
9688   let prev;
9689   let code;
9690   let token = { value: '', depth: 0, isGlob: false };
9691
9692   const eos = () => index >= length;
9693   const peek = () => str.charCodeAt(index + 1);
9694   const advance = () => {
9695     prev = code;
9696     return str.charCodeAt(++index);
9697   };
9698
9699   while (index < length) {
9700     code = advance();
9701     let next;
9702
9703     if (code === CHAR_BACKWARD_SLASH) {
9704       backslashes = token.backslashes = true;
9705       code = advance();
9706
9707       if (code === CHAR_LEFT_CURLY_BRACE) {
9708         braceEscaped = true;
9709       }
9710       continue;
9711     }
9712
9713     if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
9714       braces++;
9715
9716       while (eos() !== true && (code = advance())) {
9717         if (code === CHAR_BACKWARD_SLASH) {
9718           backslashes = token.backslashes = true;
9719           advance();
9720           continue;
9721         }
9722
9723         if (code === CHAR_LEFT_CURLY_BRACE) {
9724           braces++;
9725           continue;
9726         }
9727
9728         if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
9729           isBrace = token.isBrace = true;
9730           isGlob = token.isGlob = true;
9731           finished = true;
9732
9733           if (scanToEnd === true) {
9734             continue;
9735           }
9736
9737           break;
9738         }
9739
9740         if (braceEscaped !== true && code === CHAR_COMMA) {
9741           isBrace = token.isBrace = true;
9742           isGlob = token.isGlob = true;
9743           finished = true;
9744
9745           if (scanToEnd === true) {
9746             continue;
9747           }
9748
9749           break;
9750         }
9751
9752         if (code === CHAR_RIGHT_CURLY_BRACE) {
9753           braces--;
9754
9755           if (braces === 0) {
9756             braceEscaped = false;
9757             isBrace = token.isBrace = true;
9758             finished = true;
9759             break;
9760           }
9761         }
9762       }
9763
9764       if (scanToEnd === true) {
9765         continue;
9766       }
9767
9768       break;
9769     }
9770
9771     if (code === CHAR_FORWARD_SLASH) {
9772       slashes.push(index);
9773       tokens.push(token);
9774       token = { value: '', depth: 0, isGlob: false };
9775
9776       if (finished === true) continue;
9777       if (prev === CHAR_DOT && index === (start + 1)) {
9778         start += 2;
9779         continue;
9780       }
9781
9782       lastIndex = index + 1;
9783       continue;
9784     }
9785
9786     if (opts.noext !== true) {
9787       const isExtglobChar = code === CHAR_PLUS
9788         || code === CHAR_AT
9789         || code === CHAR_ASTERISK
9790         || code === CHAR_QUESTION_MARK
9791         || code === CHAR_EXCLAMATION_MARK;
9792
9793       if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
9794         isGlob = token.isGlob = true;
9795         isExtglob = token.isExtglob = true;
9796         finished = true;
9797
9798         if (scanToEnd === true) {
9799           while (eos() !== true && (code = advance())) {
9800             if (code === CHAR_BACKWARD_SLASH) {
9801               backslashes = token.backslashes = true;
9802               code = advance();
9803               continue;
9804             }
9805
9806             if (code === CHAR_RIGHT_PARENTHESES) {
9807               isGlob = token.isGlob = true;
9808               finished = true;
9809               break;
9810             }
9811           }
9812           continue;
9813         }
9814         break;
9815       }
9816     }
9817
9818     if (code === CHAR_ASTERISK) {
9819       if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
9820       isGlob = token.isGlob = true;
9821       finished = true;
9822
9823       if (scanToEnd === true) {
9824         continue;
9825       }
9826       break;
9827     }
9828
9829     if (code === CHAR_QUESTION_MARK) {
9830       isGlob = token.isGlob = true;
9831       finished = true;
9832
9833       if (scanToEnd === true) {
9834         continue;
9835       }
9836       break;
9837     }
9838
9839     if (code === CHAR_LEFT_SQUARE_BRACKET) {
9840       while (eos() !== true && (next = advance())) {
9841         if (next === CHAR_BACKWARD_SLASH) {
9842           backslashes = token.backslashes = true;
9843           advance();
9844           continue;
9845         }
9846
9847         if (next === CHAR_RIGHT_SQUARE_BRACKET) {
9848           isBracket = token.isBracket = true;
9849           isGlob = token.isGlob = true;
9850           finished = true;
9851
9852           if (scanToEnd === true) {
9853             continue;
9854           }
9855           break;
9856         }
9857       }
9858     }
9859
9860     if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
9861       negated = token.negated = true;
9862       start++;
9863       continue;
9864     }
9865
9866     if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
9867       isGlob = token.isGlob = true;
9868
9869       if (scanToEnd === true) {
9870         while (eos() !== true && (code = advance())) {
9871           if (code === CHAR_LEFT_PARENTHESES) {
9872             backslashes = token.backslashes = true;
9873             code = advance();
9874             continue;
9875           }
9876
9877           if (code === CHAR_RIGHT_PARENTHESES) {
9878             finished = true;
9879             break;
9880           }
9881         }
9882         continue;
9883       }
9884       break;
9885     }
9886
9887     if (isGlob === true) {
9888       finished = true;
9889
9890       if (scanToEnd === true) {
9891         continue;
9892       }
9893
9894       break;
9895     }
9896   }
9897
9898   if (opts.noext === true) {
9899     isExtglob = false;
9900     isGlob = false;
9901   }
9902
9903   let base = str;
9904   let prefix = '';
9905   let glob = '';
9906
9907   if (start > 0) {
9908     prefix = str.slice(0, start);
9909     str = str.slice(start);
9910     lastIndex -= start;
9911   }
9912
9913   if (base && isGlob === true && lastIndex > 0) {
9914     base = str.slice(0, lastIndex);
9915     glob = str.slice(lastIndex);
9916   } else if (isGlob === true) {
9917     base = '';
9918     glob = str;
9919   } else {
9920     base = str;
9921   }
9922
9923   if (base && base !== '' && base !== '/' && base !== str) {
9924     if (isPathSeparator(base.charCodeAt(base.length - 1))) {
9925       base = base.slice(0, -1);
9926     }
9927   }
9928
9929   if (opts.unescape === true) {
9930     if (glob) glob = utils.removeBackslashes(glob);
9931
9932     if (base && backslashes === true) {
9933       base = utils.removeBackslashes(base);
9934     }
9935   }
9936
9937   const state = {
9938     prefix,
9939     input,
9940     start,
9941     base,
9942     glob,
9943     isBrace,
9944     isBracket,
9945     isGlob,
9946     isExtglob,
9947     isGlobstar,
9948     negated
9949   };
9950
9951   if (opts.tokens === true) {
9952     state.maxDepth = 0;
9953     if (!isPathSeparator(code)) {
9954       tokens.push(token);
9955     }
9956     state.tokens = tokens;
9957   }
9958
9959   if (opts.parts === true || opts.tokens === true) {
9960     let prevIndex;
9961
9962     for (let idx = 0; idx < slashes.length; idx++) {
9963       const n = prevIndex ? prevIndex + 1 : start;
9964       const i = slashes[idx];
9965       const value = input.slice(n, i);
9966       if (opts.tokens) {
9967         if (idx === 0 && start !== 0) {
9968           tokens[idx].isPrefix = true;
9969           tokens[idx].value = prefix;
9970         } else {
9971           tokens[idx].value = value;
9972         }
9973         depth(tokens[idx]);
9974         state.maxDepth += tokens[idx].depth;
9975       }
9976       if (idx !== 0 || value !== '') {
9977         parts.push(value);
9978       }
9979       prevIndex = i;
9980     }
9981
9982     if (prevIndex && prevIndex + 1 < input.length) {
9983       const value = input.slice(prevIndex + 1);
9984       parts.push(value);
9985
9986       if (opts.tokens) {
9987         tokens[tokens.length - 1].value = value;
9988         depth(tokens[tokens.length - 1]);
9989         state.maxDepth += tokens[tokens.length - 1].depth;
9990       }
9991     }
9992
9993     state.slashes = slashes;
9994     state.parts = parts;
9995   }
9996
9997   return state;
9998 };
9999
10000 module.exports = scan;
10001
10002
10003 /***/ }),
10004 /* 54 */
10005 /***/ (function(module, exports, __webpack_require__) {
10006
10007 "use strict";
10008
10009
10010 const path = __webpack_require__(2);
10011 const win32 = process.platform === 'win32';
10012 const {
10013   REGEX_BACKSLASH,
10014   REGEX_REMOVE_BACKSLASH,
10015   REGEX_SPECIAL_CHARS,
10016   REGEX_SPECIAL_CHARS_GLOBAL
10017 } = __webpack_require__(55);
10018
10019 exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
10020 exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
10021 exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
10022 exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
10023 exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
10024
10025 exports.removeBackslashes = str => {
10026   return str.replace(REGEX_REMOVE_BACKSLASH, match => {
10027     return match === '\\' ? '' : match;
10028   });
10029 };
10030
10031 exports.supportsLookbehinds = () => {
10032   const segs = process.version.slice(1).split('.').map(Number);
10033   if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
10034     return true;
10035   }
10036   return false;
10037 };
10038
10039 exports.isWindows = options => {
10040   if (options && typeof options.windows === 'boolean') {
10041     return options.windows;
10042   }
10043   return win32 === true || path.sep === '\\';
10044 };
10045
10046 exports.escapeLast = (input, char, lastIdx) => {
10047   const idx = input.lastIndexOf(char, lastIdx);
10048   if (idx === -1) return input;
10049   if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
10050   return `${input.slice(0, idx)}\\${input.slice(idx)}`;
10051 };
10052
10053 exports.removePrefix = (input, state = {}) => {
10054   let output = input;
10055   if (output.startsWith('./')) {
10056     output = output.slice(2);
10057     state.prefix = './';
10058   }
10059   return output;
10060 };
10061
10062 exports.wrapOutput = (input, state = {}, options = {}) => {
10063   const prepend = options.contains ? '' : '^';
10064   const append = options.contains ? '' : '$';
10065
10066   let output = `${prepend}(?:${input})${append}`;
10067   if (state.negated === true) {
10068     output = `(?:^(?!${output}).*$)`;
10069   }
10070   return output;
10071 };
10072
10073
10074 /***/ }),
10075 /* 55 */
10076 /***/ (function(module, exports, __webpack_require__) {
10077
10078 "use strict";
10079
10080
10081 const path = __webpack_require__(2);
10082 const WIN_SLASH = '\\\\/';
10083 const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
10084
10085 /**
10086  * Posix glob regex
10087  */
10088
10089 const DOT_LITERAL = '\\.';
10090 const PLUS_LITERAL = '\\+';
10091 const QMARK_LITERAL = '\\?';
10092 const SLASH_LITERAL = '\\/';
10093 const ONE_CHAR = '(?=.)';
10094 const QMARK = '[^/]';
10095 const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
10096 const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
10097 const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
10098 const NO_DOT = `(?!${DOT_LITERAL})`;
10099 const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
10100 const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
10101 const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
10102 const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
10103 const STAR = `${QMARK}*?`;
10104
10105 const POSIX_CHARS = {
10106   DOT_LITERAL,
10107   PLUS_LITERAL,
10108   QMARK_LITERAL,
10109   SLASH_LITERAL,
10110   ONE_CHAR,
10111   QMARK,
10112   END_ANCHOR,
10113   DOTS_SLASH,
10114   NO_DOT,
10115   NO_DOTS,
10116   NO_DOT_SLASH,
10117   NO_DOTS_SLASH,
10118   QMARK_NO_DOT,
10119   STAR,
10120   START_ANCHOR
10121 };
10122
10123 /**
10124  * Windows glob regex
10125  */
10126
10127 const WINDOWS_CHARS = {
10128   ...POSIX_CHARS,
10129
10130   SLASH_LITERAL: `[${WIN_SLASH}]`,
10131   QMARK: WIN_NO_SLASH,
10132   STAR: `${WIN_NO_SLASH}*?`,
10133   DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
10134   NO_DOT: `(?!${DOT_LITERAL})`,
10135   NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
10136   NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
10137   NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
10138   QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
10139   START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
10140   END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
10141 };
10142
10143 /**
10144  * POSIX Bracket Regex
10145  */
10146
10147 const POSIX_REGEX_SOURCE = {
10148   alnum: 'a-zA-Z0-9',
10149   alpha: 'a-zA-Z',
10150   ascii: '\\x00-\\x7F',
10151   blank: ' \\t',
10152   cntrl: '\\x00-\\x1F\\x7F',
10153   digit: '0-9',
10154   graph: '\\x21-\\x7E',
10155   lower: 'a-z',
10156   print: '\\x20-\\x7E ',
10157   punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
10158   space: ' \\t\\r\\n\\v\\f',
10159   upper: 'A-Z',
10160   word: 'A-Za-z0-9_',
10161   xdigit: 'A-Fa-f0-9'
10162 };
10163
10164 module.exports = {
10165   MAX_LENGTH: 1024 * 64,
10166   POSIX_REGEX_SOURCE,
10167
10168   // regular expressions
10169   REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
10170   REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
10171   REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
10172   REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
10173   REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
10174   REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
10175
10176   // Replace globs with equivalent patterns to reduce parsing time.
10177   REPLACEMENTS: {
10178     '***': '*',
10179     '**/**': '**',
10180     '**/**/**': '**'
10181   },
10182
10183   // Digits
10184   CHAR_0: 48, /* 0 */
10185   CHAR_9: 57, /* 9 */
10186
10187   // Alphabet chars.
10188   CHAR_UPPERCASE_A: 65, /* A */
10189   CHAR_LOWERCASE_A: 97, /* a */
10190   CHAR_UPPERCASE_Z: 90, /* Z */
10191   CHAR_LOWERCASE_Z: 122, /* z */
10192
10193   CHAR_LEFT_PARENTHESES: 40, /* ( */
10194   CHAR_RIGHT_PARENTHESES: 41, /* ) */
10195
10196   CHAR_ASTERISK: 42, /* * */
10197
10198   // Non-alphabetic chars.
10199   CHAR_AMPERSAND: 38, /* & */
10200   CHAR_AT: 64, /* @ */
10201   CHAR_BACKWARD_SLASH: 92, /* \ */
10202   CHAR_CARRIAGE_RETURN: 13, /* \r */
10203   CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
10204   CHAR_COLON: 58, /* : */
10205   CHAR_COMMA: 44, /* , */
10206   CHAR_DOT: 46, /* . */
10207   CHAR_DOUBLE_QUOTE: 34, /* " */
10208   CHAR_EQUAL: 61, /* = */
10209   CHAR_EXCLAMATION_MARK: 33, /* ! */
10210   CHAR_FORM_FEED: 12, /* \f */
10211   CHAR_FORWARD_SLASH: 47, /* / */
10212   CHAR_GRAVE_ACCENT: 96, /* ` */
10213   CHAR_HASH: 35, /* # */
10214   CHAR_HYPHEN_MINUS: 45, /* - */
10215   CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
10216   CHAR_LEFT_CURLY_BRACE: 123, /* { */
10217   CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
10218   CHAR_LINE_FEED: 10, /* \n */
10219   CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
10220   CHAR_PERCENT: 37, /* % */
10221   CHAR_PLUS: 43, /* + */
10222   CHAR_QUESTION_MARK: 63, /* ? */
10223   CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
10224   CHAR_RIGHT_CURLY_BRACE: 125, /* } */
10225   CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
10226   CHAR_SEMICOLON: 59, /* ; */
10227   CHAR_SINGLE_QUOTE: 39, /* ' */
10228   CHAR_SPACE: 32, /*   */
10229   CHAR_TAB: 9, /* \t */
10230   CHAR_UNDERSCORE: 95, /* _ */
10231   CHAR_VERTICAL_LINE: 124, /* | */
10232   CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
10233
10234   SEP: path.sep,
10235
10236   /**
10237    * Create EXTGLOB_CHARS
10238    */
10239
10240   extglobChars(chars) {
10241     return {
10242       '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
10243       '?': { type: 'qmark', open: '(?:', close: ')?' },
10244       '+': { type: 'plus', open: '(?:', close: ')+' },
10245       '*': { type: 'star', open: '(?:', close: ')*' },
10246       '@': { type: 'at', open: '(?:', close: ')' }
10247     };
10248   },
10249
10250   /**
10251    * Create GLOB_CHARS
10252    */
10253
10254   globChars(win32) {
10255     return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
10256   }
10257 };
10258
10259
10260 /***/ }),
10261 /* 56 */
10262 /***/ (function(module, exports, __webpack_require__) {
10263
10264 "use strict";
10265
10266
10267 const constants = __webpack_require__(55);
10268 const utils = __webpack_require__(54);
10269
10270 /**
10271  * Constants
10272  */
10273
10274 const {
10275   MAX_LENGTH,
10276   POSIX_REGEX_SOURCE,
10277   REGEX_NON_SPECIAL_CHARS,
10278   REGEX_SPECIAL_CHARS_BACKREF,
10279   REPLACEMENTS
10280 } = constants;
10281
10282 /**
10283  * Helpers
10284  */
10285
10286 const expandRange = (args, options) => {
10287   if (typeof options.expandRange === 'function') {
10288     return options.expandRange(...args, options);
10289   }
10290
10291   args.sort();
10292   const value = `[${args.join('-')}]`;
10293
10294   try {
10295     /* eslint-disable-next-line no-new */
10296     new RegExp(value);
10297   } catch (ex) {
10298     return args.map(v => utils.escapeRegex(v)).join('..');
10299   }
10300
10301   return value;
10302 };
10303
10304 /**
10305  * Create the message for a syntax error
10306  */
10307
10308 const syntaxError = (type, char) => {
10309   return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
10310 };
10311
10312 /**
10313  * Parse the given input string.
10314  * @param {String} input
10315  * @param {Object} options
10316  * @return {Object}
10317  */
10318
10319 const parse = (input, options) => {
10320   if (typeof input !== 'string') {
10321     throw new TypeError('Expected a string');
10322   }
10323
10324   input = REPLACEMENTS[input] || input;
10325
10326   const opts = { ...options };
10327   const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
10328
10329   let len = input.length;
10330   if (len > max) {
10331     throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
10332   }
10333
10334   const bos = { type: 'bos', value: '', output: opts.prepend || '' };
10335   const tokens = [bos];
10336
10337   const capture = opts.capture ? '' : '?:';
10338   const win32 = utils.isWindows(options);
10339
10340   // create constants based on platform, for windows or posix
10341   const PLATFORM_CHARS = constants.globChars(win32);
10342   const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
10343
10344   const {
10345     DOT_LITERAL,
10346     PLUS_LITERAL,
10347     SLASH_LITERAL,
10348     ONE_CHAR,
10349     DOTS_SLASH,
10350     NO_DOT,
10351     NO_DOT_SLASH,
10352     NO_DOTS_SLASH,
10353     QMARK,
10354     QMARK_NO_DOT,
10355     STAR,
10356     START_ANCHOR
10357   } = PLATFORM_CHARS;
10358
10359   const globstar = (opts) => {
10360     return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
10361   };
10362
10363   const nodot = opts.dot ? '' : NO_DOT;
10364   const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
10365   let star = opts.bash === true ? globstar(opts) : STAR;
10366
10367   if (opts.capture) {
10368     star = `(${star})`;
10369   }
10370
10371   // minimatch options support
10372   if (typeof opts.noext === 'boolean') {
10373     opts.noextglob = opts.noext;
10374   }
10375
10376   const state = {
10377     input,
10378     index: -1,
10379     start: 0,
10380     dot: opts.dot === true,
10381     consumed: '',
10382     output: '',
10383     prefix: '',
10384     backtrack: false,
10385     negated: false,
10386     brackets: 0,
10387     braces: 0,
10388     parens: 0,
10389     quotes: 0,
10390     globstar: false,
10391     tokens
10392   };
10393
10394   input = utils.removePrefix(input, state);
10395   len = input.length;
10396
10397   const extglobs = [];
10398   const braces = [];
10399   const stack = [];
10400   let prev = bos;
10401   let value;
10402
10403   /**
10404    * Tokenizing helpers
10405    */
10406
10407   const eos = () => state.index === len - 1;
10408   const peek = state.peek = (n = 1) => input[state.index + n];
10409   const advance = state.advance = () => input[++state.index];
10410   const remaining = () => input.slice(state.index + 1);
10411   const consume = (value = '', num = 0) => {
10412     state.consumed += value;
10413     state.index += num;
10414   };
10415   const append = token => {
10416     state.output += token.output != null ? token.output : token.value;
10417     consume(token.value);
10418   };
10419
10420   const negate = () => {
10421     let count = 1;
10422
10423     while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
10424       advance();
10425       state.start++;
10426       count++;
10427     }
10428
10429     if (count % 2 === 0) {
10430       return false;
10431     }
10432
10433     state.negated = true;
10434     state.start++;
10435     return true;
10436   };
10437
10438   const increment = type => {
10439     state[type]++;
10440     stack.push(type);
10441   };
10442
10443   const decrement = type => {
10444     state[type]--;
10445     stack.pop();
10446   };
10447
10448   /**
10449    * Push tokens onto the tokens array. This helper speeds up
10450    * tokenizing by 1) helping us avoid backtracking as much as possible,
10451    * and 2) helping us avoid creating extra tokens when consecutive
10452    * characters are plain text. This improves performance and simplifies
10453    * lookbehinds.
10454    */
10455
10456   const push = tok => {
10457     if (prev.type === 'globstar') {
10458       const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
10459       const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
10460
10461       if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
10462         state.output = state.output.slice(0, -prev.output.length);
10463         prev.type = 'star';
10464         prev.value = '*';
10465         prev.output = star;
10466         state.output += prev.output;
10467       }
10468     }
10469
10470     if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) {
10471       extglobs[extglobs.length - 1].inner += tok.value;
10472     }
10473
10474     if (tok.value || tok.output) append(tok);
10475     if (prev && prev.type === 'text' && tok.type === 'text') {
10476       prev.value += tok.value;
10477       prev.output = (prev.output || '') + tok.value;
10478       return;
10479     }
10480
10481     tok.prev = prev;
10482     tokens.push(tok);
10483     prev = tok;
10484   };
10485
10486   const extglobOpen = (type, value) => {
10487     const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
10488
10489     token.prev = prev;
10490     token.parens = state.parens;
10491     token.output = state.output;
10492     const output = (opts.capture ? '(' : '') + token.open;
10493
10494     increment('parens');
10495     push({ type, value, output: state.output ? '' : ONE_CHAR });
10496     push({ type: 'paren', extglob: true, value: advance(), output });
10497     extglobs.push(token);
10498   };
10499
10500   const extglobClose = token => {
10501     let output = token.close + (opts.capture ? ')' : '');
10502
10503     if (token.type === 'negate') {
10504       let extglobStar = star;
10505
10506       if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
10507         extglobStar = globstar(opts);
10508       }
10509
10510       if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
10511         output = token.close = `)$))${extglobStar}`;
10512       }
10513
10514       if (token.prev.type === 'bos' && eos()) {
10515         state.negatedExtglob = true;
10516       }
10517     }
10518
10519     push({ type: 'paren', extglob: true, value, output });
10520     decrement('parens');
10521   };
10522
10523   /**
10524    * Fast paths
10525    */
10526
10527   if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
10528     let backslashes = false;
10529
10530     let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
10531       if (first === '\\') {
10532         backslashes = true;
10533         return m;
10534       }
10535
10536       if (first === '?') {
10537         if (esc) {
10538           return esc + first + (rest ? QMARK.repeat(rest.length) : '');
10539         }
10540         if (index === 0) {
10541           return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
10542         }
10543         return QMARK.repeat(chars.length);
10544       }
10545
10546       if (first === '.') {
10547         return DOT_LITERAL.repeat(chars.length);
10548       }
10549
10550       if (first === '*') {
10551         if (esc) {
10552           return esc + first + (rest ? star : '');
10553         }
10554         return star;
10555       }
10556       return esc ? m : `\\${m}`;
10557     });
10558
10559     if (backslashes === true) {
10560       if (opts.unescape === true) {
10561         output = output.replace(/\\/g, '');
10562       } else {
10563         output = output.replace(/\\+/g, m => {
10564           return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
10565         });
10566       }
10567     }
10568
10569     if (output === input && opts.contains === true) {
10570       state.output = input;
10571       return state;
10572     }
10573
10574     state.output = utils.wrapOutput(output, state, options);
10575     return state;
10576   }
10577
10578   /**
10579    * Tokenize input until we reach end-of-string
10580    */
10581
10582   while (!eos()) {
10583     value = advance();
10584
10585     if (value === '\u0000') {
10586       continue;
10587     }
10588
10589     /**
10590      * Escaped characters
10591      */
10592
10593     if (value === '\\') {
10594       const next = peek();
10595
10596       if (next === '/' && opts.bash !== true) {
10597         continue;
10598       }
10599
10600       if (next === '.' || next === ';') {
10601         continue;
10602       }
10603
10604       if (!next) {
10605         value += '\\';
10606         push({ type: 'text', value });
10607         continue;
10608       }
10609
10610       // collapse slashes to reduce potential for exploits
10611       const match = /^\\+/.exec(remaining());
10612       let slashes = 0;
10613
10614       if (match && match[0].length > 2) {
10615         slashes = match[0].length;
10616         state.index += slashes;
10617         if (slashes % 2 !== 0) {
10618           value += '\\';
10619         }
10620       }
10621
10622       if (opts.unescape === true) {
10623         value = advance() || '';
10624       } else {
10625         value += advance() || '';
10626       }
10627
10628       if (state.brackets === 0) {
10629         push({ type: 'text', value });
10630         continue;
10631       }
10632     }
10633
10634     /**
10635      * If we're inside a regex character class, continue
10636      * until we reach the closing bracket.
10637      */
10638
10639     if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
10640       if (opts.posix !== false && value === ':') {
10641         const inner = prev.value.slice(1);
10642         if (inner.includes('[')) {
10643           prev.posix = true;
10644
10645           if (inner.includes(':')) {
10646             const idx = prev.value.lastIndexOf('[');
10647             const pre = prev.value.slice(0, idx);
10648             const rest = prev.value.slice(idx + 2);
10649             const posix = POSIX_REGEX_SOURCE[rest];
10650             if (posix) {
10651               prev.value = pre + posix;
10652               state.backtrack = true;
10653               advance();
10654
10655               if (!bos.output && tokens.indexOf(prev) === 1) {
10656                 bos.output = ONE_CHAR;
10657               }
10658               continue;
10659             }
10660           }
10661         }
10662       }
10663
10664       if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
10665         value = `\\${value}`;
10666       }
10667
10668       if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
10669         value = `\\${value}`;
10670       }
10671
10672       if (opts.posix === true && value === '!' && prev.value === '[') {
10673         value = '^';
10674       }
10675
10676       prev.value += value;
10677       append({ value });
10678       continue;
10679     }
10680
10681     /**
10682      * If we're inside a quoted string, continue
10683      * until we reach the closing double quote.
10684      */
10685
10686     if (state.quotes === 1 && value !== '"') {
10687       value = utils.escapeRegex(value);
10688       prev.value += value;
10689       append({ value });
10690       continue;
10691     }
10692
10693     /**
10694      * Double quotes
10695      */
10696
10697     if (value === '"') {
10698       state.quotes = state.quotes === 1 ? 0 : 1;
10699       if (opts.keepQuotes === true) {
10700         push({ type: 'text', value });
10701       }
10702       continue;
10703     }
10704
10705     /**
10706      * Parentheses
10707      */
10708
10709     if (value === '(') {
10710       increment('parens');
10711       push({ type: 'paren', value });
10712       continue;
10713     }
10714
10715     if (value === ')') {
10716       if (state.parens === 0 && opts.strictBrackets === true) {
10717         throw new SyntaxError(syntaxError('opening', '('));
10718       }
10719
10720       const extglob = extglobs[extglobs.length - 1];
10721       if (extglob && state.parens === extglob.parens + 1) {
10722         extglobClose(extglobs.pop());
10723         continue;
10724       }
10725
10726       push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
10727       decrement('parens');
10728       continue;
10729     }
10730
10731     /**
10732      * Square brackets
10733      */
10734
10735     if (value === '[') {
10736       if (opts.nobracket === true || !remaining().includes(']')) {
10737         if (opts.nobracket !== true && opts.strictBrackets === true) {
10738           throw new SyntaxError(syntaxError('closing', ']'));
10739         }
10740
10741         value = `\\${value}`;
10742       } else {
10743         increment('brackets');
10744       }
10745
10746       push({ type: 'bracket', value });
10747       continue;
10748     }
10749
10750     if (value === ']') {
10751       if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
10752         push({ type: 'text', value, output: `\\${value}` });
10753         continue;
10754       }
10755
10756       if (state.brackets === 0) {
10757         if (opts.strictBrackets === true) {
10758           throw new SyntaxError(syntaxError('opening', '['));
10759         }
10760
10761         push({ type: 'text', value, output: `\\${value}` });
10762         continue;
10763       }
10764
10765       decrement('brackets');
10766
10767       const prevValue = prev.value.slice(1);
10768       if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
10769         value = `/${value}`;
10770       }
10771
10772       prev.value += value;
10773       append({ value });
10774
10775       // when literal brackets are explicitly disabled
10776       // assume we should match with a regex character class
10777       if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
10778         continue;
10779       }
10780
10781       const escaped = utils.escapeRegex(prev.value);
10782       state.output = state.output.slice(0, -prev.value.length);
10783
10784       // when literal brackets are explicitly enabled
10785       // assume we should escape the brackets to match literal characters
10786       if (opts.literalBrackets === true) {
10787         state.output += escaped;
10788         prev.value = escaped;
10789         continue;
10790       }
10791
10792       // when the user specifies nothing, try to match both
10793       prev.value = `(${capture}${escaped}|${prev.value})`;
10794       state.output += prev.value;
10795       continue;
10796     }
10797
10798     /**
10799      * Braces
10800      */
10801
10802     if (value === '{' && opts.nobrace !== true) {
10803       increment('braces');
10804
10805       const open = {
10806         type: 'brace',
10807         value,
10808         output: '(',
10809         outputIndex: state.output.length,
10810         tokensIndex: state.tokens.length
10811       };
10812
10813       braces.push(open);
10814       push(open);
10815       continue;
10816     }
10817
10818     if (value === '}') {
10819       const brace = braces[braces.length - 1];
10820
10821       if (opts.nobrace === true || !brace) {
10822         push({ type: 'text', value, output: value });
10823         continue;
10824       }
10825
10826       let output = ')';
10827
10828       if (brace.dots === true) {
10829         const arr = tokens.slice();
10830         const range = [];
10831
10832         for (let i = arr.length - 1; i >= 0; i--) {
10833           tokens.pop();
10834           if (arr[i].type === 'brace') {
10835             break;
10836           }
10837           if (arr[i].type !== 'dots') {
10838             range.unshift(arr[i].value);
10839           }
10840         }
10841
10842         output = expandRange(range, opts);
10843         state.backtrack = true;
10844       }
10845
10846       if (brace.comma !== true && brace.dots !== true) {
10847         const out = state.output.slice(0, brace.outputIndex);
10848         const toks = state.tokens.slice(brace.tokensIndex);
10849         brace.value = brace.output = '\\{';
10850         value = output = '\\}';
10851         state.output = out;
10852         for (const t of toks) {
10853           state.output += (t.output || t.value);
10854         }
10855       }
10856
10857       push({ type: 'brace', value, output });
10858       decrement('braces');
10859       braces.pop();
10860       continue;
10861     }
10862
10863     /**
10864      * Pipes
10865      */
10866
10867     if (value === '|') {
10868       if (extglobs.length > 0) {
10869         extglobs[extglobs.length - 1].conditions++;
10870       }
10871       push({ type: 'text', value });
10872       continue;
10873     }
10874
10875     /**
10876      * Commas
10877      */
10878
10879     if (value === ',') {
10880       let output = value;
10881
10882       const brace = braces[braces.length - 1];
10883       if (brace && stack[stack.length - 1] === 'braces') {
10884         brace.comma = true;
10885         output = '|';
10886       }
10887
10888       push({ type: 'comma', value, output });
10889       continue;
10890     }
10891
10892     /**
10893      * Slashes
10894      */
10895
10896     if (value === '/') {
10897       // if the beginning of the glob is "./", advance the start
10898       // to the current index, and don't add the "./" characters
10899       // to the state. This greatly simplifies lookbehinds when
10900       // checking for BOS characters like "!" and "." (not "./")
10901       if (prev.type === 'dot' && state.index === state.start + 1) {
10902         state.start = state.index + 1;
10903         state.consumed = '';
10904         state.output = '';
10905         tokens.pop();
10906         prev = bos; // reset "prev" to the first token
10907         continue;
10908       }
10909
10910       push({ type: 'slash', value, output: SLASH_LITERAL });
10911       continue;
10912     }
10913
10914     /**
10915      * Dots
10916      */
10917
10918     if (value === '.') {
10919       if (state.braces > 0 && prev.type === 'dot') {
10920         if (prev.value === '.') prev.output = DOT_LITERAL;
10921         const brace = braces[braces.length - 1];
10922         prev.type = 'dots';
10923         prev.output += value;
10924         prev.value += value;
10925         brace.dots = true;
10926         continue;
10927       }
10928
10929       if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
10930         push({ type: 'text', value, output: DOT_LITERAL });
10931         continue;
10932       }
10933
10934       push({ type: 'dot', value, output: DOT_LITERAL });
10935       continue;
10936     }
10937
10938     /**
10939      * Question marks
10940      */
10941
10942     if (value === '?') {
10943       const isGroup = prev && prev.value === '(';
10944       if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10945         extglobOpen('qmark', value);
10946         continue;
10947       }
10948
10949       if (prev && prev.type === 'paren') {
10950         const next = peek();
10951         let output = value;
10952
10953         if (next === '<' && !utils.supportsLookbehinds()) {
10954           throw new Error('Node.js v10 or higher is required for regex lookbehinds');
10955         }
10956
10957         if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
10958           output = `\\${value}`;
10959         }
10960
10961         push({ type: 'text', value, output });
10962         continue;
10963       }
10964
10965       if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
10966         push({ type: 'qmark', value, output: QMARK_NO_DOT });
10967         continue;
10968       }
10969
10970       push({ type: 'qmark', value, output: QMARK });
10971       continue;
10972     }
10973
10974     /**
10975      * Exclamation
10976      */
10977
10978     if (value === '!') {
10979       if (opts.noextglob !== true && peek() === '(') {
10980         if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
10981           extglobOpen('negate', value);
10982           continue;
10983         }
10984       }
10985
10986       if (opts.nonegate !== true && state.index === 0) {
10987         negate();
10988         continue;
10989       }
10990     }
10991
10992     /**
10993      * Plus
10994      */
10995
10996     if (value === '+') {
10997       if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10998         extglobOpen('plus', value);
10999         continue;
11000       }
11001
11002       if ((prev && prev.value === '(') || opts.regex === false) {
11003         push({ type: 'plus', value, output: PLUS_LITERAL });
11004         continue;
11005       }
11006
11007       if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
11008         push({ type: 'plus', value });
11009         continue;
11010       }
11011
11012       push({ type: 'plus', value: PLUS_LITERAL });
11013       continue;
11014     }
11015
11016     /**
11017      * Plain text
11018      */
11019
11020     if (value === '@') {
11021       if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
11022         push({ type: 'at', extglob: true, value, output: '' });
11023         continue;
11024       }
11025
11026       push({ type: 'text', value });
11027       continue;
11028     }
11029
11030     /**
11031      * Plain text
11032      */
11033
11034     if (value !== '*') {
11035       if (value === '$' || value === '^') {
11036         value = `\\${value}`;
11037       }
11038
11039       const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
11040       if (match) {
11041         value += match[0];
11042         state.index += match[0].length;
11043       }
11044
11045       push({ type: 'text', value });
11046       continue;
11047     }
11048
11049     /**
11050      * Stars
11051      */
11052
11053     if (prev && (prev.type === 'globstar' || prev.star === true)) {
11054       prev.type = 'star';
11055       prev.star = true;
11056       prev.value += value;
11057       prev.output = star;
11058       state.backtrack = true;
11059       state.globstar = true;
11060       consume(value);
11061       continue;
11062     }
11063
11064     let rest = remaining();
11065     if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
11066       extglobOpen('star', value);
11067       continue;
11068     }
11069
11070     if (prev.type === 'star') {
11071       if (opts.noglobstar === true) {
11072         consume(value);
11073         continue;
11074       }
11075
11076       const prior = prev.prev;
11077       const before = prior.prev;
11078       const isStart = prior.type === 'slash' || prior.type === 'bos';
11079       const afterStar = before && (before.type === 'star' || before.type === 'globstar');
11080
11081       if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
11082         push({ type: 'star', value, output: '' });
11083         continue;
11084       }
11085
11086       const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
11087       const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
11088       if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
11089         push({ type: 'star', value, output: '' });
11090         continue;
11091       }
11092
11093       // strip consecutive `/**/`
11094       while (rest.slice(0, 3) === '/**') {
11095         const after = input[state.index + 4];
11096         if (after && after !== '/') {
11097           break;
11098         }
11099         rest = rest.slice(3);
11100         consume('/**', 3);
11101       }
11102
11103       if (prior.type === 'bos' && eos()) {
11104         prev.type = 'globstar';
11105         prev.value += value;
11106         prev.output = globstar(opts);
11107         state.output = prev.output;
11108         state.globstar = true;
11109         consume(value);
11110         continue;
11111       }
11112
11113       if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
11114         state.output = state.output.slice(0, -(prior.output + prev.output).length);
11115         prior.output = `(?:${prior.output}`;
11116
11117         prev.type = 'globstar';
11118         prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
11119         prev.value += value;
11120         state.globstar = true;
11121         state.output += prior.output + prev.output;
11122         consume(value);
11123         continue;
11124       }
11125
11126       if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
11127         const end = rest[1] !== void 0 ? '|$' : '';
11128
11129         state.output = state.output.slice(0, -(prior.output + prev.output).length);
11130         prior.output = `(?:${prior.output}`;
11131
11132         prev.type = 'globstar';
11133         prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
11134         prev.value += value;
11135
11136         state.output += prior.output + prev.output;
11137         state.globstar = true;
11138
11139         consume(value + advance());
11140
11141         push({ type: 'slash', value: '/', output: '' });
11142         continue;
11143       }
11144
11145       if (prior.type === 'bos' && rest[0] === '/') {
11146         prev.type = 'globstar';
11147         prev.value += value;
11148         prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
11149         state.output = prev.output;
11150         state.globstar = true;
11151         consume(value + advance());
11152         push({ type: 'slash', value: '/', output: '' });
11153         continue;
11154       }
11155
11156       // remove single star from output
11157       state.output = state.output.slice(0, -prev.output.length);
11158
11159       // reset previous token to globstar
11160       prev.type = 'globstar';
11161       prev.output = globstar(opts);
11162       prev.value += value;
11163
11164       // reset output with globstar
11165       state.output += prev.output;
11166       state.globstar = true;
11167       consume(value);
11168       continue;
11169     }
11170
11171     const token = { type: 'star', value, output: star };
11172
11173     if (opts.bash === true) {
11174       token.output = '.*?';
11175       if (prev.type === 'bos' || prev.type === 'slash') {
11176         token.output = nodot + token.output;
11177       }
11178       push(token);
11179       continue;
11180     }
11181
11182     if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
11183       token.output = value;
11184       push(token);
11185       continue;
11186     }
11187
11188     if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
11189       if (prev.type === 'dot') {
11190         state.output += NO_DOT_SLASH;
11191         prev.output += NO_DOT_SLASH;
11192
11193       } else if (opts.dot === true) {
11194         state.output += NO_DOTS_SLASH;
11195         prev.output += NO_DOTS_SLASH;
11196
11197       } else {
11198         state.output += nodot;
11199         prev.output += nodot;
11200       }
11201
11202       if (peek() !== '*') {
11203         state.output += ONE_CHAR;
11204         prev.output += ONE_CHAR;
11205       }
11206     }
11207
11208     push(token);
11209   }
11210
11211   while (state.brackets > 0) {
11212     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
11213     state.output = utils.escapeLast(state.output, '[');
11214     decrement('brackets');
11215   }
11216
11217   while (state.parens > 0) {
11218     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
11219     state.output = utils.escapeLast(state.output, '(');
11220     decrement('parens');
11221   }
11222
11223   while (state.braces > 0) {
11224     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
11225     state.output = utils.escapeLast(state.output, '{');
11226     decrement('braces');
11227   }
11228
11229   if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
11230     push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
11231   }
11232
11233   // rebuild the output if we had to backtrack at any point
11234   if (state.backtrack === true) {
11235     state.output = '';
11236
11237     for (const token of state.tokens) {
11238       state.output += token.output != null ? token.output : token.value;
11239
11240       if (token.suffix) {
11241         state.output += token.suffix;
11242       }
11243     }
11244   }
11245
11246   return state;
11247 };
11248
11249 /**
11250  * Fast paths for creating regular expressions for common glob patterns.
11251  * This can significantly speed up processing and has very little downside
11252  * impact when none of the fast paths match.
11253  */
11254
11255 parse.fastpaths = (input, options) => {
11256   const opts = { ...options };
11257   const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
11258   const len = input.length;
11259   if (len > max) {
11260     throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
11261   }
11262
11263   input = REPLACEMENTS[input] || input;
11264   const win32 = utils.isWindows(options);
11265
11266   // create constants based on platform, for windows or posix
11267   const {
11268     DOT_LITERAL,
11269     SLASH_LITERAL,
11270     ONE_CHAR,
11271     DOTS_SLASH,
11272     NO_DOT,
11273     NO_DOTS,
11274     NO_DOTS_SLASH,
11275     STAR,
11276     START_ANCHOR
11277   } = constants.globChars(win32);
11278
11279   const nodot = opts.dot ? NO_DOTS : NO_DOT;
11280   const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
11281   const capture = opts.capture ? '' : '?:';
11282   const state = { negated: false, prefix: '' };
11283   let star = opts.bash === true ? '.*?' : STAR;
11284
11285   if (opts.capture) {
11286     star = `(${star})`;
11287   }
11288
11289   const globstar = (opts) => {
11290     if (opts.noglobstar === true) return star;
11291     return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
11292   };
11293
11294   const create = str => {
11295     switch (str) {
11296       case '*':
11297         return `${nodot}${ONE_CHAR}${star}`;
11298
11299       case '.*':
11300         return `${DOT_LITERAL}${ONE_CHAR}${star}`;
11301
11302       case '*.*':
11303         return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
11304
11305       case '*/*':
11306         return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
11307
11308       case '**':
11309         return nodot + globstar(opts);
11310
11311       case '**/*':
11312         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
11313
11314       case '**/*.*':
11315         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
11316
11317       case '**/.*':
11318         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
11319
11320       default: {
11321         const match = /^(.*?)\.(\w+)$/.exec(str);
11322         if (!match) return;
11323
11324         const source = create(match[1]);
11325         if (!source) return;
11326
11327         return source + DOT_LITERAL + match[2];
11328       }
11329     }
11330   };
11331
11332   const output = utils.removePrefix(input, state);
11333   let source = create(output);
11334
11335   if (source && opts.strictSlashes !== true) {
11336     source += `${SLASH_LITERAL}?`;
11337   }
11338
11339   return source;
11340 };
11341
11342 module.exports = parse;
11343
11344
11345 /***/ }),
11346 /* 57 */
11347 /***/ (function(module, exports, __webpack_require__) {
11348
11349 const assert = __webpack_require__(58)
11350 const path = __webpack_require__(2)
11351 const fs = __webpack_require__(42)
11352 let glob = undefined
11353 try {
11354   glob = __webpack_require__(59)
11355 } catch (_err) {
11356   // treat glob as optional.
11357 }
11358
11359 const defaultGlobOpts = {
11360   nosort: true,
11361   silent: true
11362 }
11363
11364 // for EMFILE handling
11365 let timeout = 0
11366
11367 const isWindows = (process.platform === "win32")
11368
11369 const defaults = options => {
11370   const methods = [
11371     'unlink',
11372     'chmod',
11373     'stat',
11374     'lstat',
11375     'rmdir',
11376     'readdir'
11377   ]
11378   methods.forEach(m => {
11379     options[m] = options[m] || fs[m]
11380     m = m + 'Sync'
11381     options[m] = options[m] || fs[m]
11382   })
11383
11384   options.maxBusyTries = options.maxBusyTries || 3
11385   options.emfileWait = options.emfileWait || 1000
11386   if (options.glob === false) {
11387     options.disableGlob = true
11388   }
11389   if (options.disableGlob !== true && glob === undefined) {
11390     throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
11391   }
11392   options.disableGlob = options.disableGlob || false
11393   options.glob = options.glob || defaultGlobOpts
11394 }
11395
11396 const rimraf = (p, options, cb) => {
11397   if (typeof options === 'function') {
11398     cb = options
11399     options = {}
11400   }
11401
11402   assert(p, 'rimraf: missing path')
11403   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
11404   assert.equal(typeof cb, 'function', 'rimraf: callback function required')
11405   assert(options, 'rimraf: invalid options argument provided')
11406   assert.equal(typeof options, 'object', 'rimraf: options should be object')
11407
11408   defaults(options)
11409
11410   let busyTries = 0
11411   let errState = null
11412   let n = 0
11413
11414   const next = (er) => {
11415     errState = errState || er
11416     if (--n === 0)
11417       cb(errState)
11418   }
11419
11420   const afterGlob = (er, results) => {
11421     if (er)
11422       return cb(er)
11423
11424     n = results.length
11425     if (n === 0)
11426       return cb()
11427
11428     results.forEach(p => {
11429       const CB = (er) => {
11430         if (er) {
11431           if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
11432               busyTries < options.maxBusyTries) {
11433             busyTries ++
11434             // try again, with the same exact callback as this one.
11435             return setTimeout(() => rimraf_(p, options, CB), busyTries * 100)
11436           }
11437
11438           // this one won't happen if graceful-fs is used.
11439           if (er.code === "EMFILE" && timeout < options.emfileWait) {
11440             return setTimeout(() => rimraf_(p, options, CB), timeout ++)
11441           }
11442
11443           // already gone
11444           if (er.code === "ENOENT") er = null
11445         }
11446
11447         timeout = 0
11448         next(er)
11449       }
11450       rimraf_(p, options, CB)
11451     })
11452   }
11453
11454   if (options.disableGlob || !glob.hasMagic(p))
11455     return afterGlob(null, [p])
11456
11457   options.lstat(p, (er, stat) => {
11458     if (!er)
11459       return afterGlob(null, [p])
11460
11461     glob(p, options.glob, afterGlob)
11462   })
11463
11464 }
11465
11466 // Two possible strategies.
11467 // 1. Assume it's a file.  unlink it, then do the dir stuff on EPERM or EISDIR
11468 // 2. Assume it's a directory.  readdir, then do the file stuff on ENOTDIR
11469 //
11470 // Both result in an extra syscall when you guess wrong.  However, there
11471 // are likely far more normal files in the world than directories.  This
11472 // is based on the assumption that a the average number of files per
11473 // directory is >= 1.
11474 //
11475 // If anyone ever complains about this, then I guess the strategy could
11476 // be made configurable somehow.  But until then, YAGNI.
11477 const rimraf_ = (p, options, cb) => {
11478   assert(p)
11479   assert(options)
11480   assert(typeof cb === 'function')
11481
11482   // sunos lets the root user unlink directories, which is... weird.
11483   // so we have to lstat here and make sure it's not a dir.
11484   options.lstat(p, (er, st) => {
11485     if (er && er.code === "ENOENT")
11486       return cb(null)
11487
11488     // Windows can EPERM on stat.  Life is suffering.
11489     if (er && er.code === "EPERM" && isWindows)
11490       fixWinEPERM(p, options, er, cb)
11491
11492     if (st && st.isDirectory())
11493       return rmdir(p, options, er, cb)
11494
11495     options.unlink(p, er => {
11496       if (er) {
11497         if (er.code === "ENOENT")
11498           return cb(null)
11499         if (er.code === "EPERM")
11500           return (isWindows)
11501             ? fixWinEPERM(p, options, er, cb)
11502             : rmdir(p, options, er, cb)
11503         if (er.code === "EISDIR")
11504           return rmdir(p, options, er, cb)
11505       }
11506       return cb(er)
11507     })
11508   })
11509 }
11510
11511 const fixWinEPERM = (p, options, er, cb) => {
11512   assert(p)
11513   assert(options)
11514   assert(typeof cb === 'function')
11515
11516   options.chmod(p, 0o666, er2 => {
11517     if (er2)
11518       cb(er2.code === "ENOENT" ? null : er)
11519     else
11520       options.stat(p, (er3, stats) => {
11521         if (er3)
11522           cb(er3.code === "ENOENT" ? null : er)
11523         else if (stats.isDirectory())
11524           rmdir(p, options, er, cb)
11525         else
11526           options.unlink(p, cb)
11527       })
11528   })
11529 }
11530
11531 const fixWinEPERMSync = (p, options, er) => {
11532   assert(p)
11533   assert(options)
11534
11535   try {
11536     options.chmodSync(p, 0o666)
11537   } catch (er2) {
11538     if (er2.code === "ENOENT")
11539       return
11540     else
11541       throw er
11542   }
11543
11544   let stats
11545   try {
11546     stats = options.statSync(p)
11547   } catch (er3) {
11548     if (er3.code === "ENOENT")
11549       return
11550     else
11551       throw er
11552   }
11553
11554   if (stats.isDirectory())
11555     rmdirSync(p, options, er)
11556   else
11557     options.unlinkSync(p)
11558 }
11559
11560 const rmdir = (p, options, originalEr, cb) => {
11561   assert(p)
11562   assert(options)
11563   assert(typeof cb === 'function')
11564
11565   // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
11566   // if we guessed wrong, and it's not a directory, then
11567   // raise the original error.
11568   options.rmdir(p, er => {
11569     if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
11570       rmkids(p, options, cb)
11571     else if (er && er.code === "ENOTDIR")
11572       cb(originalEr)
11573     else
11574       cb(er)
11575   })
11576 }
11577
11578 const rmkids = (p, options, cb) => {
11579   assert(p)
11580   assert(options)
11581   assert(typeof cb === 'function')
11582
11583   options.readdir(p, (er, files) => {
11584     if (er)
11585       return cb(er)
11586     let n = files.length
11587     if (n === 0)
11588       return options.rmdir(p, cb)
11589     let errState
11590     files.forEach(f => {
11591       rimraf(path.join(p, f), options, er => {
11592         if (errState)
11593           return
11594         if (er)
11595           return cb(errState = er)
11596         if (--n === 0)
11597           options.rmdir(p, cb)
11598       })
11599     })
11600   })
11601 }
11602
11603 // this looks simpler, and is strictly *faster*, but will
11604 // tie up the JavaScript thread and fail on excessively
11605 // deep directory trees.
11606 const rimrafSync = (p, options) => {
11607   options = options || {}
11608   defaults(options)
11609
11610   assert(p, 'rimraf: missing path')
11611   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
11612   assert(options, 'rimraf: missing options')
11613   assert.equal(typeof options, 'object', 'rimraf: options should be object')
11614
11615   let results
11616
11617   if (options.disableGlob || !glob.hasMagic(p)) {
11618     results = [p]
11619   } else {
11620     try {
11621       options.lstatSync(p)
11622       results = [p]
11623     } catch (er) {
11624       results = glob.sync(p, options.glob)
11625     }
11626   }
11627
11628   if (!results.length)
11629     return
11630
11631   for (let i = 0; i < results.length; i++) {
11632     const p = results[i]
11633
11634     let st
11635     try {
11636       st = options.lstatSync(p)
11637     } catch (er) {
11638       if (er.code === "ENOENT")
11639         return
11640
11641       // Windows can EPERM on stat.  Life is suffering.
11642       if (er.code === "EPERM" && isWindows)
11643         fixWinEPERMSync(p, options, er)
11644     }
11645
11646     try {
11647       // sunos lets the root user unlink directories, which is... weird.
11648       if (st && st.isDirectory())
11649         rmdirSync(p, options, null)
11650       else
11651         options.unlinkSync(p)
11652     } catch (er) {
11653       if (er.code === "ENOENT")
11654         return
11655       if (er.code === "EPERM")
11656         return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
11657       if (er.code !== "EISDIR")
11658         throw er
11659
11660       rmdirSync(p, options, er)
11661     }
11662   }
11663 }
11664
11665 const rmdirSync = (p, options, originalEr) => {
11666   assert(p)
11667   assert(options)
11668
11669   try {
11670     options.rmdirSync(p)
11671   } catch (er) {
11672     if (er.code === "ENOENT")
11673       return
11674     if (er.code === "ENOTDIR")
11675       throw originalEr
11676     if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
11677       rmkidsSync(p, options)
11678   }
11679 }
11680
11681 const rmkidsSync = (p, options) => {
11682   assert(p)
11683   assert(options)
11684   options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
11685
11686   // We only end up here once we got ENOTEMPTY at least once, and
11687   // at this point, we are guaranteed to have removed all the kids.
11688   // So, we know that it won't be ENOENT or ENOTDIR or anything else.
11689   // try really hard to delete stuff on windows, because it has a
11690   // PROFOUNDLY annoying habit of not closing handles promptly when
11691   // files are deleted, resulting in spurious ENOTEMPTY errors.
11692   const retries = isWindows ? 100 : 1
11693   let i = 0
11694   do {
11695     let threw = true
11696     try {
11697       const ret = options.rmdirSync(p, options)
11698       threw = false
11699       return ret
11700     } finally {
11701       if (++i < retries && threw)
11702         continue
11703     }
11704   } while (true)
11705 }
11706
11707 module.exports = rimraf
11708 rimraf.sync = rimrafSync
11709
11710
11711 /***/ }),
11712 /* 58 */
11713 /***/ (function(module, exports) {
11714
11715 module.exports = require("assert");
11716
11717 /***/ }),
11718 /* 59 */
11719 /***/ (function(module, exports, __webpack_require__) {
11720
11721 // Approach:
11722 //
11723 // 1. Get the minimatch set
11724 // 2. For each pattern in the set, PROCESS(pattern, false)
11725 // 3. Store matches per-set, then uniq them
11726 //
11727 // PROCESS(pattern, inGlobStar)
11728 // Get the first [n] items from pattern that are all strings
11729 // Join these together.  This is PREFIX.
11730 //   If there is no more remaining, then stat(PREFIX) and
11731 //   add to matches if it succeeds.  END.
11732 //
11733 // If inGlobStar and PREFIX is symlink and points to dir
11734 //   set ENTRIES = []
11735 // else readdir(PREFIX) as ENTRIES
11736 //   If fail, END
11737 //
11738 // with ENTRIES
11739 //   If pattern[n] is GLOBSTAR
11740 //     // handle the case where the globstar match is empty
11741 //     // by pruning it out, and testing the resulting pattern
11742 //     PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
11743 //     // handle other cases.
11744 //     for ENTRY in ENTRIES (not dotfiles)
11745 //       // attach globstar + tail onto the entry
11746 //       // Mark that this entry is a globstar match
11747 //       PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
11748 //
11749 //   else // not globstar
11750 //     for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
11751 //       Test ENTRY against pattern[n]
11752 //       If fails, continue
11753 //       If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
11754 //
11755 // Caveat:
11756 //   Cache all stats and readdirs results to minimize syscall.  Since all
11757 //   we ever care about is existence and directory-ness, we can just keep
11758 //   `true` for files, and [children,...] for directories, or `false` for
11759 //   things that don't exist.
11760
11761 module.exports = glob
11762
11763 var fs = __webpack_require__(42)
11764 var rp = __webpack_require__(60)
11765 var minimatch = __webpack_require__(62)
11766 var Minimatch = minimatch.Minimatch
11767 var inherits = __webpack_require__(66)
11768 var EE = __webpack_require__(68).EventEmitter
11769 var path = __webpack_require__(2)
11770 var assert = __webpack_require__(58)
11771 var isAbsolute = __webpack_require__(69)
11772 var globSync = __webpack_require__(70)
11773 var common = __webpack_require__(71)
11774 var alphasort = common.alphasort
11775 var alphasorti = common.alphasorti
11776 var setopts = common.setopts
11777 var ownProp = common.ownProp
11778 var inflight = __webpack_require__(72)
11779 var util = __webpack_require__(50)
11780 var childrenIgnored = common.childrenIgnored
11781 var isIgnored = common.isIgnored
11782
11783 var once = __webpack_require__(74)
11784
11785 function glob (pattern, options, cb) {
11786   if (typeof options === 'function') cb = options, options = {}
11787   if (!options) options = {}
11788
11789   if (options.sync) {
11790     if (cb)
11791       throw new TypeError('callback provided to sync glob')
11792     return globSync(pattern, options)
11793   }
11794
11795   return new Glob(pattern, options, cb)
11796 }
11797
11798 glob.sync = globSync
11799 var GlobSync = glob.GlobSync = globSync.GlobSync
11800
11801 // old api surface
11802 glob.glob = glob
11803
11804 function extend (origin, add) {
11805   if (add === null || typeof add !== 'object') {
11806     return origin
11807   }
11808
11809   var keys = Object.keys(add)
11810   var i = keys.length
11811   while (i--) {
11812     origin[keys[i]] = add[keys[i]]
11813   }
11814   return origin
11815 }
11816
11817 glob.hasMagic = function (pattern, options_) {
11818   var options = extend({}, options_)
11819   options.noprocess = true
11820
11821   var g = new Glob(pattern, options)
11822   var set = g.minimatch.set
11823
11824   if (!pattern)
11825     return false
11826
11827   if (set.length > 1)
11828     return true
11829
11830   for (var j = 0; j < set[0].length; j++) {
11831     if (typeof set[0][j] !== 'string')
11832       return true
11833   }
11834
11835   return false
11836 }
11837
11838 glob.Glob = Glob
11839 inherits(Glob, EE)
11840 function Glob (pattern, options, cb) {
11841   if (typeof options === 'function') {
11842     cb = options
11843     options = null
11844   }
11845
11846   if (options && options.sync) {
11847     if (cb)
11848       throw new TypeError('callback provided to sync glob')
11849     return new GlobSync(pattern, options)
11850   }
11851
11852   if (!(this instanceof Glob))
11853     return new Glob(pattern, options, cb)
11854
11855   setopts(this, pattern, options)
11856   this._didRealPath = false
11857
11858   // process each pattern in the minimatch set
11859   var n = this.minimatch.set.length
11860
11861   // The matches are stored as {<filename>: true,...} so that
11862   // duplicates are automagically pruned.
11863   // Later, we do an Object.keys() on these.
11864   // Keep them as a list so we can fill in when nonull is set.
11865   this.matches = new Array(n)
11866
11867   if (typeof cb === 'function') {
11868     cb = once(cb)
11869     this.on('error', cb)
11870     this.on('end', function (matches) {
11871       cb(null, matches)
11872     })
11873   }
11874
11875   var self = this
11876   this._processing = 0
11877
11878   this._emitQueue = []
11879   this._processQueue = []
11880   this.paused = false
11881
11882   if (this.noprocess)
11883     return this
11884
11885   if (n === 0)
11886     return done()
11887
11888   var sync = true
11889   for (var i = 0; i < n; i ++) {
11890     this._process(this.minimatch.set[i], i, false, done)
11891   }
11892   sync = false
11893
11894   function done () {
11895     --self._processing
11896     if (self._processing <= 0) {
11897       if (sync) {
11898         process.nextTick(function () {
11899           self._finish()
11900         })
11901       } else {
11902         self._finish()
11903       }
11904     }
11905   }
11906 }
11907
11908 Glob.prototype._finish = function () {
11909   assert(this instanceof Glob)
11910   if (this.aborted)
11911     return
11912
11913   if (this.realpath && !this._didRealpath)
11914     return this._realpath()
11915
11916   common.finish(this)
11917   this.emit('end', this.found)
11918 }
11919
11920 Glob.prototype._realpath = function () {
11921   if (this._didRealpath)
11922     return
11923
11924   this._didRealpath = true
11925
11926   var n = this.matches.length
11927   if (n === 0)
11928     return this._finish()
11929
11930   var self = this
11931   for (var i = 0; i < this.matches.length; i++)
11932     this._realpathSet(i, next)
11933
11934   function next () {
11935     if (--n === 0)
11936       self._finish()
11937   }
11938 }
11939
11940 Glob.prototype._realpathSet = function (index, cb) {
11941   var matchset = this.matches[index]
11942   if (!matchset)
11943     return cb()
11944
11945   var found = Object.keys(matchset)
11946   var self = this
11947   var n = found.length
11948
11949   if (n === 0)
11950     return cb()
11951
11952   var set = this.matches[index] = Object.create(null)
11953   found.forEach(function (p, i) {
11954     // If there's a problem with the stat, then it means that
11955     // one or more of the links in the realpath couldn't be
11956     // resolved.  just return the abs value in that case.
11957     p = self._makeAbs(p)
11958     rp.realpath(p, self.realpathCache, function (er, real) {
11959       if (!er)
11960         set[real] = true
11961       else if (er.syscall === 'stat')
11962         set[p] = true
11963       else
11964         self.emit('error', er) // srsly wtf right here
11965
11966       if (--n === 0) {
11967         self.matches[index] = set
11968         cb()
11969       }
11970     })
11971   })
11972 }
11973
11974 Glob.prototype._mark = function (p) {
11975   return common.mark(this, p)
11976 }
11977
11978 Glob.prototype._makeAbs = function (f) {
11979   return common.makeAbs(this, f)
11980 }
11981
11982 Glob.prototype.abort = function () {
11983   this.aborted = true
11984   this.emit('abort')
11985 }
11986
11987 Glob.prototype.pause = function () {
11988   if (!this.paused) {
11989     this.paused = true
11990     this.emit('pause')
11991   }
11992 }
11993
11994 Glob.prototype.resume = function () {
11995   if (this.paused) {
11996     this.emit('resume')
11997     this.paused = false
11998     if (this._emitQueue.length) {
11999       var eq = this._emitQueue.slice(0)
12000       this._emitQueue.length = 0
12001       for (var i = 0; i < eq.length; i ++) {
12002         var e = eq[i]
12003         this._emitMatch(e[0], e[1])
12004       }
12005     }
12006     if (this._processQueue.length) {
12007       var pq = this._processQueue.slice(0)
12008       this._processQueue.length = 0
12009       for (var i = 0; i < pq.length; i ++) {
12010         var p = pq[i]
12011         this._processing--
12012         this._process(p[0], p[1], p[2], p[3])
12013       }
12014     }
12015   }
12016 }
12017
12018 Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
12019   assert(this instanceof Glob)
12020   assert(typeof cb === 'function')
12021
12022   if (this.aborted)
12023     return
12024
12025   this._processing++
12026   if (this.paused) {
12027     this._processQueue.push([pattern, index, inGlobStar, cb])
12028     return
12029   }
12030
12031   //console.error('PROCESS %d', this._processing, pattern)
12032
12033   // Get the first [n] parts of pattern that are all strings.
12034   var n = 0
12035   while (typeof pattern[n] === 'string') {
12036     n ++
12037   }
12038   // now n is the index of the first one that is *not* a string.
12039
12040   // see if there's anything else
12041   var prefix
12042   switch (n) {
12043     // if not, then this is rather simple
12044     case pattern.length:
12045       this._processSimple(pattern.join('/'), index, cb)
12046       return
12047
12048     case 0:
12049       // pattern *starts* with some non-trivial item.
12050       // going to readdir(cwd), but not include the prefix in matches.
12051       prefix = null
12052       break
12053
12054     default:
12055       // pattern has some string bits in the front.
12056       // whatever it starts with, whether that's 'absolute' like /foo/bar,
12057       // or 'relative' like '../baz'
12058       prefix = pattern.slice(0, n).join('/')
12059       break
12060   }
12061
12062   var remain = pattern.slice(n)
12063
12064   // get the list of entries.
12065   var read
12066   if (prefix === null)
12067     read = '.'
12068   else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
12069     if (!prefix || !isAbsolute(prefix))
12070       prefix = '/' + prefix
12071     read = prefix
12072   } else
12073     read = prefix
12074
12075   var abs = this._makeAbs(read)
12076
12077   //if ignored, skip _processing
12078   if (childrenIgnored(this, read))
12079     return cb()
12080
12081   var isGlobStar = remain[0] === minimatch.GLOBSTAR
12082   if (isGlobStar)
12083     this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
12084   else
12085     this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
12086 }
12087
12088 Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
12089   var self = this
12090   this._readdir(abs, inGlobStar, function (er, entries) {
12091     return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
12092   })
12093 }
12094
12095 Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
12096
12097   // if the abs isn't a dir, then nothing can match!
12098   if (!entries)
12099     return cb()
12100
12101   // It will only match dot entries if it starts with a dot, or if
12102   // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
12103   var pn = remain[0]
12104   var negate = !!this.minimatch.negate
12105   var rawGlob = pn._glob
12106   var dotOk = this.dot || rawGlob.charAt(0) === '.'
12107
12108   var matchedEntries = []
12109   for (var i = 0; i < entries.length; i++) {
12110     var e = entries[i]
12111     if (e.charAt(0) !== '.' || dotOk) {
12112       var m
12113       if (negate && !prefix) {
12114         m = !e.match(pn)
12115       } else {
12116         m = e.match(pn)
12117       }
12118       if (m)
12119         matchedEntries.push(e)
12120     }
12121   }
12122
12123   //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
12124
12125   var len = matchedEntries.length
12126   // If there are no matched entries, then nothing matches.
12127   if (len === 0)
12128     return cb()
12129
12130   // if this is the last remaining pattern bit, then no need for
12131   // an additional stat *unless* the user has specified mark or
12132   // stat explicitly.  We know they exist, since readdir returned
12133   // them.
12134
12135   if (remain.length === 1 && !this.mark && !this.stat) {
12136     if (!this.matches[index])
12137       this.matches[index] = Object.create(null)
12138
12139     for (var i = 0; i < len; i ++) {
12140       var e = matchedEntries[i]
12141       if (prefix) {
12142         if (prefix !== '/')
12143           e = prefix + '/' + e
12144         else
12145           e = prefix + e
12146       }
12147
12148       if (e.charAt(0) === '/' && !this.nomount) {
12149         e = path.join(this.root, e)
12150       }
12151       this._emitMatch(index, e)
12152     }
12153     // This was the last one, and no stats were needed
12154     return cb()
12155   }
12156
12157   // now test all matched entries as stand-ins for that part
12158   // of the pattern.
12159   remain.shift()
12160   for (var i = 0; i < len; i ++) {
12161     var e = matchedEntries[i]
12162     var newPattern
12163     if (prefix) {
12164       if (prefix !== '/')
12165         e = prefix + '/' + e
12166       else
12167         e = prefix + e
12168     }
12169     this._process([e].concat(remain), index, inGlobStar, cb)
12170   }
12171   cb()
12172 }
12173
12174 Glob.prototype._emitMatch = function (index, e) {
12175   if (this.aborted)
12176     return
12177
12178   if (isIgnored(this, e))
12179     return
12180
12181   if (this.paused) {
12182     this._emitQueue.push([index, e])
12183     return
12184   }
12185
12186   var abs = isAbsolute(e) ? e : this._makeAbs(e)
12187
12188   if (this.mark)
12189     e = this._mark(e)
12190
12191   if (this.absolute)
12192     e = abs
12193
12194   if (this.matches[index][e])
12195     return
12196
12197   if (this.nodir) {
12198     var c = this.cache[abs]
12199     if (c === 'DIR' || Array.isArray(c))
12200       return
12201   }
12202
12203   this.matches[index][e] = true
12204
12205   var st = this.statCache[abs]
12206   if (st)
12207     this.emit('stat', e, st)
12208
12209   this.emit('match', e)
12210 }
12211
12212 Glob.prototype._readdirInGlobStar = function (abs, cb) {
12213   if (this.aborted)
12214     return
12215
12216   // follow all symlinked directories forever
12217   // just proceed as if this is a non-globstar situation
12218   if (this.follow)
12219     return this._readdir(abs, false, cb)
12220
12221   var lstatkey = 'lstat\0' + abs
12222   var self = this
12223   var lstatcb = inflight(lstatkey, lstatcb_)
12224
12225   if (lstatcb)
12226     fs.lstat(abs, lstatcb)
12227
12228   function lstatcb_ (er, lstat) {
12229     if (er && er.code === 'ENOENT')
12230       return cb()
12231
12232     var isSym = lstat && lstat.isSymbolicLink()
12233     self.symlinks[abs] = isSym
12234
12235     // If it's not a symlink or a dir, then it's definitely a regular file.
12236     // don't bother doing a readdir in that case.
12237     if (!isSym && lstat && !lstat.isDirectory()) {
12238       self.cache[abs] = 'FILE'
12239       cb()
12240     } else
12241       self._readdir(abs, false, cb)
12242   }
12243 }
12244
12245 Glob.prototype._readdir = function (abs, inGlobStar, cb) {
12246   if (this.aborted)
12247     return
12248
12249   cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
12250   if (!cb)
12251     return
12252
12253   //console.error('RD %j %j', +inGlobStar, abs)
12254   if (inGlobStar && !ownProp(this.symlinks, abs))
12255     return this._readdirInGlobStar(abs, cb)
12256
12257   if (ownProp(this.cache, abs)) {
12258     var c = this.cache[abs]
12259     if (!c || c === 'FILE')
12260       return cb()
12261
12262     if (Array.isArray(c))
12263       return cb(null, c)
12264   }
12265
12266   var self = this
12267   fs.readdir(abs, readdirCb(this, abs, cb))
12268 }
12269
12270 function readdirCb (self, abs, cb) {
12271   return function (er, entries) {
12272     if (er)
12273       self._readdirError(abs, er, cb)
12274     else
12275       self._readdirEntries(abs, entries, cb)
12276   }
12277 }
12278
12279 Glob.prototype._readdirEntries = function (abs, entries, cb) {
12280   if (this.aborted)
12281     return
12282
12283   // if we haven't asked to stat everything, then just
12284   // assume that everything in there exists, so we can avoid
12285   // having to stat it a second time.
12286   if (!this.mark && !this.stat) {
12287     for (var i = 0; i < entries.length; i ++) {
12288       var e = entries[i]
12289       if (abs === '/')
12290         e = abs + e
12291       else
12292         e = abs + '/' + e
12293       this.cache[e] = true
12294     }
12295   }
12296
12297   this.cache[abs] = entries
12298   return cb(null, entries)
12299 }
12300
12301 Glob.prototype._readdirError = function (f, er, cb) {
12302   if (this.aborted)
12303     return
12304
12305   // handle errors, and cache the information
12306   switch (er.code) {
12307     case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
12308     case 'ENOTDIR': // totally normal. means it *does* exist.
12309       var abs = this._makeAbs(f)
12310       this.cache[abs] = 'FILE'
12311       if (abs === this.cwdAbs) {
12312         var error = new Error(er.code + ' invalid cwd ' + this.cwd)
12313         error.path = this.cwd
12314         error.code = er.code
12315         this.emit('error', error)
12316         this.abort()
12317       }
12318       break
12319
12320     case 'ENOENT': // not terribly unusual
12321     case 'ELOOP':
12322     case 'ENAMETOOLONG':
12323     case 'UNKNOWN':
12324       this.cache[this._makeAbs(f)] = false
12325       break
12326
12327     default: // some unusual error.  Treat as failure.
12328       this.cache[this._makeAbs(f)] = false
12329       if (this.strict) {
12330         this.emit('error', er)
12331         // If the error is handled, then we abort
12332         // if not, we threw out of here
12333         this.abort()
12334       }
12335       if (!this.silent)
12336         console.error('glob error', er)
12337       break
12338   }
12339
12340   return cb()
12341 }
12342
12343 Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
12344   var self = this
12345   this._readdir(abs, inGlobStar, function (er, entries) {
12346     self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
12347   })
12348 }
12349
12350
12351 Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
12352   //console.error('pgs2', prefix, remain[0], entries)
12353
12354   // no entries means not a dir, so it can never have matches
12355   // foo.txt/** doesn't match foo.txt
12356   if (!entries)
12357     return cb()
12358
12359   // test without the globstar, and with every child both below
12360   // and replacing the globstar.
12361   var remainWithoutGlobStar = remain.slice(1)
12362   var gspref = prefix ? [ prefix ] : []
12363   var noGlobStar = gspref.concat(remainWithoutGlobStar)
12364
12365   // the noGlobStar pattern exits the inGlobStar state
12366   this._process(noGlobStar, index, false, cb)
12367
12368   var isSym = this.symlinks[abs]
12369   var len = entries.length
12370
12371   // If it's a symlink, and we're in a globstar, then stop
12372   if (isSym && inGlobStar)
12373     return cb()
12374
12375   for (var i = 0; i < len; i++) {
12376     var e = entries[i]
12377     if (e.charAt(0) === '.' && !this.dot)
12378       continue
12379
12380     // these two cases enter the inGlobStar state
12381     var instead = gspref.concat(entries[i], remainWithoutGlobStar)
12382     this._process(instead, index, true, cb)
12383
12384     var below = gspref.concat(entries[i], remain)
12385     this._process(below, index, true, cb)
12386   }
12387
12388   cb()
12389 }
12390
12391 Glob.prototype._processSimple = function (prefix, index, cb) {
12392   // XXX review this.  Shouldn't it be doing the mounting etc
12393   // before doing stat?  kinda weird?
12394   var self = this
12395   this._stat(prefix, function (er, exists) {
12396     self._processSimple2(prefix, index, er, exists, cb)
12397   })
12398 }
12399 Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
12400
12401   //console.error('ps2', prefix, exists)
12402
12403   if (!this.matches[index])
12404     this.matches[index] = Object.create(null)
12405
12406   // If it doesn't exist, then just mark the lack of results
12407   if (!exists)
12408     return cb()
12409
12410   if (prefix && isAbsolute(prefix) && !this.nomount) {
12411     var trail = /[\/\\]$/.test(prefix)
12412     if (prefix.charAt(0) === '/') {
12413       prefix = path.join(this.root, prefix)
12414     } else {
12415       prefix = path.resolve(this.root, prefix)
12416       if (trail)
12417         prefix += '/'
12418     }
12419   }
12420
12421   if (process.platform === 'win32')
12422     prefix = prefix.replace(/\\/g, '/')
12423
12424   // Mark this as a match
12425   this._emitMatch(index, prefix)
12426   cb()
12427 }
12428
12429 // Returns either 'DIR', 'FILE', or false
12430 Glob.prototype._stat = function (f, cb) {
12431   var abs = this._makeAbs(f)
12432   var needDir = f.slice(-1) === '/'
12433
12434   if (f.length > this.maxLength)
12435     return cb()
12436
12437   if (!this.stat && ownProp(this.cache, abs)) {
12438     var c = this.cache[abs]
12439
12440     if (Array.isArray(c))
12441       c = 'DIR'
12442
12443     // It exists, but maybe not how we need it
12444     if (!needDir || c === 'DIR')
12445       return cb(null, c)
12446
12447     if (needDir && c === 'FILE')
12448       return cb()
12449
12450     // otherwise we have to stat, because maybe c=true
12451     // if we know it exists, but not what it is.
12452   }
12453
12454   var exists
12455   var stat = this.statCache[abs]
12456   if (stat !== undefined) {
12457     if (stat === false)
12458       return cb(null, stat)
12459     else {
12460       var type = stat.isDirectory() ? 'DIR' : 'FILE'
12461       if (needDir && type === 'FILE')
12462         return cb()
12463       else
12464         return cb(null, type, stat)
12465     }
12466   }
12467
12468   var self = this
12469   var statcb = inflight('stat\0' + abs, lstatcb_)
12470   if (statcb)
12471     fs.lstat(abs, statcb)
12472
12473   function lstatcb_ (er, lstat) {
12474     if (lstat && lstat.isSymbolicLink()) {
12475       // If it's a symlink, then treat it as the target, unless
12476       // the target does not exist, then treat it as a file.
12477       return fs.stat(abs, function (er, stat) {
12478         if (er)
12479           self._stat2(f, abs, null, lstat, cb)
12480         else
12481           self._stat2(f, abs, er, stat, cb)
12482       })
12483     } else {
12484       self._stat2(f, abs, er, lstat, cb)
12485     }
12486   }
12487 }
12488
12489 Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
12490   if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
12491     this.statCache[abs] = false
12492     return cb()
12493   }
12494
12495   var needDir = f.slice(-1) === '/'
12496   this.statCache[abs] = stat
12497
12498   if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
12499     return cb(null, false, stat)
12500
12501   var c = true
12502   if (stat)
12503     c = stat.isDirectory() ? 'DIR' : 'FILE'
12504   this.cache[abs] = this.cache[abs] || c
12505
12506   if (needDir && c === 'FILE')
12507     return cb()
12508
12509   return cb(null, c, stat)
12510 }
12511
12512
12513 /***/ }),
12514 /* 60 */
12515 /***/ (function(module, exports, __webpack_require__) {
12516
12517 module.exports = realpath
12518 realpath.realpath = realpath
12519 realpath.sync = realpathSync
12520 realpath.realpathSync = realpathSync
12521 realpath.monkeypatch = monkeypatch
12522 realpath.unmonkeypatch = unmonkeypatch
12523
12524 var fs = __webpack_require__(42)
12525 var origRealpath = fs.realpath
12526 var origRealpathSync = fs.realpathSync
12527
12528 var version = process.version
12529 var ok = /^v[0-5]\./.test(version)
12530 var old = __webpack_require__(61)
12531
12532 function newError (er) {
12533   return er && er.syscall === 'realpath' && (
12534     er.code === 'ELOOP' ||
12535     er.code === 'ENOMEM' ||
12536     er.code === 'ENAMETOOLONG'
12537   )
12538 }
12539
12540 function realpath (p, cache, cb) {
12541   if (ok) {
12542     return origRealpath(p, cache, cb)
12543   }
12544
12545   if (typeof cache === 'function') {
12546     cb = cache
12547     cache = null
12548   }
12549   origRealpath(p, cache, function (er, result) {
12550     if (newError(er)) {
12551       old.realpath(p, cache, cb)
12552     } else {
12553       cb(er, result)
12554     }
12555   })
12556 }
12557
12558 function realpathSync (p, cache) {
12559   if (ok) {
12560     return origRealpathSync(p, cache)
12561   }
12562
12563   try {
12564     return origRealpathSync(p, cache)
12565   } catch (er) {
12566     if (newError(er)) {
12567       return old.realpathSync(p, cache)
12568     } else {
12569       throw er
12570     }
12571   }
12572 }
12573
12574 function monkeypatch () {
12575   fs.realpath = realpath
12576   fs.realpathSync = realpathSync
12577 }
12578
12579 function unmonkeypatch () {
12580   fs.realpath = origRealpath
12581   fs.realpathSync = origRealpathSync
12582 }
12583
12584
12585 /***/ }),
12586 /* 61 */
12587 /***/ (function(module, exports, __webpack_require__) {
12588
12589 // Copyright Joyent, Inc. and other Node contributors.
12590 //
12591 // Permission is hereby granted, free of charge, to any person obtaining a
12592 // copy of this software and associated documentation files (the
12593 // "Software"), to deal in the Software without restriction, including
12594 // without limitation the rights to use, copy, modify, merge, publish,
12595 // distribute, sublicense, and/or sell copies of the Software, and to permit
12596 // persons to whom the Software is furnished to do so, subject to the
12597 // following conditions:
12598 //
12599 // The above copyright notice and this permission notice shall be included
12600 // in all copies or substantial portions of the Software.
12601 //
12602 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12603 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12604 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12605 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12606 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12607 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12608 // USE OR OTHER DEALINGS IN THE SOFTWARE.
12609
12610 var pathModule = __webpack_require__(2);
12611 var isWindows = process.platform === 'win32';
12612 var fs = __webpack_require__(42);
12613
12614 // JavaScript implementation of realpath, ported from node pre-v6
12615
12616 var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
12617
12618 function rethrow() {
12619   // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
12620   // is fairly slow to generate.
12621   var callback;
12622   if (DEBUG) {
12623     var backtrace = new Error;
12624     callback = debugCallback;
12625   } else
12626     callback = missingCallback;
12627
12628   return callback;
12629
12630   function debugCallback(err) {
12631     if (err) {
12632       backtrace.message = err.message;
12633       err = backtrace;
12634       missingCallback(err);
12635     }
12636   }
12637
12638   function missingCallback(err) {
12639     if (err) {
12640       if (process.throwDeprecation)
12641         throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
12642       else if (!process.noDeprecation) {
12643         var msg = 'fs: missing callback ' + (err.stack || err.message);
12644         if (process.traceDeprecation)
12645           console.trace(msg);
12646         else
12647           console.error(msg);
12648       }
12649     }
12650   }
12651 }
12652
12653 function maybeCallback(cb) {
12654   return typeof cb === 'function' ? cb : rethrow();
12655 }
12656
12657 var normalize = pathModule.normalize;
12658
12659 // Regexp that finds the next partion of a (partial) path
12660 // result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
12661 if (isWindows) {
12662   var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
12663 } else {
12664   var nextPartRe = /(.*?)(?:[\/]+|$)/g;
12665 }
12666
12667 // Regex to find the device root, including trailing slash. E.g. 'c:\\'.
12668 if (isWindows) {
12669   var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
12670 } else {
12671   var splitRootRe = /^[\/]*/;
12672 }
12673
12674 exports.realpathSync = function realpathSync(p, cache) {
12675   // make p is absolute
12676   p = pathModule.resolve(p);
12677
12678   if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
12679     return cache[p];
12680   }
12681
12682   var original = p,
12683       seenLinks = {},
12684       knownHard = {};
12685
12686   // current character position in p
12687   var pos;
12688   // the partial path so far, including a trailing slash if any
12689   var current;
12690   // the partial path without a trailing slash (except when pointing at a root)
12691   var base;
12692   // the partial path scanned in the previous round, with slash
12693   var previous;
12694
12695   start();
12696
12697   function start() {
12698     // Skip over roots
12699     var m = splitRootRe.exec(p);
12700     pos = m[0].length;
12701     current = m[0];
12702     base = m[0];
12703     previous = '';
12704
12705     // On windows, check that the root exists. On unix there is no need.
12706     if (isWindows && !knownHard[base]) {
12707       fs.lstatSync(base);
12708       knownHard[base] = true;
12709     }
12710   }
12711
12712   // walk down the path, swapping out linked pathparts for their real
12713   // values
12714   // NB: p.length changes.
12715   while (pos < p.length) {
12716     // find the next part
12717     nextPartRe.lastIndex = pos;
12718     var result = nextPartRe.exec(p);
12719     previous = current;
12720     current += result[0];
12721     base = previous + result[1];
12722     pos = nextPartRe.lastIndex;
12723
12724     // continue if not a symlink
12725     if (knownHard[base] || (cache && cache[base] === base)) {
12726       continue;
12727     }
12728
12729     var resolvedLink;
12730     if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
12731       // some known symbolic link.  no need to stat again.
12732       resolvedLink = cache[base];
12733     } else {
12734       var stat = fs.lstatSync(base);
12735       if (!stat.isSymbolicLink()) {
12736         knownHard[base] = true;
12737         if (cache) cache[base] = base;
12738         continue;
12739       }
12740
12741       // read the link if it wasn't read before
12742       // dev/ino always return 0 on windows, so skip the check.
12743       var linkTarget = null;
12744       if (!isWindows) {
12745         var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
12746         if (seenLinks.hasOwnProperty(id)) {
12747           linkTarget = seenLinks[id];
12748         }
12749       }
12750       if (linkTarget === null) {
12751         fs.statSync(base);
12752         linkTarget = fs.readlinkSync(base);
12753       }
12754       resolvedLink = pathModule.resolve(previous, linkTarget);
12755       // track this, if given a cache.
12756       if (cache) cache[base] = resolvedLink;
12757       if (!isWindows) seenLinks[id] = linkTarget;
12758     }
12759
12760     // resolve the link, then start over
12761     p = pathModule.resolve(resolvedLink, p.slice(pos));
12762     start();
12763   }
12764
12765   if (cache) cache[original] = p;
12766
12767   return p;
12768 };
12769
12770
12771 exports.realpath = function realpath(p, cache, cb) {
12772   if (typeof cb !== 'function') {
12773     cb = maybeCallback(cache);
12774     cache = null;
12775   }
12776
12777   // make p is absolute
12778   p = pathModule.resolve(p);
12779
12780   if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
12781     return process.nextTick(cb.bind(null, null, cache[p]));
12782   }
12783
12784   var original = p,
12785       seenLinks = {},
12786       knownHard = {};
12787
12788   // current character position in p
12789   var pos;
12790   // the partial path so far, including a trailing slash if any
12791   var current;
12792   // the partial path without a trailing slash (except when pointing at a root)
12793   var base;
12794   // the partial path scanned in the previous round, with slash
12795   var previous;
12796
12797   start();
12798
12799   function start() {
12800     // Skip over roots
12801     var m = splitRootRe.exec(p);
12802     pos = m[0].length;
12803     current = m[0];
12804     base = m[0];
12805     previous = '';
12806
12807     // On windows, check that the root exists. On unix there is no need.
12808     if (isWindows && !knownHard[base]) {
12809       fs.lstat(base, function(err) {
12810         if (err) return cb(err);
12811         knownHard[base] = true;
12812         LOOP();
12813       });
12814     } else {
12815       process.nextTick(LOOP);
12816     }
12817   }
12818
12819   // walk down the path, swapping out linked pathparts for their real
12820   // values
12821   function LOOP() {
12822     // stop if scanned past end of path
12823     if (pos >= p.length) {
12824       if (cache) cache[original] = p;
12825       return cb(null, p);
12826     }
12827
12828     // find the next part
12829     nextPartRe.lastIndex = pos;
12830     var result = nextPartRe.exec(p);
12831     previous = current;
12832     current += result[0];
12833     base = previous + result[1];
12834     pos = nextPartRe.lastIndex;
12835
12836     // continue if not a symlink
12837     if (knownHard[base] || (cache && cache[base] === base)) {
12838       return process.nextTick(LOOP);
12839     }
12840
12841     if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
12842       // known symbolic link.  no need to stat again.
12843       return gotResolvedLink(cache[base]);
12844     }
12845
12846     return fs.lstat(base, gotStat);
12847   }
12848
12849   function gotStat(err, stat) {
12850     if (err) return cb(err);
12851
12852     // if not a symlink, skip to the next path part
12853     if (!stat.isSymbolicLink()) {
12854       knownHard[base] = true;
12855       if (cache) cache[base] = base;
12856       return process.nextTick(LOOP);
12857     }
12858
12859     // stat & read the link if not read before
12860     // call gotTarget as soon as the link target is known
12861     // dev/ino always return 0 on windows, so skip the check.
12862     if (!isWindows) {
12863       var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
12864       if (seenLinks.hasOwnProperty(id)) {
12865         return gotTarget(null, seenLinks[id], base);
12866       }
12867     }
12868     fs.stat(base, function(err) {
12869       if (err) return cb(err);
12870
12871       fs.readlink(base, function(err, target) {
12872         if (!isWindows) seenLinks[id] = target;
12873         gotTarget(err, target);
12874       });
12875     });
12876   }
12877
12878   function gotTarget(err, target, base) {
12879     if (err) return cb(err);
12880
12881     var resolvedLink = pathModule.resolve(previous, target);
12882     if (cache) cache[base] = resolvedLink;
12883     gotResolvedLink(resolvedLink);
12884   }
12885
12886   function gotResolvedLink(resolvedLink) {
12887     // resolve the link, then start over
12888     p = pathModule.resolve(resolvedLink, p.slice(pos));
12889     start();
12890   }
12891 };
12892
12893
12894 /***/ }),
12895 /* 62 */
12896 /***/ (function(module, exports, __webpack_require__) {
12897
12898 module.exports = minimatch
12899 minimatch.Minimatch = Minimatch
12900
12901 var path = { sep: '/' }
12902 try {
12903   path = __webpack_require__(2)
12904 } catch (er) {}
12905
12906 var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
12907 var expand = __webpack_require__(63)
12908
12909 var plTypes = {
12910   '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
12911   '?': { open: '(?:', close: ')?' },
12912   '+': { open: '(?:', close: ')+' },
12913   '*': { open: '(?:', close: ')*' },
12914   '@': { open: '(?:', close: ')' }
12915 }
12916
12917 // any single thing other than /
12918 // don't need to escape / when using new RegExp()
12919 var qmark = '[^/]'
12920
12921 // * => any number of characters
12922 var star = qmark + '*?'
12923
12924 // ** when dots are allowed.  Anything goes, except .. and .
12925 // not (^ or / followed by one or two dots followed by $ or /),
12926 // followed by anything, any number of times.
12927 var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
12928
12929 // not a ^ or / followed by a dot,
12930 // followed by anything, any number of times.
12931 var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
12932
12933 // characters that need to be escaped in RegExp.
12934 var reSpecials = charSet('().*{}+?[]^$\\!')
12935
12936 // "abc" -> { a:true, b:true, c:true }
12937 function charSet (s) {
12938   return s.split('').reduce(function (set, c) {
12939     set[c] = true
12940     return set
12941   }, {})
12942 }
12943
12944 // normalizes slashes.
12945 var slashSplit = /\/+/
12946
12947 minimatch.filter = filter
12948 function filter (pattern, options) {
12949   options = options || {}
12950   return function (p, i, list) {
12951     return minimatch(p, pattern, options)
12952   }
12953 }
12954
12955 function ext (a, b) {
12956   a = a || {}
12957   b = b || {}
12958   var t = {}
12959   Object.keys(b).forEach(function (k) {
12960     t[k] = b[k]
12961   })
12962   Object.keys(a).forEach(function (k) {
12963     t[k] = a[k]
12964   })
12965   return t
12966 }
12967
12968 minimatch.defaults = function (def) {
12969   if (!def || !Object.keys(def).length) return minimatch
12970
12971   var orig = minimatch
12972
12973   var m = function minimatch (p, pattern, options) {
12974     return orig.minimatch(p, pattern, ext(def, options))
12975   }
12976
12977   m.Minimatch = function Minimatch (pattern, options) {
12978     return new orig.Minimatch(pattern, ext(def, options))
12979   }
12980
12981   return m
12982 }
12983
12984 Minimatch.defaults = function (def) {
12985   if (!def || !Object.keys(def).length) return Minimatch
12986   return minimatch.defaults(def).Minimatch
12987 }
12988
12989 function minimatch (p, pattern, options) {
12990   if (typeof pattern !== 'string') {
12991     throw new TypeError('glob pattern string required')
12992   }
12993
12994   if (!options) options = {}
12995
12996   // shortcut: comments match nothing.
12997   if (!options.nocomment && pattern.charAt(0) === '#') {
12998     return false
12999   }
13000
13001   // "" only matches ""
13002   if (pattern.trim() === '') return p === ''
13003
13004   return new Minimatch(pattern, options).match(p)
13005 }
13006
13007 function Minimatch (pattern, options) {
13008   if (!(this instanceof Minimatch)) {
13009     return new Minimatch(pattern, options)
13010   }
13011
13012   if (typeof pattern !== 'string') {
13013     throw new TypeError('glob pattern string required')
13014   }
13015
13016   if (!options) options = {}
13017   pattern = pattern.trim()
13018
13019   // windows support: need to use /, not \
13020   if (path.sep !== '/') {
13021     pattern = pattern.split(path.sep).join('/')
13022   }
13023
13024   this.options = options
13025   this.set = []
13026   this.pattern = pattern
13027   this.regexp = null
13028   this.negate = false
13029   this.comment = false
13030   this.empty = false
13031
13032   // make the set of regexps etc.
13033   this.make()
13034 }
13035
13036 Minimatch.prototype.debug = function () {}
13037
13038 Minimatch.prototype.make = make
13039 function make () {
13040   // don't do it more than once.
13041   if (this._made) return
13042
13043   var pattern = this.pattern
13044   var options = this.options
13045
13046   // empty patterns and comments match nothing.
13047   if (!options.nocomment && pattern.charAt(0) === '#') {
13048     this.comment = true
13049     return
13050   }
13051   if (!pattern) {
13052     this.empty = true
13053     return
13054   }
13055
13056   // step 1: figure out negation, etc.
13057   this.parseNegate()
13058
13059   // step 2: expand braces
13060   var set = this.globSet = this.braceExpand()
13061
13062   if (options.debug) this.debug = console.error
13063
13064   this.debug(this.pattern, set)
13065
13066   // step 3: now we have a set, so turn each one into a series of path-portion
13067   // matching patterns.
13068   // These will be regexps, except in the case of "**", which is
13069   // set to the GLOBSTAR object for globstar behavior,
13070   // and will not contain any / characters
13071   set = this.globParts = set.map(function (s) {
13072     return s.split(slashSplit)
13073   })
13074
13075   this.debug(this.pattern, set)
13076
13077   // glob --> regexps
13078   set = set.map(function (s, si, set) {
13079     return s.map(this.parse, this)
13080   }, this)
13081
13082   this.debug(this.pattern, set)
13083
13084   // filter out everything that didn't compile properly.
13085   set = set.filter(function (s) {
13086     return s.indexOf(false) === -1
13087   })
13088
13089   this.debug(this.pattern, set)
13090
13091   this.set = set
13092 }
13093
13094 Minimatch.prototype.parseNegate = parseNegate
13095 function parseNegate () {
13096   var pattern = this.pattern
13097   var negate = false
13098   var options = this.options
13099   var negateOffset = 0
13100
13101   if (options.nonegate) return
13102
13103   for (var i = 0, l = pattern.length
13104     ; i < l && pattern.charAt(i) === '!'
13105     ; i++) {
13106     negate = !negate
13107     negateOffset++
13108   }
13109
13110   if (negateOffset) this.pattern = pattern.substr(negateOffset)
13111   this.negate = negate
13112 }
13113
13114 // Brace expansion:
13115 // a{b,c}d -> abd acd
13116 // a{b,}c -> abc ac
13117 // a{0..3}d -> a0d a1d a2d a3d
13118 // a{b,c{d,e}f}g -> abg acdfg acefg
13119 // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
13120 //
13121 // Invalid sets are not expanded.
13122 // a{2..}b -> a{2..}b
13123 // a{b}c -> a{b}c
13124 minimatch.braceExpand = function (pattern, options) {
13125   return braceExpand(pattern, options)
13126 }
13127
13128 Minimatch.prototype.braceExpand = braceExpand
13129
13130 function braceExpand (pattern, options) {
13131   if (!options) {
13132     if (this instanceof Minimatch) {
13133       options = this.options
13134     } else {
13135       options = {}
13136     }
13137   }
13138
13139   pattern = typeof pattern === 'undefined'
13140     ? this.pattern : pattern
13141
13142   if (typeof pattern === 'undefined') {
13143     throw new TypeError('undefined pattern')
13144   }
13145
13146   if (options.nobrace ||
13147     !pattern.match(/\{.*\}/)) {
13148     // shortcut. no need to expand.
13149     return [pattern]
13150   }
13151
13152   return expand(pattern)
13153 }
13154
13155 // parse a component of the expanded set.
13156 // At this point, no pattern may contain "/" in it
13157 // so we're going to return a 2d array, where each entry is the full
13158 // pattern, split on '/', and then turned into a regular expression.
13159 // A regexp is made at the end which joins each array with an
13160 // escaped /, and another full one which joins each regexp with |.
13161 //
13162 // Following the lead of Bash 4.1, note that "**" only has special meaning
13163 // when it is the *only* thing in a path portion.  Otherwise, any series
13164 // of * is equivalent to a single *.  Globstar behavior is enabled by
13165 // default, and can be disabled by setting options.noglobstar.
13166 Minimatch.prototype.parse = parse
13167 var SUBPARSE = {}
13168 function parse (pattern, isSub) {
13169   if (pattern.length > 1024 * 64) {
13170     throw new TypeError('pattern is too long')
13171   }
13172
13173   var options = this.options
13174
13175   // shortcuts
13176   if (!options.noglobstar && pattern === '**') return GLOBSTAR
13177   if (pattern === '') return ''
13178
13179   var re = ''
13180   var hasMagic = !!options.nocase
13181   var escaping = false
13182   // ? => one single character
13183   var patternListStack = []
13184   var negativeLists = []
13185   var stateChar
13186   var inClass = false
13187   var reClassStart = -1
13188   var classStart = -1
13189   // . and .. never match anything that doesn't start with .,
13190   // even when options.dot is set.
13191   var patternStart = pattern.charAt(0) === '.' ? '' // anything
13192   // not (start or / followed by . or .. followed by / or end)
13193   : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
13194   : '(?!\\.)'
13195   var self = this
13196
13197   function clearStateChar () {
13198     if (stateChar) {
13199       // we had some state-tracking character
13200       // that wasn't consumed by this pass.
13201       switch (stateChar) {
13202         case '*':
13203           re += star
13204           hasMagic = true
13205         break
13206         case '?':
13207           re += qmark
13208           hasMagic = true
13209         break
13210         default:
13211           re += '\\' + stateChar
13212         break
13213       }
13214       self.debug('clearStateChar %j %j', stateChar, re)
13215       stateChar = false
13216     }
13217   }
13218
13219   for (var i = 0, len = pattern.length, c
13220     ; (i < len) && (c = pattern.charAt(i))
13221     ; i++) {
13222     this.debug('%s\t%s %s %j', pattern, i, re, c)
13223
13224     // skip over any that are escaped.
13225     if (escaping && reSpecials[c]) {
13226       re += '\\' + c
13227       escaping = false
13228       continue
13229     }
13230
13231     switch (c) {
13232       case '/':
13233         // completely not allowed, even escaped.
13234         // Should already be path-split by now.
13235         return false
13236
13237       case '\\':
13238         clearStateChar()
13239         escaping = true
13240       continue
13241
13242       // the various stateChar values
13243       // for the "extglob" stuff.
13244       case '?':
13245       case '*':
13246       case '+':
13247       case '@':
13248       case '!':
13249         this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
13250
13251         // all of those are literals inside a class, except that
13252         // the glob [!a] means [^a] in regexp
13253         if (inClass) {
13254           this.debug('  in class')
13255           if (c === '!' && i === classStart + 1) c = '^'
13256           re += c
13257           continue
13258         }
13259
13260         // if we already have a stateChar, then it means
13261         // that there was something like ** or +? in there.
13262         // Handle the stateChar, then proceed with this one.
13263         self.debug('call clearStateChar %j', stateChar)
13264         clearStateChar()
13265         stateChar = c
13266         // if extglob is disabled, then +(asdf|foo) isn't a thing.
13267         // just clear the statechar *now*, rather than even diving into
13268         // the patternList stuff.
13269         if (options.noext) clearStateChar()
13270       continue
13271
13272       case '(':
13273         if (inClass) {
13274           re += '('
13275           continue
13276         }
13277
13278         if (!stateChar) {
13279           re += '\\('
13280           continue
13281         }
13282
13283         patternListStack.push({
13284           type: stateChar,
13285           start: i - 1,
13286           reStart: re.length,
13287           open: plTypes[stateChar].open,
13288           close: plTypes[stateChar].close
13289         })
13290         // negation is (?:(?!js)[^/]*)
13291         re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
13292         this.debug('plType %j %j', stateChar, re)
13293         stateChar = false
13294       continue
13295
13296       case ')':
13297         if (inClass || !patternListStack.length) {
13298           re += '\\)'
13299           continue
13300         }
13301
13302         clearStateChar()
13303         hasMagic = true
13304         var pl = patternListStack.pop()
13305         // negation is (?:(?!js)[^/]*)
13306         // The others are (?:<pattern>)<type>
13307         re += pl.close
13308         if (pl.type === '!') {
13309           negativeLists.push(pl)
13310         }
13311         pl.reEnd = re.length
13312       continue
13313
13314       case '|':
13315         if (inClass || !patternListStack.length || escaping) {
13316           re += '\\|'
13317           escaping = false
13318           continue
13319         }
13320
13321         clearStateChar()
13322         re += '|'
13323       continue
13324
13325       // these are mostly the same in regexp and glob
13326       case '[':
13327         // swallow any state-tracking char before the [
13328         clearStateChar()
13329
13330         if (inClass) {
13331           re += '\\' + c
13332           continue
13333         }
13334
13335         inClass = true
13336         classStart = i
13337         reClassStart = re.length
13338         re += c
13339       continue
13340
13341       case ']':
13342         //  a right bracket shall lose its special
13343         //  meaning and represent itself in
13344         //  a bracket expression if it occurs
13345         //  first in the list.  -- POSIX.2 2.8.3.2
13346         if (i === classStart + 1 || !inClass) {
13347           re += '\\' + c
13348           escaping = false
13349           continue
13350         }
13351
13352         // handle the case where we left a class open.
13353         // "[z-a]" is valid, equivalent to "\[z-a\]"
13354         if (inClass) {
13355           // split where the last [ was, make sure we don't have
13356           // an invalid re. if so, re-walk the contents of the
13357           // would-be class to re-translate any characters that
13358           // were passed through as-is
13359           // TODO: It would probably be faster to determine this
13360           // without a try/catch and a new RegExp, but it's tricky
13361           // to do safely.  For now, this is safe and works.
13362           var cs = pattern.substring(classStart + 1, i)
13363           try {
13364             RegExp('[' + cs + ']')
13365           } catch (er) {
13366             // not a valid class!
13367             var sp = this.parse(cs, SUBPARSE)
13368             re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
13369             hasMagic = hasMagic || sp[1]
13370             inClass = false
13371             continue
13372           }
13373         }
13374
13375         // finish up the class.
13376         hasMagic = true
13377         inClass = false
13378         re += c
13379       continue
13380
13381       default:
13382         // swallow any state char that wasn't consumed
13383         clearStateChar()
13384
13385         if (escaping) {
13386           // no need
13387           escaping = false
13388         } else if (reSpecials[c]
13389           && !(c === '^' && inClass)) {
13390           re += '\\'
13391         }
13392
13393         re += c
13394
13395     } // switch
13396   } // for
13397
13398   // handle the case where we left a class open.
13399   // "[abc" is valid, equivalent to "\[abc"
13400   if (inClass) {
13401     // split where the last [ was, and escape it
13402     // this is a huge pita.  We now have to re-walk
13403     // the contents of the would-be class to re-translate
13404     // any characters that were passed through as-is
13405     cs = pattern.substr(classStart + 1)
13406     sp = this.parse(cs, SUBPARSE)
13407     re = re.substr(0, reClassStart) + '\\[' + sp[0]
13408     hasMagic = hasMagic || sp[1]
13409   }
13410
13411   // handle the case where we had a +( thing at the *end*
13412   // of the pattern.
13413   // each pattern list stack adds 3 chars, and we need to go through
13414   // and escape any | chars that were passed through as-is for the regexp.
13415   // Go through and escape them, taking care not to double-escape any
13416   // | chars that were already escaped.
13417   for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
13418     var tail = re.slice(pl.reStart + pl.open.length)
13419     this.debug('setting tail', re, pl)
13420     // maybe some even number of \, then maybe 1 \, followed by a |
13421     tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
13422       if (!$2) {
13423         // the | isn't already escaped, so escape it.
13424         $2 = '\\'
13425       }
13426
13427       // need to escape all those slashes *again*, without escaping the
13428       // one that we need for escaping the | character.  As it works out,
13429       // escaping an even number of slashes can be done by simply repeating
13430       // it exactly after itself.  That's why this trick works.
13431       //
13432       // I am sorry that you have to see this.
13433       return $1 + $1 + $2 + '|'
13434     })
13435
13436     this.debug('tail=%j\n   %s', tail, tail, pl, re)
13437     var t = pl.type === '*' ? star
13438       : pl.type === '?' ? qmark
13439       : '\\' + pl.type
13440
13441     hasMagic = true
13442     re = re.slice(0, pl.reStart) + t + '\\(' + tail
13443   }
13444
13445   // handle trailing things that only matter at the very end.
13446   clearStateChar()
13447   if (escaping) {
13448     // trailing \\
13449     re += '\\\\'
13450   }
13451
13452   // only need to apply the nodot start if the re starts with
13453   // something that could conceivably capture a dot
13454   var addPatternStart = false
13455   switch (re.charAt(0)) {
13456     case '.':
13457     case '[':
13458     case '(': addPatternStart = true
13459   }
13460
13461   // Hack to work around lack of negative lookbehind in JS
13462   // A pattern like: *.!(x).!(y|z) needs to ensure that a name
13463   // like 'a.xyz.yz' doesn't match.  So, the first negative
13464   // lookahead, has to look ALL the way ahead, to the end of
13465   // the pattern.
13466   for (var n = negativeLists.length - 1; n > -1; n--) {
13467     var nl = negativeLists[n]
13468
13469     var nlBefore = re.slice(0, nl.reStart)
13470     var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
13471     var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
13472     var nlAfter = re.slice(nl.reEnd)
13473
13474     nlLast += nlAfter
13475
13476     // Handle nested stuff like *(*.js|!(*.json)), where open parens
13477     // mean that we should *not* include the ) in the bit that is considered
13478     // "after" the negated section.
13479     var openParensBefore = nlBefore.split('(').length - 1
13480     var cleanAfter = nlAfter
13481     for (i = 0; i < openParensBefore; i++) {
13482       cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
13483     }
13484     nlAfter = cleanAfter
13485
13486     var dollar = ''
13487     if (nlAfter === '' && isSub !== SUBPARSE) {
13488       dollar = '$'
13489     }
13490     var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
13491     re = newRe
13492   }
13493
13494   // if the re is not "" at this point, then we need to make sure
13495   // it doesn't match against an empty path part.
13496   // Otherwise a/* will match a/, which it should not.
13497   if (re !== '' && hasMagic) {
13498     re = '(?=.)' + re
13499   }
13500
13501   if (addPatternStart) {
13502     re = patternStart + re
13503   }
13504
13505   // parsing just a piece of a larger pattern.
13506   if (isSub === SUBPARSE) {
13507     return [re, hasMagic]
13508   }
13509
13510   // skip the regexp for non-magical patterns
13511   // unescape anything in it, though, so that it'll be
13512   // an exact match against a file etc.
13513   if (!hasMagic) {
13514     return globUnescape(pattern)
13515   }
13516
13517   var flags = options.nocase ? 'i' : ''
13518   try {
13519     var regExp = new RegExp('^' + re + '$', flags)
13520   } catch (er) {
13521     // If it was an invalid regular expression, then it can't match
13522     // anything.  This trick looks for a character after the end of
13523     // the string, which is of course impossible, except in multi-line
13524     // mode, but it's not a /m regex.
13525     return new RegExp('$.')
13526   }
13527
13528   regExp._glob = pattern
13529   regExp._src = re
13530
13531   return regExp
13532 }
13533
13534 minimatch.makeRe = function (pattern, options) {
13535   return new Minimatch(pattern, options || {}).makeRe()
13536 }
13537
13538 Minimatch.prototype.makeRe = makeRe
13539 function makeRe () {
13540   if (this.regexp || this.regexp === false) return this.regexp
13541
13542   // at this point, this.set is a 2d array of partial
13543   // pattern strings, or "**".
13544   //
13545   // It's better to use .match().  This function shouldn't
13546   // be used, really, but it's pretty convenient sometimes,
13547   // when you just want to work with a regex.
13548   var set = this.set
13549
13550   if (!set.length) {
13551     this.regexp = false
13552     return this.regexp
13553   }
13554   var options = this.options
13555
13556   var twoStar = options.noglobstar ? star
13557     : options.dot ? twoStarDot
13558     : twoStarNoDot
13559   var flags = options.nocase ? 'i' : ''
13560
13561   var re = set.map(function (pattern) {
13562     return pattern.map(function (p) {
13563       return (p === GLOBSTAR) ? twoStar
13564       : (typeof p === 'string') ? regExpEscape(p)
13565       : p._src
13566     }).join('\\\/')
13567   }).join('|')
13568
13569   // must match entire pattern
13570   // ending in a * or ** will make it less strict.
13571   re = '^(?:' + re + ')$'
13572
13573   // can match anything, as long as it's not this.
13574   if (this.negate) re = '^(?!' + re + ').*$'
13575
13576   try {
13577     this.regexp = new RegExp(re, flags)
13578   } catch (ex) {
13579     this.regexp = false
13580   }
13581   return this.regexp
13582 }
13583
13584 minimatch.match = function (list, pattern, options) {
13585   options = options || {}
13586   var mm = new Minimatch(pattern, options)
13587   list = list.filter(function (f) {
13588     return mm.match(f)
13589   })
13590   if (mm.options.nonull && !list.length) {
13591     list.push(pattern)
13592   }
13593   return list
13594 }
13595
13596 Minimatch.prototype.match = match
13597 function match (f, partial) {
13598   this.debug('match', f, this.pattern)
13599   // short-circuit in the case of busted things.
13600   // comments, etc.
13601   if (this.comment) return false
13602   if (this.empty) return f === ''
13603
13604   if (f === '/' && partial) return true
13605
13606   var options = this.options
13607
13608   // windows: need to use /, not \
13609   if (path.sep !== '/') {
13610     f = f.split(path.sep).join('/')
13611   }
13612
13613   // treat the test path as a set of pathparts.
13614   f = f.split(slashSplit)
13615   this.debug(this.pattern, 'split', f)
13616
13617   // just ONE of the pattern sets in this.set needs to match
13618   // in order for it to be valid.  If negating, then just one
13619   // match means that we have failed.
13620   // Either way, return on the first hit.
13621
13622   var set = this.set
13623   this.debug(this.pattern, 'set', set)
13624
13625   // Find the basename of the path by looking for the last non-empty segment
13626   var filename
13627   var i
13628   for (i = f.length - 1; i >= 0; i--) {
13629     filename = f[i]
13630     if (filename) break
13631   }
13632
13633   for (i = 0; i < set.length; i++) {
13634     var pattern = set[i]
13635     var file = f
13636     if (options.matchBase && pattern.length === 1) {
13637       file = [filename]
13638     }
13639     var hit = this.matchOne(file, pattern, partial)
13640     if (hit) {
13641       if (options.flipNegate) return true
13642       return !this.negate
13643     }
13644   }
13645
13646   // didn't get any hits.  this is success if it's a negative
13647   // pattern, failure otherwise.
13648   if (options.flipNegate) return false
13649   return this.negate
13650 }
13651
13652 // set partial to true to test if, for example,
13653 // "/a/b" matches the start of "/*/b/*/d"
13654 // Partial means, if you run out of file before you run
13655 // out of pattern, then that's fine, as long as all
13656 // the parts match.
13657 Minimatch.prototype.matchOne = function (file, pattern, partial) {
13658   var options = this.options
13659
13660   this.debug('matchOne',
13661     { 'this': this, file: file, pattern: pattern })
13662
13663   this.debug('matchOne', file.length, pattern.length)
13664
13665   for (var fi = 0,
13666       pi = 0,
13667       fl = file.length,
13668       pl = pattern.length
13669       ; (fi < fl) && (pi < pl)
13670       ; fi++, pi++) {
13671     this.debug('matchOne loop')
13672     var p = pattern[pi]
13673     var f = file[fi]
13674
13675     this.debug(pattern, p, f)
13676
13677     // should be impossible.
13678     // some invalid regexp stuff in the set.
13679     if (p === false) return false
13680
13681     if (p === GLOBSTAR) {
13682       this.debug('GLOBSTAR', [pattern, p, f])
13683
13684       // "**"
13685       // a/**/b/**/c would match the following:
13686       // a/b/x/y/z/c
13687       // a/x/y/z/b/c
13688       // a/b/x/b/x/c
13689       // a/b/c
13690       // To do this, take the rest of the pattern after
13691       // the **, and see if it would match the file remainder.
13692       // If so, return success.
13693       // If not, the ** "swallows" a segment, and try again.
13694       // This is recursively awful.
13695       //
13696       // a/**/b/**/c matching a/b/x/y/z/c
13697       // - a matches a
13698       // - doublestar
13699       //   - matchOne(b/x/y/z/c, b/**/c)
13700       //     - b matches b
13701       //     - doublestar
13702       //       - matchOne(x/y/z/c, c) -> no
13703       //       - matchOne(y/z/c, c) -> no
13704       //       - matchOne(z/c, c) -> no
13705       //       - matchOne(c, c) yes, hit
13706       var fr = fi
13707       var pr = pi + 1
13708       if (pr === pl) {
13709         this.debug('** at the end')
13710         // a ** at the end will just swallow the rest.
13711         // We have found a match.
13712         // however, it will not swallow /.x, unless
13713         // options.dot is set.
13714         // . and .. are *never* matched by **, for explosively
13715         // exponential reasons.
13716         for (; fi < fl; fi++) {
13717           if (file[fi] === '.' || file[fi] === '..' ||
13718             (!options.dot && file[fi].charAt(0) === '.')) return false
13719         }
13720         return true
13721       }
13722
13723       // ok, let's see if we can swallow whatever we can.
13724       while (fr < fl) {
13725         var swallowee = file[fr]
13726
13727         this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
13728
13729         // XXX remove this slice.  Just pass the start index.
13730         if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
13731           this.debug('globstar found match!', fr, fl, swallowee)
13732           // found a match.
13733           return true
13734         } else {
13735           // can't swallow "." or ".." ever.
13736           // can only swallow ".foo" when explicitly asked.
13737           if (swallowee === '.' || swallowee === '..' ||
13738             (!options.dot && swallowee.charAt(0) === '.')) {
13739             this.debug('dot detected!', file, fr, pattern, pr)
13740             break
13741           }
13742
13743           // ** swallows a segment, and continue.
13744           this.debug('globstar swallow a segment, and continue')
13745           fr++
13746         }
13747       }
13748
13749       // no match was found.
13750       // However, in partial mode, we can't say this is necessarily over.
13751       // If there's more *pattern* left, then
13752       if (partial) {
13753         // ran out of file
13754         this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
13755         if (fr === fl) return true
13756       }
13757       return false
13758     }
13759
13760     // something other than **
13761     // non-magic patterns just have to match exactly
13762     // patterns with magic have been turned into regexps.
13763     var hit
13764     if (typeof p === 'string') {
13765       if (options.nocase) {
13766         hit = f.toLowerCase() === p.toLowerCase()
13767       } else {
13768         hit = f === p
13769       }
13770       this.debug('string match', p, f, hit)
13771     } else {
13772       hit = f.match(p)
13773       this.debug('pattern match', p, f, hit)
13774     }
13775
13776     if (!hit) return false
13777   }
13778
13779   // Note: ending in / means that we'll get a final ""
13780   // at the end of the pattern.  This can only match a
13781   // corresponding "" at the end of the file.
13782   // If the file ends in /, then it can only match a
13783   // a pattern that ends in /, unless the pattern just
13784   // doesn't have any more for it. But, a/b/ should *not*
13785   // match "a/b/*", even though "" matches against the
13786   // [^/]*? pattern, except in partial mode, where it might
13787   // simply not be reached yet.
13788   // However, a/b/ should still satisfy a/*
13789
13790   // now either we fell off the end of the pattern, or we're done.
13791   if (fi === fl && pi === pl) {
13792     // ran out of pattern and filename at the same time.
13793     // an exact hit!
13794     return true
13795   } else if (fi === fl) {
13796     // ran out of file, but still had pattern left.
13797     // this is ok if we're doing the match as part of
13798     // a glob fs traversal.
13799     return partial
13800   } else if (pi === pl) {
13801     // ran out of pattern, still have file left.
13802     // this is only acceptable if we're on the very last
13803     // empty segment of a file with a trailing slash.
13804     // a/* should match a/b/
13805     var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
13806     return emptyFileEnd
13807   }
13808
13809   // should be unreachable.
13810   throw new Error('wtf?')
13811 }
13812
13813 // replace stuff like \* with *
13814 function globUnescape (s) {
13815   return s.replace(/\\(.)/g, '$1')
13816 }
13817
13818 function regExpEscape (s) {
13819   return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
13820 }
13821
13822
13823 /***/ }),
13824 /* 63 */
13825 /***/ (function(module, exports, __webpack_require__) {
13826
13827 var concatMap = __webpack_require__(64);
13828 var balanced = __webpack_require__(65);
13829
13830 module.exports = expandTop;
13831
13832 var escSlash = '\0SLASH'+Math.random()+'\0';
13833 var escOpen = '\0OPEN'+Math.random()+'\0';
13834 var escClose = '\0CLOSE'+Math.random()+'\0';
13835 var escComma = '\0COMMA'+Math.random()+'\0';
13836 var escPeriod = '\0PERIOD'+Math.random()+'\0';
13837
13838 function numeric(str) {
13839   return parseInt(str, 10) == str
13840     ? parseInt(str, 10)
13841     : str.charCodeAt(0);
13842 }
13843
13844 function escapeBraces(str) {
13845   return str.split('\\\\').join(escSlash)
13846             .split('\\{').join(escOpen)
13847             .split('\\}').join(escClose)
13848             .split('\\,').join(escComma)
13849             .split('\\.').join(escPeriod);
13850 }
13851
13852 function unescapeBraces(str) {
13853   return str.split(escSlash).join('\\')
13854             .split(escOpen).join('{')
13855             .split(escClose).join('}')
13856             .split(escComma).join(',')
13857             .split(escPeriod).join('.');
13858 }
13859
13860
13861 // Basically just str.split(","), but handling cases
13862 // where we have nested braced sections, which should be
13863 // treated as individual members, like {a,{b,c},d}
13864 function parseCommaParts(str) {
13865   if (!str)
13866     return [''];
13867
13868   var parts = [];
13869   var m = balanced('{', '}', str);
13870
13871   if (!m)
13872     return str.split(',');
13873
13874   var pre = m.pre;
13875   var body = m.body;
13876   var post = m.post;
13877   var p = pre.split(',');
13878
13879   p[p.length-1] += '{' + body + '}';
13880   var postParts = parseCommaParts(post);
13881   if (post.length) {
13882     p[p.length-1] += postParts.shift();
13883     p.push.apply(p, postParts);
13884   }
13885
13886   parts.push.apply(parts, p);
13887
13888   return parts;
13889 }
13890
13891 function expandTop(str) {
13892   if (!str)
13893     return [];
13894
13895   // I don't know why Bash 4.3 does this, but it does.
13896   // Anything starting with {} will have the first two bytes preserved
13897   // but *only* at the top level, so {},a}b will not expand to anything,
13898   // but a{},b}c will be expanded to [a}c,abc].
13899   // One could argue that this is a bug in Bash, but since the goal of
13900   // this module is to match Bash's rules, we escape a leading {}
13901   if (str.substr(0, 2) === '{}') {
13902     str = '\\{\\}' + str.substr(2);
13903   }
13904
13905   return expand(escapeBraces(str), true).map(unescapeBraces);
13906 }
13907
13908 function identity(e) {
13909   return e;
13910 }
13911
13912 function embrace(str) {
13913   return '{' + str + '}';
13914 }
13915 function isPadded(el) {
13916   return /^-?0\d/.test(el);
13917 }
13918
13919 function lte(i, y) {
13920   return i <= y;
13921 }
13922 function gte(i, y) {
13923   return i >= y;
13924 }
13925
13926 function expand(str, isTop) {
13927   var expansions = [];
13928
13929   var m = balanced('{', '}', str);
13930   if (!m || /\$$/.test(m.pre)) return [str];
13931
13932   var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
13933   var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
13934   var isSequence = isNumericSequence || isAlphaSequence;
13935   var isOptions = m.body.indexOf(',') >= 0;
13936   if (!isSequence && !isOptions) {
13937     // {a},b}
13938     if (m.post.match(/,.*\}/)) {
13939       str = m.pre + '{' + m.body + escClose + m.post;
13940       return expand(str);
13941     }
13942     return [str];
13943   }
13944
13945   var n;
13946   if (isSequence) {
13947     n = m.body.split(/\.\./);
13948   } else {
13949     n = parseCommaParts(m.body);
13950     if (n.length === 1) {
13951       // x{{a,b}}y ==> x{a}y x{b}y
13952       n = expand(n[0], false).map(embrace);
13953       if (n.length === 1) {
13954         var post = m.post.length
13955           ? expand(m.post, false)
13956           : [''];
13957         return post.map(function(p) {
13958           return m.pre + n[0] + p;
13959         });
13960       }
13961     }
13962   }
13963
13964   // at this point, n is the parts, and we know it's not a comma set
13965   // with a single entry.
13966
13967   // no need to expand pre, since it is guaranteed to be free of brace-sets
13968   var pre = m.pre;
13969   var post = m.post.length
13970     ? expand(m.post, false)
13971     : [''];
13972
13973   var N;
13974
13975   if (isSequence) {
13976     var x = numeric(n[0]);
13977     var y = numeric(n[1]);
13978     var width = Math.max(n[0].length, n[1].length)
13979     var incr = n.length == 3
13980       ? Math.abs(numeric(n[2]))
13981       : 1;
13982     var test = lte;
13983     var reverse = y < x;
13984     if (reverse) {
13985       incr *= -1;
13986       test = gte;
13987     }
13988     var pad = n.some(isPadded);
13989
13990     N = [];
13991
13992     for (var i = x; test(i, y); i += incr) {
13993       var c;
13994       if (isAlphaSequence) {
13995         c = String.fromCharCode(i);
13996         if (c === '\\')
13997           c = '';
13998       } else {
13999         c = String(i);
14000         if (pad) {
14001           var need = width - c.length;
14002           if (need > 0) {
14003             var z = new Array(need + 1).join('0');
14004             if (i < 0)
14005               c = '-' + z + c.slice(1);
14006             else
14007               c = z + c;
14008           }
14009         }
14010       }
14011       N.push(c);
14012     }
14013   } else {
14014     N = concatMap(n, function(el) { return expand(el, false) });
14015   }
14016
14017   for (var j = 0; j < N.length; j++) {
14018     for (var k = 0; k < post.length; k++) {
14019       var expansion = pre + N[j] + post[k];
14020       if (!isTop || isSequence || expansion)
14021         expansions.push(expansion);
14022     }
14023   }
14024
14025   return expansions;
14026 }
14027
14028
14029
14030 /***/ }),
14031 /* 64 */
14032 /***/ (function(module, exports) {
14033
14034 module.exports = function (xs, fn) {
14035     var res = [];
14036     for (var i = 0; i < xs.length; i++) {
14037         var x = fn(xs[i], i);
14038         if (isArray(x)) res.push.apply(res, x);
14039         else res.push(x);
14040     }
14041     return res;
14042 };
14043
14044 var isArray = Array.isArray || function (xs) {
14045     return Object.prototype.toString.call(xs) === '[object Array]';
14046 };
14047
14048
14049 /***/ }),
14050 /* 65 */
14051 /***/ (function(module, exports, __webpack_require__) {
14052
14053 "use strict";
14054
14055 module.exports = balanced;
14056 function balanced(a, b, str) {
14057   if (a instanceof RegExp) a = maybeMatch(a, str);
14058   if (b instanceof RegExp) b = maybeMatch(b, str);
14059
14060   var r = range(a, b, str);
14061
14062   return r && {
14063     start: r[0],
14064     end: r[1],
14065     pre: str.slice(0, r[0]),
14066     body: str.slice(r[0] + a.length, r[1]),
14067     post: str.slice(r[1] + b.length)
14068   };
14069 }
14070
14071 function maybeMatch(reg, str) {
14072   var m = str.match(reg);
14073   return m ? m[0] : null;
14074 }
14075
14076 balanced.range = range;
14077 function range(a, b, str) {
14078   var begs, beg, left, right, result;
14079   var ai = str.indexOf(a);
14080   var bi = str.indexOf(b, ai + 1);
14081   var i = ai;
14082
14083   if (ai >= 0 && bi > 0) {
14084     begs = [];
14085     left = str.length;
14086
14087     while (i >= 0 && !result) {
14088       if (i == ai) {
14089         begs.push(i);
14090         ai = str.indexOf(a, i + 1);
14091       } else if (begs.length == 1) {
14092         result = [ begs.pop(), bi ];
14093       } else {
14094         beg = begs.pop();
14095         if (beg < left) {
14096           left = beg;
14097           right = bi;
14098         }
14099
14100         bi = str.indexOf(b, i + 1);
14101       }
14102
14103       i = ai < bi && ai >= 0 ? ai : bi;
14104     }
14105
14106     if (begs.length) {
14107       result = [ left, right ];
14108     }
14109   }
14110
14111   return result;
14112 }
14113
14114
14115 /***/ }),
14116 /* 66 */
14117 /***/ (function(module, exports, __webpack_require__) {
14118
14119 try {
14120   var util = __webpack_require__(50);
14121   /* istanbul ignore next */
14122   if (typeof util.inherits !== 'function') throw '';
14123   module.exports = util.inherits;
14124 } catch (e) {
14125   /* istanbul ignore next */
14126   module.exports = __webpack_require__(67);
14127 }
14128
14129
14130 /***/ }),
14131 /* 67 */
14132 /***/ (function(module, exports) {
14133
14134 if (typeof Object.create === 'function') {
14135   // implementation from standard node.js 'util' module
14136   module.exports = function inherits(ctor, superCtor) {
14137     if (superCtor) {
14138       ctor.super_ = superCtor
14139       ctor.prototype = Object.create(superCtor.prototype, {
14140         constructor: {
14141           value: ctor,
14142           enumerable: false,
14143           writable: true,
14144           configurable: true
14145         }
14146       })
14147     }
14148   };
14149 } else {
14150   // old school shim for old browsers
14151   module.exports = function inherits(ctor, superCtor) {
14152     if (superCtor) {
14153       ctor.super_ = superCtor
14154       var TempCtor = function () {}
14155       TempCtor.prototype = superCtor.prototype
14156       ctor.prototype = new TempCtor()
14157       ctor.prototype.constructor = ctor
14158     }
14159   }
14160 }
14161
14162
14163 /***/ }),
14164 /* 68 */
14165 /***/ (function(module, exports) {
14166
14167 module.exports = require("events");
14168
14169 /***/ }),
14170 /* 69 */
14171 /***/ (function(module, exports, __webpack_require__) {
14172
14173 "use strict";
14174
14175
14176 function posix(path) {
14177         return path.charAt(0) === '/';
14178 }
14179
14180 function win32(path) {
14181         // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
14182         var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
14183         var result = splitDeviceRe.exec(path);
14184         var device = result[1] || '';
14185         var isUnc = Boolean(device && device.charAt(1) !== ':');
14186
14187         // UNC paths are always absolute
14188         return Boolean(result[2] || isUnc);
14189 }
14190
14191 module.exports = process.platform === 'win32' ? win32 : posix;
14192 module.exports.posix = posix;
14193 module.exports.win32 = win32;
14194
14195
14196 /***/ }),
14197 /* 70 */
14198 /***/ (function(module, exports, __webpack_require__) {
14199
14200 module.exports = globSync
14201 globSync.GlobSync = GlobSync
14202
14203 var fs = __webpack_require__(42)
14204 var rp = __webpack_require__(60)
14205 var minimatch = __webpack_require__(62)
14206 var Minimatch = minimatch.Minimatch
14207 var Glob = __webpack_require__(59).Glob
14208 var util = __webpack_require__(50)
14209 var path = __webpack_require__(2)
14210 var assert = __webpack_require__(58)
14211 var isAbsolute = __webpack_require__(69)
14212 var common = __webpack_require__(71)
14213 var alphasort = common.alphasort
14214 var alphasorti = common.alphasorti
14215 var setopts = common.setopts
14216 var ownProp = common.ownProp
14217 var childrenIgnored = common.childrenIgnored
14218 var isIgnored = common.isIgnored
14219
14220 function globSync (pattern, options) {
14221   if (typeof options === 'function' || arguments.length === 3)
14222     throw new TypeError('callback provided to sync glob\n'+
14223                         'See: https://github.com/isaacs/node-glob/issues/167')
14224
14225   return new GlobSync(pattern, options).found
14226 }
14227
14228 function GlobSync (pattern, options) {
14229   if (!pattern)
14230     throw new Error('must provide pattern')
14231
14232   if (typeof options === 'function' || arguments.length === 3)
14233     throw new TypeError('callback provided to sync glob\n'+
14234                         'See: https://github.com/isaacs/node-glob/issues/167')
14235
14236   if (!(this instanceof GlobSync))
14237     return new GlobSync(pattern, options)
14238
14239   setopts(this, pattern, options)
14240
14241   if (this.noprocess)
14242     return this
14243
14244   var n = this.minimatch.set.length
14245   this.matches = new Array(n)
14246   for (var i = 0; i < n; i ++) {
14247     this._process(this.minimatch.set[i], i, false)
14248   }
14249   this._finish()
14250 }
14251
14252 GlobSync.prototype._finish = function () {
14253   assert(this instanceof GlobSync)
14254   if (this.realpath) {
14255     var self = this
14256     this.matches.forEach(function (matchset, index) {
14257       var set = self.matches[index] = Object.create(null)
14258       for (var p in matchset) {
14259         try {
14260           p = self._makeAbs(p)
14261           var real = rp.realpathSync(p, self.realpathCache)
14262           set[real] = true
14263         } catch (er) {
14264           if (er.syscall === 'stat')
14265             set[self._makeAbs(p)] = true
14266           else
14267             throw er
14268         }
14269       }
14270     })
14271   }
14272   common.finish(this)
14273 }
14274
14275
14276 GlobSync.prototype._process = function (pattern, index, inGlobStar) {
14277   assert(this instanceof GlobSync)
14278
14279   // Get the first [n] parts of pattern that are all strings.
14280   var n = 0
14281   while (typeof pattern[n] === 'string') {
14282     n ++
14283   }
14284   // now n is the index of the first one that is *not* a string.
14285
14286   // See if there's anything else
14287   var prefix
14288   switch (n) {
14289     // if not, then this is rather simple
14290     case pattern.length:
14291       this._processSimple(pattern.join('/'), index)
14292       return
14293
14294     case 0:
14295       // pattern *starts* with some non-trivial item.
14296       // going to readdir(cwd), but not include the prefix in matches.
14297       prefix = null
14298       break
14299
14300     default:
14301       // pattern has some string bits in the front.
14302       // whatever it starts with, whether that's 'absolute' like /foo/bar,
14303       // or 'relative' like '../baz'
14304       prefix = pattern.slice(0, n).join('/')
14305       break
14306   }
14307
14308   var remain = pattern.slice(n)
14309
14310   // get the list of entries.
14311   var read
14312   if (prefix === null)
14313     read = '.'
14314   else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
14315     if (!prefix || !isAbsolute(prefix))
14316       prefix = '/' + prefix
14317     read = prefix
14318   } else
14319     read = prefix
14320
14321   var abs = this._makeAbs(read)
14322
14323   //if ignored, skip processing
14324   if (childrenIgnored(this, read))
14325     return
14326
14327   var isGlobStar = remain[0] === minimatch.GLOBSTAR
14328   if (isGlobStar)
14329     this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
14330   else
14331     this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
14332 }
14333
14334
14335 GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
14336   var entries = this._readdir(abs, inGlobStar)
14337
14338   // if the abs isn't a dir, then nothing can match!
14339   if (!entries)
14340     return
14341
14342   // It will only match dot entries if it starts with a dot, or if
14343   // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
14344   var pn = remain[0]
14345   var negate = !!this.minimatch.negate
14346   var rawGlob = pn._glob
14347   var dotOk = this.dot || rawGlob.charAt(0) === '.'
14348
14349   var matchedEntries = []
14350   for (var i = 0; i < entries.length; i++) {
14351     var e = entries[i]
14352     if (e.charAt(0) !== '.' || dotOk) {
14353       var m
14354       if (negate && !prefix) {
14355         m = !e.match(pn)
14356       } else {
14357         m = e.match(pn)
14358       }
14359       if (m)
14360         matchedEntries.push(e)
14361     }
14362   }
14363
14364   var len = matchedEntries.length
14365   // If there are no matched entries, then nothing matches.
14366   if (len === 0)
14367     return
14368
14369   // if this is the last remaining pattern bit, then no need for
14370   // an additional stat *unless* the user has specified mark or
14371   // stat explicitly.  We know they exist, since readdir returned
14372   // them.
14373
14374   if (remain.length === 1 && !this.mark && !this.stat) {
14375     if (!this.matches[index])
14376       this.matches[index] = Object.create(null)
14377
14378     for (var i = 0; i < len; i ++) {
14379       var e = matchedEntries[i]
14380       if (prefix) {
14381         if (prefix.slice(-1) !== '/')
14382           e = prefix + '/' + e
14383         else
14384           e = prefix + e
14385       }
14386
14387       if (e.charAt(0) === '/' && !this.nomount) {
14388         e = path.join(this.root, e)
14389       }
14390       this._emitMatch(index, e)
14391     }
14392     // This was the last one, and no stats were needed
14393     return
14394   }
14395
14396   // now test all matched entries as stand-ins for that part
14397   // of the pattern.
14398   remain.shift()
14399   for (var i = 0; i < len; i ++) {
14400     var e = matchedEntries[i]
14401     var newPattern
14402     if (prefix)
14403       newPattern = [prefix, e]
14404     else
14405       newPattern = [e]
14406     this._process(newPattern.concat(remain), index, inGlobStar)
14407   }
14408 }
14409
14410
14411 GlobSync.prototype._emitMatch = function (index, e) {
14412   if (isIgnored(this, e))
14413     return
14414
14415   var abs = this._makeAbs(e)
14416
14417   if (this.mark)
14418     e = this._mark(e)
14419
14420   if (this.absolute) {
14421     e = abs
14422   }
14423
14424   if (this.matches[index][e])
14425     return
14426
14427   if (this.nodir) {
14428     var c = this.cache[abs]
14429     if (c === 'DIR' || Array.isArray(c))
14430       return
14431   }
14432
14433   this.matches[index][e] = true
14434
14435   if (this.stat)
14436     this._stat(e)
14437 }
14438
14439
14440 GlobSync.prototype._readdirInGlobStar = function (abs) {
14441   // follow all symlinked directories forever
14442   // just proceed as if this is a non-globstar situation
14443   if (this.follow)
14444     return this._readdir(abs, false)
14445
14446   var entries
14447   var lstat
14448   var stat
14449   try {
14450     lstat = fs.lstatSync(abs)
14451   } catch (er) {
14452     if (er.code === 'ENOENT') {
14453       // lstat failed, doesn't exist
14454       return null
14455     }
14456   }
14457
14458   var isSym = lstat && lstat.isSymbolicLink()
14459   this.symlinks[abs] = isSym
14460
14461   // If it's not a symlink or a dir, then it's definitely a regular file.
14462   // don't bother doing a readdir in that case.
14463   if (!isSym && lstat && !lstat.isDirectory())
14464     this.cache[abs] = 'FILE'
14465   else
14466     entries = this._readdir(abs, false)
14467
14468   return entries
14469 }
14470
14471 GlobSync.prototype._readdir = function (abs, inGlobStar) {
14472   var entries
14473
14474   if (inGlobStar && !ownProp(this.symlinks, abs))
14475     return this._readdirInGlobStar(abs)
14476
14477   if (ownProp(this.cache, abs)) {
14478     var c = this.cache[abs]
14479     if (!c || c === 'FILE')
14480       return null
14481
14482     if (Array.isArray(c))
14483       return c
14484   }
14485
14486   try {
14487     return this._readdirEntries(abs, fs.readdirSync(abs))
14488   } catch (er) {
14489     this._readdirError(abs, er)
14490     return null
14491   }
14492 }
14493
14494 GlobSync.prototype._readdirEntries = function (abs, entries) {
14495   // if we haven't asked to stat everything, then just
14496   // assume that everything in there exists, so we can avoid
14497   // having to stat it a second time.
14498   if (!this.mark && !this.stat) {
14499     for (var i = 0; i < entries.length; i ++) {
14500       var e = entries[i]
14501       if (abs === '/')
14502         e = abs + e
14503       else
14504         e = abs + '/' + e
14505       this.cache[e] = true
14506     }
14507   }
14508
14509   this.cache[abs] = entries
14510
14511   // mark and cache dir-ness
14512   return entries
14513 }
14514
14515 GlobSync.prototype._readdirError = function (f, er) {
14516   // handle errors, and cache the information
14517   switch (er.code) {
14518     case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
14519     case 'ENOTDIR': // totally normal. means it *does* exist.
14520       var abs = this._makeAbs(f)
14521       this.cache[abs] = 'FILE'
14522       if (abs === this.cwdAbs) {
14523         var error = new Error(er.code + ' invalid cwd ' + this.cwd)
14524         error.path = this.cwd
14525         error.code = er.code
14526         throw error
14527       }
14528       break
14529
14530     case 'ENOENT': // not terribly unusual
14531     case 'ELOOP':
14532     case 'ENAMETOOLONG':
14533     case 'UNKNOWN':
14534       this.cache[this._makeAbs(f)] = false
14535       break
14536
14537     default: // some unusual error.  Treat as failure.
14538       this.cache[this._makeAbs(f)] = false
14539       if (this.strict)
14540         throw er
14541       if (!this.silent)
14542         console.error('glob error', er)
14543       break
14544   }
14545 }
14546
14547 GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
14548
14549   var entries = this._readdir(abs, inGlobStar)
14550
14551   // no entries means not a dir, so it can never have matches
14552   // foo.txt/** doesn't match foo.txt
14553   if (!entries)
14554     return
14555
14556   // test without the globstar, and with every child both below
14557   // and replacing the globstar.
14558   var remainWithoutGlobStar = remain.slice(1)
14559   var gspref = prefix ? [ prefix ] : []
14560   var noGlobStar = gspref.concat(remainWithoutGlobStar)
14561
14562   // the noGlobStar pattern exits the inGlobStar state
14563   this._process(noGlobStar, index, false)
14564
14565   var len = entries.length
14566   var isSym = this.symlinks[abs]
14567
14568   // If it's a symlink, and we're in a globstar, then stop
14569   if (isSym && inGlobStar)
14570     return
14571
14572   for (var i = 0; i < len; i++) {
14573     var e = entries[i]
14574     if (e.charAt(0) === '.' && !this.dot)
14575       continue
14576
14577     // these two cases enter the inGlobStar state
14578     var instead = gspref.concat(entries[i], remainWithoutGlobStar)
14579     this._process(instead, index, true)
14580
14581     var below = gspref.concat(entries[i], remain)
14582     this._process(below, index, true)
14583   }
14584 }
14585
14586 GlobSync.prototype._processSimple = function (prefix, index) {
14587   // XXX review this.  Shouldn't it be doing the mounting etc
14588   // before doing stat?  kinda weird?
14589   var exists = this._stat(prefix)
14590
14591   if (!this.matches[index])
14592     this.matches[index] = Object.create(null)
14593
14594   // If it doesn't exist, then just mark the lack of results
14595   if (!exists)
14596     return
14597
14598   if (prefix && isAbsolute(prefix) && !this.nomount) {
14599     var trail = /[\/\\]$/.test(prefix)
14600     if (prefix.charAt(0) === '/') {
14601       prefix = path.join(this.root, prefix)
14602     } else {
14603       prefix = path.resolve(this.root, prefix)
14604       if (trail)
14605         prefix += '/'
14606     }
14607   }
14608
14609   if (process.platform === 'win32')
14610     prefix = prefix.replace(/\\/g, '/')
14611
14612   // Mark this as a match
14613   this._emitMatch(index, prefix)
14614 }
14615
14616 // Returns either 'DIR', 'FILE', or false
14617 GlobSync.prototype._stat = function (f) {
14618   var abs = this._makeAbs(f)
14619   var needDir = f.slice(-1) === '/'
14620
14621   if (f.length > this.maxLength)
14622     return false
14623
14624   if (!this.stat && ownProp(this.cache, abs)) {
14625     var c = this.cache[abs]
14626
14627     if (Array.isArray(c))
14628       c = 'DIR'
14629
14630     // It exists, but maybe not how we need it
14631     if (!needDir || c === 'DIR')
14632       return c
14633
14634     if (needDir && c === 'FILE')
14635       return false
14636
14637     // otherwise we have to stat, because maybe c=true
14638     // if we know it exists, but not what it is.
14639   }
14640
14641   var exists
14642   var stat = this.statCache[abs]
14643   if (!stat) {
14644     var lstat
14645     try {
14646       lstat = fs.lstatSync(abs)
14647     } catch (er) {
14648       if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
14649         this.statCache[abs] = false
14650         return false
14651       }
14652     }
14653
14654     if (lstat && lstat.isSymbolicLink()) {
14655       try {
14656         stat = fs.statSync(abs)
14657       } catch (er) {
14658         stat = lstat
14659       }
14660     } else {
14661       stat = lstat
14662     }
14663   }
14664
14665   this.statCache[abs] = stat
14666
14667   var c = true
14668   if (stat)
14669     c = stat.isDirectory() ? 'DIR' : 'FILE'
14670
14671   this.cache[abs] = this.cache[abs] || c
14672
14673   if (needDir && c === 'FILE')
14674     return false
14675
14676   return c
14677 }
14678
14679 GlobSync.prototype._mark = function (p) {
14680   return common.mark(this, p)
14681 }
14682
14683 GlobSync.prototype._makeAbs = function (f) {
14684   return common.makeAbs(this, f)
14685 }
14686
14687
14688 /***/ }),
14689 /* 71 */
14690 /***/ (function(module, exports, __webpack_require__) {
14691
14692 exports.alphasort = alphasort
14693 exports.alphasorti = alphasorti
14694 exports.setopts = setopts
14695 exports.ownProp = ownProp
14696 exports.makeAbs = makeAbs
14697 exports.finish = finish
14698 exports.mark = mark
14699 exports.isIgnored = isIgnored
14700 exports.childrenIgnored = childrenIgnored
14701
14702 function ownProp (obj, field) {
14703   return Object.prototype.hasOwnProperty.call(obj, field)
14704 }
14705
14706 var path = __webpack_require__(2)
14707 var minimatch = __webpack_require__(62)
14708 var isAbsolute = __webpack_require__(69)
14709 var Minimatch = minimatch.Minimatch
14710
14711 function alphasorti (a, b) {
14712   return a.toLowerCase().localeCompare(b.toLowerCase())
14713 }
14714
14715 function alphasort (a, b) {
14716   return a.localeCompare(b)
14717 }
14718
14719 function setupIgnores (self, options) {
14720   self.ignore = options.ignore || []
14721
14722   if (!Array.isArray(self.ignore))
14723     self.ignore = [self.ignore]
14724
14725   if (self.ignore.length) {
14726     self.ignore = self.ignore.map(ignoreMap)
14727   }
14728 }
14729
14730 // ignore patterns are always in dot:true mode.
14731 function ignoreMap (pattern) {
14732   var gmatcher = null
14733   if (pattern.slice(-3) === '/**') {
14734     var gpattern = pattern.replace(/(\/\*\*)+$/, '')
14735     gmatcher = new Minimatch(gpattern, { dot: true })
14736   }
14737
14738   return {
14739     matcher: new Minimatch(pattern, { dot: true }),
14740     gmatcher: gmatcher
14741   }
14742 }
14743
14744 function setopts (self, pattern, options) {
14745   if (!options)
14746     options = {}
14747
14748   // base-matching: just use globstar for that.
14749   if (options.matchBase && -1 === pattern.indexOf("/")) {
14750     if (options.noglobstar) {
14751       throw new Error("base matching requires globstar")
14752     }
14753     pattern = "**/" + pattern
14754   }
14755
14756   self.silent = !!options.silent
14757   self.pattern = pattern
14758   self.strict = options.strict !== false
14759   self.realpath = !!options.realpath
14760   self.realpathCache = options.realpathCache || Object.create(null)
14761   self.follow = !!options.follow
14762   self.dot = !!options.dot
14763   self.mark = !!options.mark
14764   self.nodir = !!options.nodir
14765   if (self.nodir)
14766     self.mark = true
14767   self.sync = !!options.sync
14768   self.nounique = !!options.nounique
14769   self.nonull = !!options.nonull
14770   self.nosort = !!options.nosort
14771   self.nocase = !!options.nocase
14772   self.stat = !!options.stat
14773   self.noprocess = !!options.noprocess
14774   self.absolute = !!options.absolute
14775
14776   self.maxLength = options.maxLength || Infinity
14777   self.cache = options.cache || Object.create(null)
14778   self.statCache = options.statCache || Object.create(null)
14779   self.symlinks = options.symlinks || Object.create(null)
14780
14781   setupIgnores(self, options)
14782
14783   self.changedCwd = false
14784   var cwd = process.cwd()
14785   if (!ownProp(options, "cwd"))
14786     self.cwd = cwd
14787   else {
14788     self.cwd = path.resolve(options.cwd)
14789     self.changedCwd = self.cwd !== cwd
14790   }
14791
14792   self.root = options.root || path.resolve(self.cwd, "/")
14793   self.root = path.resolve(self.root)
14794   if (process.platform === "win32")
14795     self.root = self.root.replace(/\\/g, "/")
14796
14797   // TODO: is an absolute `cwd` supposed to be resolved against `root`?
14798   // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
14799   self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
14800   if (process.platform === "win32")
14801     self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
14802   self.nomount = !!options.nomount
14803
14804   // disable comments and negation in Minimatch.
14805   // Note that they are not supported in Glob itself anyway.
14806   options.nonegate = true
14807   options.nocomment = true
14808
14809   self.minimatch = new Minimatch(pattern, options)
14810   self.options = self.minimatch.options
14811 }
14812
14813 function finish (self) {
14814   var nou = self.nounique
14815   var all = nou ? [] : Object.create(null)
14816
14817   for (var i = 0, l = self.matches.length; i < l; i ++) {
14818     var matches = self.matches[i]
14819     if (!matches || Object.keys(matches).length === 0) {
14820       if (self.nonull) {
14821         // do like the shell, and spit out the literal glob
14822         var literal = self.minimatch.globSet[i]
14823         if (nou)
14824           all.push(literal)
14825         else
14826           all[literal] = true
14827       }
14828     } else {
14829       // had matches
14830       var m = Object.keys(matches)
14831       if (nou)
14832         all.push.apply(all, m)
14833       else
14834         m.forEach(function (m) {
14835           all[m] = true
14836         })
14837     }
14838   }
14839
14840   if (!nou)
14841     all = Object.keys(all)
14842
14843   if (!self.nosort)
14844     all = all.sort(self.nocase ? alphasorti : alphasort)
14845
14846   // at *some* point we statted all of these
14847   if (self.mark) {
14848     for (var i = 0; i < all.length; i++) {
14849       all[i] = self._mark(all[i])
14850     }
14851     if (self.nodir) {
14852       all = all.filter(function (e) {
14853         var notDir = !(/\/$/.test(e))
14854         var c = self.cache[e] || self.cache[makeAbs(self, e)]
14855         if (notDir && c)
14856           notDir = c !== 'DIR' && !Array.isArray(c)
14857         return notDir
14858       })
14859     }
14860   }
14861
14862   if (self.ignore.length)
14863     all = all.filter(function(m) {
14864       return !isIgnored(self, m)
14865     })
14866
14867   self.found = all
14868 }
14869
14870 function mark (self, p) {
14871   var abs = makeAbs(self, p)
14872   var c = self.cache[abs]
14873   var m = p
14874   if (c) {
14875     var isDir = c === 'DIR' || Array.isArray(c)
14876     var slash = p.slice(-1) === '/'
14877
14878     if (isDir && !slash)
14879       m += '/'
14880     else if (!isDir && slash)
14881       m = m.slice(0, -1)
14882
14883     if (m !== p) {
14884       var mabs = makeAbs(self, m)
14885       self.statCache[mabs] = self.statCache[abs]
14886       self.cache[mabs] = self.cache[abs]
14887     }
14888   }
14889
14890   return m
14891 }
14892
14893 // lotta situps...
14894 function makeAbs (self, f) {
14895   var abs = f
14896   if (f.charAt(0) === '/') {
14897     abs = path.join(self.root, f)
14898   } else if (isAbsolute(f) || f === '') {
14899     abs = f
14900   } else if (self.changedCwd) {
14901     abs = path.resolve(self.cwd, f)
14902   } else {
14903     abs = path.resolve(f)
14904   }
14905
14906   if (process.platform === 'win32')
14907     abs = abs.replace(/\\/g, '/')
14908
14909   return abs
14910 }
14911
14912
14913 // Return true, if pattern ends with globstar '**', for the accompanying parent directory.
14914 // Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
14915 function isIgnored (self, path) {
14916   if (!self.ignore.length)
14917     return false
14918
14919   return self.ignore.some(function(item) {
14920     return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
14921   })
14922 }
14923
14924 function childrenIgnored (self, path) {
14925   if (!self.ignore.length)
14926     return false
14927
14928   return self.ignore.some(function(item) {
14929     return !!(item.gmatcher && item.gmatcher.match(path))
14930   })
14931 }
14932
14933
14934 /***/ }),
14935 /* 72 */
14936 /***/ (function(module, exports, __webpack_require__) {
14937
14938 var wrappy = __webpack_require__(73)
14939 var reqs = Object.create(null)
14940 var once = __webpack_require__(74)
14941
14942 module.exports = wrappy(inflight)
14943
14944 function inflight (key, cb) {
14945   if (reqs[key]) {
14946     reqs[key].push(cb)
14947     return null
14948   } else {
14949     reqs[key] = [cb]
14950     return makeres(key)
14951   }
14952 }
14953
14954 function makeres (key) {
14955   return once(function RES () {
14956     var cbs = reqs[key]
14957     var len = cbs.length
14958     var args = slice(arguments)
14959
14960     // XXX It's somewhat ambiguous whether a new callback added in this
14961     // pass should be queued for later execution if something in the
14962     // list of callbacks throws, or if it should just be discarded.
14963     // However, it's such an edge case that it hardly matters, and either
14964     // choice is likely as surprising as the other.
14965     // As it happens, we do go ahead and schedule it for later execution.
14966     try {
14967       for (var i = 0; i < len; i++) {
14968         cbs[i].apply(null, args)
14969       }
14970     } finally {
14971       if (cbs.length > len) {
14972         // added more in the interim.
14973         // de-zalgo, just in case, but don't call again.
14974         cbs.splice(0, len)
14975         process.nextTick(function () {
14976           RES.apply(null, args)
14977         })
14978       } else {
14979         delete reqs[key]
14980       }
14981     }
14982   })
14983 }
14984
14985 function slice (args) {
14986   var length = args.length
14987   var array = []
14988
14989   for (var i = 0; i < length; i++) array[i] = args[i]
14990   return array
14991 }
14992
14993
14994 /***/ }),
14995 /* 73 */
14996 /***/ (function(module, exports) {
14997
14998 // Returns a wrapper function that returns a wrapped callback
14999 // The wrapper function should do some stuff, and return a
15000 // presumably different callback function.
15001 // This makes sure that own properties are retained, so that
15002 // decorations and such are not lost along the way.
15003 module.exports = wrappy
15004 function wrappy (fn, cb) {
15005   if (fn && cb) return wrappy(fn)(cb)
15006
15007   if (typeof fn !== 'function')
15008     throw new TypeError('need wrapper function')
15009
15010   Object.keys(fn).forEach(function (k) {
15011     wrapper[k] = fn[k]
15012   })
15013
15014   return wrapper
15015
15016   function wrapper() {
15017     var args = new Array(arguments.length)
15018     for (var i = 0; i < args.length; i++) {
15019       args[i] = arguments[i]
15020     }
15021     var ret = fn.apply(this, args)
15022     var cb = args[args.length-1]
15023     if (typeof ret === 'function' && ret !== cb) {
15024       Object.keys(cb).forEach(function (k) {
15025         ret[k] = cb[k]
15026       })
15027     }
15028     return ret
15029   }
15030 }
15031
15032
15033 /***/ }),
15034 /* 74 */
15035 /***/ (function(module, exports, __webpack_require__) {
15036
15037 var wrappy = __webpack_require__(73)
15038 module.exports = wrappy(once)
15039 module.exports.strict = wrappy(onceStrict)
15040
15041 once.proto = once(function () {
15042   Object.defineProperty(Function.prototype, 'once', {
15043     value: function () {
15044       return once(this)
15045     },
15046     configurable: true
15047   })
15048
15049   Object.defineProperty(Function.prototype, 'onceStrict', {
15050     value: function () {
15051       return onceStrict(this)
15052     },
15053     configurable: true
15054   })
15055 })
15056
15057 function once (fn) {
15058   var f = function () {
15059     if (f.called) return f.value
15060     f.called = true
15061     return f.value = fn.apply(this, arguments)
15062   }
15063   f.called = false
15064   return f
15065 }
15066
15067 function onceStrict (fn) {
15068   var f = function () {
15069     if (f.called)
15070       throw new Error(f.onceError)
15071     f.called = true
15072     return f.value = fn.apply(this, arguments)
15073   }
15074   var name = fn.name || 'Function wrapped with `once`'
15075   f.onceError = name + " shouldn't be called more than once"
15076   f.called = false
15077   return f
15078 }
15079
15080
15081 /***/ }),
15082 /* 75 */
15083 /***/ (function(module, exports, __webpack_require__) {
15084
15085 // just pre-load all the stuff that index.js lazily exports
15086 const internalRe = __webpack_require__(76)
15087 module.exports = {
15088   re: internalRe.re,
15089   src: internalRe.src,
15090   tokens: internalRe.t,
15091   SEMVER_SPEC_VERSION: __webpack_require__(77).SEMVER_SPEC_VERSION,
15092   SemVer: __webpack_require__(79),
15093   compareIdentifiers: __webpack_require__(80).compareIdentifiers,
15094   rcompareIdentifiers: __webpack_require__(80).rcompareIdentifiers,
15095   parse: __webpack_require__(81),
15096   valid: __webpack_require__(82),
15097   clean: __webpack_require__(83),
15098   inc: __webpack_require__(84),
15099   diff: __webpack_require__(85),
15100   major: __webpack_require__(88),
15101   minor: __webpack_require__(89),
15102   patch: __webpack_require__(90),
15103   prerelease: __webpack_require__(91),
15104   compare: __webpack_require__(87),
15105   rcompare: __webpack_require__(92),
15106   compareLoose: __webpack_require__(93),
15107   compareBuild: __webpack_require__(94),
15108   sort: __webpack_require__(95),
15109   rsort: __webpack_require__(96),
15110   gt: __webpack_require__(97),
15111   lt: __webpack_require__(98),
15112   eq: __webpack_require__(86),
15113   neq: __webpack_require__(99),
15114   gte: __webpack_require__(100),
15115   lte: __webpack_require__(101),
15116   cmp: __webpack_require__(102),
15117   coerce: __webpack_require__(103),
15118   Comparator: __webpack_require__(104),
15119   Range: __webpack_require__(105),
15120   satisfies: __webpack_require__(106),
15121   toComparators: __webpack_require__(107),
15122   maxSatisfying: __webpack_require__(108),
15123   minSatisfying: __webpack_require__(109),
15124   minVersion: __webpack_require__(110),
15125   validRange: __webpack_require__(111),
15126   outside: __webpack_require__(112),
15127   gtr: __webpack_require__(113),
15128   ltr: __webpack_require__(114),
15129   intersects: __webpack_require__(115),
15130   simplifyRange: __webpack_require__(116),
15131   subset: __webpack_require__(117),
15132 }
15133
15134
15135 /***/ }),
15136 /* 76 */
15137 /***/ (function(module, exports, __webpack_require__) {
15138
15139 const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(77)
15140 const debug = __webpack_require__(78)
15141 exports = module.exports = {}
15142
15143 // The actual regexps go on exports.re
15144 const re = exports.re = []
15145 const src = exports.src = []
15146 const t = exports.t = {}
15147 let R = 0
15148
15149 const createToken = (name, value, isGlobal) => {
15150   const index = R++
15151   debug(index, value)
15152   t[name] = index
15153   src[index] = value
15154   re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
15155 }
15156
15157 // The following Regular Expressions can be used for tokenizing,
15158 // validating, and parsing SemVer version strings.
15159
15160 // ## Numeric Identifier
15161 // A single `0`, or a non-zero digit followed by zero or more digits.
15162
15163 createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
15164 createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
15165
15166 // ## Non-numeric Identifier
15167 // Zero or more digits, followed by a letter or hyphen, and then zero or
15168 // more letters, digits, or hyphens.
15169
15170 createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
15171
15172 // ## Main Version
15173 // Three dot-separated numeric identifiers.
15174
15175 createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
15176                    `(${src[t.NUMERICIDENTIFIER]})\\.` +
15177                    `(${src[t.NUMERICIDENTIFIER]})`)
15178
15179 createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
15180                         `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
15181                         `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
15182
15183 // ## Pre-release Version Identifier
15184 // A numeric identifier, or a non-numeric identifier.
15185
15186 createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
15187 }|${src[t.NONNUMERICIDENTIFIER]})`)
15188
15189 createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
15190 }|${src[t.NONNUMERICIDENTIFIER]})`)
15191
15192 // ## Pre-release Version
15193 // Hyphen, followed by one or more dot-separated pre-release version
15194 // identifiers.
15195
15196 createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
15197 }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
15198
15199 createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
15200 }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
15201
15202 // ## Build Metadata Identifier
15203 // Any combination of digits, letters, or hyphens.
15204
15205 createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
15206
15207 // ## Build Metadata
15208 // Plus sign, followed by one or more period-separated build metadata
15209 // identifiers.
15210
15211 createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
15212 }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
15213
15214 // ## Full Version String
15215 // A main version, followed optionally by a pre-release version and
15216 // build metadata.
15217
15218 // Note that the only major, minor, patch, and pre-release sections of
15219 // the version string are capturing groups.  The build metadata is not a
15220 // capturing group, because it should not ever be used in version
15221 // comparison.
15222
15223 createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
15224 }${src[t.PRERELEASE]}?${
15225   src[t.BUILD]}?`)
15226
15227 createToken('FULL', `^${src[t.FULLPLAIN]}$`)
15228
15229 // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
15230 // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
15231 // common in the npm registry.
15232 createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
15233 }${src[t.PRERELEASELOOSE]}?${
15234   src[t.BUILD]}?`)
15235
15236 createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
15237
15238 createToken('GTLT', '((?:<|>)?=?)')
15239
15240 // Something like "2.*" or "1.2.x".
15241 // Note that "x.x" is a valid xRange identifer, meaning "any version"
15242 // Only the first item is strictly required.
15243 createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
15244 createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
15245
15246 createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
15247                    `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
15248                    `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
15249                    `(?:${src[t.PRERELEASE]})?${
15250                      src[t.BUILD]}?` +
15251                    `)?)?`)
15252
15253 createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15254                         `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15255                         `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15256                         `(?:${src[t.PRERELEASELOOSE]})?${
15257                           src[t.BUILD]}?` +
15258                         `)?)?`)
15259
15260 createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
15261 createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
15262
15263 // Coercion.
15264 // Extract anything that could conceivably be a part of a valid semver
15265 createToken('COERCE', `${'(^|[^\\d])' +
15266               '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
15267               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
15268               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
15269               `(?:$|[^\\d])`)
15270 createToken('COERCERTL', src[t.COERCE], true)
15271
15272 // Tilde ranges.
15273 // Meaning is "reasonably at or greater than"
15274 createToken('LONETILDE', '(?:~>?)')
15275
15276 createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
15277 exports.tildeTrimReplace = '$1~'
15278
15279 createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
15280 createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
15281
15282 // Caret ranges.
15283 // Meaning is "at least and backwards compatible with"
15284 createToken('LONECARET', '(?:\\^)')
15285
15286 createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
15287 exports.caretTrimReplace = '$1^'
15288
15289 createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
15290 createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
15291
15292 // A simple gt/lt/eq thing, or just "" to indicate "any version"
15293 createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
15294 createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
15295
15296 // An expression to strip any whitespace between the gtlt and the thing
15297 // it modifies, so that `> 1.2.3` ==> `>1.2.3`
15298 createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
15299 }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
15300 exports.comparatorTrimReplace = '$1$2$3'
15301
15302 // Something like `1.2.3 - 1.2.4`
15303 // Note that these all use the loose form, because they'll be
15304 // checked against either the strict or loose comparator form
15305 // later.
15306 createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
15307                    `\\s+-\\s+` +
15308                    `(${src[t.XRANGEPLAIN]})` +
15309                    `\\s*$`)
15310
15311 createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
15312                         `\\s+-\\s+` +
15313                         `(${src[t.XRANGEPLAINLOOSE]})` +
15314                         `\\s*$`)
15315
15316 // Star ranges basically just allow anything at all.
15317 createToken('STAR', '(<|>)?=?\\s*\\*')
15318 // >=0.0.0 is like a star
15319 createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
15320 createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
15321
15322
15323 /***/ }),
15324 /* 77 */
15325 /***/ (function(module, exports) {
15326
15327 // Note: this is the semver.org version of the spec that it implements
15328 // Not necessarily the package version of this code.
15329 const SEMVER_SPEC_VERSION = '2.0.0'
15330
15331 const MAX_LENGTH = 256
15332 const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
15333   /* istanbul ignore next */ 9007199254740991
15334
15335 // Max safe segment length for coercion.
15336 const MAX_SAFE_COMPONENT_LENGTH = 16
15337
15338 module.exports = {
15339   SEMVER_SPEC_VERSION,
15340   MAX_LENGTH,
15341   MAX_SAFE_INTEGER,
15342   MAX_SAFE_COMPONENT_LENGTH
15343 }
15344
15345
15346 /***/ }),
15347 /* 78 */
15348 /***/ (function(module, exports) {
15349
15350 const debug = (
15351   typeof process === 'object' &&
15352   process.env &&
15353   process.env.NODE_DEBUG &&
15354   /\bsemver\b/i.test(process.env.NODE_DEBUG)
15355 ) ? (...args) => console.error('SEMVER', ...args)
15356   : () => {}
15357
15358 module.exports = debug
15359
15360
15361 /***/ }),
15362 /* 79 */
15363 /***/ (function(module, exports, __webpack_require__) {
15364
15365 const debug = __webpack_require__(78)
15366 const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(77)
15367 const { re, t } = __webpack_require__(76)
15368
15369 const { compareIdentifiers } = __webpack_require__(80)
15370 class SemVer {
15371   constructor (version, options) {
15372     if (!options || typeof options !== 'object') {
15373       options = {
15374         loose: !!options,
15375         includePrerelease: false
15376       }
15377     }
15378     if (version instanceof SemVer) {
15379       if (version.loose === !!options.loose &&
15380           version.includePrerelease === !!options.includePrerelease) {
15381         return version
15382       } else {
15383         version = version.version
15384       }
15385     } else if (typeof version !== 'string') {
15386       throw new TypeError(`Invalid Version: ${version}`)
15387     }
15388
15389     if (version.length > MAX_LENGTH) {
15390       throw new TypeError(
15391         `version is longer than ${MAX_LENGTH} characters`
15392       )
15393     }
15394
15395     debug('SemVer', version, options)
15396     this.options = options
15397     this.loose = !!options.loose
15398     // this isn't actually relevant for versions, but keep it so that we
15399     // don't run into trouble passing this.options around.
15400     this.includePrerelease = !!options.includePrerelease
15401
15402     const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
15403
15404     if (!m) {
15405       throw new TypeError(`Invalid Version: ${version}`)
15406     }
15407
15408     this.raw = version
15409
15410     // these are actually numbers
15411     this.major = +m[1]
15412     this.minor = +m[2]
15413     this.patch = +m[3]
15414
15415     if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
15416       throw new TypeError('Invalid major version')
15417     }
15418
15419     if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
15420       throw new TypeError('Invalid minor version')
15421     }
15422
15423     if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
15424       throw new TypeError('Invalid patch version')
15425     }
15426
15427     // numberify any prerelease numeric ids
15428     if (!m[4]) {
15429       this.prerelease = []
15430     } else {
15431       this.prerelease = m[4].split('.').map((id) => {
15432         if (/^[0-9]+$/.test(id)) {
15433           const num = +id
15434           if (num >= 0 && num < MAX_SAFE_INTEGER) {
15435             return num
15436           }
15437         }
15438         return id
15439       })
15440     }
15441
15442     this.build = m[5] ? m[5].split('.') : []
15443     this.format()
15444   }
15445
15446   format () {
15447     this.version = `${this.major}.${this.minor}.${this.patch}`
15448     if (this.prerelease.length) {
15449       this.version += `-${this.prerelease.join('.')}`
15450     }
15451     return this.version
15452   }
15453
15454   toString () {
15455     return this.version
15456   }
15457
15458   compare (other) {
15459     debug('SemVer.compare', this.version, this.options, other)
15460     if (!(other instanceof SemVer)) {
15461       if (typeof other === 'string' && other === this.version) {
15462         return 0
15463       }
15464       other = new SemVer(other, this.options)
15465     }
15466
15467     if (other.version === this.version) {
15468       return 0
15469     }
15470
15471     return this.compareMain(other) || this.comparePre(other)
15472   }
15473
15474   compareMain (other) {
15475     if (!(other instanceof SemVer)) {
15476       other = new SemVer(other, this.options)
15477     }
15478
15479     return (
15480       compareIdentifiers(this.major, other.major) ||
15481       compareIdentifiers(this.minor, other.minor) ||
15482       compareIdentifiers(this.patch, other.patch)
15483     )
15484   }
15485
15486   comparePre (other) {
15487     if (!(other instanceof SemVer)) {
15488       other = new SemVer(other, this.options)
15489     }
15490
15491     // NOT having a prerelease is > having one
15492     if (this.prerelease.length && !other.prerelease.length) {
15493       return -1
15494     } else if (!this.prerelease.length && other.prerelease.length) {
15495       return 1
15496     } else if (!this.prerelease.length && !other.prerelease.length) {
15497       return 0
15498     }
15499
15500     let i = 0
15501     do {
15502       const a = this.prerelease[i]
15503       const b = other.prerelease[i]
15504       debug('prerelease compare', i, a, b)
15505       if (a === undefined && b === undefined) {
15506         return 0
15507       } else if (b === undefined) {
15508         return 1
15509       } else if (a === undefined) {
15510         return -1
15511       } else if (a === b) {
15512         continue
15513       } else {
15514         return compareIdentifiers(a, b)
15515       }
15516     } while (++i)
15517   }
15518
15519   compareBuild (other) {
15520     if (!(other instanceof SemVer)) {
15521       other = new SemVer(other, this.options)
15522     }
15523
15524     let i = 0
15525     do {
15526       const a = this.build[i]
15527       const b = other.build[i]
15528       debug('prerelease compare', i, a, b)
15529       if (a === undefined && b === undefined) {
15530         return 0
15531       } else if (b === undefined) {
15532         return 1
15533       } else if (a === undefined) {
15534         return -1
15535       } else if (a === b) {
15536         continue
15537       } else {
15538         return compareIdentifiers(a, b)
15539       }
15540     } while (++i)
15541   }
15542
15543   // preminor will bump the version up to the next minor release, and immediately
15544   // down to pre-release. premajor and prepatch work the same way.
15545   inc (release, identifier) {
15546     switch (release) {
15547       case 'premajor':
15548         this.prerelease.length = 0
15549         this.patch = 0
15550         this.minor = 0
15551         this.major++
15552         this.inc('pre', identifier)
15553         break
15554       case 'preminor':
15555         this.prerelease.length = 0
15556         this.patch = 0
15557         this.minor++
15558         this.inc('pre', identifier)
15559         break
15560       case 'prepatch':
15561         // If this is already a prerelease, it will bump to the next version
15562         // drop any prereleases that might already exist, since they are not
15563         // relevant at this point.
15564         this.prerelease.length = 0
15565         this.inc('patch', identifier)
15566         this.inc('pre', identifier)
15567         break
15568       // If the input is a non-prerelease version, this acts the same as
15569       // prepatch.
15570       case 'prerelease':
15571         if (this.prerelease.length === 0) {
15572           this.inc('patch', identifier)
15573         }
15574         this.inc('pre', identifier)
15575         break
15576
15577       case 'major':
15578         // If this is a pre-major version, bump up to the same major version.
15579         // Otherwise increment major.
15580         // 1.0.0-5 bumps to 1.0.0
15581         // 1.1.0 bumps to 2.0.0
15582         if (
15583           this.minor !== 0 ||
15584           this.patch !== 0 ||
15585           this.prerelease.length === 0
15586         ) {
15587           this.major++
15588         }
15589         this.minor = 0
15590         this.patch = 0
15591         this.prerelease = []
15592         break
15593       case 'minor':
15594         // If this is a pre-minor version, bump up to the same minor version.
15595         // Otherwise increment minor.
15596         // 1.2.0-5 bumps to 1.2.0
15597         // 1.2.1 bumps to 1.3.0
15598         if (this.patch !== 0 || this.prerelease.length === 0) {
15599           this.minor++
15600         }
15601         this.patch = 0
15602         this.prerelease = []
15603         break
15604       case 'patch':
15605         // If this is not a pre-release version, it will increment the patch.
15606         // If it is a pre-release it will bump up to the same patch version.
15607         // 1.2.0-5 patches to 1.2.0
15608         // 1.2.0 patches to 1.2.1
15609         if (this.prerelease.length === 0) {
15610           this.patch++
15611         }
15612         this.prerelease = []
15613         break
15614       // This probably shouldn't be used publicly.
15615       // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
15616       case 'pre':
15617         if (this.prerelease.length === 0) {
15618           this.prerelease = [0]
15619         } else {
15620           let i = this.prerelease.length
15621           while (--i >= 0) {
15622             if (typeof this.prerelease[i] === 'number') {
15623               this.prerelease[i]++
15624               i = -2
15625             }
15626           }
15627           if (i === -1) {
15628             // didn't increment anything
15629             this.prerelease.push(0)
15630           }
15631         }
15632         if (identifier) {
15633           // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
15634           // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
15635           if (this.prerelease[0] === identifier) {
15636             if (isNaN(this.prerelease[1])) {
15637               this.prerelease = [identifier, 0]
15638             }
15639           } else {
15640             this.prerelease = [identifier, 0]
15641           }
15642         }
15643         break
15644
15645       default:
15646         throw new Error(`invalid increment argument: ${release}`)
15647     }
15648     this.format()
15649     this.raw = this.version
15650     return this
15651   }
15652 }
15653
15654 module.exports = SemVer
15655
15656
15657 /***/ }),
15658 /* 80 */
15659 /***/ (function(module, exports) {
15660
15661 const numeric = /^[0-9]+$/
15662 const compareIdentifiers = (a, b) => {
15663   const anum = numeric.test(a)
15664   const bnum = numeric.test(b)
15665
15666   if (anum && bnum) {
15667     a = +a
15668     b = +b
15669   }
15670
15671   return a === b ? 0
15672     : (anum && !bnum) ? -1
15673     : (bnum && !anum) ? 1
15674     : a < b ? -1
15675     : 1
15676 }
15677
15678 const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
15679
15680 module.exports = {
15681   compareIdentifiers,
15682   rcompareIdentifiers
15683 }
15684
15685
15686 /***/ }),
15687 /* 81 */
15688 /***/ (function(module, exports, __webpack_require__) {
15689
15690 const {MAX_LENGTH} = __webpack_require__(77)
15691 const { re, t } = __webpack_require__(76)
15692 const SemVer = __webpack_require__(79)
15693
15694 const parse = (version, options) => {
15695   if (!options || typeof options !== 'object') {
15696     options = {
15697       loose: !!options,
15698       includePrerelease: false
15699     }
15700   }
15701
15702   if (version instanceof SemVer) {
15703     return version
15704   }
15705
15706   if (typeof version !== 'string') {
15707     return null
15708   }
15709
15710   if (version.length > MAX_LENGTH) {
15711     return null
15712   }
15713
15714   const r = options.loose ? re[t.LOOSE] : re[t.FULL]
15715   if (!r.test(version)) {
15716     return null
15717   }
15718
15719   try {
15720     return new SemVer(version, options)
15721   } catch (er) {
15722     return null
15723   }
15724 }
15725
15726 module.exports = parse
15727
15728
15729 /***/ }),
15730 /* 82 */
15731 /***/ (function(module, exports, __webpack_require__) {
15732
15733 const parse = __webpack_require__(81)
15734 const valid = (version, options) => {
15735   const v = parse(version, options)
15736   return v ? v.version : null
15737 }
15738 module.exports = valid
15739
15740
15741 /***/ }),
15742 /* 83 */
15743 /***/ (function(module, exports, __webpack_require__) {
15744
15745 const parse = __webpack_require__(81)
15746 const clean = (version, options) => {
15747   const s = parse(version.trim().replace(/^[=v]+/, ''), options)
15748   return s ? s.version : null
15749 }
15750 module.exports = clean
15751
15752
15753 /***/ }),
15754 /* 84 */
15755 /***/ (function(module, exports, __webpack_require__) {
15756
15757 const SemVer = __webpack_require__(79)
15758
15759 const inc = (version, release, options, identifier) => {
15760   if (typeof (options) === 'string') {
15761     identifier = options
15762     options = undefined
15763   }
15764
15765   try {
15766     return new SemVer(version, options).inc(release, identifier).version
15767   } catch (er) {
15768     return null
15769   }
15770 }
15771 module.exports = inc
15772
15773
15774 /***/ }),
15775 /* 85 */
15776 /***/ (function(module, exports, __webpack_require__) {
15777
15778 const parse = __webpack_require__(81)
15779 const eq = __webpack_require__(86)
15780
15781 const diff = (version1, version2) => {
15782   if (eq(version1, version2)) {
15783     return null
15784   } else {
15785     const v1 = parse(version1)
15786     const v2 = parse(version2)
15787     const hasPre = v1.prerelease.length || v2.prerelease.length
15788     const prefix = hasPre ? 'pre' : ''
15789     const defaultResult = hasPre ? 'prerelease' : ''
15790     for (const key in v1) {
15791       if (key === 'major' || key === 'minor' || key === 'patch') {
15792         if (v1[key] !== v2[key]) {
15793           return prefix + key
15794         }
15795       }
15796     }
15797     return defaultResult // may be undefined
15798   }
15799 }
15800 module.exports = diff
15801
15802
15803 /***/ }),
15804 /* 86 */
15805 /***/ (function(module, exports, __webpack_require__) {
15806
15807 const compare = __webpack_require__(87)
15808 const eq = (a, b, loose) => compare(a, b, loose) === 0
15809 module.exports = eq
15810
15811
15812 /***/ }),
15813 /* 87 */
15814 /***/ (function(module, exports, __webpack_require__) {
15815
15816 const SemVer = __webpack_require__(79)
15817 const compare = (a, b, loose) =>
15818   new SemVer(a, loose).compare(new SemVer(b, loose))
15819
15820 module.exports = compare
15821
15822
15823 /***/ }),
15824 /* 88 */
15825 /***/ (function(module, exports, __webpack_require__) {
15826
15827 const SemVer = __webpack_require__(79)
15828 const major = (a, loose) => new SemVer(a, loose).major
15829 module.exports = major
15830
15831
15832 /***/ }),
15833 /* 89 */
15834 /***/ (function(module, exports, __webpack_require__) {
15835
15836 const SemVer = __webpack_require__(79)
15837 const minor = (a, loose) => new SemVer(a, loose).minor
15838 module.exports = minor
15839
15840
15841 /***/ }),
15842 /* 90 */
15843 /***/ (function(module, exports, __webpack_require__) {
15844
15845 const SemVer = __webpack_require__(79)
15846 const patch = (a, loose) => new SemVer(a, loose).patch
15847 module.exports = patch
15848
15849
15850 /***/ }),
15851 /* 91 */
15852 /***/ (function(module, exports, __webpack_require__) {
15853
15854 const parse = __webpack_require__(81)
15855 const prerelease = (version, options) => {
15856   const parsed = parse(version, options)
15857   return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
15858 }
15859 module.exports = prerelease
15860
15861
15862 /***/ }),
15863 /* 92 */
15864 /***/ (function(module, exports, __webpack_require__) {
15865
15866 const compare = __webpack_require__(87)
15867 const rcompare = (a, b, loose) => compare(b, a, loose)
15868 module.exports = rcompare
15869
15870
15871 /***/ }),
15872 /* 93 */
15873 /***/ (function(module, exports, __webpack_require__) {
15874
15875 const compare = __webpack_require__(87)
15876 const compareLoose = (a, b) => compare(a, b, true)
15877 module.exports = compareLoose
15878
15879
15880 /***/ }),
15881 /* 94 */
15882 /***/ (function(module, exports, __webpack_require__) {
15883
15884 const SemVer = __webpack_require__(79)
15885 const compareBuild = (a, b, loose) => {
15886   const versionA = new SemVer(a, loose)
15887   const versionB = new SemVer(b, loose)
15888   return versionA.compare(versionB) || versionA.compareBuild(versionB)
15889 }
15890 module.exports = compareBuild
15891
15892
15893 /***/ }),
15894 /* 95 */
15895 /***/ (function(module, exports, __webpack_require__) {
15896
15897 const compareBuild = __webpack_require__(94)
15898 const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
15899 module.exports = sort
15900
15901
15902 /***/ }),
15903 /* 96 */
15904 /***/ (function(module, exports, __webpack_require__) {
15905
15906 const compareBuild = __webpack_require__(94)
15907 const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
15908 module.exports = rsort
15909
15910
15911 /***/ }),
15912 /* 97 */
15913 /***/ (function(module, exports, __webpack_require__) {
15914
15915 const compare = __webpack_require__(87)
15916 const gt = (a, b, loose) => compare(a, b, loose) > 0
15917 module.exports = gt
15918
15919
15920 /***/ }),
15921 /* 98 */
15922 /***/ (function(module, exports, __webpack_require__) {
15923
15924 const compare = __webpack_require__(87)
15925 const lt = (a, b, loose) => compare(a, b, loose) < 0
15926 module.exports = lt
15927
15928
15929 /***/ }),
15930 /* 99 */
15931 /***/ (function(module, exports, __webpack_require__) {
15932
15933 const compare = __webpack_require__(87)
15934 const neq = (a, b, loose) => compare(a, b, loose) !== 0
15935 module.exports = neq
15936
15937
15938 /***/ }),
15939 /* 100 */
15940 /***/ (function(module, exports, __webpack_require__) {
15941
15942 const compare = __webpack_require__(87)
15943 const gte = (a, b, loose) => compare(a, b, loose) >= 0
15944 module.exports = gte
15945
15946
15947 /***/ }),
15948 /* 101 */
15949 /***/ (function(module, exports, __webpack_require__) {
15950
15951 const compare = __webpack_require__(87)
15952 const lte = (a, b, loose) => compare(a, b, loose) <= 0
15953 module.exports = lte
15954
15955
15956 /***/ }),
15957 /* 102 */
15958 /***/ (function(module, exports, __webpack_require__) {
15959
15960 const eq = __webpack_require__(86)
15961 const neq = __webpack_require__(99)
15962 const gt = __webpack_require__(97)
15963 const gte = __webpack_require__(100)
15964 const lt = __webpack_require__(98)
15965 const lte = __webpack_require__(101)
15966
15967 const cmp = (a, op, b, loose) => {
15968   switch (op) {
15969     case '===':
15970       if (typeof a === 'object')
15971         a = a.version
15972       if (typeof b === 'object')
15973         b = b.version
15974       return a === b
15975
15976     case '!==':
15977       if (typeof a === 'object')
15978         a = a.version
15979       if (typeof b === 'object')
15980         b = b.version
15981       return a !== b
15982
15983     case '':
15984     case '=':
15985     case '==':
15986       return eq(a, b, loose)
15987
15988     case '!=':
15989       return neq(a, b, loose)
15990
15991     case '>':
15992       return gt(a, b, loose)
15993
15994     case '>=':
15995       return gte(a, b, loose)
15996
15997     case '<':
15998       return lt(a, b, loose)
15999
16000     case '<=':
16001       return lte(a, b, loose)
16002
16003     default:
16004       throw new TypeError(`Invalid operator: ${op}`)
16005   }
16006 }
16007 module.exports = cmp
16008
16009
16010 /***/ }),
16011 /* 103 */
16012 /***/ (function(module, exports, __webpack_require__) {
16013
16014 const SemVer = __webpack_require__(79)
16015 const parse = __webpack_require__(81)
16016 const {re, t} = __webpack_require__(76)
16017
16018 const coerce = (version, options) => {
16019   if (version instanceof SemVer) {
16020     return version
16021   }
16022
16023   if (typeof version === 'number') {
16024     version = String(version)
16025   }
16026
16027   if (typeof version !== 'string') {
16028     return null
16029   }
16030
16031   options = options || {}
16032
16033   let match = null
16034   if (!options.rtl) {
16035     match = version.match(re[t.COERCE])
16036   } else {
16037     // Find the right-most coercible string that does not share
16038     // a terminus with a more left-ward coercible string.
16039     // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
16040     //
16041     // Walk through the string checking with a /g regexp
16042     // Manually set the index so as to pick up overlapping matches.
16043     // Stop when we get a match that ends at the string end, since no
16044     // coercible string can be more right-ward without the same terminus.
16045     let next
16046     while ((next = re[t.COERCERTL].exec(version)) &&
16047         (!match || match.index + match[0].length !== version.length)
16048     ) {
16049       if (!match ||
16050             next.index + next[0].length !== match.index + match[0].length) {
16051         match = next
16052       }
16053       re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
16054     }
16055     // leave it in a clean state
16056     re[t.COERCERTL].lastIndex = -1
16057   }
16058
16059   if (match === null)
16060     return null
16061
16062   return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
16063 }
16064 module.exports = coerce
16065
16066
16067 /***/ }),
16068 /* 104 */
16069 /***/ (function(module, exports, __webpack_require__) {
16070
16071 const ANY = Symbol('SemVer ANY')
16072 // hoisted class for cyclic dependency
16073 class Comparator {
16074   static get ANY () {
16075     return ANY
16076   }
16077   constructor (comp, options) {
16078     if (!options || typeof options !== 'object') {
16079       options = {
16080         loose: !!options,
16081         includePrerelease: false
16082       }
16083     }
16084
16085     if (comp instanceof Comparator) {
16086       if (comp.loose === !!options.loose) {
16087         return comp
16088       } else {
16089         comp = comp.value
16090       }
16091     }
16092
16093     debug('comparator', comp, options)
16094     this.options = options
16095     this.loose = !!options.loose
16096     this.parse(comp)
16097
16098     if (this.semver === ANY) {
16099       this.value = ''
16100     } else {
16101       this.value = this.operator + this.semver.version
16102     }
16103
16104     debug('comp', this)
16105   }
16106
16107   parse (comp) {
16108     const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
16109     const m = comp.match(r)
16110
16111     if (!m) {
16112       throw new TypeError(`Invalid comparator: ${comp}`)
16113     }
16114
16115     this.operator = m[1] !== undefined ? m[1] : ''
16116     if (this.operator === '=') {
16117       this.operator = ''
16118     }
16119
16120     // if it literally is just '>' or '' then allow anything.
16121     if (!m[2]) {
16122       this.semver = ANY
16123     } else {
16124       this.semver = new SemVer(m[2], this.options.loose)
16125     }
16126   }
16127
16128   toString () {
16129     return this.value
16130   }
16131
16132   test (version) {
16133     debug('Comparator.test', version, this.options.loose)
16134
16135     if (this.semver === ANY || version === ANY) {
16136       return true
16137     }
16138
16139     if (typeof version === 'string') {
16140       try {
16141         version = new SemVer(version, this.options)
16142       } catch (er) {
16143         return false
16144       }
16145     }
16146
16147     return cmp(version, this.operator, this.semver, this.options)
16148   }
16149
16150   intersects (comp, options) {
16151     if (!(comp instanceof Comparator)) {
16152       throw new TypeError('a Comparator is required')
16153     }
16154
16155     if (!options || typeof options !== 'object') {
16156       options = {
16157         loose: !!options,
16158         includePrerelease: false
16159       }
16160     }
16161
16162     if (this.operator === '') {
16163       if (this.value === '') {
16164         return true
16165       }
16166       return new Range(comp.value, options).test(this.value)
16167     } else if (comp.operator === '') {
16168       if (comp.value === '') {
16169         return true
16170       }
16171       return new Range(this.value, options).test(comp.semver)
16172     }
16173
16174     const sameDirectionIncreasing =
16175       (this.operator === '>=' || this.operator === '>') &&
16176       (comp.operator === '>=' || comp.operator === '>')
16177     const sameDirectionDecreasing =
16178       (this.operator === '<=' || this.operator === '<') &&
16179       (comp.operator === '<=' || comp.operator === '<')
16180     const sameSemVer = this.semver.version === comp.semver.version
16181     const differentDirectionsInclusive =
16182       (this.operator === '>=' || this.operator === '<=') &&
16183       (comp.operator === '>=' || comp.operator === '<=')
16184     const oppositeDirectionsLessThan =
16185       cmp(this.semver, '<', comp.semver, options) &&
16186       (this.operator === '>=' || this.operator === '>') &&
16187         (comp.operator === '<=' || comp.operator === '<')
16188     const oppositeDirectionsGreaterThan =
16189       cmp(this.semver, '>', comp.semver, options) &&
16190       (this.operator === '<=' || this.operator === '<') &&
16191         (comp.operator === '>=' || comp.operator === '>')
16192
16193     return (
16194       sameDirectionIncreasing ||
16195       sameDirectionDecreasing ||
16196       (sameSemVer && differentDirectionsInclusive) ||
16197       oppositeDirectionsLessThan ||
16198       oppositeDirectionsGreaterThan
16199     )
16200   }
16201 }
16202
16203 module.exports = Comparator
16204
16205 const {re, t} = __webpack_require__(76)
16206 const cmp = __webpack_require__(102)
16207 const debug = __webpack_require__(78)
16208 const SemVer = __webpack_require__(79)
16209 const Range = __webpack_require__(105)
16210
16211
16212 /***/ }),
16213 /* 105 */
16214 /***/ (function(module, exports, __webpack_require__) {
16215
16216 // hoisted class for cyclic dependency
16217 class Range {
16218   constructor (range, options) {
16219     if (!options || typeof options !== 'object') {
16220       options = {
16221         loose: !!options,
16222         includePrerelease: false
16223       }
16224     }
16225
16226     if (range instanceof Range) {
16227       if (
16228         range.loose === !!options.loose &&
16229         range.includePrerelease === !!options.includePrerelease
16230       ) {
16231         return range
16232       } else {
16233         return new Range(range.raw, options)
16234       }
16235     }
16236
16237     if (range instanceof Comparator) {
16238       // just put it in the set and return
16239       this.raw = range.value
16240       this.set = [[range]]
16241       this.format()
16242       return this
16243     }
16244
16245     this.options = options
16246     this.loose = !!options.loose
16247     this.includePrerelease = !!options.includePrerelease
16248
16249     // First, split based on boolean or ||
16250     this.raw = range
16251     this.set = range
16252       .split(/\s*\|\|\s*/)
16253       // map the range to a 2d array of comparators
16254       .map(range => this.parseRange(range.trim()))
16255       // throw out any comparator lists that are empty
16256       // this generally means that it was not a valid range, which is allowed
16257       // in loose mode, but will still throw if the WHOLE range is invalid.
16258       .filter(c => c.length)
16259
16260     if (!this.set.length) {
16261       throw new TypeError(`Invalid SemVer Range: ${range}`)
16262     }
16263
16264     this.format()
16265   }
16266
16267   format () {
16268     this.range = this.set
16269       .map((comps) => {
16270         return comps.join(' ').trim()
16271       })
16272       .join('||')
16273       .trim()
16274     return this.range
16275   }
16276
16277   toString () {
16278     return this.range
16279   }
16280
16281   parseRange (range) {
16282     const loose = this.options.loose
16283     range = range.trim()
16284     // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
16285     const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
16286     range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
16287     debug('hyphen replace', range)
16288     // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
16289     range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
16290     debug('comparator trim', range, re[t.COMPARATORTRIM])
16291
16292     // `~ 1.2.3` => `~1.2.3`
16293     range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
16294
16295     // `^ 1.2.3` => `^1.2.3`
16296     range = range.replace(re[t.CARETTRIM], caretTrimReplace)
16297
16298     // normalize spaces
16299     range = range.split(/\s+/).join(' ')
16300
16301     // At this point, the range is completely trimmed and
16302     // ready to be split into comparators.
16303
16304     const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
16305     return range
16306       .split(' ')
16307       .map(comp => parseComparator(comp, this.options))
16308       .join(' ')
16309       .split(/\s+/)
16310       .map(comp => replaceGTE0(comp, this.options))
16311       // in loose mode, throw out any that are not valid comparators
16312       .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
16313       .map(comp => new Comparator(comp, this.options))
16314   }
16315
16316   intersects (range, options) {
16317     if (!(range instanceof Range)) {
16318       throw new TypeError('a Range is required')
16319     }
16320
16321     return this.set.some((thisComparators) => {
16322       return (
16323         isSatisfiable(thisComparators, options) &&
16324         range.set.some((rangeComparators) => {
16325           return (
16326             isSatisfiable(rangeComparators, options) &&
16327             thisComparators.every((thisComparator) => {
16328               return rangeComparators.every((rangeComparator) => {
16329                 return thisComparator.intersects(rangeComparator, options)
16330               })
16331             })
16332           )
16333         })
16334       )
16335     })
16336   }
16337
16338   // if ANY of the sets match ALL of its comparators, then pass
16339   test (version) {
16340     if (!version) {
16341       return false
16342     }
16343
16344     if (typeof version === 'string') {
16345       try {
16346         version = new SemVer(version, this.options)
16347       } catch (er) {
16348         return false
16349       }
16350     }
16351
16352     for (let i = 0; i < this.set.length; i++) {
16353       if (testSet(this.set[i], version, this.options)) {
16354         return true
16355       }
16356     }
16357     return false
16358   }
16359 }
16360 module.exports = Range
16361
16362 const Comparator = __webpack_require__(104)
16363 const debug = __webpack_require__(78)
16364 const SemVer = __webpack_require__(79)
16365 const {
16366   re,
16367   t,
16368   comparatorTrimReplace,
16369   tildeTrimReplace,
16370   caretTrimReplace
16371 } = __webpack_require__(76)
16372
16373 // take a set of comparators and determine whether there
16374 // exists a version which can satisfy it
16375 const isSatisfiable = (comparators, options) => {
16376   let result = true
16377   const remainingComparators = comparators.slice()
16378   let testComparator = remainingComparators.pop()
16379
16380   while (result && remainingComparators.length) {
16381     result = remainingComparators.every((otherComparator) => {
16382       return testComparator.intersects(otherComparator, options)
16383     })
16384
16385     testComparator = remainingComparators.pop()
16386   }
16387
16388   return result
16389 }
16390
16391 // comprised of xranges, tildes, stars, and gtlt's at this point.
16392 // already replaced the hyphen ranges
16393 // turn into a set of JUST comparators.
16394 const parseComparator = (comp, options) => {
16395   debug('comp', comp, options)
16396   comp = replaceCarets(comp, options)
16397   debug('caret', comp)
16398   comp = replaceTildes(comp, options)
16399   debug('tildes', comp)
16400   comp = replaceXRanges(comp, options)
16401   debug('xrange', comp)
16402   comp = replaceStars(comp, options)
16403   debug('stars', comp)
16404   return comp
16405 }
16406
16407 const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
16408
16409 // ~, ~> --> * (any, kinda silly)
16410 // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
16411 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
16412 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
16413 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
16414 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
16415 const replaceTildes = (comp, options) =>
16416   comp.trim().split(/\s+/).map((comp) => {
16417     return replaceTilde(comp, options)
16418   }).join(' ')
16419
16420 const replaceTilde = (comp, options) => {
16421   const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
16422   return comp.replace(r, (_, M, m, p, pr) => {
16423     debug('tilde', comp, _, M, m, p, pr)
16424     let ret
16425
16426     if (isX(M)) {
16427       ret = ''
16428     } else if (isX(m)) {
16429       ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
16430     } else if (isX(p)) {
16431       // ~1.2 == >=1.2.0 <1.3.0-0
16432       ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
16433     } else if (pr) {
16434       debug('replaceTilde pr', pr)
16435       ret = `>=${M}.${m}.${p}-${pr
16436       } <${M}.${+m + 1}.0-0`
16437     } else {
16438       // ~1.2.3 == >=1.2.3 <1.3.0-0
16439       ret = `>=${M}.${m}.${p
16440       } <${M}.${+m + 1}.0-0`
16441     }
16442
16443     debug('tilde return', ret)
16444     return ret
16445   })
16446 }
16447
16448 // ^ --> * (any, kinda silly)
16449 // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
16450 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
16451 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
16452 // ^1.2.3 --> >=1.2.3 <2.0.0-0
16453 // ^1.2.0 --> >=1.2.0 <2.0.0-0
16454 const replaceCarets = (comp, options) =>
16455   comp.trim().split(/\s+/).map((comp) => {
16456     return replaceCaret(comp, options)
16457   }).join(' ')
16458
16459 const replaceCaret = (comp, options) => {
16460   debug('caret', comp, options)
16461   const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
16462   const z = options.includePrerelease ? '-0' : ''
16463   return comp.replace(r, (_, M, m, p, pr) => {
16464     debug('caret', comp, _, M, m, p, pr)
16465     let ret
16466
16467     if (isX(M)) {
16468       ret = ''
16469     } else if (isX(m)) {
16470       ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
16471     } else if (isX(p)) {
16472       if (M === '0') {
16473         ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
16474       } else {
16475         ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
16476       }
16477     } else if (pr) {
16478       debug('replaceCaret pr', pr)
16479       if (M === '0') {
16480         if (m === '0') {
16481           ret = `>=${M}.${m}.${p}-${pr
16482           } <${M}.${m}.${+p + 1}-0`
16483         } else {
16484           ret = `>=${M}.${m}.${p}-${pr
16485           } <${M}.${+m + 1}.0-0`
16486         }
16487       } else {
16488         ret = `>=${M}.${m}.${p}-${pr
16489         } <${+M + 1}.0.0-0`
16490       }
16491     } else {
16492       debug('no pr')
16493       if (M === '0') {
16494         if (m === '0') {
16495           ret = `>=${M}.${m}.${p
16496           }${z} <${M}.${m}.${+p + 1}-0`
16497         } else {
16498           ret = `>=${M}.${m}.${p
16499           }${z} <${M}.${+m + 1}.0-0`
16500         }
16501       } else {
16502         ret = `>=${M}.${m}.${p
16503         } <${+M + 1}.0.0-0`
16504       }
16505     }
16506
16507     debug('caret return', ret)
16508     return ret
16509   })
16510 }
16511
16512 const replaceXRanges = (comp, options) => {
16513   debug('replaceXRanges', comp, options)
16514   return comp.split(/\s+/).map((comp) => {
16515     return replaceXRange(comp, options)
16516   }).join(' ')
16517 }
16518
16519 const replaceXRange = (comp, options) => {
16520   comp = comp.trim()
16521   const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
16522   return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
16523     debug('xRange', comp, ret, gtlt, M, m, p, pr)
16524     const xM = isX(M)
16525     const xm = xM || isX(m)
16526     const xp = xm || isX(p)
16527     const anyX = xp
16528
16529     if (gtlt === '=' && anyX) {
16530       gtlt = ''
16531     }
16532
16533     // if we're including prereleases in the match, then we need
16534     // to fix this to -0, the lowest possible prerelease value
16535     pr = options.includePrerelease ? '-0' : ''
16536
16537     if (xM) {
16538       if (gtlt === '>' || gtlt === '<') {
16539         // nothing is allowed
16540         ret = '<0.0.0-0'
16541       } else {
16542         // nothing is forbidden
16543         ret = '*'
16544       }
16545     } else if (gtlt && anyX) {
16546       // we know patch is an x, because we have any x at all.
16547       // replace X with 0
16548       if (xm) {
16549         m = 0
16550       }
16551       p = 0
16552
16553       if (gtlt === '>') {
16554         // >1 => >=2.0.0
16555         // >1.2 => >=1.3.0
16556         gtlt = '>='
16557         if (xm) {
16558           M = +M + 1
16559           m = 0
16560           p = 0
16561         } else {
16562           m = +m + 1
16563           p = 0
16564         }
16565       } else if (gtlt === '<=') {
16566         // <=0.7.x is actually <0.8.0, since any 0.7.x should
16567         // pass.  Similarly, <=7.x is actually <8.0.0, etc.
16568         gtlt = '<'
16569         if (xm) {
16570           M = +M + 1
16571         } else {
16572           m = +m + 1
16573         }
16574       }
16575
16576       if (gtlt === '<')
16577         pr = '-0'
16578
16579       ret = `${gtlt + M}.${m}.${p}${pr}`
16580     } else if (xm) {
16581       ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
16582     } else if (xp) {
16583       ret = `>=${M}.${m}.0${pr
16584       } <${M}.${+m + 1}.0-0`
16585     }
16586
16587     debug('xRange return', ret)
16588
16589     return ret
16590   })
16591 }
16592
16593 // Because * is AND-ed with everything else in the comparator,
16594 // and '' means "any version", just remove the *s entirely.
16595 const replaceStars = (comp, options) => {
16596   debug('replaceStars', comp, options)
16597   // Looseness is ignored here.  star is always as loose as it gets!
16598   return comp.trim().replace(re[t.STAR], '')
16599 }
16600
16601 const replaceGTE0 = (comp, options) => {
16602   debug('replaceGTE0', comp, options)
16603   return comp.trim()
16604     .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
16605 }
16606
16607 // This function is passed to string.replace(re[t.HYPHENRANGE])
16608 // M, m, patch, prerelease, build
16609 // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
16610 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
16611 // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
16612 const hyphenReplace = incPr => ($0,
16613   from, fM, fm, fp, fpr, fb,
16614   to, tM, tm, tp, tpr, tb) => {
16615   if (isX(fM)) {
16616     from = ''
16617   } else if (isX(fm)) {
16618     from = `>=${fM}.0.0${incPr ? '-0' : ''}`
16619   } else if (isX(fp)) {
16620     from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
16621   } else if (fpr) {
16622     from = `>=${from}`
16623   } else {
16624     from = `>=${from}${incPr ? '-0' : ''}`
16625   }
16626
16627   if (isX(tM)) {
16628     to = ''
16629   } else if (isX(tm)) {
16630     to = `<${+tM + 1}.0.0-0`
16631   } else if (isX(tp)) {
16632     to = `<${tM}.${+tm + 1}.0-0`
16633   } else if (tpr) {
16634     to = `<=${tM}.${tm}.${tp}-${tpr}`
16635   } else if (incPr) {
16636     to = `<${tM}.${tm}.${+tp + 1}-0`
16637   } else {
16638     to = `<=${to}`
16639   }
16640
16641   return (`${from} ${to}`).trim()
16642 }
16643
16644 const testSet = (set, version, options) => {
16645   for (let i = 0; i < set.length; i++) {
16646     if (!set[i].test(version)) {
16647       return false
16648     }
16649   }
16650
16651   if (version.prerelease.length && !options.includePrerelease) {
16652     // Find the set of versions that are allowed to have prereleases
16653     // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
16654     // That should allow `1.2.3-pr.2` to pass.
16655     // However, `1.2.4-alpha.notready` should NOT be allowed,
16656     // even though it's within the range set by the comparators.
16657     for (let i = 0; i < set.length; i++) {
16658       debug(set[i].semver)
16659       if (set[i].semver === Comparator.ANY) {
16660         continue
16661       }
16662
16663       if (set[i].semver.prerelease.length > 0) {
16664         const allowed = set[i].semver
16665         if (allowed.major === version.major &&
16666             allowed.minor === version.minor &&
16667             allowed.patch === version.patch) {
16668           return true
16669         }
16670       }
16671     }
16672
16673     // Version has a -pre, but it's not one of the ones we like.
16674     return false
16675   }
16676
16677   return true
16678 }
16679
16680
16681 /***/ }),
16682 /* 106 */
16683 /***/ (function(module, exports, __webpack_require__) {
16684
16685 const Range = __webpack_require__(105)
16686 const satisfies = (version, range, options) => {
16687   try {
16688     range = new Range(range, options)
16689   } catch (er) {
16690     return false
16691   }
16692   return range.test(version)
16693 }
16694 module.exports = satisfies
16695
16696
16697 /***/ }),
16698 /* 107 */
16699 /***/ (function(module, exports, __webpack_require__) {
16700
16701 const Range = __webpack_require__(105)
16702
16703 // Mostly just for testing and legacy API reasons
16704 const toComparators = (range, options) =>
16705   new Range(range, options).set
16706     .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
16707
16708 module.exports = toComparators
16709
16710
16711 /***/ }),
16712 /* 108 */
16713 /***/ (function(module, exports, __webpack_require__) {
16714
16715 const SemVer = __webpack_require__(79)
16716 const Range = __webpack_require__(105)
16717
16718 const maxSatisfying = (versions, range, options) => {
16719   let max = null
16720   let maxSV = null
16721   let rangeObj = null
16722   try {
16723     rangeObj = new Range(range, options)
16724   } catch (er) {
16725     return null
16726   }
16727   versions.forEach((v) => {
16728     if (rangeObj.test(v)) {
16729       // satisfies(v, range, options)
16730       if (!max || maxSV.compare(v) === -1) {
16731         // compare(max, v, true)
16732         max = v
16733         maxSV = new SemVer(max, options)
16734       }
16735     }
16736   })
16737   return max
16738 }
16739 module.exports = maxSatisfying
16740
16741
16742 /***/ }),
16743 /* 109 */
16744 /***/ (function(module, exports, __webpack_require__) {
16745
16746 const SemVer = __webpack_require__(79)
16747 const Range = __webpack_require__(105)
16748 const minSatisfying = (versions, range, options) => {
16749   let min = null
16750   let minSV = null
16751   let rangeObj = null
16752   try {
16753     rangeObj = new Range(range, options)
16754   } catch (er) {
16755     return null
16756   }
16757   versions.forEach((v) => {
16758     if (rangeObj.test(v)) {
16759       // satisfies(v, range, options)
16760       if (!min || minSV.compare(v) === 1) {
16761         // compare(min, v, true)
16762         min = v
16763         minSV = new SemVer(min, options)
16764       }
16765     }
16766   })
16767   return min
16768 }
16769 module.exports = minSatisfying
16770
16771
16772 /***/ }),
16773 /* 110 */
16774 /***/ (function(module, exports, __webpack_require__) {
16775
16776 const SemVer = __webpack_require__(79)
16777 const Range = __webpack_require__(105)
16778 const gt = __webpack_require__(97)
16779
16780 const minVersion = (range, loose) => {
16781   range = new Range(range, loose)
16782
16783   let minver = new SemVer('0.0.0')
16784   if (range.test(minver)) {
16785     return minver
16786   }
16787
16788   minver = new SemVer('0.0.0-0')
16789   if (range.test(minver)) {
16790     return minver
16791   }
16792
16793   minver = null
16794   for (let i = 0; i < range.set.length; ++i) {
16795     const comparators = range.set[i]
16796
16797     comparators.forEach((comparator) => {
16798       // Clone to avoid manipulating the comparator's semver object.
16799       const compver = new SemVer(comparator.semver.version)
16800       switch (comparator.operator) {
16801         case '>':
16802           if (compver.prerelease.length === 0) {
16803             compver.patch++
16804           } else {
16805             compver.prerelease.push(0)
16806           }
16807           compver.raw = compver.format()
16808           /* fallthrough */
16809         case '':
16810         case '>=':
16811           if (!minver || gt(minver, compver)) {
16812             minver = compver
16813           }
16814           break
16815         case '<':
16816         case '<=':
16817           /* Ignore maximum versions */
16818           break
16819         /* istanbul ignore next */
16820         default:
16821           throw new Error(`Unexpected operation: ${comparator.operator}`)
16822       }
16823     })
16824   }
16825
16826   if (minver && range.test(minver)) {
16827     return minver
16828   }
16829
16830   return null
16831 }
16832 module.exports = minVersion
16833
16834
16835 /***/ }),
16836 /* 111 */
16837 /***/ (function(module, exports, __webpack_require__) {
16838
16839 const Range = __webpack_require__(105)
16840 const validRange = (range, options) => {
16841   try {
16842     // Return '*' instead of '' so that truthiness works.
16843     // This will throw if it's invalid anyway
16844     return new Range(range, options).range || '*'
16845   } catch (er) {
16846     return null
16847   }
16848 }
16849 module.exports = validRange
16850
16851
16852 /***/ }),
16853 /* 112 */
16854 /***/ (function(module, exports, __webpack_require__) {
16855
16856 const SemVer = __webpack_require__(79)
16857 const Comparator = __webpack_require__(104)
16858 const {ANY} = Comparator
16859 const Range = __webpack_require__(105)
16860 const satisfies = __webpack_require__(106)
16861 const gt = __webpack_require__(97)
16862 const lt = __webpack_require__(98)
16863 const lte = __webpack_require__(101)
16864 const gte = __webpack_require__(100)
16865
16866 const outside = (version, range, hilo, options) => {
16867   version = new SemVer(version, options)
16868   range = new Range(range, options)
16869
16870   let gtfn, ltefn, ltfn, comp, ecomp
16871   switch (hilo) {
16872     case '>':
16873       gtfn = gt
16874       ltefn = lte
16875       ltfn = lt
16876       comp = '>'
16877       ecomp = '>='
16878       break
16879     case '<':
16880       gtfn = lt
16881       ltefn = gte
16882       ltfn = gt
16883       comp = '<'
16884       ecomp = '<='
16885       break
16886     default:
16887       throw new TypeError('Must provide a hilo val of "<" or ">"')
16888   }
16889
16890   // If it satisifes the range it is not outside
16891   if (satisfies(version, range, options)) {
16892     return false
16893   }
16894
16895   // From now on, variable terms are as if we're in "gtr" mode.
16896   // but note that everything is flipped for the "ltr" function.
16897
16898   for (let i = 0; i < range.set.length; ++i) {
16899     const comparators = range.set[i]
16900
16901     let high = null
16902     let low = null
16903
16904     comparators.forEach((comparator) => {
16905       if (comparator.semver === ANY) {
16906         comparator = new Comparator('>=0.0.0')
16907       }
16908       high = high || comparator
16909       low = low || comparator
16910       if (gtfn(comparator.semver, high.semver, options)) {
16911         high = comparator
16912       } else if (ltfn(comparator.semver, low.semver, options)) {
16913         low = comparator
16914       }
16915     })
16916
16917     // If the edge version comparator has a operator then our version
16918     // isn't outside it
16919     if (high.operator === comp || high.operator === ecomp) {
16920       return false
16921     }
16922
16923     // If the lowest version comparator has an operator and our version
16924     // is less than it then it isn't higher than the range
16925     if ((!low.operator || low.operator === comp) &&
16926         ltefn(version, low.semver)) {
16927       return false
16928     } else if (low.operator === ecomp && ltfn(version, low.semver)) {
16929       return false
16930     }
16931   }
16932   return true
16933 }
16934
16935 module.exports = outside
16936
16937
16938 /***/ }),
16939 /* 113 */
16940 /***/ (function(module, exports, __webpack_require__) {
16941
16942 // Determine if version is greater than all the versions possible in the range.
16943 const outside = __webpack_require__(112)
16944 const gtr = (version, range, options) => outside(version, range, '>', options)
16945 module.exports = gtr
16946
16947
16948 /***/ }),
16949 /* 114 */
16950 /***/ (function(module, exports, __webpack_require__) {
16951
16952 const outside = __webpack_require__(112)
16953 // Determine if version is less than all the versions possible in the range
16954 const ltr = (version, range, options) => outside(version, range, '<', options)
16955 module.exports = ltr
16956
16957
16958 /***/ }),
16959 /* 115 */
16960 /***/ (function(module, exports, __webpack_require__) {
16961
16962 const Range = __webpack_require__(105)
16963 const intersects = (r1, r2, options) => {
16964   r1 = new Range(r1, options)
16965   r2 = new Range(r2, options)
16966   return r1.intersects(r2)
16967 }
16968 module.exports = intersects
16969
16970
16971 /***/ }),
16972 /* 116 */
16973 /***/ (function(module, exports, __webpack_require__) {
16974
16975 // given a set of versions and a range, create a "simplified" range
16976 // that includes the same versions that the original range does
16977 // If the original range is shorter than the simplified one, return that.
16978 const satisfies = __webpack_require__(106)
16979 const compare = __webpack_require__(87)
16980 module.exports = (versions, range, options) => {
16981   const set = []
16982   let min = null
16983   let prev = null
16984   const v = versions.sort((a, b) => compare(a, b, options))
16985   for (const version of v) {
16986     const included = satisfies(version, range, options)
16987     if (included) {
16988       prev = version
16989       if (!min)
16990         min = version
16991     } else {
16992       if (prev) {
16993         set.push([min, prev])
16994       }
16995       prev = null
16996       min = null
16997     }
16998   }
16999   if (min)
17000     set.push([min, null])
17001
17002   const ranges = []
17003   for (const [min, max] of set) {
17004     if (min === max)
17005       ranges.push(min)
17006     else if (!max && min === v[0])
17007       ranges.push('*')
17008     else if (!max)
17009       ranges.push(`>=${min}`)
17010     else if (min === v[0])
17011       ranges.push(`<=${max}`)
17012     else
17013       ranges.push(`${min} - ${max}`)
17014   }
17015   const simplified = ranges.join(' || ')
17016   const original = typeof range.raw === 'string' ? range.raw : String(range)
17017   return simplified.length < original.length ? simplified : range
17018 }
17019
17020
17021 /***/ }),
17022 /* 117 */
17023 /***/ (function(module, exports, __webpack_require__) {
17024
17025 const Range = __webpack_require__(105)
17026 const { ANY } = __webpack_require__(104)
17027 const satisfies = __webpack_require__(106)
17028 const compare = __webpack_require__(87)
17029
17030 // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
17031 // - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
17032 //
17033 // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
17034 // - If c is only the ANY comparator
17035 //   - If C is only the ANY comparator, return true
17036 //   - Else return false
17037 // - Let EQ be the set of = comparators in c
17038 // - If EQ is more than one, return true (null set)
17039 // - Let GT be the highest > or >= comparator in c
17040 // - Let LT be the lowest < or <= comparator in c
17041 // - If GT and LT, and GT.semver > LT.semver, return true (null set)
17042 // - If EQ
17043 //   - If GT, and EQ does not satisfy GT, return true (null set)
17044 //   - If LT, and EQ does not satisfy LT, return true (null set)
17045 //   - If EQ satisfies every C, return true
17046 //   - Else return false
17047 // - If GT
17048 //   - If GT is lower than any > or >= comp in C, return false
17049 //   - If GT is >=, and GT.semver does not satisfy every C, return false
17050 // - If LT
17051 //   - If LT.semver is greater than that of any > comp in C, return false
17052 //   - If LT is <=, and LT.semver does not satisfy every C, return false
17053 // - If any C is a = range, and GT or LT are set, return false
17054 // - Else return true
17055
17056 const subset = (sub, dom, options) => {
17057   sub = new Range(sub, options)
17058   dom = new Range(dom, options)
17059   let sawNonNull = false
17060
17061   OUTER: for (const simpleSub of sub.set) {
17062     for (const simpleDom of dom.set) {
17063       const isSub = simpleSubset(simpleSub, simpleDom, options)
17064       sawNonNull = sawNonNull || isSub !== null
17065       if (isSub)
17066         continue OUTER
17067     }
17068     // the null set is a subset of everything, but null simple ranges in
17069     // a complex range should be ignored.  so if we saw a non-null range,
17070     // then we know this isn't a subset, but if EVERY simple range was null,
17071     // then it is a subset.
17072     if (sawNonNull)
17073       return false
17074   }
17075   return true
17076 }
17077
17078 const simpleSubset = (sub, dom, options) => {
17079   if (sub.length === 1 && sub[0].semver === ANY)
17080     return dom.length === 1 && dom[0].semver === ANY
17081
17082   const eqSet = new Set()
17083   let gt, lt
17084   for (const c of sub) {
17085     if (c.operator === '>' || c.operator === '>=')
17086       gt = higherGT(gt, c, options)
17087     else if (c.operator === '<' || c.operator === '<=')
17088       lt = lowerLT(lt, c, options)
17089     else
17090       eqSet.add(c.semver)
17091   }
17092
17093   if (eqSet.size > 1)
17094     return null
17095
17096   let gtltComp
17097   if (gt && lt) {
17098     gtltComp = compare(gt.semver, lt.semver, options)
17099     if (gtltComp > 0)
17100       return null
17101     else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
17102       return null
17103   }
17104
17105   // will iterate one or zero times
17106   for (const eq of eqSet) {
17107     if (gt && !satisfies(eq, String(gt), options))
17108       return null
17109
17110     if (lt && !satisfies(eq, String(lt), options))
17111       return null
17112
17113     for (const c of dom) {
17114       if (!satisfies(eq, String(c), options))
17115         return false
17116     }
17117     return true
17118   }
17119
17120   let higher, lower
17121   let hasDomLT, hasDomGT
17122   for (const c of dom) {
17123     hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
17124     hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
17125     if (gt) {
17126       if (c.operator === '>' || c.operator === '>=') {
17127         higher = higherGT(gt, c, options)
17128         if (higher === c)
17129           return false
17130       } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
17131         return false
17132     }
17133     if (lt) {
17134       if (c.operator === '<' || c.operator === '<=') {
17135         lower = lowerLT(lt, c, options)
17136         if (lower === c)
17137           return false
17138       } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
17139         return false
17140     }
17141     if (!c.operator && (lt || gt) && gtltComp !== 0)
17142       return false
17143   }
17144
17145   // if there was a < or >, and nothing in the dom, then must be false
17146   // UNLESS it was limited by another range in the other direction.
17147   // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
17148   if (gt && hasDomLT && !lt && gtltComp !== 0)
17149     return false
17150
17151   if (lt && hasDomGT && !gt && gtltComp !== 0)
17152     return false
17153
17154   return true
17155 }
17156
17157 // >=1.2.3 is lower than >1.2.3
17158 const higherGT = (a, b, options) => {
17159   if (!a)
17160     return b
17161   const comp = compare(a.semver, b.semver, options)
17162   return comp > 0 ? a
17163     : comp < 0 ? b
17164     : b.operator === '>' && a.operator === '>=' ? b
17165     : a
17166 }
17167
17168 // <=1.2.3 is higher than <1.2.3
17169 const lowerLT = (a, b, options) => {
17170   if (!a)
17171     return b
17172   const comp = compare(a.semver, b.semver, options)
17173   return comp < 0 ? a
17174     : comp > 0 ? b
17175     : b.operator === '<' && a.operator === '<=' ? b
17176     : a
17177 }
17178
17179 module.exports = subset
17180
17181
17182 /***/ }),
17183 /* 118 */
17184 /***/ (function(module, exports, __webpack_require__) {
17185
17186 "use strict";
17187
17188 // Polyfills for node 0.8
17189 __webpack_require__(119);
17190 __webpack_require__(120);
17191 __webpack_require__(121);
17192
17193
17194 exports.Parse = __webpack_require__(122);
17195 exports.ParseOne = __webpack_require__(186);
17196 exports.Extract = __webpack_require__(188);
17197 exports.Open = __webpack_require__(211);
17198
17199 /***/ }),
17200 /* 119 */
17201 /***/ (function(module, exports, __webpack_require__) {
17202
17203 "use strict";
17204
17205
17206 var listenerCount = __webpack_require__(68).listenerCount
17207 // listenerCount isn't in node 0.10, so here's a basic polyfill
17208 listenerCount = listenerCount || function (ee, event) {
17209   var listeners = ee && ee._events && ee._events[event]
17210   if (Array.isArray(listeners)) {
17211     return listeners.length
17212   } else if (typeof listeners === 'function') {
17213     return 1
17214   } else {
17215     return 0
17216   }
17217 }
17218
17219 module.exports = listenerCount
17220
17221
17222 /***/ }),
17223 /* 120 */
17224 /***/ (function(module, exports, __webpack_require__) {
17225
17226 "use strict";
17227
17228
17229 if (!Buffer.prototype.indexOf) {
17230     Buffer.prototype.indexOf = function (value, offset) {
17231         offset = offset || 0;
17232
17233         // Always wrap the input as a Buffer so that this method will support any
17234         // data type such as array octet, string or buffer.
17235         if (typeof value === "string" || value instanceof String) {
17236             value = new Buffer(value);
17237         } else if (typeof value === "number" || value instanceof Number) {
17238             value = new Buffer([ value ]);
17239         }
17240
17241         var len = value.length;
17242
17243         for (var i = offset; i <= this.length - len; i++) {
17244             var mismatch = false;
17245             for (var j = 0; j < len; j++) {
17246                 if (this[i + j] != value[j]) {
17247                     mismatch = true;
17248                     break;
17249                 }
17250             }
17251
17252             if (!mismatch) {
17253                 return i;
17254             }
17255         }
17256
17257         return -1;
17258     };
17259 }
17260
17261 function bufferLastIndexOf (value, offset) {
17262
17263     // Always wrap the input as a Buffer so that this method will support any
17264     // data type such as array octet, string or buffer.
17265     if (typeof value === "string" || value instanceof String) {
17266         value = new Buffer(value);
17267     } else if (typeof value === "number" || value instanceof Number) {
17268         value = new Buffer([ value ]);
17269     }
17270
17271     var len = value.length;
17272     offset = offset || this.length - len;
17273
17274     for (var i = offset; i >= 0; i--) {
17275         var mismatch = false;
17276         for (var j = 0; j < len; j++) {
17277             if (this[i + j] != value[j]) {
17278                 mismatch = true;
17279                 break;
17280             }
17281         }
17282
17283         if (!mismatch) {
17284             return i;
17285         }
17286     }
17287
17288     return -1;
17289 }
17290
17291
17292 if (Buffer.prototype.lastIndexOf) {
17293     // check Buffer#lastIndexOf is usable: https://github.com/nodejs/node/issues/4604
17294     if (new Buffer ("ABC").lastIndexOf ("ABC") === -1)
17295         Buffer.prototype.lastIndexOf = bufferLastIndexOf;
17296 } else {
17297     Buffer.prototype.lastIndexOf = bufferLastIndexOf;
17298 }
17299
17300
17301 /***/ }),
17302 /* 121 */
17303 /***/ (function(module, exports) {
17304
17305 (function (global, undefined) {
17306     "use strict";
17307
17308     if (global.setImmediate) {
17309         return;
17310     }
17311
17312     var nextHandle = 1; // Spec says greater than zero
17313     var tasksByHandle = {};
17314     var currentlyRunningATask = false;
17315     var doc = global.document;
17316     var registerImmediate;
17317
17318     function setImmediate(callback) {
17319       // Callback can either be a function or a string
17320       if (typeof callback !== "function") {
17321         callback = new Function("" + callback);
17322       }
17323       // Copy function arguments
17324       var args = new Array(arguments.length - 1);
17325       for (var i = 0; i < args.length; i++) {
17326           args[i] = arguments[i + 1];
17327       }
17328       // Store and register the task
17329       var task = { callback: callback, args: args };
17330       tasksByHandle[nextHandle] = task;
17331       registerImmediate(nextHandle);
17332       return nextHandle++;
17333     }
17334
17335     function clearImmediate(handle) {
17336         delete tasksByHandle[handle];
17337     }
17338
17339     function run(task) {
17340         var callback = task.callback;
17341         var args = task.args;
17342         switch (args.length) {
17343         case 0:
17344             callback();
17345             break;
17346         case 1:
17347             callback(args[0]);
17348             break;
17349         case 2:
17350             callback(args[0], args[1]);
17351             break;
17352         case 3:
17353             callback(args[0], args[1], args[2]);
17354             break;
17355         default:
17356             callback.apply(undefined, args);
17357             break;
17358         }
17359     }
17360
17361     function runIfPresent(handle) {
17362         // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
17363         // So if we're currently running a task, we'll need to delay this invocation.
17364         if (currentlyRunningATask) {
17365             // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
17366             // "too much recursion" error.
17367             setTimeout(runIfPresent, 0, handle);
17368         } else {
17369             var task = tasksByHandle[handle];
17370             if (task) {
17371                 currentlyRunningATask = true;
17372                 try {
17373                     run(task);
17374                 } finally {
17375                     clearImmediate(handle);
17376                     currentlyRunningATask = false;
17377                 }
17378             }
17379         }
17380     }
17381
17382     function installNextTickImplementation() {
17383         registerImmediate = function(handle) {
17384             process.nextTick(function () { runIfPresent(handle); });
17385         };
17386     }
17387
17388     function canUsePostMessage() {
17389         // The test against `importScripts` prevents this implementation from being installed inside a web worker,
17390         // where `global.postMessage` means something completely different and can't be used for this purpose.
17391         if (global.postMessage && !global.importScripts) {
17392             var postMessageIsAsynchronous = true;
17393             var oldOnMessage = global.onmessage;
17394             global.onmessage = function() {
17395                 postMessageIsAsynchronous = false;
17396             };
17397             global.postMessage("", "*");
17398             global.onmessage = oldOnMessage;
17399             return postMessageIsAsynchronous;
17400         }
17401     }
17402
17403     function installPostMessageImplementation() {
17404         // Installs an event handler on `global` for the `message` event: see
17405         // * https://developer.mozilla.org/en/DOM/window.postMessage
17406         // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
17407
17408         var messagePrefix = "setImmediate$" + Math.random() + "$";
17409         var onGlobalMessage = function(event) {
17410             if (event.source === global &&
17411                 typeof event.data === "string" &&
17412                 event.data.indexOf(messagePrefix) === 0) {
17413                 runIfPresent(+event.data.slice(messagePrefix.length));
17414             }
17415         };
17416
17417         if (global.addEventListener) {
17418             global.addEventListener("message", onGlobalMessage, false);
17419         } else {
17420             global.attachEvent("onmessage", onGlobalMessage);
17421         }
17422
17423         registerImmediate = function(handle) {
17424             global.postMessage(messagePrefix + handle, "*");
17425         };
17426     }
17427
17428     function installMessageChannelImplementation() {
17429         var channel = new MessageChannel();
17430         channel.port1.onmessage = function(event) {
17431             var handle = event.data;
17432             runIfPresent(handle);
17433         };
17434
17435         registerImmediate = function(handle) {
17436             channel.port2.postMessage(handle);
17437         };
17438     }
17439
17440     function installReadyStateChangeImplementation() {
17441         var html = doc.documentElement;
17442         registerImmediate = function(handle) {
17443             // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
17444             // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
17445             var script = doc.createElement("script");
17446             script.onreadystatechange = function () {
17447                 runIfPresent(handle);
17448                 script.onreadystatechange = null;
17449                 html.removeChild(script);
17450                 script = null;
17451             };
17452             html.appendChild(script);
17453         };
17454     }
17455
17456     function installSetTimeoutImplementation() {
17457         registerImmediate = function(handle) {
17458             setTimeout(runIfPresent, 0, handle);
17459         };
17460     }
17461
17462     // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
17463     var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
17464     attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
17465
17466     // Don't get fooled by e.g. browserify environments.
17467     if ({}.toString.call(global.process) === "[object process]") {
17468         // For Node.js before 0.9
17469         installNextTickImplementation();
17470
17471     } else if (canUsePostMessage()) {
17472         // For non-IE10 modern browsers
17473         installPostMessageImplementation();
17474
17475     } else if (global.MessageChannel) {
17476         // For web workers, where supported
17477         installMessageChannelImplementation();
17478
17479     } else if (doc && "onreadystatechange" in doc.createElement("script")) {
17480         // For IE 6–8
17481         installReadyStateChangeImplementation();
17482
17483     } else {
17484         // For older browsers
17485         installSetTimeoutImplementation();
17486     }
17487
17488     attachTo.setImmediate = setImmediate;
17489     attachTo.clearImmediate = clearImmediate;
17490 }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
17491
17492
17493 /***/ }),
17494 /* 122 */
17495 /***/ (function(module, exports, __webpack_require__) {
17496
17497 var util = __webpack_require__(50);
17498 var zlib = __webpack_require__(48);
17499 var Stream = __webpack_require__(44);
17500 var binary = __webpack_require__(123);
17501 var Promise = __webpack_require__(128);
17502 var PullStream = __webpack_require__(164);
17503 var NoopStream = __webpack_require__(182);
17504 var BufferStream = __webpack_require__(183);
17505 var parseExtraField = __webpack_require__(184);
17506 var Buffer = __webpack_require__(165);
17507 var parseDateTime = __webpack_require__(185);
17508
17509 // Backwards compatibility for node versions < 8
17510 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
17511   Stream = __webpack_require__(167);
17512
17513 var endDirectorySignature = Buffer.alloc(4);
17514 endDirectorySignature.writeUInt32LE(0x06054b50, 0);
17515
17516 function Parse(opts) {
17517   if (!(this instanceof Parse)) {
17518     return new Parse(opts);
17519   }
17520   var self = this;
17521   self._opts = opts || { verbose: false };
17522
17523   PullStream.call(self, self._opts);
17524   self.on('finish',function() {
17525     self.emit('close');
17526   });
17527   self._readRecord().catch(function(e) {
17528     if (!self.__emittedError || self.__emittedError !== e)
17529       self.emit('error',e);
17530   });
17531 }
17532
17533 util.inherits(Parse, PullStream);
17534
17535 Parse.prototype._readRecord = function () {
17536   var self = this;
17537   return self.pull(4).then(function(data) {
17538     if (data.length === 0)
17539       return;
17540
17541     var signature = data.readUInt32LE(0);
17542
17543     if (signature === 0x34327243) {
17544       return self._readCrxHeader();
17545     }
17546     if (signature === 0x04034b50) {
17547       return self._readFile();
17548     }
17549     else if (signature === 0x02014b50) {
17550       self.__ended = true;
17551       return self._readCentralDirectoryFileHeader();
17552     }
17553     else if (signature === 0x06054b50) {
17554       return self._readEndOfCentralDirectoryRecord();
17555     }
17556     else if (self.__ended) {
17557       return self.pull(endDirectorySignature).then(function() {
17558           return self._readEndOfCentralDirectoryRecord();
17559         });
17560     }
17561     else
17562       self.emit('error', new Error('invalid signature: 0x' + signature.toString(16)));
17563   });
17564 };
17565
17566 Parse.prototype._readCrxHeader = function() {
17567   var self = this;
17568   return self.pull(12).then(function(data) {
17569     self.crxHeader = binary.parse(data)
17570       .word32lu('version')
17571       .word32lu('pubKeyLength')
17572       .word32lu('signatureLength')
17573       .vars;
17574     return self.pull(self.crxHeader.pubKeyLength + self.crxHeader.signatureLength);
17575   }).then(function(data) {
17576     self.crxHeader.publicKey = data.slice(0,self.crxHeader.pubKeyLength);
17577     self.crxHeader.signature = data.slice(self.crxHeader.pubKeyLength);
17578     self.emit('crx-header',self.crxHeader);
17579     return self._readRecord();
17580   });
17581 };
17582
17583 Parse.prototype._readFile = function () {
17584   var self = this;
17585   return self.pull(26).then(function(data) {
17586     var vars = binary.parse(data)
17587       .word16lu('versionsNeededToExtract')
17588       .word16lu('flags')
17589       .word16lu('compressionMethod')
17590       .word16lu('lastModifiedTime')
17591       .word16lu('lastModifiedDate')
17592       .word32lu('crc32')
17593       .word32lu('compressedSize')
17594       .word32lu('uncompressedSize')
17595       .word16lu('fileNameLength')
17596       .word16lu('extraFieldLength')
17597       .vars;
17598
17599     vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
17600
17601     if (self.crxHeader) vars.crxHeader = self.crxHeader;
17602
17603     return self.pull(vars.fileNameLength).then(function(fileNameBuffer) {
17604       var fileName = fileNameBuffer.toString('utf8');
17605       var entry = Stream.PassThrough();
17606       var __autodraining = false;
17607
17608       entry.autodrain = function() {
17609         __autodraining = true;
17610         var draining = entry.pipe(NoopStream());
17611         draining.promise = function() {
17612           return new Promise(function(resolve, reject) {
17613             draining.on('finish',resolve);
17614             draining.on('error',reject);
17615           });
17616         };
17617         return draining;
17618       };
17619
17620       entry.buffer = function() {
17621         return BufferStream(entry);
17622       };
17623
17624       entry.path = fileName;
17625       entry.props = {};
17626       entry.props.path = fileName;
17627       entry.props.pathBuffer = fileNameBuffer;
17628       entry.props.flags = {
17629         "isUnicode": vars.flags & 0x11
17630       };
17631       entry.type = (vars.uncompressedSize === 0 && /[\/\\]$/.test(fileName)) ? 'Directory' : 'File';
17632
17633       if (self._opts.verbose) {
17634         if (entry.type === 'Directory') {
17635           console.log('   creating:', fileName);
17636         } else if (entry.type === 'File') {
17637           if (vars.compressionMethod === 0) {
17638             console.log(' extracting:', fileName);
17639           } else {
17640             console.log('  inflating:', fileName);
17641           }
17642         }
17643       }
17644
17645       return self.pull(vars.extraFieldLength).then(function(extraField) {
17646         var extra = parseExtraField(extraField, vars);
17647
17648         entry.vars = vars;
17649         entry.extra = extra;
17650
17651         if (self._opts.forceStream) {
17652           self.push(entry);
17653         } else {
17654           self.emit('entry', entry);
17655
17656           if (self._readableState.pipesCount || (self._readableState.pipes && self._readableState.pipes.length))
17657             self.push(entry);
17658         }
17659
17660         if (self._opts.verbose)
17661           console.log({
17662             filename:fileName,
17663             vars: vars,
17664             extra: extra
17665           });
17666
17667         var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0,
17668             eof;
17669
17670         entry.__autodraining = __autodraining;  // expose __autodraining for test purposes
17671         var inflater = (vars.compressionMethod && !__autodraining) ? zlib.createInflateRaw() : Stream.PassThrough();
17672
17673         if (fileSizeKnown) {
17674           entry.size = vars.uncompressedSize;
17675           eof = vars.compressedSize;
17676         } else {
17677           eof = Buffer.alloc(4);
17678           eof.writeUInt32LE(0x08074b50, 0);
17679         }
17680
17681         return new Promise(function(resolve, reject) {
17682           self.stream(eof)
17683             .pipe(inflater)
17684             .on('error',function(err) { self.emit('error',err);})
17685             .pipe(entry)
17686             .on('finish', function() {
17687               return fileSizeKnown ?
17688                 self._readRecord().then(resolve).catch(reject) :
17689                 self._processDataDescriptor(entry).then(resolve).catch(reject);
17690             });
17691         });
17692       });
17693     });
17694   });
17695 };
17696
17697 Parse.prototype._processDataDescriptor = function (entry) {
17698   var self = this;
17699   return self.pull(16).then(function(data) {
17700     var vars = binary.parse(data)
17701       .word32lu('dataDescriptorSignature')
17702       .word32lu('crc32')
17703       .word32lu('compressedSize')
17704       .word32lu('uncompressedSize')
17705       .vars;
17706
17707     entry.size = vars.uncompressedSize;
17708     return self._readRecord();
17709   });
17710 };
17711
17712 Parse.prototype._readCentralDirectoryFileHeader = function () {
17713   var self = this;
17714   return self.pull(42).then(function(data) {
17715
17716     var vars = binary.parse(data)
17717       .word16lu('versionMadeBy')
17718       .word16lu('versionsNeededToExtract')
17719       .word16lu('flags')
17720       .word16lu('compressionMethod')
17721       .word16lu('lastModifiedTime')
17722       .word16lu('lastModifiedDate')
17723       .word32lu('crc32')
17724       .word32lu('compressedSize')
17725       .word32lu('uncompressedSize')
17726       .word16lu('fileNameLength')
17727       .word16lu('extraFieldLength')
17728       .word16lu('fileCommentLength')
17729       .word16lu('diskNumber')
17730       .word16lu('internalFileAttributes')
17731       .word32lu('externalFileAttributes')
17732       .word32lu('offsetToLocalFileHeader')
17733       .vars;
17734
17735     return self.pull(vars.fileNameLength).then(function(fileName) {
17736       vars.fileName = fileName.toString('utf8');
17737       return self.pull(vars.extraFieldLength);
17738     })
17739     .then(function(extraField) {
17740       return self.pull(vars.fileCommentLength);
17741     })
17742     .then(function(fileComment) {
17743       return self._readRecord();
17744     });
17745   });
17746 };
17747
17748 Parse.prototype._readEndOfCentralDirectoryRecord = function() {
17749   var self = this;
17750   return self.pull(18).then(function(data) {
17751
17752     var vars = binary.parse(data)
17753       .word16lu('diskNumber')
17754       .word16lu('diskStart')
17755       .word16lu('numberOfRecordsOnDisk')
17756       .word16lu('numberOfRecords')
17757       .word32lu('sizeOfCentralDirectory')
17758       .word32lu('offsetToStartOfCentralDirectory')
17759       .word16lu('commentLength')
17760       .vars;
17761
17762     return self.pull(vars.commentLength).then(function(comment) {
17763       comment = comment.toString('utf8');
17764       self.end();
17765       self.push(null);
17766     });
17767
17768   });
17769 };
17770
17771 Parse.prototype.promise = function() {
17772   var self = this;
17773   return new Promise(function(resolve,reject) {
17774     self.on('finish',resolve);
17775     self.on('error',reject);
17776   });
17777 };
17778
17779 module.exports = Parse;
17780
17781
17782 /***/ }),
17783 /* 123 */
17784 /***/ (function(module, exports, __webpack_require__) {
17785
17786 var Chainsaw = __webpack_require__(124);
17787 var EventEmitter = __webpack_require__(68).EventEmitter;
17788 var Buffers = __webpack_require__(126);
17789 var Vars = __webpack_require__(127);
17790 var Stream = __webpack_require__(44).Stream;
17791
17792 exports = module.exports = function (bufOrEm, eventName) {
17793     if (Buffer.isBuffer(bufOrEm)) {
17794         return exports.parse(bufOrEm);
17795     }
17796     
17797     var s = exports.stream();
17798     if (bufOrEm && bufOrEm.pipe) {
17799         bufOrEm.pipe(s);
17800     }
17801     else if (bufOrEm) {
17802         bufOrEm.on(eventName || 'data', function (buf) {
17803             s.write(buf);
17804         });
17805         
17806         bufOrEm.on('end', function () {
17807             s.end();
17808         });
17809     }
17810     return s;
17811 };
17812
17813 exports.stream = function (input) {
17814     if (input) return exports.apply(null, arguments);
17815     
17816     var pending = null;
17817     function getBytes (bytes, cb, skip) {
17818         pending = {
17819             bytes : bytes,
17820             skip : skip,
17821             cb : function (buf) {
17822                 pending = null;
17823                 cb(buf);
17824             },
17825         };
17826         dispatch();
17827     }
17828     
17829     var offset = null;
17830     function dispatch () {
17831         if (!pending) {
17832             if (caughtEnd) done = true;
17833             return;
17834         }
17835         if (typeof pending === 'function') {
17836             pending();
17837         }
17838         else {
17839             var bytes = offset + pending.bytes;
17840             
17841             if (buffers.length >= bytes) {
17842                 var buf;
17843                 if (offset == null) {
17844                     buf = buffers.splice(0, bytes);
17845                     if (!pending.skip) {
17846                         buf = buf.slice();
17847                     }
17848                 }
17849                 else {
17850                     if (!pending.skip) {
17851                         buf = buffers.slice(offset, bytes);
17852                     }
17853                     offset = bytes;
17854                 }
17855                 
17856                 if (pending.skip) {
17857                     pending.cb();
17858                 }
17859                 else {
17860                     pending.cb(buf);
17861                 }
17862             }
17863         }
17864     }
17865     
17866     function builder (saw) {
17867         function next () { if (!done) saw.next() }
17868         
17869         var self = words(function (bytes, cb) {
17870             return function (name) {
17871                 getBytes(bytes, function (buf) {
17872                     vars.set(name, cb(buf));
17873                     next();
17874                 });
17875             };
17876         });
17877         
17878         self.tap = function (cb) {
17879             saw.nest(cb, vars.store);
17880         };
17881         
17882         self.into = function (key, cb) {
17883             if (!vars.get(key)) vars.set(key, {});
17884             var parent = vars;
17885             vars = Vars(parent.get(key));
17886             
17887             saw.nest(function () {
17888                 cb.apply(this, arguments);
17889                 this.tap(function () {
17890                     vars = parent;
17891                 });
17892             }, vars.store);
17893         };
17894         
17895         self.flush = function () {
17896             vars.store = {};
17897             next();
17898         };
17899         
17900         self.loop = function (cb) {
17901             var end = false;
17902             
17903             saw.nest(false, function loop () {
17904                 this.vars = vars.store;
17905                 cb.call(this, function () {
17906                     end = true;
17907                     next();
17908                 }, vars.store);
17909                 this.tap(function () {
17910                     if (end) saw.next()
17911                     else loop.call(this)
17912                 }.bind(this));
17913             }, vars.store);
17914         };
17915         
17916         self.buffer = function (name, bytes) {
17917             if (typeof bytes === 'string') {
17918                 bytes = vars.get(bytes);
17919             }
17920             
17921             getBytes(bytes, function (buf) {
17922                 vars.set(name, buf);
17923                 next();
17924             });
17925         };
17926         
17927         self.skip = function (bytes) {
17928             if (typeof bytes === 'string') {
17929                 bytes = vars.get(bytes);
17930             }
17931             
17932             getBytes(bytes, function () {
17933                 next();
17934             });
17935         };
17936         
17937         self.scan = function find (name, search) {
17938             if (typeof search === 'string') {
17939                 search = new Buffer(search);
17940             }
17941             else if (!Buffer.isBuffer(search)) {
17942                 throw new Error('search must be a Buffer or a string');
17943             }
17944             
17945             var taken = 0;
17946             pending = function () {
17947                 var pos = buffers.indexOf(search, offset + taken);
17948                 var i = pos-offset-taken;
17949                 if (pos !== -1) {
17950                     pending = null;
17951                     if (offset != null) {
17952                         vars.set(
17953                             name,
17954                             buffers.slice(offset, offset + taken + i)
17955                         );
17956                         offset += taken + i + search.length;
17957                     }
17958                     else {
17959                         vars.set(
17960                             name,
17961                             buffers.slice(0, taken + i)
17962                         );
17963                         buffers.splice(0, taken + i + search.length);
17964                     }
17965                     next();
17966                     dispatch();
17967                 } else {
17968                     i = Math.max(buffers.length - search.length - offset - taken, 0);
17969                                 }
17970                 taken += i;
17971             };
17972             dispatch();
17973         };
17974         
17975         self.peek = function (cb) {
17976             offset = 0;
17977             saw.nest(function () {
17978                 cb.call(this, vars.store);
17979                 this.tap(function () {
17980                     offset = null;
17981                 });
17982             });
17983         };
17984         
17985         return self;
17986     };
17987     
17988     var stream = Chainsaw.light(builder);
17989     stream.writable = true;
17990     
17991     var buffers = Buffers();
17992     
17993     stream.write = function (buf) {
17994         buffers.push(buf);
17995         dispatch();
17996     };
17997     
17998     var vars = Vars();
17999     
18000     var done = false, caughtEnd = false;
18001     stream.end = function () {
18002         caughtEnd = true;
18003     };
18004     
18005     stream.pipe = Stream.prototype.pipe;
18006     Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) {
18007         stream[name] = EventEmitter.prototype[name];
18008     });
18009     
18010     return stream;
18011 };
18012
18013 exports.parse = function parse (buffer) {
18014     var self = words(function (bytes, cb) {
18015         return function (name) {
18016             if (offset + bytes <= buffer.length) {
18017                 var buf = buffer.slice(offset, offset + bytes);
18018                 offset += bytes;
18019                 vars.set(name, cb(buf));
18020             }
18021             else {
18022                 vars.set(name, null);
18023             }
18024             return self;
18025         };
18026     });
18027     
18028     var offset = 0;
18029     var vars = Vars();
18030     self.vars = vars.store;
18031     
18032     self.tap = function (cb) {
18033         cb.call(self, vars.store);
18034         return self;
18035     };
18036     
18037     self.into = function (key, cb) {
18038         if (!vars.get(key)) {
18039             vars.set(key, {});
18040         }
18041         var parent = vars;
18042         vars = Vars(parent.get(key));
18043         cb.call(self, vars.store);
18044         vars = parent;
18045         return self;
18046     };
18047     
18048     self.loop = function (cb) {
18049         var end = false;
18050         var ender = function () { end = true };
18051         while (end === false) {
18052             cb.call(self, ender, vars.store);
18053         }
18054         return self;
18055     };
18056     
18057     self.buffer = function (name, size) {
18058         if (typeof size === 'string') {
18059             size = vars.get(size);
18060         }
18061         var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
18062         offset += size;
18063         vars.set(name, buf);
18064         
18065         return self;
18066     };
18067     
18068     self.skip = function (bytes) {
18069         if (typeof bytes === 'string') {
18070             bytes = vars.get(bytes);
18071         }
18072         offset += bytes;
18073         
18074         return self;
18075     };
18076     
18077     self.scan = function (name, search) {
18078         if (typeof search === 'string') {
18079             search = new Buffer(search);
18080         }
18081         else if (!Buffer.isBuffer(search)) {
18082             throw new Error('search must be a Buffer or a string');
18083         }
18084         vars.set(name, null);
18085         
18086         // simple but slow string search
18087         for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
18088             for (
18089                 var j = 0;
18090                 j < search.length && buffer[offset+i+j] === search[j];
18091                 j++
18092             );
18093             if (j === search.length) break;
18094         }
18095         
18096         vars.set(name, buffer.slice(offset, offset + i));
18097         offset += i + search.length;
18098         return self;
18099     };
18100     
18101     self.peek = function (cb) {
18102         var was = offset;
18103         cb.call(self, vars.store);
18104         offset = was;
18105         return self;
18106     };
18107     
18108     self.flush = function () {
18109         vars.store = {};
18110         return self;
18111     };
18112     
18113     self.eof = function () {
18114         return offset >= buffer.length;
18115     };
18116     
18117     return self;
18118 };
18119
18120 // convert byte strings to unsigned little endian numbers
18121 function decodeLEu (bytes) {
18122     var acc = 0;
18123     for (var i = 0; i < bytes.length; i++) {
18124         acc += Math.pow(256,i) * bytes[i];
18125     }
18126     return acc;
18127 }
18128
18129 // convert byte strings to unsigned big endian numbers
18130 function decodeBEu (bytes) {
18131     var acc = 0;
18132     for (var i = 0; i < bytes.length; i++) {
18133         acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
18134     }
18135     return acc;
18136 }
18137
18138 // convert byte strings to signed big endian numbers
18139 function decodeBEs (bytes) {
18140     var val = decodeBEu(bytes);
18141     if ((bytes[0] & 0x80) == 0x80) {
18142         val -= Math.pow(256, bytes.length);
18143     }
18144     return val;
18145 }
18146
18147 // convert byte strings to signed little endian numbers
18148 function decodeLEs (bytes) {
18149     var val = decodeLEu(bytes);
18150     if ((bytes[bytes.length - 1] & 0x80) == 0x80) {
18151         val -= Math.pow(256, bytes.length);
18152     }
18153     return val;
18154 }
18155
18156 function words (decode) {
18157     var self = {};
18158     
18159     [ 1, 2, 4, 8 ].forEach(function (bytes) {
18160         var bits = bytes * 8;
18161         
18162         self['word' + bits + 'le']
18163         = self['word' + bits + 'lu']
18164         = decode(bytes, decodeLEu);
18165         
18166         self['word' + bits + 'ls']
18167         = decode(bytes, decodeLEs);
18168         
18169         self['word' + bits + 'be']
18170         = self['word' + bits + 'bu']
18171         = decode(bytes, decodeBEu);
18172         
18173         self['word' + bits + 'bs']
18174         = decode(bytes, decodeBEs);
18175     });
18176     
18177     // word8be(n) == word8le(n) for all n
18178     self.word8 = self.word8u = self.word8be;
18179     self.word8s = self.word8bs;
18180     
18181     return self;
18182 }
18183
18184
18185 /***/ }),
18186 /* 124 */
18187 /***/ (function(module, exports, __webpack_require__) {
18188
18189 var Traverse = __webpack_require__(125);
18190 var EventEmitter = __webpack_require__(68).EventEmitter;
18191
18192 module.exports = Chainsaw;
18193 function Chainsaw (builder) {
18194     var saw = Chainsaw.saw(builder, {});
18195     var r = builder.call(saw.handlers, saw);
18196     if (r !== undefined) saw.handlers = r;
18197     saw.record();
18198     return saw.chain();
18199 };
18200
18201 Chainsaw.light = function ChainsawLight (builder) {
18202     var saw = Chainsaw.saw(builder, {});
18203     var r = builder.call(saw.handlers, saw);
18204     if (r !== undefined) saw.handlers = r;
18205     return saw.chain();
18206 };
18207
18208 Chainsaw.saw = function (builder, handlers) {
18209     var saw = new EventEmitter;
18210     saw.handlers = handlers;
18211     saw.actions = [];
18212
18213     saw.chain = function () {
18214         var ch = Traverse(saw.handlers).map(function (node) {
18215             if (this.isRoot) return node;
18216             var ps = this.path;
18217
18218             if (typeof node === 'function') {
18219                 this.update(function () {
18220                     saw.actions.push({
18221                         path : ps,
18222                         args : [].slice.call(arguments)
18223                     });
18224                     return ch;
18225                 });
18226             }
18227         });
18228
18229         process.nextTick(function () {
18230             saw.emit('begin');
18231             saw.next();
18232         });
18233
18234         return ch;
18235     };
18236
18237     saw.pop = function () {
18238         return saw.actions.shift();
18239     };
18240
18241     saw.next = function () {
18242         var action = saw.pop();
18243
18244         if (!action) {
18245             saw.emit('end');
18246         }
18247         else if (!action.trap) {
18248             var node = saw.handlers;
18249             action.path.forEach(function (key) { node = node[key] });
18250             node.apply(saw.handlers, action.args);
18251         }
18252     };
18253
18254     saw.nest = function (cb) {
18255         var args = [].slice.call(arguments, 1);
18256         var autonext = true;
18257
18258         if (typeof cb === 'boolean') {
18259             var autonext = cb;
18260             cb = args.shift();
18261         }
18262
18263         var s = Chainsaw.saw(builder, {});
18264         var r = builder.call(s.handlers, s);
18265
18266         if (r !== undefined) s.handlers = r;
18267
18268         // If we are recording...
18269         if ("undefined" !== typeof saw.step) {
18270             // ... our children should, too
18271             s.record();
18272         }
18273
18274         cb.apply(s.chain(), args);
18275         if (autonext !== false) s.on('end', saw.next);
18276     };
18277
18278     saw.record = function () {
18279         upgradeChainsaw(saw);
18280     };
18281
18282     ['trap', 'down', 'jump'].forEach(function (method) {
18283         saw[method] = function () {
18284             throw new Error("To use the trap, down and jump features, please "+
18285                             "call record() first to start recording actions.");
18286         };
18287     });
18288
18289     return saw;
18290 };
18291
18292 function upgradeChainsaw(saw) {
18293     saw.step = 0;
18294
18295     // override pop
18296     saw.pop = function () {
18297         return saw.actions[saw.step++];
18298     };
18299
18300     saw.trap = function (name, cb) {
18301         var ps = Array.isArray(name) ? name : [name];
18302         saw.actions.push({
18303             path : ps,
18304             step : saw.step,
18305             cb : cb,
18306             trap : true
18307         });
18308     };
18309
18310     saw.down = function (name) {
18311         var ps = (Array.isArray(name) ? name : [name]).join('/');
18312         var i = saw.actions.slice(saw.step).map(function (x) {
18313             if (x.trap && x.step <= saw.step) return false;
18314             return x.path.join('/') == ps;
18315         }).indexOf(true);
18316
18317         if (i >= 0) saw.step += i;
18318         else saw.step = saw.actions.length;
18319
18320         var act = saw.actions[saw.step - 1];
18321         if (act && act.trap) {
18322             // It's a trap!
18323             saw.step = act.step;
18324             act.cb();
18325         }
18326         else saw.next();
18327     };
18328
18329     saw.jump = function (step) {
18330         saw.step = step;
18331         saw.next();
18332     };
18333 };
18334
18335
18336 /***/ }),
18337 /* 125 */
18338 /***/ (function(module, exports) {
18339
18340 module.exports = Traverse;
18341 function Traverse (obj) {
18342     if (!(this instanceof Traverse)) return new Traverse(obj);
18343     this.value = obj;
18344 }
18345
18346 Traverse.prototype.get = function (ps) {
18347     var node = this.value;
18348     for (var i = 0; i < ps.length; i ++) {
18349         var key = ps[i];
18350         if (!Object.hasOwnProperty.call(node, key)) {
18351             node = undefined;
18352             break;
18353         }
18354         node = node[key];
18355     }
18356     return node;
18357 };
18358
18359 Traverse.prototype.set = function (ps, value) {
18360     var node = this.value;
18361     for (var i = 0; i < ps.length - 1; i ++) {
18362         var key = ps[i];
18363         if (!Object.hasOwnProperty.call(node, key)) node[key] = {};
18364         node = node[key];
18365     }
18366     node[ps[i]] = value;
18367     return value;
18368 };
18369
18370 Traverse.prototype.map = function (cb) {
18371     return walk(this.value, cb, true);
18372 };
18373
18374 Traverse.prototype.forEach = function (cb) {
18375     this.value = walk(this.value, cb, false);
18376     return this.value;
18377 };
18378
18379 Traverse.prototype.reduce = function (cb, init) {
18380     var skip = arguments.length === 1;
18381     var acc = skip ? this.value : init;
18382     this.forEach(function (x) {
18383         if (!this.isRoot || !skip) {
18384             acc = cb.call(this, acc, x);
18385         }
18386     });
18387     return acc;
18388 };
18389
18390 Traverse.prototype.deepEqual = function (obj) {
18391     if (arguments.length !== 1) {
18392         throw new Error(
18393             'deepEqual requires exactly one object to compare against'
18394         );
18395     }
18396     
18397     var equal = true;
18398     var node = obj;
18399     
18400     this.forEach(function (y) {
18401         var notEqual = (function () {
18402             equal = false;
18403             //this.stop();
18404             return undefined;
18405         }).bind(this);
18406         
18407         //if (node === undefined || node === null) return notEqual();
18408         
18409         if (!this.isRoot) {
18410         /*
18411             if (!Object.hasOwnProperty.call(node, this.key)) {
18412                 return notEqual();
18413             }
18414         */
18415             if (typeof node !== 'object') return notEqual();
18416             node = node[this.key];
18417         }
18418         
18419         var x = node;
18420         
18421         this.post(function () {
18422             node = x;
18423         });
18424         
18425         var toS = function (o) {
18426             return Object.prototype.toString.call(o);
18427         };
18428         
18429         if (this.circular) {
18430             if (Traverse(obj).get(this.circular.path) !== x) notEqual();
18431         }
18432         else if (typeof x !== typeof y) {
18433             notEqual();
18434         }
18435         else if (x === null || y === null || x === undefined || y === undefined) {
18436             if (x !== y) notEqual();
18437         }
18438         else if (x.__proto__ !== y.__proto__) {
18439             notEqual();
18440         }
18441         else if (x === y) {
18442             // nop
18443         }
18444         else if (typeof x === 'function') {
18445             if (x instanceof RegExp) {
18446                 // both regexps on account of the __proto__ check
18447                 if (x.toString() != y.toString()) notEqual();
18448             }
18449             else if (x !== y) notEqual();
18450         }
18451         else if (typeof x === 'object') {
18452             if (toS(y) === '[object Arguments]'
18453             || toS(x) === '[object Arguments]') {
18454                 if (toS(x) !== toS(y)) {
18455                     notEqual();
18456                 }
18457             }
18458             else if (x instanceof Date || y instanceof Date) {
18459                 if (!(x instanceof Date) || !(y instanceof Date)
18460                 || x.getTime() !== y.getTime()) {
18461                     notEqual();
18462                 }
18463             }
18464             else {
18465                 var kx = Object.keys(x);
18466                 var ky = Object.keys(y);
18467                 if (kx.length !== ky.length) return notEqual();
18468                 for (var i = 0; i < kx.length; i++) {
18469                     var k = kx[i];
18470                     if (!Object.hasOwnProperty.call(y, k)) {
18471                         notEqual();
18472                     }
18473                 }
18474             }
18475         }
18476     });
18477     
18478     return equal;
18479 };
18480
18481 Traverse.prototype.paths = function () {
18482     var acc = [];
18483     this.forEach(function (x) {
18484         acc.push(this.path); 
18485     });
18486     return acc;
18487 };
18488
18489 Traverse.prototype.nodes = function () {
18490     var acc = [];
18491     this.forEach(function (x) {
18492         acc.push(this.node);
18493     });
18494     return acc;
18495 };
18496
18497 Traverse.prototype.clone = function () {
18498     var parents = [], nodes = [];
18499     
18500     return (function clone (src) {
18501         for (var i = 0; i < parents.length; i++) {
18502             if (parents[i] === src) {
18503                 return nodes[i];
18504             }
18505         }
18506         
18507         if (typeof src === 'object' && src !== null) {
18508             var dst = copy(src);
18509             
18510             parents.push(src);
18511             nodes.push(dst);
18512             
18513             Object.keys(src).forEach(function (key) {
18514                 dst[key] = clone(src[key]);
18515             });
18516             
18517             parents.pop();
18518             nodes.pop();
18519             return dst;
18520         }
18521         else {
18522             return src;
18523         }
18524     })(this.value);
18525 };
18526
18527 function walk (root, cb, immutable) {
18528     var path = [];
18529     var parents = [];
18530     var alive = true;
18531     
18532     return (function walker (node_) {
18533         var node = immutable ? copy(node_) : node_;
18534         var modifiers = {};
18535         
18536         var state = {
18537             node : node,
18538             node_ : node_,
18539             path : [].concat(path),
18540             parent : parents.slice(-1)[0],
18541             key : path.slice(-1)[0],
18542             isRoot : path.length === 0,
18543             level : path.length,
18544             circular : null,
18545             update : function (x) {
18546                 if (!state.isRoot) {
18547                     state.parent.node[state.key] = x;
18548                 }
18549                 state.node = x;
18550             },
18551             'delete' : function () {
18552                 delete state.parent.node[state.key];
18553             },
18554             remove : function () {
18555                 if (Array.isArray(state.parent.node)) {
18556                     state.parent.node.splice(state.key, 1);
18557                 }
18558                 else {
18559                     delete state.parent.node[state.key];
18560                 }
18561             },
18562             before : function (f) { modifiers.before = f },
18563             after : function (f) { modifiers.after = f },
18564             pre : function (f) { modifiers.pre = f },
18565             post : function (f) { modifiers.post = f },
18566             stop : function () { alive = false }
18567         };
18568         
18569         if (!alive) return state;
18570         
18571         if (typeof node === 'object' && node !== null) {
18572             state.isLeaf = Object.keys(node).length == 0;
18573             
18574             for (var i = 0; i < parents.length; i++) {
18575                 if (parents[i].node_ === node_) {
18576                     state.circular = parents[i];
18577                     break;
18578                 }
18579             }
18580         }
18581         else {
18582             state.isLeaf = true;
18583         }
18584         
18585         state.notLeaf = !state.isLeaf;
18586         state.notRoot = !state.isRoot;
18587         
18588         // use return values to update if defined
18589         var ret = cb.call(state, state.node);
18590         if (ret !== undefined && state.update) state.update(ret);
18591         if (modifiers.before) modifiers.before.call(state, state.node);
18592         
18593         if (typeof state.node == 'object'
18594         && state.node !== null && !state.circular) {
18595             parents.push(state);
18596             
18597             var keys = Object.keys(state.node);
18598             keys.forEach(function (key, i) {
18599                 path.push(key);
18600                 
18601                 if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
18602                 
18603                 var child = walker(state.node[key]);
18604                 if (immutable && Object.hasOwnProperty.call(state.node, key)) {
18605                     state.node[key] = child.node;
18606                 }
18607                 
18608                 child.isLast = i == keys.length - 1;
18609                 child.isFirst = i == 0;
18610                 
18611                 if (modifiers.post) modifiers.post.call(state, child);
18612                 
18613                 path.pop();
18614             });
18615             parents.pop();
18616         }
18617         
18618         if (modifiers.after) modifiers.after.call(state, state.node);
18619         
18620         return state;
18621     })(root).node;
18622 }
18623
18624 Object.keys(Traverse.prototype).forEach(function (key) {
18625     Traverse[key] = function (obj) {
18626         var args = [].slice.call(arguments, 1);
18627         var t = Traverse(obj);
18628         return t[key].apply(t, args);
18629     };
18630 });
18631
18632 function copy (src) {
18633     if (typeof src === 'object' && src !== null) {
18634         var dst;
18635         
18636         if (Array.isArray(src)) {
18637             dst = [];
18638         }
18639         else if (src instanceof Date) {
18640             dst = new Date(src);
18641         }
18642         else if (src instanceof Boolean) {
18643             dst = new Boolean(src);
18644         }
18645         else if (src instanceof Number) {
18646             dst = new Number(src);
18647         }
18648         else if (src instanceof String) {
18649             dst = new String(src);
18650         }
18651         else {
18652             dst = Object.create(Object.getPrototypeOf(src));
18653         }
18654         
18655         Object.keys(src).forEach(function (key) {
18656             dst[key] = src[key];
18657         });
18658         return dst;
18659     }
18660     else return src;
18661 }
18662
18663
18664 /***/ }),
18665 /* 126 */
18666 /***/ (function(module, exports) {
18667
18668 module.exports = Buffers;
18669
18670 function Buffers (bufs) {
18671     if (!(this instanceof Buffers)) return new Buffers(bufs);
18672     this.buffers = bufs || [];
18673     this.length = this.buffers.reduce(function (size, buf) {
18674         return size + buf.length
18675     }, 0);
18676 }
18677
18678 Buffers.prototype.push = function () {
18679     for (var i = 0; i < arguments.length; i++) {
18680         if (!Buffer.isBuffer(arguments[i])) {
18681             throw new TypeError('Tried to push a non-buffer');
18682         }
18683     }
18684     
18685     for (var i = 0; i < arguments.length; i++) {
18686         var buf = arguments[i];
18687         this.buffers.push(buf);
18688         this.length += buf.length;
18689     }
18690     return this.length;
18691 };
18692
18693 Buffers.prototype.unshift = function () {
18694     for (var i = 0; i < arguments.length; i++) {
18695         if (!Buffer.isBuffer(arguments[i])) {
18696             throw new TypeError('Tried to unshift a non-buffer');
18697         }
18698     }
18699     
18700     for (var i = 0; i < arguments.length; i++) {
18701         var buf = arguments[i];
18702         this.buffers.unshift(buf);
18703         this.length += buf.length;
18704     }
18705     return this.length;
18706 };
18707
18708 Buffers.prototype.copy = function (dst, dStart, start, end) {
18709     return this.slice(start, end).copy(dst, dStart, 0, end - start);
18710 };
18711
18712 Buffers.prototype.splice = function (i, howMany) {
18713     var buffers = this.buffers;
18714     var index = i >= 0 ? i : this.length - i;
18715     var reps = [].slice.call(arguments, 2);
18716     
18717     if (howMany === undefined) {
18718         howMany = this.length - index;
18719     }
18720     else if (howMany > this.length - index) {
18721         howMany = this.length - index;
18722     }
18723     
18724     for (var i = 0; i < reps.length; i++) {
18725         this.length += reps[i].length;
18726     }
18727     
18728     var removed = new Buffers();
18729     var bytes = 0;
18730     
18731     var startBytes = 0;
18732     for (
18733         var ii = 0;
18734         ii < buffers.length && startBytes + buffers[ii].length < index;
18735         ii ++
18736     ) { startBytes += buffers[ii].length }
18737     
18738     if (index - startBytes > 0) {
18739         var start = index - startBytes;
18740         
18741         if (start + howMany < buffers[ii].length) {
18742             removed.push(buffers[ii].slice(start, start + howMany));
18743             
18744             var orig = buffers[ii];
18745             //var buf = new Buffer(orig.length - howMany);
18746             var buf0 = new Buffer(start);
18747             for (var i = 0; i < start; i++) {
18748                 buf0[i] = orig[i];
18749             }
18750             
18751             var buf1 = new Buffer(orig.length - start - howMany);
18752             for (var i = start + howMany; i < orig.length; i++) {
18753                 buf1[ i - howMany - start ] = orig[i]
18754             }
18755             
18756             if (reps.length > 0) {
18757                 var reps_ = reps.slice();
18758                 reps_.unshift(buf0);
18759                 reps_.push(buf1);
18760                 buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
18761                 ii += reps_.length;
18762                 reps = [];
18763             }
18764             else {
18765                 buffers.splice(ii, 1, buf0, buf1);
18766                 //buffers[ii] = buf;
18767                 ii += 2;
18768             }
18769         }
18770         else {
18771             removed.push(buffers[ii].slice(start));
18772             buffers[ii] = buffers[ii].slice(0, start);
18773             ii ++;
18774         }
18775     }
18776     
18777     if (reps.length > 0) {
18778         buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
18779         ii += reps.length;
18780     }
18781     
18782     while (removed.length < howMany) {
18783         var buf = buffers[ii];
18784         var len = buf.length;
18785         var take = Math.min(len, howMany - removed.length);
18786         
18787         if (take === len) {
18788             removed.push(buf);
18789             buffers.splice(ii, 1);
18790         }
18791         else {
18792             removed.push(buf.slice(0, take));
18793             buffers[ii] = buffers[ii].slice(take);
18794         }
18795     }
18796     
18797     this.length -= removed.length;
18798     
18799     return removed;
18800 };
18801  
18802 Buffers.prototype.slice = function (i, j) {
18803     var buffers = this.buffers;
18804     if (j === undefined) j = this.length;
18805     if (i === undefined) i = 0;
18806     
18807     if (j > this.length) j = this.length;
18808     
18809     var startBytes = 0;
18810     for (
18811         var si = 0;
18812         si < buffers.length && startBytes + buffers[si].length <= i;
18813         si ++
18814     ) { startBytes += buffers[si].length }
18815     
18816     var target = new Buffer(j - i);
18817     
18818     var ti = 0;
18819     for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
18820         var len = buffers[ii].length;
18821         
18822         var start = ti === 0 ? i - startBytes : 0;
18823         var end = ti + len >= j - i
18824             ? Math.min(start + (j - i) - ti, len)
18825             : len
18826         ;
18827         
18828         buffers[ii].copy(target, ti, start, end);
18829         ti += end - start;
18830     }
18831     
18832     return target;
18833 };
18834
18835 Buffers.prototype.pos = function (i) {
18836     if (i < 0 || i >= this.length) throw new Error('oob');
18837     var l = i, bi = 0, bu = null;
18838     for (;;) {
18839         bu = this.buffers[bi];
18840         if (l < bu.length) {
18841             return {buf: bi, offset: l};
18842         } else {
18843             l -= bu.length;
18844         }
18845         bi++;
18846     }
18847 };
18848
18849 Buffers.prototype.get = function get (i) {
18850     var pos = this.pos(i);
18851
18852     return this.buffers[pos.buf].get(pos.offset);
18853 };
18854
18855 Buffers.prototype.set = function set (i, b) {
18856     var pos = this.pos(i);
18857
18858     return this.buffers[pos.buf].set(pos.offset, b);
18859 };
18860
18861 Buffers.prototype.indexOf = function (needle, offset) {
18862     if ("string" === typeof needle) {
18863         needle = new Buffer(needle);
18864     } else if (needle instanceof Buffer) {
18865         // already a buffer
18866     } else {
18867         throw new Error('Invalid type for a search string');
18868     }
18869
18870     if (!needle.length) {
18871         return 0;
18872     }
18873
18874     if (!this.length) {
18875         return -1;
18876     }
18877
18878     var i = 0, j = 0, match = 0, mstart, pos = 0;
18879
18880     // start search from a particular point in the virtual buffer
18881     if (offset) {
18882         var p = this.pos(offset);
18883         i = p.buf;
18884         j = p.offset;
18885         pos = offset;
18886     }
18887
18888     // for each character in virtual buffer
18889     for (;;) {
18890         while (j >= this.buffers[i].length) {
18891             j = 0;
18892             i++;
18893
18894             if (i >= this.buffers.length) {
18895                 // search string not found
18896                 return -1;
18897             }
18898         }
18899
18900         var char = this.buffers[i][j];
18901
18902         if (char == needle[match]) {
18903             // keep track where match started
18904             if (match == 0) {
18905                 mstart = {
18906                     i: i,
18907                     j: j,
18908                     pos: pos
18909                 };
18910             }
18911             match++;
18912             if (match == needle.length) {
18913                 // full match
18914                 return mstart.pos;
18915             }
18916         } else if (match != 0) {
18917             // a partial match ended, go back to match starting position
18918             // this will continue the search at the next character
18919             i = mstart.i;
18920             j = mstart.j;
18921             pos = mstart.pos;
18922             match = 0;
18923         }
18924
18925         j++;
18926         pos++;
18927     }
18928 };
18929
18930 Buffers.prototype.toBuffer = function() {
18931     return this.slice();
18932 }
18933
18934 Buffers.prototype.toString = function(encoding, start, end) {
18935     return this.slice(start, end).toString(encoding);
18936 }
18937
18938
18939 /***/ }),
18940 /* 127 */
18941 /***/ (function(module, exports) {
18942
18943 module.exports = function (store) {
18944     function getset (name, value) {
18945         var node = vars.store;
18946         var keys = name.split('.');
18947         keys.slice(0,-1).forEach(function (k) {
18948             if (node[k] === undefined) node[k] = {};
18949             node = node[k]
18950         });
18951         var key = keys[keys.length - 1];
18952         if (arguments.length == 1) {
18953             return node[key];
18954         }
18955         else {
18956             return node[key] = value;
18957         }
18958     }
18959     
18960     var vars = {
18961         get : function (name) {
18962             return getset(name);
18963         },
18964         set : function (name, value) {
18965             return getset(name, value);
18966         },
18967         store : store || {},
18968     };
18969     return vars;
18970 };
18971
18972
18973 /***/ }),
18974 /* 128 */
18975 /***/ (function(module, exports, __webpack_require__) {
18976
18977 "use strict";
18978
18979 var old;
18980 if (typeof Promise !== "undefined") old = Promise;
18981 function noConflict() {
18982     try { if (Promise === bluebird) Promise = old; }
18983     catch (e) {}
18984     return bluebird;
18985 }
18986 var bluebird = __webpack_require__(129)();
18987 bluebird.noConflict = noConflict;
18988 module.exports = bluebird;
18989
18990
18991 /***/ }),
18992 /* 129 */
18993 /***/ (function(module, exports, __webpack_require__) {
18994
18995 "use strict";
18996
18997 module.exports = function() {
18998 var makeSelfResolutionError = function () {
18999     return new TypeError("circular promise resolution chain\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
19000 };
19001 var reflectHandler = function() {
19002     return new Promise.PromiseInspection(this._target());
19003 };
19004 var apiRejection = function(msg) {
19005     return Promise.reject(new TypeError(msg));
19006 };
19007 function Proxyable() {}
19008 var UNDEFINED_BINDING = {};
19009 var util = __webpack_require__(130);
19010
19011 var getDomain;
19012 if (util.isNode) {
19013     getDomain = function() {
19014         var ret = process.domain;
19015         if (ret === undefined) ret = null;
19016         return ret;
19017     };
19018 } else {
19019     getDomain = function() {
19020         return null;
19021     };
19022 }
19023 util.notEnumerableProp(Promise, "_getDomain", getDomain);
19024
19025 var es5 = __webpack_require__(131);
19026 var Async = __webpack_require__(132);
19027 var async = new Async();
19028 es5.defineProperty(Promise, "_async", {value: async});
19029 var errors = __webpack_require__(135);
19030 var TypeError = Promise.TypeError = errors.TypeError;
19031 Promise.RangeError = errors.RangeError;
19032 var CancellationError = Promise.CancellationError = errors.CancellationError;
19033 Promise.TimeoutError = errors.TimeoutError;
19034 Promise.OperationalError = errors.OperationalError;
19035 Promise.RejectionError = errors.OperationalError;
19036 Promise.AggregateError = errors.AggregateError;
19037 var INTERNAL = function(){};
19038 var APPLY = {};
19039 var NEXT_FILTER = {};
19040 var tryConvertToPromise = __webpack_require__(136)(Promise, INTERNAL);
19041 var PromiseArray =
19042     __webpack_require__(137)(Promise, INTERNAL,
19043                                tryConvertToPromise, apiRejection, Proxyable);
19044 var Context = __webpack_require__(138)(Promise);
19045  /*jshint unused:false*/
19046 var createContext = Context.create;
19047 var debug = __webpack_require__(139)(Promise, Context);
19048 var CapturedTrace = debug.CapturedTrace;
19049 var PassThroughHandlerContext =
19050     __webpack_require__(140)(Promise, tryConvertToPromise);
19051 var catchFilter = __webpack_require__(141)(NEXT_FILTER);
19052 var nodebackForPromise = __webpack_require__(142);
19053 var errorObj = util.errorObj;
19054 var tryCatch = util.tryCatch;
19055 function check(self, executor) {
19056     if (typeof executor !== "function") {
19057         throw new TypeError("expecting a function but got " + util.classString(executor));
19058     }
19059     if (self.constructor !== Promise) {
19060         throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
19061     }
19062 }
19063
19064 function Promise(executor) {
19065     this._bitField = 0;
19066     this._fulfillmentHandler0 = undefined;
19067     this._rejectionHandler0 = undefined;
19068     this._promise0 = undefined;
19069     this._receiver0 = undefined;
19070     if (executor !== INTERNAL) {
19071         check(this, executor);
19072         this._resolveFromExecutor(executor);
19073     }
19074     this._promiseCreated();
19075     this._fireEvent("promiseCreated", this);
19076 }
19077
19078 Promise.prototype.toString = function () {
19079     return "[object Promise]";
19080 };
19081
19082 Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
19083     var len = arguments.length;
19084     if (len > 1) {
19085         var catchInstances = new Array(len - 1),
19086             j = 0, i;
19087         for (i = 0; i < len - 1; ++i) {
19088             var item = arguments[i];
19089             if (util.isObject(item)) {
19090                 catchInstances[j++] = item;
19091             } else {
19092                 return apiRejection("expecting an object but got " +
19093                     "A catch statement predicate " + util.classString(item));
19094             }
19095         }
19096         catchInstances.length = j;
19097         fn = arguments[i];
19098         return this.then(undefined, catchFilter(catchInstances, fn, this));
19099     }
19100     return this.then(undefined, fn);
19101 };
19102
19103 Promise.prototype.reflect = function () {
19104     return this._then(reflectHandler,
19105         reflectHandler, undefined, this, undefined);
19106 };
19107
19108 Promise.prototype.then = function (didFulfill, didReject) {
19109     if (debug.warnings() && arguments.length > 0 &&
19110         typeof didFulfill !== "function" &&
19111         typeof didReject !== "function") {
19112         var msg = ".then() only accepts functions but was passed: " +
19113                 util.classString(didFulfill);
19114         if (arguments.length > 1) {
19115             msg += ", " + util.classString(didReject);
19116         }
19117         this._warn(msg);
19118     }
19119     return this._then(didFulfill, didReject, undefined, undefined, undefined);
19120 };
19121
19122 Promise.prototype.done = function (didFulfill, didReject) {
19123     var promise =
19124         this._then(didFulfill, didReject, undefined, undefined, undefined);
19125     promise._setIsFinal();
19126 };
19127
19128 Promise.prototype.spread = function (fn) {
19129     if (typeof fn !== "function") {
19130         return apiRejection("expecting a function but got " + util.classString(fn));
19131     }
19132     return this.all()._then(fn, undefined, undefined, APPLY, undefined);
19133 };
19134
19135 Promise.prototype.toJSON = function () {
19136     var ret = {
19137         isFulfilled: false,
19138         isRejected: false,
19139         fulfillmentValue: undefined,
19140         rejectionReason: undefined
19141     };
19142     if (this.isFulfilled()) {
19143         ret.fulfillmentValue = this.value();
19144         ret.isFulfilled = true;
19145     } else if (this.isRejected()) {
19146         ret.rejectionReason = this.reason();
19147         ret.isRejected = true;
19148     }
19149     return ret;
19150 };
19151
19152 Promise.prototype.all = function () {
19153     if (arguments.length > 0) {
19154         this._warn(".all() was passed arguments but it does not take any");
19155     }
19156     return new PromiseArray(this).promise();
19157 };
19158
19159 Promise.prototype.error = function (fn) {
19160     return this.caught(util.originatesFromRejection, fn);
19161 };
19162
19163 Promise.getNewLibraryCopy = module.exports;
19164
19165 Promise.is = function (val) {
19166     return val instanceof Promise;
19167 };
19168
19169 Promise.fromNode = Promise.fromCallback = function(fn) {
19170     var ret = new Promise(INTERNAL);
19171     ret._captureStackTrace();
19172     var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
19173                                          : false;
19174     var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
19175     if (result === errorObj) {
19176         ret._rejectCallback(result.e, true);
19177     }
19178     if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
19179     return ret;
19180 };
19181
19182 Promise.all = function (promises) {
19183     return new PromiseArray(promises).promise();
19184 };
19185
19186 Promise.cast = function (obj) {
19187     var ret = tryConvertToPromise(obj);
19188     if (!(ret instanceof Promise)) {
19189         ret = new Promise(INTERNAL);
19190         ret._captureStackTrace();
19191         ret._setFulfilled();
19192         ret._rejectionHandler0 = obj;
19193     }
19194     return ret;
19195 };
19196
19197 Promise.resolve = Promise.fulfilled = Promise.cast;
19198
19199 Promise.reject = Promise.rejected = function (reason) {
19200     var ret = new Promise(INTERNAL);
19201     ret._captureStackTrace();
19202     ret._rejectCallback(reason, true);
19203     return ret;
19204 };
19205
19206 Promise.setScheduler = function(fn) {
19207     if (typeof fn !== "function") {
19208         throw new TypeError("expecting a function but got " + util.classString(fn));
19209     }
19210     return async.setScheduler(fn);
19211 };
19212
19213 Promise.prototype._then = function (
19214     didFulfill,
19215     didReject,
19216     _,    receiver,
19217     internalData
19218 ) {
19219     var haveInternalData = internalData !== undefined;
19220     var promise = haveInternalData ? internalData : new Promise(INTERNAL);
19221     var target = this._target();
19222     var bitField = target._bitField;
19223
19224     if (!haveInternalData) {
19225         promise._propagateFrom(this, 3);
19226         promise._captureStackTrace();
19227         if (receiver === undefined &&
19228             ((this._bitField & 2097152) !== 0)) {
19229             if (!((bitField & 50397184) === 0)) {
19230                 receiver = this._boundValue();
19231             } else {
19232                 receiver = target === this ? undefined : this._boundTo;
19233             }
19234         }
19235         this._fireEvent("promiseChained", this, promise);
19236     }
19237
19238     var domain = getDomain();
19239     if (!((bitField & 50397184) === 0)) {
19240         var handler, value, settler = target._settlePromiseCtx;
19241         if (((bitField & 33554432) !== 0)) {
19242             value = target._rejectionHandler0;
19243             handler = didFulfill;
19244         } else if (((bitField & 16777216) !== 0)) {
19245             value = target._fulfillmentHandler0;
19246             handler = didReject;
19247             target._unsetRejectionIsUnhandled();
19248         } else {
19249             settler = target._settlePromiseLateCancellationObserver;
19250             value = new CancellationError("late cancellation observer");
19251             target._attachExtraTrace(value);
19252             handler = didReject;
19253         }
19254
19255         async.invoke(settler, target, {
19256             handler: domain === null ? handler
19257                 : (typeof handler === "function" &&
19258                     util.domainBind(domain, handler)),
19259             promise: promise,
19260             receiver: receiver,
19261             value: value
19262         });
19263     } else {
19264         target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
19265     }
19266
19267     return promise;
19268 };
19269
19270 Promise.prototype._length = function () {
19271     return this._bitField & 65535;
19272 };
19273
19274 Promise.prototype._isFateSealed = function () {
19275     return (this._bitField & 117506048) !== 0;
19276 };
19277
19278 Promise.prototype._isFollowing = function () {
19279     return (this._bitField & 67108864) === 67108864;
19280 };
19281
19282 Promise.prototype._setLength = function (len) {
19283     this._bitField = (this._bitField & -65536) |
19284         (len & 65535);
19285 };
19286
19287 Promise.prototype._setFulfilled = function () {
19288     this._bitField = this._bitField | 33554432;
19289     this._fireEvent("promiseFulfilled", this);
19290 };
19291
19292 Promise.prototype._setRejected = function () {
19293     this._bitField = this._bitField | 16777216;
19294     this._fireEvent("promiseRejected", this);
19295 };
19296
19297 Promise.prototype._setFollowing = function () {
19298     this._bitField = this._bitField | 67108864;
19299     this._fireEvent("promiseResolved", this);
19300 };
19301
19302 Promise.prototype._setIsFinal = function () {
19303     this._bitField = this._bitField | 4194304;
19304 };
19305
19306 Promise.prototype._isFinal = function () {
19307     return (this._bitField & 4194304) > 0;
19308 };
19309
19310 Promise.prototype._unsetCancelled = function() {
19311     this._bitField = this._bitField & (~65536);
19312 };
19313
19314 Promise.prototype._setCancelled = function() {
19315     this._bitField = this._bitField | 65536;
19316     this._fireEvent("promiseCancelled", this);
19317 };
19318
19319 Promise.prototype._setWillBeCancelled = function() {
19320     this._bitField = this._bitField | 8388608;
19321 };
19322
19323 Promise.prototype._setAsyncGuaranteed = function() {
19324     if (async.hasCustomScheduler()) return;
19325     this._bitField = this._bitField | 134217728;
19326 };
19327
19328 Promise.prototype._receiverAt = function (index) {
19329     var ret = index === 0 ? this._receiver0 : this[
19330             index * 4 - 4 + 3];
19331     if (ret === UNDEFINED_BINDING) {
19332         return undefined;
19333     } else if (ret === undefined && this._isBound()) {
19334         return this._boundValue();
19335     }
19336     return ret;
19337 };
19338
19339 Promise.prototype._promiseAt = function (index) {
19340     return this[
19341             index * 4 - 4 + 2];
19342 };
19343
19344 Promise.prototype._fulfillmentHandlerAt = function (index) {
19345     return this[
19346             index * 4 - 4 + 0];
19347 };
19348
19349 Promise.prototype._rejectionHandlerAt = function (index) {
19350     return this[
19351             index * 4 - 4 + 1];
19352 };
19353
19354 Promise.prototype._boundValue = function() {};
19355
19356 Promise.prototype._migrateCallback0 = function (follower) {
19357     var bitField = follower._bitField;
19358     var fulfill = follower._fulfillmentHandler0;
19359     var reject = follower._rejectionHandler0;
19360     var promise = follower._promise0;
19361     var receiver = follower._receiverAt(0);
19362     if (receiver === undefined) receiver = UNDEFINED_BINDING;
19363     this._addCallbacks(fulfill, reject, promise, receiver, null);
19364 };
19365
19366 Promise.prototype._migrateCallbackAt = function (follower, index) {
19367     var fulfill = follower._fulfillmentHandlerAt(index);
19368     var reject = follower._rejectionHandlerAt(index);
19369     var promise = follower._promiseAt(index);
19370     var receiver = follower._receiverAt(index);
19371     if (receiver === undefined) receiver = UNDEFINED_BINDING;
19372     this._addCallbacks(fulfill, reject, promise, receiver, null);
19373 };
19374
19375 Promise.prototype._addCallbacks = function (
19376     fulfill,
19377     reject,
19378     promise,
19379     receiver,
19380     domain
19381 ) {
19382     var index = this._length();
19383
19384     if (index >= 65535 - 4) {
19385         index = 0;
19386         this._setLength(0);
19387     }
19388
19389     if (index === 0) {
19390         this._promise0 = promise;
19391         this._receiver0 = receiver;
19392         if (typeof fulfill === "function") {
19393             this._fulfillmentHandler0 =
19394                 domain === null ? fulfill : util.domainBind(domain, fulfill);
19395         }
19396         if (typeof reject === "function") {
19397             this._rejectionHandler0 =
19398                 domain === null ? reject : util.domainBind(domain, reject);
19399         }
19400     } else {
19401         var base = index * 4 - 4;
19402         this[base + 2] = promise;
19403         this[base + 3] = receiver;
19404         if (typeof fulfill === "function") {
19405             this[base + 0] =
19406                 domain === null ? fulfill : util.domainBind(domain, fulfill);
19407         }
19408         if (typeof reject === "function") {
19409             this[base + 1] =
19410                 domain === null ? reject : util.domainBind(domain, reject);
19411         }
19412     }
19413     this._setLength(index + 1);
19414     return index;
19415 };
19416
19417 Promise.prototype._proxy = function (proxyable, arg) {
19418     this._addCallbacks(undefined, undefined, arg, proxyable, null);
19419 };
19420
19421 Promise.prototype._resolveCallback = function(value, shouldBind) {
19422     if (((this._bitField & 117506048) !== 0)) return;
19423     if (value === this)
19424         return this._rejectCallback(makeSelfResolutionError(), false);
19425     var maybePromise = tryConvertToPromise(value, this);
19426     if (!(maybePromise instanceof Promise)) return this._fulfill(value);
19427
19428     if (shouldBind) this._propagateFrom(maybePromise, 2);
19429
19430     var promise = maybePromise._target();
19431
19432     if (promise === this) {
19433         this._reject(makeSelfResolutionError());
19434         return;
19435     }
19436
19437     var bitField = promise._bitField;
19438     if (((bitField & 50397184) === 0)) {
19439         var len = this._length();
19440         if (len > 0) promise._migrateCallback0(this);
19441         for (var i = 1; i < len; ++i) {
19442             promise._migrateCallbackAt(this, i);
19443         }
19444         this._setFollowing();
19445         this._setLength(0);
19446         this._setFollowee(promise);
19447     } else if (((bitField & 33554432) !== 0)) {
19448         this._fulfill(promise._value());
19449     } else if (((bitField & 16777216) !== 0)) {
19450         this._reject(promise._reason());
19451     } else {
19452         var reason = new CancellationError("late cancellation observer");
19453         promise._attachExtraTrace(reason);
19454         this._reject(reason);
19455     }
19456 };
19457
19458 Promise.prototype._rejectCallback =
19459 function(reason, synchronous, ignoreNonErrorWarnings) {
19460     var trace = util.ensureErrorObject(reason);
19461     var hasStack = trace === reason;
19462     if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
19463         var message = "a promise was rejected with a non-error: " +
19464             util.classString(reason);
19465         this._warn(message, true);
19466     }
19467     this._attachExtraTrace(trace, synchronous ? hasStack : false);
19468     this._reject(reason);
19469 };
19470
19471 Promise.prototype._resolveFromExecutor = function (executor) {
19472     var promise = this;
19473     this._captureStackTrace();
19474     this._pushContext();
19475     var synchronous = true;
19476     var r = this._execute(executor, function(value) {
19477         promise._resolveCallback(value);
19478     }, function (reason) {
19479         promise._rejectCallback(reason, synchronous);
19480     });
19481     synchronous = false;
19482     this._popContext();
19483
19484     if (r !== undefined) {
19485         promise._rejectCallback(r, true);
19486     }
19487 };
19488
19489 Promise.prototype._settlePromiseFromHandler = function (
19490     handler, receiver, value, promise
19491 ) {
19492     var bitField = promise._bitField;
19493     if (((bitField & 65536) !== 0)) return;
19494     promise._pushContext();
19495     var x;
19496     if (receiver === APPLY) {
19497         if (!value || typeof value.length !== "number") {
19498             x = errorObj;
19499             x.e = new TypeError("cannot .spread() a non-array: " +
19500                                     util.classString(value));
19501         } else {
19502             x = tryCatch(handler).apply(this._boundValue(), value);
19503         }
19504     } else {
19505         x = tryCatch(handler).call(receiver, value);
19506     }
19507     var promiseCreated = promise._popContext();
19508     bitField = promise._bitField;
19509     if (((bitField & 65536) !== 0)) return;
19510
19511     if (x === NEXT_FILTER) {
19512         promise._reject(value);
19513     } else if (x === errorObj) {
19514         promise._rejectCallback(x.e, false);
19515     } else {
19516         debug.checkForgottenReturns(x, promiseCreated, "",  promise, this);
19517         promise._resolveCallback(x);
19518     }
19519 };
19520
19521 Promise.prototype._target = function() {
19522     var ret = this;
19523     while (ret._isFollowing()) ret = ret._followee();
19524     return ret;
19525 };
19526
19527 Promise.prototype._followee = function() {
19528     return this._rejectionHandler0;
19529 };
19530
19531 Promise.prototype._setFollowee = function(promise) {
19532     this._rejectionHandler0 = promise;
19533 };
19534
19535 Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
19536     var isPromise = promise instanceof Promise;
19537     var bitField = this._bitField;
19538     var asyncGuaranteed = ((bitField & 134217728) !== 0);
19539     if (((bitField & 65536) !== 0)) {
19540         if (isPromise) promise._invokeInternalOnCancel();
19541
19542         if (receiver instanceof PassThroughHandlerContext &&
19543             receiver.isFinallyHandler()) {
19544             receiver.cancelPromise = promise;
19545             if (tryCatch(handler).call(receiver, value) === errorObj) {
19546                 promise._reject(errorObj.e);
19547             }
19548         } else if (handler === reflectHandler) {
19549             promise._fulfill(reflectHandler.call(receiver));
19550         } else if (receiver instanceof Proxyable) {
19551             receiver._promiseCancelled(promise);
19552         } else if (isPromise || promise instanceof PromiseArray) {
19553             promise._cancel();
19554         } else {
19555             receiver.cancel();
19556         }
19557     } else if (typeof handler === "function") {
19558         if (!isPromise) {
19559             handler.call(receiver, value, promise);
19560         } else {
19561             if (asyncGuaranteed) promise._setAsyncGuaranteed();
19562             this._settlePromiseFromHandler(handler, receiver, value, promise);
19563         }
19564     } else if (receiver instanceof Proxyable) {
19565         if (!receiver._isResolved()) {
19566             if (((bitField & 33554432) !== 0)) {
19567                 receiver._promiseFulfilled(value, promise);
19568             } else {
19569                 receiver._promiseRejected(value, promise);
19570             }
19571         }
19572     } else if (isPromise) {
19573         if (asyncGuaranteed) promise._setAsyncGuaranteed();
19574         if (((bitField & 33554432) !== 0)) {
19575             promise._fulfill(value);
19576         } else {
19577             promise._reject(value);
19578         }
19579     }
19580 };
19581
19582 Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
19583     var handler = ctx.handler;
19584     var promise = ctx.promise;
19585     var receiver = ctx.receiver;
19586     var value = ctx.value;
19587     if (typeof handler === "function") {
19588         if (!(promise instanceof Promise)) {
19589             handler.call(receiver, value, promise);
19590         } else {
19591             this._settlePromiseFromHandler(handler, receiver, value, promise);
19592         }
19593     } else if (promise instanceof Promise) {
19594         promise._reject(value);
19595     }
19596 };
19597
19598 Promise.prototype._settlePromiseCtx = function(ctx) {
19599     this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
19600 };
19601
19602 Promise.prototype._settlePromise0 = function(handler, value, bitField) {
19603     var promise = this._promise0;
19604     var receiver = this._receiverAt(0);
19605     this._promise0 = undefined;
19606     this._receiver0 = undefined;
19607     this._settlePromise(promise, handler, receiver, value);
19608 };
19609
19610 Promise.prototype._clearCallbackDataAtIndex = function(index) {
19611     var base = index * 4 - 4;
19612     this[base + 2] =
19613     this[base + 3] =
19614     this[base + 0] =
19615     this[base + 1] = undefined;
19616 };
19617
19618 Promise.prototype._fulfill = function (value) {
19619     var bitField = this._bitField;
19620     if (((bitField & 117506048) >>> 16)) return;
19621     if (value === this) {
19622         var err = makeSelfResolutionError();
19623         this._attachExtraTrace(err);
19624         return this._reject(err);
19625     }
19626     this._setFulfilled();
19627     this._rejectionHandler0 = value;
19628
19629     if ((bitField & 65535) > 0) {
19630         if (((bitField & 134217728) !== 0)) {
19631             this._settlePromises();
19632         } else {
19633             async.settlePromises(this);
19634         }
19635     }
19636 };
19637
19638 Promise.prototype._reject = function (reason) {
19639     var bitField = this._bitField;
19640     if (((bitField & 117506048) >>> 16)) return;
19641     this._setRejected();
19642     this._fulfillmentHandler0 = reason;
19643
19644     if (this._isFinal()) {
19645         return async.fatalError(reason, util.isNode);
19646     }
19647
19648     if ((bitField & 65535) > 0) {
19649         async.settlePromises(this);
19650     } else {
19651         this._ensurePossibleRejectionHandled();
19652     }
19653 };
19654
19655 Promise.prototype._fulfillPromises = function (len, value) {
19656     for (var i = 1; i < len; i++) {
19657         var handler = this._fulfillmentHandlerAt(i);
19658         var promise = this._promiseAt(i);
19659         var receiver = this._receiverAt(i);
19660         this._clearCallbackDataAtIndex(i);
19661         this._settlePromise(promise, handler, receiver, value);
19662     }
19663 };
19664
19665 Promise.prototype._rejectPromises = function (len, reason) {
19666     for (var i = 1; i < len; i++) {
19667         var handler = this._rejectionHandlerAt(i);
19668         var promise = this._promiseAt(i);
19669         var receiver = this._receiverAt(i);
19670         this._clearCallbackDataAtIndex(i);
19671         this._settlePromise(promise, handler, receiver, reason);
19672     }
19673 };
19674
19675 Promise.prototype._settlePromises = function () {
19676     var bitField = this._bitField;
19677     var len = (bitField & 65535);
19678
19679     if (len > 0) {
19680         if (((bitField & 16842752) !== 0)) {
19681             var reason = this._fulfillmentHandler0;
19682             this._settlePromise0(this._rejectionHandler0, reason, bitField);
19683             this._rejectPromises(len, reason);
19684         } else {
19685             var value = this._rejectionHandler0;
19686             this._settlePromise0(this._fulfillmentHandler0, value, bitField);
19687             this._fulfillPromises(len, value);
19688         }
19689         this._setLength(0);
19690     }
19691     this._clearCancellationData();
19692 };
19693
19694 Promise.prototype._settledValue = function() {
19695     var bitField = this._bitField;
19696     if (((bitField & 33554432) !== 0)) {
19697         return this._rejectionHandler0;
19698     } else if (((bitField & 16777216) !== 0)) {
19699         return this._fulfillmentHandler0;
19700     }
19701 };
19702
19703 function deferResolve(v) {this.promise._resolveCallback(v);}
19704 function deferReject(v) {this.promise._rejectCallback(v, false);}
19705
19706 Promise.defer = Promise.pending = function() {
19707     debug.deprecated("Promise.defer", "new Promise");
19708     var promise = new Promise(INTERNAL);
19709     return {
19710         promise: promise,
19711         resolve: deferResolve,
19712         reject: deferReject
19713     };
19714 };
19715
19716 util.notEnumerableProp(Promise,
19717                        "_makeSelfResolutionError",
19718                        makeSelfResolutionError);
19719
19720 __webpack_require__(143)(Promise, INTERNAL, tryConvertToPromise, apiRejection,
19721     debug);
19722 __webpack_require__(144)(Promise, INTERNAL, tryConvertToPromise, debug);
19723 __webpack_require__(145)(Promise, PromiseArray, apiRejection, debug);
19724 __webpack_require__(146)(Promise);
19725 __webpack_require__(147)(Promise);
19726 __webpack_require__(148)(
19727     Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
19728 Promise.Promise = Promise;
19729 Promise.version = "3.4.7";
19730 __webpack_require__(149)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
19731 __webpack_require__(150)(Promise);
19732 __webpack_require__(151)(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
19733 __webpack_require__(152)(Promise, INTERNAL, debug);
19734 __webpack_require__(153)(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
19735 __webpack_require__(154)(Promise);
19736 __webpack_require__(155)(Promise, INTERNAL);
19737 __webpack_require__(156)(Promise, PromiseArray, tryConvertToPromise, apiRejection);
19738 __webpack_require__(157)(Promise, INTERNAL, tryConvertToPromise, apiRejection);
19739 __webpack_require__(158)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
19740 __webpack_require__(159)(Promise, PromiseArray, debug);
19741 __webpack_require__(160)(Promise, PromiseArray, apiRejection);
19742 __webpack_require__(161)(Promise, INTERNAL);
19743 __webpack_require__(162)(Promise, INTERNAL);
19744 __webpack_require__(163)(Promise);
19745                                                          
19746     util.toFastProperties(Promise);                                          
19747     util.toFastProperties(Promise.prototype);                                
19748     function fillTypes(value) {                                              
19749         var p = new Promise(INTERNAL);                                       
19750         p._fulfillmentHandler0 = value;                                      
19751         p._rejectionHandler0 = value;                                        
19752         p._promise0 = value;                                                 
19753         p._receiver0 = value;                                                
19754     }                                                                        
19755     // Complete slack tracking, opt out of field-type tracking and           
19756     // stabilize map                                                         
19757     fillTypes({a: 1});                                                       
19758     fillTypes({b: 2});                                                       
19759     fillTypes({c: 3});                                                       
19760     fillTypes(1);                                                            
19761     fillTypes(function(){});                                                 
19762     fillTypes(undefined);                                                    
19763     fillTypes(false);                                                        
19764     fillTypes(new Promise(INTERNAL));                                        
19765     debug.setBounds(Async.firstLineError, util.lastLineError);               
19766     return Promise;                                                          
19767
19768 };
19769
19770
19771 /***/ }),
19772 /* 130 */
19773 /***/ (function(module, exports, __webpack_require__) {
19774
19775 "use strict";
19776
19777 var es5 = __webpack_require__(131);
19778 var canEvaluate = typeof navigator == "undefined";
19779
19780 var errorObj = {e: {}};
19781 var tryCatchTarget;
19782 var globalObject = typeof self !== "undefined" ? self :
19783     typeof window !== "undefined" ? window :
19784     typeof global !== "undefined" ? global :
19785     this !== undefined ? this : null;
19786
19787 function tryCatcher() {
19788     try {
19789         var target = tryCatchTarget;
19790         tryCatchTarget = null;
19791         return target.apply(this, arguments);
19792     } catch (e) {
19793         errorObj.e = e;
19794         return errorObj;
19795     }
19796 }
19797 function tryCatch(fn) {
19798     tryCatchTarget = fn;
19799     return tryCatcher;
19800 }
19801
19802 var inherits = function(Child, Parent) {
19803     var hasProp = {}.hasOwnProperty;
19804
19805     function T() {
19806         this.constructor = Child;
19807         this.constructor$ = Parent;
19808         for (var propertyName in Parent.prototype) {
19809             if (hasProp.call(Parent.prototype, propertyName) &&
19810                 propertyName.charAt(propertyName.length-1) !== "$"
19811            ) {
19812                 this[propertyName + "$"] = Parent.prototype[propertyName];
19813             }
19814         }
19815     }
19816     T.prototype = Parent.prototype;
19817     Child.prototype = new T();
19818     return Child.prototype;
19819 };
19820
19821
19822 function isPrimitive(val) {
19823     return val == null || val === true || val === false ||
19824         typeof val === "string" || typeof val === "number";
19825
19826 }
19827
19828 function isObject(value) {
19829     return typeof value === "function" ||
19830            typeof value === "object" && value !== null;
19831 }
19832
19833 function maybeWrapAsError(maybeError) {
19834     if (!isPrimitive(maybeError)) return maybeError;
19835
19836     return new Error(safeToString(maybeError));
19837 }
19838
19839 function withAppended(target, appendee) {
19840     var len = target.length;
19841     var ret = new Array(len + 1);
19842     var i;
19843     for (i = 0; i < len; ++i) {
19844         ret[i] = target[i];
19845     }
19846     ret[i] = appendee;
19847     return ret;
19848 }
19849
19850 function getDataPropertyOrDefault(obj, key, defaultValue) {
19851     if (es5.isES5) {
19852         var desc = Object.getOwnPropertyDescriptor(obj, key);
19853
19854         if (desc != null) {
19855             return desc.get == null && desc.set == null
19856                     ? desc.value
19857                     : defaultValue;
19858         }
19859     } else {
19860         return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
19861     }
19862 }
19863
19864 function notEnumerableProp(obj, name, value) {
19865     if (isPrimitive(obj)) return obj;
19866     var descriptor = {
19867         value: value,
19868         configurable: true,
19869         enumerable: false,
19870         writable: true
19871     };
19872     es5.defineProperty(obj, name, descriptor);
19873     return obj;
19874 }
19875
19876 function thrower(r) {
19877     throw r;
19878 }
19879
19880 var inheritedDataKeys = (function() {
19881     var excludedPrototypes = [
19882         Array.prototype,
19883         Object.prototype,
19884         Function.prototype
19885     ];
19886
19887     var isExcludedProto = function(val) {
19888         for (var i = 0; i < excludedPrototypes.length; ++i) {
19889             if (excludedPrototypes[i] === val) {
19890                 return true;
19891             }
19892         }
19893         return false;
19894     };
19895
19896     if (es5.isES5) {
19897         var getKeys = Object.getOwnPropertyNames;
19898         return function(obj) {
19899             var ret = [];
19900             var visitedKeys = Object.create(null);
19901             while (obj != null && !isExcludedProto(obj)) {
19902                 var keys;
19903                 try {
19904                     keys = getKeys(obj);
19905                 } catch (e) {
19906                     return ret;
19907                 }
19908                 for (var i = 0; i < keys.length; ++i) {
19909                     var key = keys[i];
19910                     if (visitedKeys[key]) continue;
19911                     visitedKeys[key] = true;
19912                     var desc = Object.getOwnPropertyDescriptor(obj, key);
19913                     if (desc != null && desc.get == null && desc.set == null) {
19914                         ret.push(key);
19915                     }
19916                 }
19917                 obj = es5.getPrototypeOf(obj);
19918             }
19919             return ret;
19920         };
19921     } else {
19922         var hasProp = {}.hasOwnProperty;
19923         return function(obj) {
19924             if (isExcludedProto(obj)) return [];
19925             var ret = [];
19926
19927             /*jshint forin:false */
19928             enumeration: for (var key in obj) {
19929                 if (hasProp.call(obj, key)) {
19930                     ret.push(key);
19931                 } else {
19932                     for (var i = 0; i < excludedPrototypes.length; ++i) {
19933                         if (hasProp.call(excludedPrototypes[i], key)) {
19934                             continue enumeration;
19935                         }
19936                     }
19937                     ret.push(key);
19938                 }
19939             }
19940             return ret;
19941         };
19942     }
19943
19944 })();
19945
19946 var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
19947 function isClass(fn) {
19948     try {
19949         if (typeof fn === "function") {
19950             var keys = es5.names(fn.prototype);
19951
19952             var hasMethods = es5.isES5 && keys.length > 1;
19953             var hasMethodsOtherThanConstructor = keys.length > 0 &&
19954                 !(keys.length === 1 && keys[0] === "constructor");
19955             var hasThisAssignmentAndStaticMethods =
19956                 thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
19957
19958             if (hasMethods || hasMethodsOtherThanConstructor ||
19959                 hasThisAssignmentAndStaticMethods) {
19960                 return true;
19961             }
19962         }
19963         return false;
19964     } catch (e) {
19965         return false;
19966     }
19967 }
19968
19969 function toFastProperties(obj) {
19970     /*jshint -W027,-W055,-W031*/
19971     function FakeConstructor() {}
19972     FakeConstructor.prototype = obj;
19973     var l = 8;
19974     while (l--) new FakeConstructor();
19975     return obj;
19976     eval(obj);
19977 }
19978
19979 var rident = /^[a-z$_][a-z$_0-9]*$/i;
19980 function isIdentifier(str) {
19981     return rident.test(str);
19982 }
19983
19984 function filledRange(count, prefix, suffix) {
19985     var ret = new Array(count);
19986     for(var i = 0; i < count; ++i) {
19987         ret[i] = prefix + i + suffix;
19988     }
19989     return ret;
19990 }
19991
19992 function safeToString(obj) {
19993     try {
19994         return obj + "";
19995     } catch (e) {
19996         return "[no string representation]";
19997     }
19998 }
19999
20000 function isError(obj) {
20001     return obj !== null &&
20002            typeof obj === "object" &&
20003            typeof obj.message === "string" &&
20004            typeof obj.name === "string";
20005 }
20006
20007 function markAsOriginatingFromRejection(e) {
20008     try {
20009         notEnumerableProp(e, "isOperational", true);
20010     }
20011     catch(ignore) {}
20012 }
20013
20014 function originatesFromRejection(e) {
20015     if (e == null) return false;
20016     return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
20017         e["isOperational"] === true);
20018 }
20019
20020 function canAttachTrace(obj) {
20021     return isError(obj) && es5.propertyIsWritable(obj, "stack");
20022 }
20023
20024 var ensureErrorObject = (function() {
20025     if (!("stack" in new Error())) {
20026         return function(value) {
20027             if (canAttachTrace(value)) return value;
20028             try {throw new Error(safeToString(value));}
20029             catch(err) {return err;}
20030         };
20031     } else {
20032         return function(value) {
20033             if (canAttachTrace(value)) return value;
20034             return new Error(safeToString(value));
20035         };
20036     }
20037 })();
20038
20039 function classString(obj) {
20040     return {}.toString.call(obj);
20041 }
20042
20043 function copyDescriptors(from, to, filter) {
20044     var keys = es5.names(from);
20045     for (var i = 0; i < keys.length; ++i) {
20046         var key = keys[i];
20047         if (filter(key)) {
20048             try {
20049                 es5.defineProperty(to, key, es5.getDescriptor(from, key));
20050             } catch (ignore) {}
20051         }
20052     }
20053 }
20054
20055 var asArray = function(v) {
20056     if (es5.isArray(v)) {
20057         return v;
20058     }
20059     return null;
20060 };
20061
20062 if (typeof Symbol !== "undefined" && Symbol.iterator) {
20063     var ArrayFrom = typeof Array.from === "function" ? function(v) {
20064         return Array.from(v);
20065     } : function(v) {
20066         var ret = [];
20067         var it = v[Symbol.iterator]();
20068         var itResult;
20069         while (!((itResult = it.next()).done)) {
20070             ret.push(itResult.value);
20071         }
20072         return ret;
20073     };
20074
20075     asArray = function(v) {
20076         if (es5.isArray(v)) {
20077             return v;
20078         } else if (v != null && typeof v[Symbol.iterator] === "function") {
20079             return ArrayFrom(v);
20080         }
20081         return null;
20082     };
20083 }
20084
20085 var isNode = typeof process !== "undefined" &&
20086         classString(process).toLowerCase() === "[object process]";
20087
20088 var hasEnvVariables = typeof process !== "undefined" &&
20089     typeof process.env !== "undefined";
20090
20091 function env(key) {
20092     return hasEnvVariables ? process.env[key] : undefined;
20093 }
20094
20095 function getNativePromise() {
20096     if (typeof Promise === "function") {
20097         try {
20098             var promise = new Promise(function(){});
20099             if ({}.toString.call(promise) === "[object Promise]") {
20100                 return Promise;
20101             }
20102         } catch (e) {}
20103     }
20104 }
20105
20106 function domainBind(self, cb) {
20107     return self.bind(cb);
20108 }
20109
20110 var ret = {
20111     isClass: isClass,
20112     isIdentifier: isIdentifier,
20113     inheritedDataKeys: inheritedDataKeys,
20114     getDataPropertyOrDefault: getDataPropertyOrDefault,
20115     thrower: thrower,
20116     isArray: es5.isArray,
20117     asArray: asArray,
20118     notEnumerableProp: notEnumerableProp,
20119     isPrimitive: isPrimitive,
20120     isObject: isObject,
20121     isError: isError,
20122     canEvaluate: canEvaluate,
20123     errorObj: errorObj,
20124     tryCatch: tryCatch,
20125     inherits: inherits,
20126     withAppended: withAppended,
20127     maybeWrapAsError: maybeWrapAsError,
20128     toFastProperties: toFastProperties,
20129     filledRange: filledRange,
20130     toString: safeToString,
20131     canAttachTrace: canAttachTrace,
20132     ensureErrorObject: ensureErrorObject,
20133     originatesFromRejection: originatesFromRejection,
20134     markAsOriginatingFromRejection: markAsOriginatingFromRejection,
20135     classString: classString,
20136     copyDescriptors: copyDescriptors,
20137     hasDevTools: typeof chrome !== "undefined" && chrome &&
20138                  typeof chrome.loadTimes === "function",
20139     isNode: isNode,
20140     hasEnvVariables: hasEnvVariables,
20141     env: env,
20142     global: globalObject,
20143     getNativePromise: getNativePromise,
20144     domainBind: domainBind
20145 };
20146 ret.isRecentNode = ret.isNode && (function() {
20147     var version = process.versions.node.split(".").map(Number);
20148     return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
20149 })();
20150
20151 if (ret.isNode) ret.toFastProperties(process);
20152
20153 try {throw new Error(); } catch (e) {ret.lastLineError = e;}
20154 module.exports = ret;
20155
20156
20157 /***/ }),
20158 /* 131 */
20159 /***/ (function(module, exports) {
20160
20161 var isES5 = (function(){
20162     "use strict";
20163     return this === undefined;
20164 })();
20165
20166 if (isES5) {
20167     module.exports = {
20168         freeze: Object.freeze,
20169         defineProperty: Object.defineProperty,
20170         getDescriptor: Object.getOwnPropertyDescriptor,
20171         keys: Object.keys,
20172         names: Object.getOwnPropertyNames,
20173         getPrototypeOf: Object.getPrototypeOf,
20174         isArray: Array.isArray,
20175         isES5: isES5,
20176         propertyIsWritable: function(obj, prop) {
20177             var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
20178             return !!(!descriptor || descriptor.writable || descriptor.set);
20179         }
20180     };
20181 } else {
20182     var has = {}.hasOwnProperty;
20183     var str = {}.toString;
20184     var proto = {}.constructor.prototype;
20185
20186     var ObjectKeys = function (o) {
20187         var ret = [];
20188         for (var key in o) {
20189             if (has.call(o, key)) {
20190                 ret.push(key);
20191             }
20192         }
20193         return ret;
20194     };
20195
20196     var ObjectGetDescriptor = function(o, key) {
20197         return {value: o[key]};
20198     };
20199
20200     var ObjectDefineProperty = function (o, key, desc) {
20201         o[key] = desc.value;
20202         return o;
20203     };
20204
20205     var ObjectFreeze = function (obj) {
20206         return obj;
20207     };
20208
20209     var ObjectGetPrototypeOf = function (obj) {
20210         try {
20211             return Object(obj).constructor.prototype;
20212         }
20213         catch (e) {
20214             return proto;
20215         }
20216     };
20217
20218     var ArrayIsArray = function (obj) {
20219         try {
20220             return str.call(obj) === "[object Array]";
20221         }
20222         catch(e) {
20223             return false;
20224         }
20225     };
20226
20227     module.exports = {
20228         isArray: ArrayIsArray,
20229         keys: ObjectKeys,
20230         names: ObjectKeys,
20231         defineProperty: ObjectDefineProperty,
20232         getDescriptor: ObjectGetDescriptor,
20233         freeze: ObjectFreeze,
20234         getPrototypeOf: ObjectGetPrototypeOf,
20235         isES5: isES5,
20236         propertyIsWritable: function() {
20237             return true;
20238         }
20239     };
20240 }
20241
20242
20243 /***/ }),
20244 /* 132 */
20245 /***/ (function(module, exports, __webpack_require__) {
20246
20247 "use strict";
20248
20249 var firstLineError;
20250 try {throw new Error(); } catch (e) {firstLineError = e;}
20251 var schedule = __webpack_require__(133);
20252 var Queue = __webpack_require__(134);
20253 var util = __webpack_require__(130);
20254
20255 function Async() {
20256     this._customScheduler = false;
20257     this._isTickUsed = false;
20258     this._lateQueue = new Queue(16);
20259     this._normalQueue = new Queue(16);
20260     this._haveDrainedQueues = false;
20261     this._trampolineEnabled = true;
20262     var self = this;
20263     this.drainQueues = function () {
20264         self._drainQueues();
20265     };
20266     this._schedule = schedule;
20267 }
20268
20269 Async.prototype.setScheduler = function(fn) {
20270     var prev = this._schedule;
20271     this._schedule = fn;
20272     this._customScheduler = true;
20273     return prev;
20274 };
20275
20276 Async.prototype.hasCustomScheduler = function() {
20277     return this._customScheduler;
20278 };
20279
20280 Async.prototype.enableTrampoline = function() {
20281     this._trampolineEnabled = true;
20282 };
20283
20284 Async.prototype.disableTrampolineIfNecessary = function() {
20285     if (util.hasDevTools) {
20286         this._trampolineEnabled = false;
20287     }
20288 };
20289
20290 Async.prototype.haveItemsQueued = function () {
20291     return this._isTickUsed || this._haveDrainedQueues;
20292 };
20293
20294
20295 Async.prototype.fatalError = function(e, isNode) {
20296     if (isNode) {
20297         process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
20298             "\n");
20299         process.exit(2);
20300     } else {
20301         this.throwLater(e);
20302     }
20303 };
20304
20305 Async.prototype.throwLater = function(fn, arg) {
20306     if (arguments.length === 1) {
20307         arg = fn;
20308         fn = function () { throw arg; };
20309     }
20310     if (typeof setTimeout !== "undefined") {
20311         setTimeout(function() {
20312             fn(arg);
20313         }, 0);
20314     } else try {
20315         this._schedule(function() {
20316             fn(arg);
20317         });
20318     } catch (e) {
20319         throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
20320     }
20321 };
20322
20323 function AsyncInvokeLater(fn, receiver, arg) {
20324     this._lateQueue.push(fn, receiver, arg);
20325     this._queueTick();
20326 }
20327
20328 function AsyncInvoke(fn, receiver, arg) {
20329     this._normalQueue.push(fn, receiver, arg);
20330     this._queueTick();
20331 }
20332
20333 function AsyncSettlePromises(promise) {
20334     this._normalQueue._pushOne(promise);
20335     this._queueTick();
20336 }
20337
20338 if (!util.hasDevTools) {
20339     Async.prototype.invokeLater = AsyncInvokeLater;
20340     Async.prototype.invoke = AsyncInvoke;
20341     Async.prototype.settlePromises = AsyncSettlePromises;
20342 } else {
20343     Async.prototype.invokeLater = function (fn, receiver, arg) {
20344         if (this._trampolineEnabled) {
20345             AsyncInvokeLater.call(this, fn, receiver, arg);
20346         } else {
20347             this._schedule(function() {
20348                 setTimeout(function() {
20349                     fn.call(receiver, arg);
20350                 }, 100);
20351             });
20352         }
20353     };
20354
20355     Async.prototype.invoke = function (fn, receiver, arg) {
20356         if (this._trampolineEnabled) {
20357             AsyncInvoke.call(this, fn, receiver, arg);
20358         } else {
20359             this._schedule(function() {
20360                 fn.call(receiver, arg);
20361             });
20362         }
20363     };
20364
20365     Async.prototype.settlePromises = function(promise) {
20366         if (this._trampolineEnabled) {
20367             AsyncSettlePromises.call(this, promise);
20368         } else {
20369             this._schedule(function() {
20370                 promise._settlePromises();
20371             });
20372         }
20373     };
20374 }
20375
20376 Async.prototype._drainQueue = function(queue) {
20377     while (queue.length() > 0) {
20378         var fn = queue.shift();
20379         if (typeof fn !== "function") {
20380             fn._settlePromises();
20381             continue;
20382         }
20383         var receiver = queue.shift();
20384         var arg = queue.shift();
20385         fn.call(receiver, arg);
20386     }
20387 };
20388
20389 Async.prototype._drainQueues = function () {
20390     this._drainQueue(this._normalQueue);
20391     this._reset();
20392     this._haveDrainedQueues = true;
20393     this._drainQueue(this._lateQueue);
20394 };
20395
20396 Async.prototype._queueTick = function () {
20397     if (!this._isTickUsed) {
20398         this._isTickUsed = true;
20399         this._schedule(this.drainQueues);
20400     }
20401 };
20402
20403 Async.prototype._reset = function () {
20404     this._isTickUsed = false;
20405 };
20406
20407 module.exports = Async;
20408 module.exports.firstLineError = firstLineError;
20409
20410
20411 /***/ }),
20412 /* 133 */
20413 /***/ (function(module, exports, __webpack_require__) {
20414
20415 "use strict";
20416
20417 var util = __webpack_require__(130);
20418 var schedule;
20419 var noAsyncScheduler = function() {
20420     throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
20421 };
20422 var NativePromise = util.getNativePromise();
20423 if (util.isNode && typeof MutationObserver === "undefined") {
20424     var GlobalSetImmediate = global.setImmediate;
20425     var ProcessNextTick = process.nextTick;
20426     schedule = util.isRecentNode
20427                 ? function(fn) { GlobalSetImmediate.call(global, fn); }
20428                 : function(fn) { ProcessNextTick.call(process, fn); };
20429 } else if (typeof NativePromise === "function" &&
20430            typeof NativePromise.resolve === "function") {
20431     var nativePromise = NativePromise.resolve();
20432     schedule = function(fn) {
20433         nativePromise.then(fn);
20434     };
20435 } else if ((typeof MutationObserver !== "undefined") &&
20436           !(typeof window !== "undefined" &&
20437             window.navigator &&
20438             (window.navigator.standalone || window.cordova))) {
20439     schedule = (function() {
20440         var div = document.createElement("div");
20441         var opts = {attributes: true};
20442         var toggleScheduled = false;
20443         var div2 = document.createElement("div");
20444         var o2 = new MutationObserver(function() {
20445             div.classList.toggle("foo");
20446             toggleScheduled = false;
20447         });
20448         o2.observe(div2, opts);
20449
20450         var scheduleToggle = function() {
20451             if (toggleScheduled) return;
20452                 toggleScheduled = true;
20453                 div2.classList.toggle("foo");
20454             };
20455
20456             return function schedule(fn) {
20457             var o = new MutationObserver(function() {
20458                 o.disconnect();
20459                 fn();
20460             });
20461             o.observe(div, opts);
20462             scheduleToggle();
20463         };
20464     })();
20465 } else if (typeof setImmediate !== "undefined") {
20466     schedule = function (fn) {
20467         setImmediate(fn);
20468     };
20469 } else if (typeof setTimeout !== "undefined") {
20470     schedule = function (fn) {
20471         setTimeout(fn, 0);
20472     };
20473 } else {
20474     schedule = noAsyncScheduler;
20475 }
20476 module.exports = schedule;
20477
20478
20479 /***/ }),
20480 /* 134 */
20481 /***/ (function(module, exports, __webpack_require__) {
20482
20483 "use strict";
20484
20485 function arrayMove(src, srcIndex, dst, dstIndex, len) {
20486     for (var j = 0; j < len; ++j) {
20487         dst[j + dstIndex] = src[j + srcIndex];
20488         src[j + srcIndex] = void 0;
20489     }
20490 }
20491
20492 function Queue(capacity) {
20493     this._capacity = capacity;
20494     this._length = 0;
20495     this._front = 0;
20496 }
20497
20498 Queue.prototype._willBeOverCapacity = function (size) {
20499     return this._capacity < size;
20500 };
20501
20502 Queue.prototype._pushOne = function (arg) {
20503     var length = this.length();
20504     this._checkCapacity(length + 1);
20505     var i = (this._front + length) & (this._capacity - 1);
20506     this[i] = arg;
20507     this._length = length + 1;
20508 };
20509
20510 Queue.prototype.push = function (fn, receiver, arg) {
20511     var length = this.length() + 3;
20512     if (this._willBeOverCapacity(length)) {
20513         this._pushOne(fn);
20514         this._pushOne(receiver);
20515         this._pushOne(arg);
20516         return;
20517     }
20518     var j = this._front + length - 3;
20519     this._checkCapacity(length);
20520     var wrapMask = this._capacity - 1;
20521     this[(j + 0) & wrapMask] = fn;
20522     this[(j + 1) & wrapMask] = receiver;
20523     this[(j + 2) & wrapMask] = arg;
20524     this._length = length;
20525 };
20526
20527 Queue.prototype.shift = function () {
20528     var front = this._front,
20529         ret = this[front];
20530
20531     this[front] = undefined;
20532     this._front = (front + 1) & (this._capacity - 1);
20533     this._length--;
20534     return ret;
20535 };
20536
20537 Queue.prototype.length = function () {
20538     return this._length;
20539 };
20540
20541 Queue.prototype._checkCapacity = function (size) {
20542     if (this._capacity < size) {
20543         this._resizeTo(this._capacity << 1);
20544     }
20545 };
20546
20547 Queue.prototype._resizeTo = function (capacity) {
20548     var oldCapacity = this._capacity;
20549     this._capacity = capacity;
20550     var front = this._front;
20551     var length = this._length;
20552     var moveItemsCount = (front + length) & (oldCapacity - 1);
20553     arrayMove(this, 0, this, oldCapacity, moveItemsCount);
20554 };
20555
20556 module.exports = Queue;
20557
20558
20559 /***/ }),
20560 /* 135 */
20561 /***/ (function(module, exports, __webpack_require__) {
20562
20563 "use strict";
20564
20565 var es5 = __webpack_require__(131);
20566 var Objectfreeze = es5.freeze;
20567 var util = __webpack_require__(130);
20568 var inherits = util.inherits;
20569 var notEnumerableProp = util.notEnumerableProp;
20570
20571 function subError(nameProperty, defaultMessage) {
20572     function SubError(message) {
20573         if (!(this instanceof SubError)) return new SubError(message);
20574         notEnumerableProp(this, "message",
20575             typeof message === "string" ? message : defaultMessage);
20576         notEnumerableProp(this, "name", nameProperty);
20577         if (Error.captureStackTrace) {
20578             Error.captureStackTrace(this, this.constructor);
20579         } else {
20580             Error.call(this);
20581         }
20582     }
20583     inherits(SubError, Error);
20584     return SubError;
20585 }
20586
20587 var _TypeError, _RangeError;
20588 var Warning = subError("Warning", "warning");
20589 var CancellationError = subError("CancellationError", "cancellation error");
20590 var TimeoutError = subError("TimeoutError", "timeout error");
20591 var AggregateError = subError("AggregateError", "aggregate error");
20592 try {
20593     _TypeError = TypeError;
20594     _RangeError = RangeError;
20595 } catch(e) {
20596     _TypeError = subError("TypeError", "type error");
20597     _RangeError = subError("RangeError", "range error");
20598 }
20599
20600 var methods = ("join pop push shift unshift slice filter forEach some " +
20601     "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
20602
20603 for (var i = 0; i < methods.length; ++i) {
20604     if (typeof Array.prototype[methods[i]] === "function") {
20605         AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
20606     }
20607 }
20608
20609 es5.defineProperty(AggregateError.prototype, "length", {
20610     value: 0,
20611     configurable: false,
20612     writable: true,
20613     enumerable: true
20614 });
20615 AggregateError.prototype["isOperational"] = true;
20616 var level = 0;
20617 AggregateError.prototype.toString = function() {
20618     var indent = Array(level * 4 + 1).join(" ");
20619     var ret = "\n" + indent + "AggregateError of:" + "\n";
20620     level++;
20621     indent = Array(level * 4 + 1).join(" ");
20622     for (var i = 0; i < this.length; ++i) {
20623         var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
20624         var lines = str.split("\n");
20625         for (var j = 0; j < lines.length; ++j) {
20626             lines[j] = indent + lines[j];
20627         }
20628         str = lines.join("\n");
20629         ret += str + "\n";
20630     }
20631     level--;
20632     return ret;
20633 };
20634
20635 function OperationalError(message) {
20636     if (!(this instanceof OperationalError))
20637         return new OperationalError(message);
20638     notEnumerableProp(this, "name", "OperationalError");
20639     notEnumerableProp(this, "message", message);
20640     this.cause = message;
20641     this["isOperational"] = true;
20642
20643     if (message instanceof Error) {
20644         notEnumerableProp(this, "message", message.message);
20645         notEnumerableProp(this, "stack", message.stack);
20646     } else if (Error.captureStackTrace) {
20647         Error.captureStackTrace(this, this.constructor);
20648     }
20649
20650 }
20651 inherits(OperationalError, Error);
20652
20653 var errorTypes = Error["__BluebirdErrorTypes__"];
20654 if (!errorTypes) {
20655     errorTypes = Objectfreeze({
20656         CancellationError: CancellationError,
20657         TimeoutError: TimeoutError,
20658         OperationalError: OperationalError,
20659         RejectionError: OperationalError,
20660         AggregateError: AggregateError
20661     });
20662     es5.defineProperty(Error, "__BluebirdErrorTypes__", {
20663         value: errorTypes,
20664         writable: false,
20665         enumerable: false,
20666         configurable: false
20667     });
20668 }
20669
20670 module.exports = {
20671     Error: Error,
20672     TypeError: _TypeError,
20673     RangeError: _RangeError,
20674     CancellationError: errorTypes.CancellationError,
20675     OperationalError: errorTypes.OperationalError,
20676     TimeoutError: errorTypes.TimeoutError,
20677     AggregateError: errorTypes.AggregateError,
20678     Warning: Warning
20679 };
20680
20681
20682 /***/ }),
20683 /* 136 */
20684 /***/ (function(module, exports, __webpack_require__) {
20685
20686 "use strict";
20687
20688 module.exports = function(Promise, INTERNAL) {
20689 var util = __webpack_require__(130);
20690 var errorObj = util.errorObj;
20691 var isObject = util.isObject;
20692
20693 function tryConvertToPromise(obj, context) {
20694     if (isObject(obj)) {
20695         if (obj instanceof Promise) return obj;
20696         var then = getThen(obj);
20697         if (then === errorObj) {
20698             if (context) context._pushContext();
20699             var ret = Promise.reject(then.e);
20700             if (context) context._popContext();
20701             return ret;
20702         } else if (typeof then === "function") {
20703             if (isAnyBluebirdPromise(obj)) {
20704                 var ret = new Promise(INTERNAL);
20705                 obj._then(
20706                     ret._fulfill,
20707                     ret._reject,
20708                     undefined,
20709                     ret,
20710                     null
20711                 );
20712                 return ret;
20713             }
20714             return doThenable(obj, then, context);
20715         }
20716     }
20717     return obj;
20718 }
20719
20720 function doGetThen(obj) {
20721     return obj.then;
20722 }
20723
20724 function getThen(obj) {
20725     try {
20726         return doGetThen(obj);
20727     } catch (e) {
20728         errorObj.e = e;
20729         return errorObj;
20730     }
20731 }
20732
20733 var hasProp = {}.hasOwnProperty;
20734 function isAnyBluebirdPromise(obj) {
20735     try {
20736         return hasProp.call(obj, "_promise0");
20737     } catch (e) {
20738         return false;
20739     }
20740 }
20741
20742 function doThenable(x, then, context) {
20743     var promise = new Promise(INTERNAL);
20744     var ret = promise;
20745     if (context) context._pushContext();
20746     promise._captureStackTrace();
20747     if (context) context._popContext();
20748     var synchronous = true;
20749     var result = util.tryCatch(then).call(x, resolve, reject);
20750     synchronous = false;
20751
20752     if (promise && result === errorObj) {
20753         promise._rejectCallback(result.e, true, true);
20754         promise = null;
20755     }
20756
20757     function resolve(value) {
20758         if (!promise) return;
20759         promise._resolveCallback(value);
20760         promise = null;
20761     }
20762
20763     function reject(reason) {
20764         if (!promise) return;
20765         promise._rejectCallback(reason, synchronous, true);
20766         promise = null;
20767     }
20768     return ret;
20769 }
20770
20771 return tryConvertToPromise;
20772 };
20773
20774
20775 /***/ }),
20776 /* 137 */
20777 /***/ (function(module, exports, __webpack_require__) {
20778
20779 "use strict";
20780
20781 module.exports = function(Promise, INTERNAL, tryConvertToPromise,
20782     apiRejection, Proxyable) {
20783 var util = __webpack_require__(130);
20784 var isArray = util.isArray;
20785
20786 function toResolutionValue(val) {
20787     switch(val) {
20788     case -2: return [];
20789     case -3: return {};
20790     }
20791 }
20792
20793 function PromiseArray(values) {
20794     var promise = this._promise = new Promise(INTERNAL);
20795     if (values instanceof Promise) {
20796         promise._propagateFrom(values, 3);
20797     }
20798     promise._setOnCancel(this);
20799     this._values = values;
20800     this._length = 0;
20801     this._totalResolved = 0;
20802     this._init(undefined, -2);
20803 }
20804 util.inherits(PromiseArray, Proxyable);
20805
20806 PromiseArray.prototype.length = function () {
20807     return this._length;
20808 };
20809
20810 PromiseArray.prototype.promise = function () {
20811     return this._promise;
20812 };
20813
20814 PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
20815     var values = tryConvertToPromise(this._values, this._promise);
20816     if (values instanceof Promise) {
20817         values = values._target();
20818         var bitField = values._bitField;
20819         ;
20820         this._values = values;
20821
20822         if (((bitField & 50397184) === 0)) {
20823             this._promise._setAsyncGuaranteed();
20824             return values._then(
20825                 init,
20826                 this._reject,
20827                 undefined,
20828                 this,
20829                 resolveValueIfEmpty
20830            );
20831         } else if (((bitField & 33554432) !== 0)) {
20832             values = values._value();
20833         } else if (((bitField & 16777216) !== 0)) {
20834             return this._reject(values._reason());
20835         } else {
20836             return this._cancel();
20837         }
20838     }
20839     values = util.asArray(values);
20840     if (values === null) {
20841         var err = apiRejection(
20842             "expecting an array or an iterable object but got " + util.classString(values)).reason();
20843         this._promise._rejectCallback(err, false);
20844         return;
20845     }
20846
20847     if (values.length === 0) {
20848         if (resolveValueIfEmpty === -5) {
20849             this._resolveEmptyArray();
20850         }
20851         else {
20852             this._resolve(toResolutionValue(resolveValueIfEmpty));
20853         }
20854         return;
20855     }
20856     this._iterate(values);
20857 };
20858
20859 PromiseArray.prototype._iterate = function(values) {
20860     var len = this.getActualLength(values.length);
20861     this._length = len;
20862     this._values = this.shouldCopyValues() ? new Array(len) : this._values;
20863     var result = this._promise;
20864     var isResolved = false;
20865     var bitField = null;
20866     for (var i = 0; i < len; ++i) {
20867         var maybePromise = tryConvertToPromise(values[i], result);
20868
20869         if (maybePromise instanceof Promise) {
20870             maybePromise = maybePromise._target();
20871             bitField = maybePromise._bitField;
20872         } else {
20873             bitField = null;
20874         }
20875
20876         if (isResolved) {
20877             if (bitField !== null) {
20878                 maybePromise.suppressUnhandledRejections();
20879             }
20880         } else if (bitField !== null) {
20881             if (((bitField & 50397184) === 0)) {
20882                 maybePromise._proxy(this, i);
20883                 this._values[i] = maybePromise;
20884             } else if (((bitField & 33554432) !== 0)) {
20885                 isResolved = this._promiseFulfilled(maybePromise._value(), i);
20886             } else if (((bitField & 16777216) !== 0)) {
20887                 isResolved = this._promiseRejected(maybePromise._reason(), i);
20888             } else {
20889                 isResolved = this._promiseCancelled(i);
20890             }
20891         } else {
20892             isResolved = this._promiseFulfilled(maybePromise, i);
20893         }
20894     }
20895     if (!isResolved) result._setAsyncGuaranteed();
20896 };
20897
20898 PromiseArray.prototype._isResolved = function () {
20899     return this._values === null;
20900 };
20901
20902 PromiseArray.prototype._resolve = function (value) {
20903     this._values = null;
20904     this._promise._fulfill(value);
20905 };
20906
20907 PromiseArray.prototype._cancel = function() {
20908     if (this._isResolved() || !this._promise._isCancellable()) return;
20909     this._values = null;
20910     this._promise._cancel();
20911 };
20912
20913 PromiseArray.prototype._reject = function (reason) {
20914     this._values = null;
20915     this._promise._rejectCallback(reason, false);
20916 };
20917
20918 PromiseArray.prototype._promiseFulfilled = function (value, index) {
20919     this._values[index] = value;
20920     var totalResolved = ++this._totalResolved;
20921     if (totalResolved >= this._length) {
20922         this._resolve(this._values);
20923         return true;
20924     }
20925     return false;
20926 };
20927
20928 PromiseArray.prototype._promiseCancelled = function() {
20929     this._cancel();
20930     return true;
20931 };
20932
20933 PromiseArray.prototype._promiseRejected = function (reason) {
20934     this._totalResolved++;
20935     this._reject(reason);
20936     return true;
20937 };
20938
20939 PromiseArray.prototype._resultCancelled = function() {
20940     if (this._isResolved()) return;
20941     var values = this._values;
20942     this._cancel();
20943     if (values instanceof Promise) {
20944         values.cancel();
20945     } else {
20946         for (var i = 0; i < values.length; ++i) {
20947             if (values[i] instanceof Promise) {
20948                 values[i].cancel();
20949             }
20950         }
20951     }
20952 };
20953
20954 PromiseArray.prototype.shouldCopyValues = function () {
20955     return true;
20956 };
20957
20958 PromiseArray.prototype.getActualLength = function (len) {
20959     return len;
20960 };
20961
20962 return PromiseArray;
20963 };
20964
20965
20966 /***/ }),
20967 /* 138 */
20968 /***/ (function(module, exports, __webpack_require__) {
20969
20970 "use strict";
20971
20972 module.exports = function(Promise) {
20973 var longStackTraces = false;
20974 var contextStack = [];
20975
20976 Promise.prototype._promiseCreated = function() {};
20977 Promise.prototype._pushContext = function() {};
20978 Promise.prototype._popContext = function() {return null;};
20979 Promise._peekContext = Promise.prototype._peekContext = function() {};
20980
20981 function Context() {
20982     this._trace = new Context.CapturedTrace(peekContext());
20983 }
20984 Context.prototype._pushContext = function () {
20985     if (this._trace !== undefined) {
20986         this._trace._promiseCreated = null;
20987         contextStack.push(this._trace);
20988     }
20989 };
20990
20991 Context.prototype._popContext = function () {
20992     if (this._trace !== undefined) {
20993         var trace = contextStack.pop();
20994         var ret = trace._promiseCreated;
20995         trace._promiseCreated = null;
20996         return ret;
20997     }
20998     return null;
20999 };
21000
21001 function createContext() {
21002     if (longStackTraces) return new Context();
21003 }
21004
21005 function peekContext() {
21006     var lastIndex = contextStack.length - 1;
21007     if (lastIndex >= 0) {
21008         return contextStack[lastIndex];
21009     }
21010     return undefined;
21011 }
21012 Context.CapturedTrace = null;
21013 Context.create = createContext;
21014 Context.deactivateLongStackTraces = function() {};
21015 Context.activateLongStackTraces = function() {
21016     var Promise_pushContext = Promise.prototype._pushContext;
21017     var Promise_popContext = Promise.prototype._popContext;
21018     var Promise_PeekContext = Promise._peekContext;
21019     var Promise_peekContext = Promise.prototype._peekContext;
21020     var Promise_promiseCreated = Promise.prototype._promiseCreated;
21021     Context.deactivateLongStackTraces = function() {
21022         Promise.prototype._pushContext = Promise_pushContext;
21023         Promise.prototype._popContext = Promise_popContext;
21024         Promise._peekContext = Promise_PeekContext;
21025         Promise.prototype._peekContext = Promise_peekContext;
21026         Promise.prototype._promiseCreated = Promise_promiseCreated;
21027         longStackTraces = false;
21028     };
21029     longStackTraces = true;
21030     Promise.prototype._pushContext = Context.prototype._pushContext;
21031     Promise.prototype._popContext = Context.prototype._popContext;
21032     Promise._peekContext = Promise.prototype._peekContext = peekContext;
21033     Promise.prototype._promiseCreated = function() {
21034         var ctx = this._peekContext();
21035         if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
21036     };
21037 };
21038 return Context;
21039 };
21040
21041
21042 /***/ }),
21043 /* 139 */
21044 /***/ (function(module, exports, __webpack_require__) {
21045
21046 "use strict";
21047
21048 module.exports = function(Promise, Context) {
21049 var getDomain = Promise._getDomain;
21050 var async = Promise._async;
21051 var Warning = __webpack_require__(135).Warning;
21052 var util = __webpack_require__(130);
21053 var canAttachTrace = util.canAttachTrace;
21054 var unhandledRejectionHandled;
21055 var possiblyUnhandledRejection;
21056 var bluebirdFramePattern =
21057     /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
21058 var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
21059 var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
21060 var stackFramePattern = null;
21061 var formatStack = null;
21062 var indentStackFrames = false;
21063 var printWarning;
21064 var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
21065                         ( false ||
21066                          util.env("BLUEBIRD_DEBUG") ||
21067                          util.env("NODE_ENV") === "development"));
21068
21069 var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
21070     (debugging || util.env("BLUEBIRD_WARNINGS")));
21071
21072 var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
21073     (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
21074
21075 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
21076     (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
21077
21078 Promise.prototype.suppressUnhandledRejections = function() {
21079     var target = this._target();
21080     target._bitField = ((target._bitField & (~1048576)) |
21081                       524288);
21082 };
21083
21084 Promise.prototype._ensurePossibleRejectionHandled = function () {
21085     if ((this._bitField & 524288) !== 0) return;
21086     this._setRejectionIsUnhandled();
21087     async.invokeLater(this._notifyUnhandledRejection, this, undefined);
21088 };
21089
21090 Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
21091     fireRejectionEvent("rejectionHandled",
21092                                   unhandledRejectionHandled, undefined, this);
21093 };
21094
21095 Promise.prototype._setReturnedNonUndefined = function() {
21096     this._bitField = this._bitField | 268435456;
21097 };
21098
21099 Promise.prototype._returnedNonUndefined = function() {
21100     return (this._bitField & 268435456) !== 0;
21101 };
21102
21103 Promise.prototype._notifyUnhandledRejection = function () {
21104     if (this._isRejectionUnhandled()) {
21105         var reason = this._settledValue();
21106         this._setUnhandledRejectionIsNotified();
21107         fireRejectionEvent("unhandledRejection",
21108                                       possiblyUnhandledRejection, reason, this);
21109     }
21110 };
21111
21112 Promise.prototype._setUnhandledRejectionIsNotified = function () {
21113     this._bitField = this._bitField | 262144;
21114 };
21115
21116 Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
21117     this._bitField = this._bitField & (~262144);
21118 };
21119
21120 Promise.prototype._isUnhandledRejectionNotified = function () {
21121     return (this._bitField & 262144) > 0;
21122 };
21123
21124 Promise.prototype._setRejectionIsUnhandled = function () {
21125     this._bitField = this._bitField | 1048576;
21126 };
21127
21128 Promise.prototype._unsetRejectionIsUnhandled = function () {
21129     this._bitField = this._bitField & (~1048576);
21130     if (this._isUnhandledRejectionNotified()) {
21131         this._unsetUnhandledRejectionIsNotified();
21132         this._notifyUnhandledRejectionIsHandled();
21133     }
21134 };
21135
21136 Promise.prototype._isRejectionUnhandled = function () {
21137     return (this._bitField & 1048576) > 0;
21138 };
21139
21140 Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
21141     return warn(message, shouldUseOwnTrace, promise || this);
21142 };
21143
21144 Promise.onPossiblyUnhandledRejection = function (fn) {
21145     var domain = getDomain();
21146     possiblyUnhandledRejection =
21147         typeof fn === "function" ? (domain === null ?
21148                                             fn : util.domainBind(domain, fn))
21149                                  : undefined;
21150 };
21151
21152 Promise.onUnhandledRejectionHandled = function (fn) {
21153     var domain = getDomain();
21154     unhandledRejectionHandled =
21155         typeof fn === "function" ? (domain === null ?
21156                                             fn : util.domainBind(domain, fn))
21157                                  : undefined;
21158 };
21159
21160 var disableLongStackTraces = function() {};
21161 Promise.longStackTraces = function () {
21162     if (async.haveItemsQueued() && !config.longStackTraces) {
21163         throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
21164     }
21165     if (!config.longStackTraces && longStackTracesIsSupported()) {
21166         var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
21167         var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
21168         config.longStackTraces = true;
21169         disableLongStackTraces = function() {
21170             if (async.haveItemsQueued() && !config.longStackTraces) {
21171                 throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
21172             }
21173             Promise.prototype._captureStackTrace = Promise_captureStackTrace;
21174             Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
21175             Context.deactivateLongStackTraces();
21176             async.enableTrampoline();
21177             config.longStackTraces = false;
21178         };
21179         Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
21180         Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
21181         Context.activateLongStackTraces();
21182         async.disableTrampolineIfNecessary();
21183     }
21184 };
21185
21186 Promise.hasLongStackTraces = function () {
21187     return config.longStackTraces && longStackTracesIsSupported();
21188 };
21189
21190 var fireDomEvent = (function() {
21191     try {
21192         if (typeof CustomEvent === "function") {
21193             var event = new CustomEvent("CustomEvent");
21194             util.global.dispatchEvent(event);
21195             return function(name, event) {
21196                 var domEvent = new CustomEvent(name.toLowerCase(), {
21197                     detail: event,
21198                     cancelable: true
21199                 });
21200                 return !util.global.dispatchEvent(domEvent);
21201             };
21202         } else if (typeof Event === "function") {
21203             var event = new Event("CustomEvent");
21204             util.global.dispatchEvent(event);
21205             return function(name, event) {
21206                 var domEvent = new Event(name.toLowerCase(), {
21207                     cancelable: true
21208                 });
21209                 domEvent.detail = event;
21210                 return !util.global.dispatchEvent(domEvent);
21211             };
21212         } else {
21213             var event = document.createEvent("CustomEvent");
21214             event.initCustomEvent("testingtheevent", false, true, {});
21215             util.global.dispatchEvent(event);
21216             return function(name, event) {
21217                 var domEvent = document.createEvent("CustomEvent");
21218                 domEvent.initCustomEvent(name.toLowerCase(), false, true,
21219                     event);
21220                 return !util.global.dispatchEvent(domEvent);
21221             };
21222         }
21223     } catch (e) {}
21224     return function() {
21225         return false;
21226     };
21227 })();
21228
21229 var fireGlobalEvent = (function() {
21230     if (util.isNode) {
21231         return function() {
21232             return process.emit.apply(process, arguments);
21233         };
21234     } else {
21235         if (!util.global) {
21236             return function() {
21237                 return false;
21238             };
21239         }
21240         return function(name) {
21241             var methodName = "on" + name.toLowerCase();
21242             var method = util.global[methodName];
21243             if (!method) return false;
21244             method.apply(util.global, [].slice.call(arguments, 1));
21245             return true;
21246         };
21247     }
21248 })();
21249
21250 function generatePromiseLifecycleEventObject(name, promise) {
21251     return {promise: promise};
21252 }
21253
21254 var eventToObjectGenerator = {
21255     promiseCreated: generatePromiseLifecycleEventObject,
21256     promiseFulfilled: generatePromiseLifecycleEventObject,
21257     promiseRejected: generatePromiseLifecycleEventObject,
21258     promiseResolved: generatePromiseLifecycleEventObject,
21259     promiseCancelled: generatePromiseLifecycleEventObject,
21260     promiseChained: function(name, promise, child) {
21261         return {promise: promise, child: child};
21262     },
21263     warning: function(name, warning) {
21264         return {warning: warning};
21265     },
21266     unhandledRejection: function (name, reason, promise) {
21267         return {reason: reason, promise: promise};
21268     },
21269     rejectionHandled: generatePromiseLifecycleEventObject
21270 };
21271
21272 var activeFireEvent = function (name) {
21273     var globalEventFired = false;
21274     try {
21275         globalEventFired = fireGlobalEvent.apply(null, arguments);
21276     } catch (e) {
21277         async.throwLater(e);
21278         globalEventFired = true;
21279     }
21280
21281     var domEventFired = false;
21282     try {
21283         domEventFired = fireDomEvent(name,
21284                     eventToObjectGenerator[name].apply(null, arguments));
21285     } catch (e) {
21286         async.throwLater(e);
21287         domEventFired = true;
21288     }
21289
21290     return domEventFired || globalEventFired;
21291 };
21292
21293 Promise.config = function(opts) {
21294     opts = Object(opts);
21295     if ("longStackTraces" in opts) {
21296         if (opts.longStackTraces) {
21297             Promise.longStackTraces();
21298         } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
21299             disableLongStackTraces();
21300         }
21301     }
21302     if ("warnings" in opts) {
21303         var warningsOption = opts.warnings;
21304         config.warnings = !!warningsOption;
21305         wForgottenReturn = config.warnings;
21306
21307         if (util.isObject(warningsOption)) {
21308             if ("wForgottenReturn" in warningsOption) {
21309                 wForgottenReturn = !!warningsOption.wForgottenReturn;
21310             }
21311         }
21312     }
21313     if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
21314         if (async.haveItemsQueued()) {
21315             throw new Error(
21316                 "cannot enable cancellation after promises are in use");
21317         }
21318         Promise.prototype._clearCancellationData =
21319             cancellationClearCancellationData;
21320         Promise.prototype._propagateFrom = cancellationPropagateFrom;
21321         Promise.prototype._onCancel = cancellationOnCancel;
21322         Promise.prototype._setOnCancel = cancellationSetOnCancel;
21323         Promise.prototype._attachCancellationCallback =
21324             cancellationAttachCancellationCallback;
21325         Promise.prototype._execute = cancellationExecute;
21326         propagateFromFunction = cancellationPropagateFrom;
21327         config.cancellation = true;
21328     }
21329     if ("monitoring" in opts) {
21330         if (opts.monitoring && !config.monitoring) {
21331             config.monitoring = true;
21332             Promise.prototype._fireEvent = activeFireEvent;
21333         } else if (!opts.monitoring && config.monitoring) {
21334             config.monitoring = false;
21335             Promise.prototype._fireEvent = defaultFireEvent;
21336         }
21337     }
21338     return Promise;
21339 };
21340
21341 function defaultFireEvent() { return false; }
21342
21343 Promise.prototype._fireEvent = defaultFireEvent;
21344 Promise.prototype._execute = function(executor, resolve, reject) {
21345     try {
21346         executor(resolve, reject);
21347     } catch (e) {
21348         return e;
21349     }
21350 };
21351 Promise.prototype._onCancel = function () {};
21352 Promise.prototype._setOnCancel = function (handler) { ; };
21353 Promise.prototype._attachCancellationCallback = function(onCancel) {
21354     ;
21355 };
21356 Promise.prototype._captureStackTrace = function () {};
21357 Promise.prototype._attachExtraTrace = function () {};
21358 Promise.prototype._clearCancellationData = function() {};
21359 Promise.prototype._propagateFrom = function (parent, flags) {
21360     ;
21361     ;
21362 };
21363
21364 function cancellationExecute(executor, resolve, reject) {
21365     var promise = this;
21366     try {
21367         executor(resolve, reject, function(onCancel) {
21368             if (typeof onCancel !== "function") {
21369                 throw new TypeError("onCancel must be a function, got: " +
21370                                     util.toString(onCancel));
21371             }
21372             promise._attachCancellationCallback(onCancel);
21373         });
21374     } catch (e) {
21375         return e;
21376     }
21377 }
21378
21379 function cancellationAttachCancellationCallback(onCancel) {
21380     if (!this._isCancellable()) return this;
21381
21382     var previousOnCancel = this._onCancel();
21383     if (previousOnCancel !== undefined) {
21384         if (util.isArray(previousOnCancel)) {
21385             previousOnCancel.push(onCancel);
21386         } else {
21387             this._setOnCancel([previousOnCancel, onCancel]);
21388         }
21389     } else {
21390         this._setOnCancel(onCancel);
21391     }
21392 }
21393
21394 function cancellationOnCancel() {
21395     return this._onCancelField;
21396 }
21397
21398 function cancellationSetOnCancel(onCancel) {
21399     this._onCancelField = onCancel;
21400 }
21401
21402 function cancellationClearCancellationData() {
21403     this._cancellationParent = undefined;
21404     this._onCancelField = undefined;
21405 }
21406
21407 function cancellationPropagateFrom(parent, flags) {
21408     if ((flags & 1) !== 0) {
21409         this._cancellationParent = parent;
21410         var branchesRemainingToCancel = parent._branchesRemainingToCancel;
21411         if (branchesRemainingToCancel === undefined) {
21412             branchesRemainingToCancel = 0;
21413         }
21414         parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
21415     }
21416     if ((flags & 2) !== 0 && parent._isBound()) {
21417         this._setBoundTo(parent._boundTo);
21418     }
21419 }
21420
21421 function bindingPropagateFrom(parent, flags) {
21422     if ((flags & 2) !== 0 && parent._isBound()) {
21423         this._setBoundTo(parent._boundTo);
21424     }
21425 }
21426 var propagateFromFunction = bindingPropagateFrom;
21427
21428 function boundValueFunction() {
21429     var ret = this._boundTo;
21430     if (ret !== undefined) {
21431         if (ret instanceof Promise) {
21432             if (ret.isFulfilled()) {
21433                 return ret.value();
21434             } else {
21435                 return undefined;
21436             }
21437         }
21438     }
21439     return ret;
21440 }
21441
21442 function longStackTracesCaptureStackTrace() {
21443     this._trace = new CapturedTrace(this._peekContext());
21444 }
21445
21446 function longStackTracesAttachExtraTrace(error, ignoreSelf) {
21447     if (canAttachTrace(error)) {
21448         var trace = this._trace;
21449         if (trace !== undefined) {
21450             if (ignoreSelf) trace = trace._parent;
21451         }
21452         if (trace !== undefined) {
21453             trace.attachExtraTrace(error);
21454         } else if (!error.__stackCleaned__) {
21455             var parsed = parseStackAndMessage(error);
21456             util.notEnumerableProp(error, "stack",
21457                 parsed.message + "\n" + parsed.stack.join("\n"));
21458             util.notEnumerableProp(error, "__stackCleaned__", true);
21459         }
21460     }
21461 }
21462
21463 function checkForgottenReturns(returnValue, promiseCreated, name, promise,
21464                                parent) {
21465     if (returnValue === undefined && promiseCreated !== null &&
21466         wForgottenReturn) {
21467         if (parent !== undefined && parent._returnedNonUndefined()) return;
21468         if ((promise._bitField & 65535) === 0) return;
21469
21470         if (name) name = name + " ";
21471         var handlerLine = "";
21472         var creatorLine = "";
21473         if (promiseCreated._trace) {
21474             var traceLines = promiseCreated._trace.stack.split("\n");
21475             var stack = cleanStack(traceLines);
21476             for (var i = stack.length - 1; i >= 0; --i) {
21477                 var line = stack[i];
21478                 if (!nodeFramePattern.test(line)) {
21479                     var lineMatches = line.match(parseLinePattern);
21480                     if (lineMatches) {
21481                         handlerLine  = "at " + lineMatches[1] +
21482                             ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
21483                     }
21484                     break;
21485                 }
21486             }
21487
21488             if (stack.length > 0) {
21489                 var firstUserLine = stack[0];
21490                 for (var i = 0; i < traceLines.length; ++i) {
21491
21492                     if (traceLines[i] === firstUserLine) {
21493                         if (i > 0) {
21494                             creatorLine = "\n" + traceLines[i - 1];
21495                         }
21496                         break;
21497                     }
21498                 }
21499
21500             }
21501         }
21502         var msg = "a promise was created in a " + name +
21503             "handler " + handlerLine + "but was not returned from it, " +
21504             "see http://goo.gl/rRqMUw" +
21505             creatorLine;
21506         promise._warn(msg, true, promiseCreated);
21507     }
21508 }
21509
21510 function deprecated(name, replacement) {
21511     var message = name +
21512         " is deprecated and will be removed in a future version.";
21513     if (replacement) message += " Use " + replacement + " instead.";
21514     return warn(message);
21515 }
21516
21517 function warn(message, shouldUseOwnTrace, promise) {
21518     if (!config.warnings) return;
21519     var warning = new Warning(message);
21520     var ctx;
21521     if (shouldUseOwnTrace) {
21522         promise._attachExtraTrace(warning);
21523     } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
21524         ctx.attachExtraTrace(warning);
21525     } else {
21526         var parsed = parseStackAndMessage(warning);
21527         warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
21528     }
21529
21530     if (!activeFireEvent("warning", warning)) {
21531         formatAndLogError(warning, "", true);
21532     }
21533 }
21534
21535 function reconstructStack(message, stacks) {
21536     for (var i = 0; i < stacks.length - 1; ++i) {
21537         stacks[i].push("From previous event:");
21538         stacks[i] = stacks[i].join("\n");
21539     }
21540     if (i < stacks.length) {
21541         stacks[i] = stacks[i].join("\n");
21542     }
21543     return message + "\n" + stacks.join("\n");
21544 }
21545
21546 function removeDuplicateOrEmptyJumps(stacks) {
21547     for (var i = 0; i < stacks.length; ++i) {
21548         if (stacks[i].length === 0 ||
21549             ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
21550             stacks.splice(i, 1);
21551             i--;
21552         }
21553     }
21554 }
21555
21556 function removeCommonRoots(stacks) {
21557     var current = stacks[0];
21558     for (var i = 1; i < stacks.length; ++i) {
21559         var prev = stacks[i];
21560         var currentLastIndex = current.length - 1;
21561         var currentLastLine = current[currentLastIndex];
21562         var commonRootMeetPoint = -1;
21563
21564         for (var j = prev.length - 1; j >= 0; --j) {
21565             if (prev[j] === currentLastLine) {
21566                 commonRootMeetPoint = j;
21567                 break;
21568             }
21569         }
21570
21571         for (var j = commonRootMeetPoint; j >= 0; --j) {
21572             var line = prev[j];
21573             if (current[currentLastIndex] === line) {
21574                 current.pop();
21575                 currentLastIndex--;
21576             } else {
21577                 break;
21578             }
21579         }
21580         current = prev;
21581     }
21582 }
21583
21584 function cleanStack(stack) {
21585     var ret = [];
21586     for (var i = 0; i < stack.length; ++i) {
21587         var line = stack[i];
21588         var isTraceLine = "    (No stack trace)" === line ||
21589             stackFramePattern.test(line);
21590         var isInternalFrame = isTraceLine && shouldIgnore(line);
21591         if (isTraceLine && !isInternalFrame) {
21592             if (indentStackFrames && line.charAt(0) !== " ") {
21593                 line = "    " + line;
21594             }
21595             ret.push(line);
21596         }
21597     }
21598     return ret;
21599 }
21600
21601 function stackFramesAsArray(error) {
21602     var stack = error.stack.replace(/\s+$/g, "").split("\n");
21603     for (var i = 0; i < stack.length; ++i) {
21604         var line = stack[i];
21605         if ("    (No stack trace)" === line || stackFramePattern.test(line)) {
21606             break;
21607         }
21608     }
21609     if (i > 0 && error.name != "SyntaxError") {
21610         stack = stack.slice(i);
21611     }
21612     return stack;
21613 }
21614
21615 function parseStackAndMessage(error) {
21616     var stack = error.stack;
21617     var message = error.toString();
21618     stack = typeof stack === "string" && stack.length > 0
21619                 ? stackFramesAsArray(error) : ["    (No stack trace)"];
21620     return {
21621         message: message,
21622         stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
21623     };
21624 }
21625
21626 function formatAndLogError(error, title, isSoft) {
21627     if (typeof console !== "undefined") {
21628         var message;
21629         if (util.isObject(error)) {
21630             var stack = error.stack;
21631             message = title + formatStack(stack, error);
21632         } else {
21633             message = title + String(error);
21634         }
21635         if (typeof printWarning === "function") {
21636             printWarning(message, isSoft);
21637         } else if (typeof console.log === "function" ||
21638             typeof console.log === "object") {
21639             console.log(message);
21640         }
21641     }
21642 }
21643
21644 function fireRejectionEvent(name, localHandler, reason, promise) {
21645     var localEventFired = false;
21646     try {
21647         if (typeof localHandler === "function") {
21648             localEventFired = true;
21649             if (name === "rejectionHandled") {
21650                 localHandler(promise);
21651             } else {
21652                 localHandler(reason, promise);
21653             }
21654         }
21655     } catch (e) {
21656         async.throwLater(e);
21657     }
21658
21659     if (name === "unhandledRejection") {
21660         if (!activeFireEvent(name, reason, promise) && !localEventFired) {
21661             formatAndLogError(reason, "Unhandled rejection ");
21662         }
21663     } else {
21664         activeFireEvent(name, promise);
21665     }
21666 }
21667
21668 function formatNonError(obj) {
21669     var str;
21670     if (typeof obj === "function") {
21671         str = "[function " +
21672             (obj.name || "anonymous") +
21673             "]";
21674     } else {
21675         str = obj && typeof obj.toString === "function"
21676             ? obj.toString() : util.toString(obj);
21677         var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
21678         if (ruselessToString.test(str)) {
21679             try {
21680                 var newStr = JSON.stringify(obj);
21681                 str = newStr;
21682             }
21683             catch(e) {
21684
21685             }
21686         }
21687         if (str.length === 0) {
21688             str = "(empty array)";
21689         }
21690     }
21691     return ("(<" + snip(str) + ">, no stack trace)");
21692 }
21693
21694 function snip(str) {
21695     var maxChars = 41;
21696     if (str.length < maxChars) {
21697         return str;
21698     }
21699     return str.substr(0, maxChars - 3) + "...";
21700 }
21701
21702 function longStackTracesIsSupported() {
21703     return typeof captureStackTrace === "function";
21704 }
21705
21706 var shouldIgnore = function() { return false; };
21707 var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
21708 function parseLineInfo(line) {
21709     var matches = line.match(parseLineInfoRegex);
21710     if (matches) {
21711         return {
21712             fileName: matches[1],
21713             line: parseInt(matches[2], 10)
21714         };
21715     }
21716 }
21717
21718 function setBounds(firstLineError, lastLineError) {
21719     if (!longStackTracesIsSupported()) return;
21720     var firstStackLines = firstLineError.stack.split("\n");
21721     var lastStackLines = lastLineError.stack.split("\n");
21722     var firstIndex = -1;
21723     var lastIndex = -1;
21724     var firstFileName;
21725     var lastFileName;
21726     for (var i = 0; i < firstStackLines.length; ++i) {
21727         var result = parseLineInfo(firstStackLines[i]);
21728         if (result) {
21729             firstFileName = result.fileName;
21730             firstIndex = result.line;
21731             break;
21732         }
21733     }
21734     for (var i = 0; i < lastStackLines.length; ++i) {
21735         var result = parseLineInfo(lastStackLines[i]);
21736         if (result) {
21737             lastFileName = result.fileName;
21738             lastIndex = result.line;
21739             break;
21740         }
21741     }
21742     if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
21743         firstFileName !== lastFileName || firstIndex >= lastIndex) {
21744         return;
21745     }
21746
21747     shouldIgnore = function(line) {
21748         if (bluebirdFramePattern.test(line)) return true;
21749         var info = parseLineInfo(line);
21750         if (info) {
21751             if (info.fileName === firstFileName &&
21752                 (firstIndex <= info.line && info.line <= lastIndex)) {
21753                 return true;
21754             }
21755         }
21756         return false;
21757     };
21758 }
21759
21760 function CapturedTrace(parent) {
21761     this._parent = parent;
21762     this._promisesCreated = 0;
21763     var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
21764     captureStackTrace(this, CapturedTrace);
21765     if (length > 32) this.uncycle();
21766 }
21767 util.inherits(CapturedTrace, Error);
21768 Context.CapturedTrace = CapturedTrace;
21769
21770 CapturedTrace.prototype.uncycle = function() {
21771     var length = this._length;
21772     if (length < 2) return;
21773     var nodes = [];
21774     var stackToIndex = {};
21775
21776     for (var i = 0, node = this; node !== undefined; ++i) {
21777         nodes.push(node);
21778         node = node._parent;
21779     }
21780     length = this._length = i;
21781     for (var i = length - 1; i >= 0; --i) {
21782         var stack = nodes[i].stack;
21783         if (stackToIndex[stack] === undefined) {
21784             stackToIndex[stack] = i;
21785         }
21786     }
21787     for (var i = 0; i < length; ++i) {
21788         var currentStack = nodes[i].stack;
21789         var index = stackToIndex[currentStack];
21790         if (index !== undefined && index !== i) {
21791             if (index > 0) {
21792                 nodes[index - 1]._parent = undefined;
21793                 nodes[index - 1]._length = 1;
21794             }
21795             nodes[i]._parent = undefined;
21796             nodes[i]._length = 1;
21797             var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
21798
21799             if (index < length - 1) {
21800                 cycleEdgeNode._parent = nodes[index + 1];
21801                 cycleEdgeNode._parent.uncycle();
21802                 cycleEdgeNode._length =
21803                     cycleEdgeNode._parent._length + 1;
21804             } else {
21805                 cycleEdgeNode._parent = undefined;
21806                 cycleEdgeNode._length = 1;
21807             }
21808             var currentChildLength = cycleEdgeNode._length + 1;
21809             for (var j = i - 2; j >= 0; --j) {
21810                 nodes[j]._length = currentChildLength;
21811                 currentChildLength++;
21812             }
21813             return;
21814         }
21815     }
21816 };
21817
21818 CapturedTrace.prototype.attachExtraTrace = function(error) {
21819     if (error.__stackCleaned__) return;
21820     this.uncycle();
21821     var parsed = parseStackAndMessage(error);
21822     var message = parsed.message;
21823     var stacks = [parsed.stack];
21824
21825     var trace = this;
21826     while (trace !== undefined) {
21827         stacks.push(cleanStack(trace.stack.split("\n")));
21828         trace = trace._parent;
21829     }
21830     removeCommonRoots(stacks);
21831     removeDuplicateOrEmptyJumps(stacks);
21832     util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
21833     util.notEnumerableProp(error, "__stackCleaned__", true);
21834 };
21835
21836 var captureStackTrace = (function stackDetection() {
21837     var v8stackFramePattern = /^\s*at\s*/;
21838     var v8stackFormatter = function(stack, error) {
21839         if (typeof stack === "string") return stack;
21840
21841         if (error.name !== undefined &&
21842             error.message !== undefined) {
21843             return error.toString();
21844         }
21845         return formatNonError(error);
21846     };
21847
21848     if (typeof Error.stackTraceLimit === "number" &&
21849         typeof Error.captureStackTrace === "function") {
21850         Error.stackTraceLimit += 6;
21851         stackFramePattern = v8stackFramePattern;
21852         formatStack = v8stackFormatter;
21853         var captureStackTrace = Error.captureStackTrace;
21854
21855         shouldIgnore = function(line) {
21856             return bluebirdFramePattern.test(line);
21857         };
21858         return function(receiver, ignoreUntil) {
21859             Error.stackTraceLimit += 6;
21860             captureStackTrace(receiver, ignoreUntil);
21861             Error.stackTraceLimit -= 6;
21862         };
21863     }
21864     var err = new Error();
21865
21866     if (typeof err.stack === "string" &&
21867         err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
21868         stackFramePattern = /@/;
21869         formatStack = v8stackFormatter;
21870         indentStackFrames = true;
21871         return function captureStackTrace(o) {
21872             o.stack = new Error().stack;
21873         };
21874     }
21875
21876     var hasStackAfterThrow;
21877     try { throw new Error(); }
21878     catch(e) {
21879         hasStackAfterThrow = ("stack" in e);
21880     }
21881     if (!("stack" in err) && hasStackAfterThrow &&
21882         typeof Error.stackTraceLimit === "number") {
21883         stackFramePattern = v8stackFramePattern;
21884         formatStack = v8stackFormatter;
21885         return function captureStackTrace(o) {
21886             Error.stackTraceLimit += 6;
21887             try { throw new Error(); }
21888             catch(e) { o.stack = e.stack; }
21889             Error.stackTraceLimit -= 6;
21890         };
21891     }
21892
21893     formatStack = function(stack, error) {
21894         if (typeof stack === "string") return stack;
21895
21896         if ((typeof error === "object" ||
21897             typeof error === "function") &&
21898             error.name !== undefined &&
21899             error.message !== undefined) {
21900             return error.toString();
21901         }
21902         return formatNonError(error);
21903     };
21904
21905     return null;
21906
21907 })([]);
21908
21909 if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
21910     printWarning = function (message) {
21911         console.warn(message);
21912     };
21913     if (util.isNode && process.stderr.isTTY) {
21914         printWarning = function(message, isSoft) {
21915             var color = isSoft ? "\u001b[33m" : "\u001b[31m";
21916             console.warn(color + message + "\u001b[0m\n");
21917         };
21918     } else if (!util.isNode && typeof (new Error().stack) === "string") {
21919         printWarning = function(message, isSoft) {
21920             console.warn("%c" + message,
21921                         isSoft ? "color: darkorange" : "color: red");
21922         };
21923     }
21924 }
21925
21926 var config = {
21927     warnings: warnings,
21928     longStackTraces: false,
21929     cancellation: false,
21930     monitoring: false
21931 };
21932
21933 if (longStackTraces) Promise.longStackTraces();
21934
21935 return {
21936     longStackTraces: function() {
21937         return config.longStackTraces;
21938     },
21939     warnings: function() {
21940         return config.warnings;
21941     },
21942     cancellation: function() {
21943         return config.cancellation;
21944     },
21945     monitoring: function() {
21946         return config.monitoring;
21947     },
21948     propagateFromFunction: function() {
21949         return propagateFromFunction;
21950     },
21951     boundValueFunction: function() {
21952         return boundValueFunction;
21953     },
21954     checkForgottenReturns: checkForgottenReturns,
21955     setBounds: setBounds,
21956     warn: warn,
21957     deprecated: deprecated,
21958     CapturedTrace: CapturedTrace,
21959     fireDomEvent: fireDomEvent,
21960     fireGlobalEvent: fireGlobalEvent
21961 };
21962 };
21963
21964
21965 /***/ }),
21966 /* 140 */
21967 /***/ (function(module, exports, __webpack_require__) {
21968
21969 "use strict";
21970
21971 module.exports = function(Promise, tryConvertToPromise) {
21972 var util = __webpack_require__(130);
21973 var CancellationError = Promise.CancellationError;
21974 var errorObj = util.errorObj;
21975
21976 function PassThroughHandlerContext(promise, type, handler) {
21977     this.promise = promise;
21978     this.type = type;
21979     this.handler = handler;
21980     this.called = false;
21981     this.cancelPromise = null;
21982 }
21983
21984 PassThroughHandlerContext.prototype.isFinallyHandler = function() {
21985     return this.type === 0;
21986 };
21987
21988 function FinallyHandlerCancelReaction(finallyHandler) {
21989     this.finallyHandler = finallyHandler;
21990 }
21991
21992 FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
21993     checkCancel(this.finallyHandler);
21994 };
21995
21996 function checkCancel(ctx, reason) {
21997     if (ctx.cancelPromise != null) {
21998         if (arguments.length > 1) {
21999             ctx.cancelPromise._reject(reason);
22000         } else {
22001             ctx.cancelPromise._cancel();
22002         }
22003         ctx.cancelPromise = null;
22004         return true;
22005     }
22006     return false;
22007 }
22008
22009 function succeed() {
22010     return finallyHandler.call(this, this.promise._target()._settledValue());
22011 }
22012 function fail(reason) {
22013     if (checkCancel(this, reason)) return;
22014     errorObj.e = reason;
22015     return errorObj;
22016 }
22017 function finallyHandler(reasonOrValue) {
22018     var promise = this.promise;
22019     var handler = this.handler;
22020
22021     if (!this.called) {
22022         this.called = true;
22023         var ret = this.isFinallyHandler()
22024             ? handler.call(promise._boundValue())
22025             : handler.call(promise._boundValue(), reasonOrValue);
22026         if (ret !== undefined) {
22027             promise._setReturnedNonUndefined();
22028             var maybePromise = tryConvertToPromise(ret, promise);
22029             if (maybePromise instanceof Promise) {
22030                 if (this.cancelPromise != null) {
22031                     if (maybePromise._isCancelled()) {
22032                         var reason =
22033                             new CancellationError("late cancellation observer");
22034                         promise._attachExtraTrace(reason);
22035                         errorObj.e = reason;
22036                         return errorObj;
22037                     } else if (maybePromise.isPending()) {
22038                         maybePromise._attachCancellationCallback(
22039                             new FinallyHandlerCancelReaction(this));
22040                     }
22041                 }
22042                 return maybePromise._then(
22043                     succeed, fail, undefined, this, undefined);
22044             }
22045         }
22046     }
22047
22048     if (promise.isRejected()) {
22049         checkCancel(this);
22050         errorObj.e = reasonOrValue;
22051         return errorObj;
22052     } else {
22053         checkCancel(this);
22054         return reasonOrValue;
22055     }
22056 }
22057
22058 Promise.prototype._passThrough = function(handler, type, success, fail) {
22059     if (typeof handler !== "function") return this.then();
22060     return this._then(success,
22061                       fail,
22062                       undefined,
22063                       new PassThroughHandlerContext(this, type, handler),
22064                       undefined);
22065 };
22066
22067 Promise.prototype.lastly =
22068 Promise.prototype["finally"] = function (handler) {
22069     return this._passThrough(handler,
22070                              0,
22071                              finallyHandler,
22072                              finallyHandler);
22073 };
22074
22075 Promise.prototype.tap = function (handler) {
22076     return this._passThrough(handler, 1, finallyHandler);
22077 };
22078
22079 return PassThroughHandlerContext;
22080 };
22081
22082
22083 /***/ }),
22084 /* 141 */
22085 /***/ (function(module, exports, __webpack_require__) {
22086
22087 "use strict";
22088
22089 module.exports = function(NEXT_FILTER) {
22090 var util = __webpack_require__(130);
22091 var getKeys = __webpack_require__(131).keys;
22092 var tryCatch = util.tryCatch;
22093 var errorObj = util.errorObj;
22094
22095 function catchFilter(instances, cb, promise) {
22096     return function(e) {
22097         var boundTo = promise._boundValue();
22098         predicateLoop: for (var i = 0; i < instances.length; ++i) {
22099             var item = instances[i];
22100
22101             if (item === Error ||
22102                 (item != null && item.prototype instanceof Error)) {
22103                 if (e instanceof item) {
22104                     return tryCatch(cb).call(boundTo, e);
22105                 }
22106             } else if (typeof item === "function") {
22107                 var matchesPredicate = tryCatch(item).call(boundTo, e);
22108                 if (matchesPredicate === errorObj) {
22109                     return matchesPredicate;
22110                 } else if (matchesPredicate) {
22111                     return tryCatch(cb).call(boundTo, e);
22112                 }
22113             } else if (util.isObject(e)) {
22114                 var keys = getKeys(item);
22115                 for (var j = 0; j < keys.length; ++j) {
22116                     var key = keys[j];
22117                     if (item[key] != e[key]) {
22118                         continue predicateLoop;
22119                     }
22120                 }
22121                 return tryCatch(cb).call(boundTo, e);
22122             }
22123         }
22124         return NEXT_FILTER;
22125     };
22126 }
22127
22128 return catchFilter;
22129 };
22130
22131
22132 /***/ }),
22133 /* 142 */
22134 /***/ (function(module, exports, __webpack_require__) {
22135
22136 "use strict";
22137
22138 var util = __webpack_require__(130);
22139 var maybeWrapAsError = util.maybeWrapAsError;
22140 var errors = __webpack_require__(135);
22141 var OperationalError = errors.OperationalError;
22142 var es5 = __webpack_require__(131);
22143
22144 function isUntypedError(obj) {
22145     return obj instanceof Error &&
22146         es5.getPrototypeOf(obj) === Error.prototype;
22147 }
22148
22149 var rErrorKey = /^(?:name|message|stack|cause)$/;
22150 function wrapAsOperationalError(obj) {
22151     var ret;
22152     if (isUntypedError(obj)) {
22153         ret = new OperationalError(obj);
22154         ret.name = obj.name;
22155         ret.message = obj.message;
22156         ret.stack = obj.stack;
22157         var keys = es5.keys(obj);
22158         for (var i = 0; i < keys.length; ++i) {
22159             var key = keys[i];
22160             if (!rErrorKey.test(key)) {
22161                 ret[key] = obj[key];
22162             }
22163         }
22164         return ret;
22165     }
22166     util.markAsOriginatingFromRejection(obj);
22167     return obj;
22168 }
22169
22170 function nodebackForPromise(promise, multiArgs) {
22171     return function(err, value) {
22172         if (promise === null) return;
22173         if (err) {
22174             var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
22175             promise._attachExtraTrace(wrapped);
22176             promise._reject(wrapped);
22177         } else if (!multiArgs) {
22178             promise._fulfill(value);
22179         } else {
22180             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];};
22181             promise._fulfill(args);
22182         }
22183         promise = null;
22184     };
22185 }
22186
22187 module.exports = nodebackForPromise;
22188
22189
22190 /***/ }),
22191 /* 143 */
22192 /***/ (function(module, exports, __webpack_require__) {
22193
22194 "use strict";
22195
22196 module.exports =
22197 function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
22198 var util = __webpack_require__(130);
22199 var tryCatch = util.tryCatch;
22200
22201 Promise.method = function (fn) {
22202     if (typeof fn !== "function") {
22203         throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
22204     }
22205     return function () {
22206         var ret = new Promise(INTERNAL);
22207         ret._captureStackTrace();
22208         ret._pushContext();
22209         var value = tryCatch(fn).apply(this, arguments);
22210         var promiseCreated = ret._popContext();
22211         debug.checkForgottenReturns(
22212             value, promiseCreated, "Promise.method", ret);
22213         ret._resolveFromSyncValue(value);
22214         return ret;
22215     };
22216 };
22217
22218 Promise.attempt = Promise["try"] = function (fn) {
22219     if (typeof fn !== "function") {
22220         return apiRejection("expecting a function but got " + util.classString(fn));
22221     }
22222     var ret = new Promise(INTERNAL);
22223     ret._captureStackTrace();
22224     ret._pushContext();
22225     var value;
22226     if (arguments.length > 1) {
22227         debug.deprecated("calling Promise.try with more than 1 argument");
22228         var arg = arguments[1];
22229         var ctx = arguments[2];
22230         value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
22231                                   : tryCatch(fn).call(ctx, arg);
22232     } else {
22233         value = tryCatch(fn)();
22234     }
22235     var promiseCreated = ret._popContext();
22236     debug.checkForgottenReturns(
22237         value, promiseCreated, "Promise.try", ret);
22238     ret._resolveFromSyncValue(value);
22239     return ret;
22240 };
22241
22242 Promise.prototype._resolveFromSyncValue = function (value) {
22243     if (value === util.errorObj) {
22244         this._rejectCallback(value.e, false);
22245     } else {
22246         this._resolveCallback(value, true);
22247     }
22248 };
22249 };
22250
22251
22252 /***/ }),
22253 /* 144 */
22254 /***/ (function(module, exports, __webpack_require__) {
22255
22256 "use strict";
22257
22258 module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
22259 var calledBind = false;
22260 var rejectThis = function(_, e) {
22261     this._reject(e);
22262 };
22263
22264 var targetRejected = function(e, context) {
22265     context.promiseRejectionQueued = true;
22266     context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
22267 };
22268
22269 var bindingResolved = function(thisArg, context) {
22270     if (((this._bitField & 50397184) === 0)) {
22271         this._resolveCallback(context.target);
22272     }
22273 };
22274
22275 var bindingRejected = function(e, context) {
22276     if (!context.promiseRejectionQueued) this._reject(e);
22277 };
22278
22279 Promise.prototype.bind = function (thisArg) {
22280     if (!calledBind) {
22281         calledBind = true;
22282         Promise.prototype._propagateFrom = debug.propagateFromFunction();
22283         Promise.prototype._boundValue = debug.boundValueFunction();
22284     }
22285     var maybePromise = tryConvertToPromise(thisArg);
22286     var ret = new Promise(INTERNAL);
22287     ret._propagateFrom(this, 1);
22288     var target = this._target();
22289     ret._setBoundTo(maybePromise);
22290     if (maybePromise instanceof Promise) {
22291         var context = {
22292             promiseRejectionQueued: false,
22293             promise: ret,
22294             target: target,
22295             bindingPromise: maybePromise
22296         };
22297         target._then(INTERNAL, targetRejected, undefined, ret, context);
22298         maybePromise._then(
22299             bindingResolved, bindingRejected, undefined, ret, context);
22300         ret._setOnCancel(maybePromise);
22301     } else {
22302         ret._resolveCallback(target);
22303     }
22304     return ret;
22305 };
22306
22307 Promise.prototype._setBoundTo = function (obj) {
22308     if (obj !== undefined) {
22309         this._bitField = this._bitField | 2097152;
22310         this._boundTo = obj;
22311     } else {
22312         this._bitField = this._bitField & (~2097152);
22313     }
22314 };
22315
22316 Promise.prototype._isBound = function () {
22317     return (this._bitField & 2097152) === 2097152;
22318 };
22319
22320 Promise.bind = function (thisArg, value) {
22321     return Promise.resolve(value).bind(thisArg);
22322 };
22323 };
22324
22325
22326 /***/ }),
22327 /* 145 */
22328 /***/ (function(module, exports, __webpack_require__) {
22329
22330 "use strict";
22331
22332 module.exports = function(Promise, PromiseArray, apiRejection, debug) {
22333 var util = __webpack_require__(130);
22334 var tryCatch = util.tryCatch;
22335 var errorObj = util.errorObj;
22336 var async = Promise._async;
22337
22338 Promise.prototype["break"] = Promise.prototype.cancel = function() {
22339     if (!debug.cancellation()) return this._warn("cancellation is disabled");
22340
22341     var promise = this;
22342     var child = promise;
22343     while (promise._isCancellable()) {
22344         if (!promise._cancelBy(child)) {
22345             if (child._isFollowing()) {
22346                 child._followee().cancel();
22347             } else {
22348                 child._cancelBranched();
22349             }
22350             break;
22351         }
22352
22353         var parent = promise._cancellationParent;
22354         if (parent == null || !parent._isCancellable()) {
22355             if (promise._isFollowing()) {
22356                 promise._followee().cancel();
22357             } else {
22358                 promise._cancelBranched();
22359             }
22360             break;
22361         } else {
22362             if (promise._isFollowing()) promise._followee().cancel();
22363             promise._setWillBeCancelled();
22364             child = promise;
22365             promise = parent;
22366         }
22367     }
22368 };
22369
22370 Promise.prototype._branchHasCancelled = function() {
22371     this._branchesRemainingToCancel--;
22372 };
22373
22374 Promise.prototype._enoughBranchesHaveCancelled = function() {
22375     return this._branchesRemainingToCancel === undefined ||
22376            this._branchesRemainingToCancel <= 0;
22377 };
22378
22379 Promise.prototype._cancelBy = function(canceller) {
22380     if (canceller === this) {
22381         this._branchesRemainingToCancel = 0;
22382         this._invokeOnCancel();
22383         return true;
22384     } else {
22385         this._branchHasCancelled();
22386         if (this._enoughBranchesHaveCancelled()) {
22387             this._invokeOnCancel();
22388             return true;
22389         }
22390     }
22391     return false;
22392 };
22393
22394 Promise.prototype._cancelBranched = function() {
22395     if (this._enoughBranchesHaveCancelled()) {
22396         this._cancel();
22397     }
22398 };
22399
22400 Promise.prototype._cancel = function() {
22401     if (!this._isCancellable()) return;
22402     this._setCancelled();
22403     async.invoke(this._cancelPromises, this, undefined);
22404 };
22405
22406 Promise.prototype._cancelPromises = function() {
22407     if (this._length() > 0) this._settlePromises();
22408 };
22409
22410 Promise.prototype._unsetOnCancel = function() {
22411     this._onCancelField = undefined;
22412 };
22413
22414 Promise.prototype._isCancellable = function() {
22415     return this.isPending() && !this._isCancelled();
22416 };
22417
22418 Promise.prototype.isCancellable = function() {
22419     return this.isPending() && !this.isCancelled();
22420 };
22421
22422 Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
22423     if (util.isArray(onCancelCallback)) {
22424         for (var i = 0; i < onCancelCallback.length; ++i) {
22425             this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
22426         }
22427     } else if (onCancelCallback !== undefined) {
22428         if (typeof onCancelCallback === "function") {
22429             if (!internalOnly) {
22430                 var e = tryCatch(onCancelCallback).call(this._boundValue());
22431                 if (e === errorObj) {
22432                     this._attachExtraTrace(e.e);
22433                     async.throwLater(e.e);
22434                 }
22435             }
22436         } else {
22437             onCancelCallback._resultCancelled(this);
22438         }
22439     }
22440 };
22441
22442 Promise.prototype._invokeOnCancel = function() {
22443     var onCancelCallback = this._onCancel();
22444     this._unsetOnCancel();
22445     async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
22446 };
22447
22448 Promise.prototype._invokeInternalOnCancel = function() {
22449     if (this._isCancellable()) {
22450         this._doInvokeOnCancel(this._onCancel(), true);
22451         this._unsetOnCancel();
22452     }
22453 };
22454
22455 Promise.prototype._resultCancelled = function() {
22456     this.cancel();
22457 };
22458
22459 };
22460
22461
22462 /***/ }),
22463 /* 146 */
22464 /***/ (function(module, exports, __webpack_require__) {
22465
22466 "use strict";
22467
22468 module.exports = function(Promise) {
22469 function returner() {
22470     return this.value;
22471 }
22472 function thrower() {
22473     throw this.reason;
22474 }
22475
22476 Promise.prototype["return"] =
22477 Promise.prototype.thenReturn = function (value) {
22478     if (value instanceof Promise) value.suppressUnhandledRejections();
22479     return this._then(
22480         returner, undefined, undefined, {value: value}, undefined);
22481 };
22482
22483 Promise.prototype["throw"] =
22484 Promise.prototype.thenThrow = function (reason) {
22485     return this._then(
22486         thrower, undefined, undefined, {reason: reason}, undefined);
22487 };
22488
22489 Promise.prototype.catchThrow = function (reason) {
22490     if (arguments.length <= 1) {
22491         return this._then(
22492             undefined, thrower, undefined, {reason: reason}, undefined);
22493     } else {
22494         var _reason = arguments[1];
22495         var handler = function() {throw _reason;};
22496         return this.caught(reason, handler);
22497     }
22498 };
22499
22500 Promise.prototype.catchReturn = function (value) {
22501     if (arguments.length <= 1) {
22502         if (value instanceof Promise) value.suppressUnhandledRejections();
22503         return this._then(
22504             undefined, returner, undefined, {value: value}, undefined);
22505     } else {
22506         var _value = arguments[1];
22507         if (_value instanceof Promise) _value.suppressUnhandledRejections();
22508         var handler = function() {return _value;};
22509         return this.caught(value, handler);
22510     }
22511 };
22512 };
22513
22514
22515 /***/ }),
22516 /* 147 */
22517 /***/ (function(module, exports, __webpack_require__) {
22518
22519 "use strict";
22520
22521 module.exports = function(Promise) {
22522 function PromiseInspection(promise) {
22523     if (promise !== undefined) {
22524         promise = promise._target();
22525         this._bitField = promise._bitField;
22526         this._settledValueField = promise._isFateSealed()
22527             ? promise._settledValue() : undefined;
22528     }
22529     else {
22530         this._bitField = 0;
22531         this._settledValueField = undefined;
22532     }
22533 }
22534
22535 PromiseInspection.prototype._settledValue = function() {
22536     return this._settledValueField;
22537 };
22538
22539 var value = PromiseInspection.prototype.value = function () {
22540     if (!this.isFulfilled()) {
22541         throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
22542     }
22543     return this._settledValue();
22544 };
22545
22546 var reason = PromiseInspection.prototype.error =
22547 PromiseInspection.prototype.reason = function () {
22548     if (!this.isRejected()) {
22549         throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
22550     }
22551     return this._settledValue();
22552 };
22553
22554 var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
22555     return (this._bitField & 33554432) !== 0;
22556 };
22557
22558 var isRejected = PromiseInspection.prototype.isRejected = function () {
22559     return (this._bitField & 16777216) !== 0;
22560 };
22561
22562 var isPending = PromiseInspection.prototype.isPending = function () {
22563     return (this._bitField & 50397184) === 0;
22564 };
22565
22566 var isResolved = PromiseInspection.prototype.isResolved = function () {
22567     return (this._bitField & 50331648) !== 0;
22568 };
22569
22570 PromiseInspection.prototype.isCancelled = function() {
22571     return (this._bitField & 8454144) !== 0;
22572 };
22573
22574 Promise.prototype.__isCancelled = function() {
22575     return (this._bitField & 65536) === 65536;
22576 };
22577
22578 Promise.prototype._isCancelled = function() {
22579     return this._target().__isCancelled();
22580 };
22581
22582 Promise.prototype.isCancelled = function() {
22583     return (this._target()._bitField & 8454144) !== 0;
22584 };
22585
22586 Promise.prototype.isPending = function() {
22587     return isPending.call(this._target());
22588 };
22589
22590 Promise.prototype.isRejected = function() {
22591     return isRejected.call(this._target());
22592 };
22593
22594 Promise.prototype.isFulfilled = function() {
22595     return isFulfilled.call(this._target());
22596 };
22597
22598 Promise.prototype.isResolved = function() {
22599     return isResolved.call(this._target());
22600 };
22601
22602 Promise.prototype.value = function() {
22603     return value.call(this._target());
22604 };
22605
22606 Promise.prototype.reason = function() {
22607     var target = this._target();
22608     target._unsetRejectionIsUnhandled();
22609     return reason.call(target);
22610 };
22611
22612 Promise.prototype._value = function() {
22613     return this._settledValue();
22614 };
22615
22616 Promise.prototype._reason = function() {
22617     this._unsetRejectionIsUnhandled();
22618     return this._settledValue();
22619 };
22620
22621 Promise.PromiseInspection = PromiseInspection;
22622 };
22623
22624
22625 /***/ }),
22626 /* 148 */
22627 /***/ (function(module, exports, __webpack_require__) {
22628
22629 "use strict";
22630
22631 module.exports =
22632 function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
22633          getDomain) {
22634 var util = __webpack_require__(130);
22635 var canEvaluate = util.canEvaluate;
22636 var tryCatch = util.tryCatch;
22637 var errorObj = util.errorObj;
22638 var reject;
22639
22640 if (true) {
22641 if (canEvaluate) {
22642     var thenCallback = function(i) {
22643         return new Function("value", "holder", "                             \n\
22644             'use strict';                                                    \n\
22645             holder.pIndex = value;                                           \n\
22646             holder.checkFulfillment(this);                                   \n\
22647             ".replace(/Index/g, i));
22648     };
22649
22650     var promiseSetter = function(i) {
22651         return new Function("promise", "holder", "                           \n\
22652             'use strict';                                                    \n\
22653             holder.pIndex = promise;                                         \n\
22654             ".replace(/Index/g, i));
22655     };
22656
22657     var generateHolderClass = function(total) {
22658         var props = new Array(total);
22659         for (var i = 0; i < props.length; ++i) {
22660             props[i] = "this.p" + (i+1);
22661         }
22662         var assignment = props.join(" = ") + " = null;";
22663         var cancellationCode= "var promise;\n" + props.map(function(prop) {
22664             return "                                                         \n\
22665                 promise = " + prop + ";                                      \n\
22666                 if (promise instanceof Promise) {                            \n\
22667                     promise.cancel();                                        \n\
22668                 }                                                            \n\
22669             ";
22670         }).join("\n");
22671         var passedArguments = props.join(", ");
22672         var name = "Holder$" + total;
22673
22674
22675         var code = "return function(tryCatch, errorObj, Promise, async) {    \n\
22676             'use strict';                                                    \n\
22677             function [TheName](fn) {                                         \n\
22678                 [TheProperties]                                              \n\
22679                 this.fn = fn;                                                \n\
22680                 this.asyncNeeded = true;                                     \n\
22681                 this.now = 0;                                                \n\
22682             }                                                                \n\
22683                                                                              \n\
22684             [TheName].prototype._callFunction = function(promise) {          \n\
22685                 promise._pushContext();                                      \n\
22686                 var ret = tryCatch(this.fn)([ThePassedArguments]);           \n\
22687                 promise._popContext();                                       \n\
22688                 if (ret === errorObj) {                                      \n\
22689                     promise._rejectCallback(ret.e, false);                   \n\
22690                 } else {                                                     \n\
22691                     promise._resolveCallback(ret);                           \n\
22692                 }                                                            \n\
22693             };                                                               \n\
22694                                                                              \n\
22695             [TheName].prototype.checkFulfillment = function(promise) {       \n\
22696                 var now = ++this.now;                                        \n\
22697                 if (now === [TheTotal]) {                                    \n\
22698                     if (this.asyncNeeded) {                                  \n\
22699                         async.invoke(this._callFunction, this, promise);     \n\
22700                     } else {                                                 \n\
22701                         this._callFunction(promise);                         \n\
22702                     }                                                        \n\
22703                                                                              \n\
22704                 }                                                            \n\
22705             };                                                               \n\
22706                                                                              \n\
22707             [TheName].prototype._resultCancelled = function() {              \n\
22708                 [CancellationCode]                                           \n\
22709             };                                                               \n\
22710                                                                              \n\
22711             return [TheName];                                                \n\
22712         }(tryCatch, errorObj, Promise, async);                               \n\
22713         ";
22714
22715         code = code.replace(/\[TheName\]/g, name)
22716             .replace(/\[TheTotal\]/g, total)
22717             .replace(/\[ThePassedArguments\]/g, passedArguments)
22718             .replace(/\[TheProperties\]/g, assignment)
22719             .replace(/\[CancellationCode\]/g, cancellationCode);
22720
22721         return new Function("tryCatch", "errorObj", "Promise", "async", code)
22722                            (tryCatch, errorObj, Promise, async);
22723     };
22724
22725     var holderClasses = [];
22726     var thenCallbacks = [];
22727     var promiseSetters = [];
22728
22729     for (var i = 0; i < 8; ++i) {
22730         holderClasses.push(generateHolderClass(i + 1));
22731         thenCallbacks.push(thenCallback(i + 1));
22732         promiseSetters.push(promiseSetter(i + 1));
22733     }
22734
22735     reject = function (reason) {
22736         this._reject(reason);
22737     };
22738 }}
22739
22740 Promise.join = function () {
22741     var last = arguments.length - 1;
22742     var fn;
22743     if (last > 0 && typeof arguments[last] === "function") {
22744         fn = arguments[last];
22745         if (true) {
22746             if (last <= 8 && canEvaluate) {
22747                 var ret = new Promise(INTERNAL);
22748                 ret._captureStackTrace();
22749                 var HolderClass = holderClasses[last - 1];
22750                 var holder = new HolderClass(fn);
22751                 var callbacks = thenCallbacks;
22752
22753                 for (var i = 0; i < last; ++i) {
22754                     var maybePromise = tryConvertToPromise(arguments[i], ret);
22755                     if (maybePromise instanceof Promise) {
22756                         maybePromise = maybePromise._target();
22757                         var bitField = maybePromise._bitField;
22758                         ;
22759                         if (((bitField & 50397184) === 0)) {
22760                             maybePromise._then(callbacks[i], reject,
22761                                                undefined, ret, holder);
22762                             promiseSetters[i](maybePromise, holder);
22763                             holder.asyncNeeded = false;
22764                         } else if (((bitField & 33554432) !== 0)) {
22765                             callbacks[i].call(ret,
22766                                               maybePromise._value(), holder);
22767                         } else if (((bitField & 16777216) !== 0)) {
22768                             ret._reject(maybePromise._reason());
22769                         } else {
22770                             ret._cancel();
22771                         }
22772                     } else {
22773                         callbacks[i].call(ret, maybePromise, holder);
22774                     }
22775                 }
22776
22777                 if (!ret._isFateSealed()) {
22778                     if (holder.asyncNeeded) {
22779                         var domain = getDomain();
22780                         if (domain !== null) {
22781                             holder.fn = util.domainBind(domain, holder.fn);
22782                         }
22783                     }
22784                     ret._setAsyncGuaranteed();
22785                     ret._setOnCancel(holder);
22786                 }
22787                 return ret;
22788             }
22789         }
22790     }
22791     var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];};
22792     if (fn) args.pop();
22793     var ret = new PromiseArray(args).promise();
22794     return fn !== undefined ? ret.spread(fn) : ret;
22795 };
22796
22797 };
22798
22799
22800 /***/ }),
22801 /* 149 */
22802 /***/ (function(module, exports, __webpack_require__) {
22803
22804 "use strict";
22805
22806 module.exports = function(Promise,
22807                           PromiseArray,
22808                           apiRejection,
22809                           tryConvertToPromise,
22810                           INTERNAL,
22811                           debug) {
22812 var getDomain = Promise._getDomain;
22813 var util = __webpack_require__(130);
22814 var tryCatch = util.tryCatch;
22815 var errorObj = util.errorObj;
22816 var async = Promise._async;
22817
22818 function MappingPromiseArray(promises, fn, limit, _filter) {
22819     this.constructor$(promises);
22820     this._promise._captureStackTrace();
22821     var domain = getDomain();
22822     this._callback = domain === null ? fn : util.domainBind(domain, fn);
22823     this._preservedValues = _filter === INTERNAL
22824         ? new Array(this.length())
22825         : null;
22826     this._limit = limit;
22827     this._inFlight = 0;
22828     this._queue = [];
22829     async.invoke(this._asyncInit, this, undefined);
22830 }
22831 util.inherits(MappingPromiseArray, PromiseArray);
22832
22833 MappingPromiseArray.prototype._asyncInit = function() {
22834     this._init$(undefined, -2);
22835 };
22836
22837 MappingPromiseArray.prototype._init = function () {};
22838
22839 MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
22840     var values = this._values;
22841     var length = this.length();
22842     var preservedValues = this._preservedValues;
22843     var limit = this._limit;
22844
22845     if (index < 0) {
22846         index = (index * -1) - 1;
22847         values[index] = value;
22848         if (limit >= 1) {
22849             this._inFlight--;
22850             this._drainQueue();
22851             if (this._isResolved()) return true;
22852         }
22853     } else {
22854         if (limit >= 1 && this._inFlight >= limit) {
22855             values[index] = value;
22856             this._queue.push(index);
22857             return false;
22858         }
22859         if (preservedValues !== null) preservedValues[index] = value;
22860
22861         var promise = this._promise;
22862         var callback = this._callback;
22863         var receiver = promise._boundValue();
22864         promise._pushContext();
22865         var ret = tryCatch(callback).call(receiver, value, index, length);
22866         var promiseCreated = promise._popContext();
22867         debug.checkForgottenReturns(
22868             ret,
22869             promiseCreated,
22870             preservedValues !== null ? "Promise.filter" : "Promise.map",
22871             promise
22872         );
22873         if (ret === errorObj) {
22874             this._reject(ret.e);
22875             return true;
22876         }
22877
22878         var maybePromise = tryConvertToPromise(ret, this._promise);
22879         if (maybePromise instanceof Promise) {
22880             maybePromise = maybePromise._target();
22881             var bitField = maybePromise._bitField;
22882             ;
22883             if (((bitField & 50397184) === 0)) {
22884                 if (limit >= 1) this._inFlight++;
22885                 values[index] = maybePromise;
22886                 maybePromise._proxy(this, (index + 1) * -1);
22887                 return false;
22888             } else if (((bitField & 33554432) !== 0)) {
22889                 ret = maybePromise._value();
22890             } else if (((bitField & 16777216) !== 0)) {
22891                 this._reject(maybePromise._reason());
22892                 return true;
22893             } else {
22894                 this._cancel();
22895                 return true;
22896             }
22897         }
22898         values[index] = ret;
22899     }
22900     var totalResolved = ++this._totalResolved;
22901     if (totalResolved >= length) {
22902         if (preservedValues !== null) {
22903             this._filter(values, preservedValues);
22904         } else {
22905             this._resolve(values);
22906         }
22907         return true;
22908     }
22909     return false;
22910 };
22911
22912 MappingPromiseArray.prototype._drainQueue = function () {
22913     var queue = this._queue;
22914     var limit = this._limit;
22915     var values = this._values;
22916     while (queue.length > 0 && this._inFlight < limit) {
22917         if (this._isResolved()) return;
22918         var index = queue.pop();
22919         this._promiseFulfilled(values[index], index);
22920     }
22921 };
22922
22923 MappingPromiseArray.prototype._filter = function (booleans, values) {
22924     var len = values.length;
22925     var ret = new Array(len);
22926     var j = 0;
22927     for (var i = 0; i < len; ++i) {
22928         if (booleans[i]) ret[j++] = values[i];
22929     }
22930     ret.length = j;
22931     this._resolve(ret);
22932 };
22933
22934 MappingPromiseArray.prototype.preservedValues = function () {
22935     return this._preservedValues;
22936 };
22937
22938 function map(promises, fn, options, _filter) {
22939     if (typeof fn !== "function") {
22940         return apiRejection("expecting a function but got " + util.classString(fn));
22941     }
22942
22943     var limit = 0;
22944     if (options !== undefined) {
22945         if (typeof options === "object" && options !== null) {
22946             if (typeof options.concurrency !== "number") {
22947                 return Promise.reject(
22948                     new TypeError("'concurrency' must be a number but it is " +
22949                                     util.classString(options.concurrency)));
22950             }
22951             limit = options.concurrency;
22952         } else {
22953             return Promise.reject(new TypeError(
22954                             "options argument must be an object but it is " +
22955                              util.classString(options)));
22956         }
22957     }
22958     limit = typeof limit === "number" &&
22959         isFinite(limit) && limit >= 1 ? limit : 0;
22960     return new MappingPromiseArray(promises, fn, limit, _filter).promise();
22961 }
22962
22963 Promise.prototype.map = function (fn, options) {
22964     return map(this, fn, options, null);
22965 };
22966
22967 Promise.map = function (promises, fn, options, _filter) {
22968     return map(promises, fn, options, _filter);
22969 };
22970
22971
22972 };
22973
22974
22975 /***/ }),
22976 /* 150 */
22977 /***/ (function(module, exports, __webpack_require__) {
22978
22979 "use strict";
22980
22981 var cr = Object.create;
22982 if (cr) {
22983     var callerCache = cr(null);
22984     var getterCache = cr(null);
22985     callerCache[" size"] = getterCache[" size"] = 0;
22986 }
22987
22988 module.exports = function(Promise) {
22989 var util = __webpack_require__(130);
22990 var canEvaluate = util.canEvaluate;
22991 var isIdentifier = util.isIdentifier;
22992
22993 var getMethodCaller;
22994 var getGetter;
22995 if (true) {
22996 var makeMethodCaller = function (methodName) {
22997     return new Function("ensureMethod", "                                    \n\
22998         return function(obj) {                                               \n\
22999             'use strict'                                                     \n\
23000             var len = this.length;                                           \n\
23001             ensureMethod(obj, 'methodName');                                 \n\
23002             switch(len) {                                                    \n\
23003                 case 1: return obj.methodName(this[0]);                      \n\
23004                 case 2: return obj.methodName(this[0], this[1]);             \n\
23005                 case 3: return obj.methodName(this[0], this[1], this[2]);    \n\
23006                 case 0: return obj.methodName();                             \n\
23007                 default:                                                     \n\
23008                     return obj.methodName.apply(obj, this);                  \n\
23009             }                                                                \n\
23010         };                                                                   \n\
23011         ".replace(/methodName/g, methodName))(ensureMethod);
23012 };
23013
23014 var makeGetter = function (propertyName) {
23015     return new Function("obj", "                                             \n\
23016         'use strict';                                                        \n\
23017         return obj.propertyName;                                             \n\
23018         ".replace("propertyName", propertyName));
23019 };
23020
23021 var getCompiled = function(name, compiler, cache) {
23022     var ret = cache[name];
23023     if (typeof ret !== "function") {
23024         if (!isIdentifier(name)) {
23025             return null;
23026         }
23027         ret = compiler(name);
23028         cache[name] = ret;
23029         cache[" size"]++;
23030         if (cache[" size"] > 512) {
23031             var keys = Object.keys(cache);
23032             for (var i = 0; i < 256; ++i) delete cache[keys[i]];
23033             cache[" size"] = keys.length - 256;
23034         }
23035     }
23036     return ret;
23037 };
23038
23039 getMethodCaller = function(name) {
23040     return getCompiled(name, makeMethodCaller, callerCache);
23041 };
23042
23043 getGetter = function(name) {
23044     return getCompiled(name, makeGetter, getterCache);
23045 };
23046 }
23047
23048 function ensureMethod(obj, methodName) {
23049     var fn;
23050     if (obj != null) fn = obj[methodName];
23051     if (typeof fn !== "function") {
23052         var message = "Object " + util.classString(obj) + " has no method '" +
23053             util.toString(methodName) + "'";
23054         throw new Promise.TypeError(message);
23055     }
23056     return fn;
23057 }
23058
23059 function caller(obj) {
23060     var methodName = this.pop();
23061     var fn = ensureMethod(obj, methodName);
23062     return fn.apply(obj, this);
23063 }
23064 Promise.prototype.call = function (methodName) {
23065     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];};
23066     if (true) {
23067         if (canEvaluate) {
23068             var maybeCaller = getMethodCaller(methodName);
23069             if (maybeCaller !== null) {
23070                 return this._then(
23071                     maybeCaller, undefined, undefined, args, undefined);
23072             }
23073         }
23074     }
23075     args.push(methodName);
23076     return this._then(caller, undefined, undefined, args, undefined);
23077 };
23078
23079 function namedGetter(obj) {
23080     return obj[this];
23081 }
23082 function indexedGetter(obj) {
23083     var index = +this;
23084     if (index < 0) index = Math.max(0, index + obj.length);
23085     return obj[index];
23086 }
23087 Promise.prototype.get = function (propertyName) {
23088     var isIndex = (typeof propertyName === "number");
23089     var getter;
23090     if (!isIndex) {
23091         if (canEvaluate) {
23092             var maybeGetter = getGetter(propertyName);
23093             getter = maybeGetter !== null ? maybeGetter : namedGetter;
23094         } else {
23095             getter = namedGetter;
23096         }
23097     } else {
23098         getter = indexedGetter;
23099     }
23100     return this._then(getter, undefined, undefined, propertyName, undefined);
23101 };
23102 };
23103
23104
23105 /***/ }),
23106 /* 151 */
23107 /***/ (function(module, exports, __webpack_require__) {
23108
23109 "use strict";
23110
23111 module.exports = function (Promise, apiRejection, tryConvertToPromise,
23112     createContext, INTERNAL, debug) {
23113     var util = __webpack_require__(130);
23114     var TypeError = __webpack_require__(135).TypeError;
23115     var inherits = __webpack_require__(130).inherits;
23116     var errorObj = util.errorObj;
23117     var tryCatch = util.tryCatch;
23118     var NULL = {};
23119
23120     function thrower(e) {
23121         setTimeout(function(){throw e;}, 0);
23122     }
23123
23124     function castPreservingDisposable(thenable) {
23125         var maybePromise = tryConvertToPromise(thenable);
23126         if (maybePromise !== thenable &&
23127             typeof thenable._isDisposable === "function" &&
23128             typeof thenable._getDisposer === "function" &&
23129             thenable._isDisposable()) {
23130             maybePromise._setDisposable(thenable._getDisposer());
23131         }
23132         return maybePromise;
23133     }
23134     function dispose(resources, inspection) {
23135         var i = 0;
23136         var len = resources.length;
23137         var ret = new Promise(INTERNAL);
23138         function iterator() {
23139             if (i >= len) return ret._fulfill();
23140             var maybePromise = castPreservingDisposable(resources[i++]);
23141             if (maybePromise instanceof Promise &&
23142                 maybePromise._isDisposable()) {
23143                 try {
23144                     maybePromise = tryConvertToPromise(
23145                         maybePromise._getDisposer().tryDispose(inspection),
23146                         resources.promise);
23147                 } catch (e) {
23148                     return thrower(e);
23149                 }
23150                 if (maybePromise instanceof Promise) {
23151                     return maybePromise._then(iterator, thrower,
23152                                               null, null, null);
23153                 }
23154             }
23155             iterator();
23156         }
23157         iterator();
23158         return ret;
23159     }
23160
23161     function Disposer(data, promise, context) {
23162         this._data = data;
23163         this._promise = promise;
23164         this._context = context;
23165     }
23166
23167     Disposer.prototype.data = function () {
23168         return this._data;
23169     };
23170
23171     Disposer.prototype.promise = function () {
23172         return this._promise;
23173     };
23174
23175     Disposer.prototype.resource = function () {
23176         if (this.promise().isFulfilled()) {
23177             return this.promise().value();
23178         }
23179         return NULL;
23180     };
23181
23182     Disposer.prototype.tryDispose = function(inspection) {
23183         var resource = this.resource();
23184         var context = this._context;
23185         if (context !== undefined) context._pushContext();
23186         var ret = resource !== NULL
23187             ? this.doDispose(resource, inspection) : null;
23188         if (context !== undefined) context._popContext();
23189         this._promise._unsetDisposable();
23190         this._data = null;
23191         return ret;
23192     };
23193
23194     Disposer.isDisposer = function (d) {
23195         return (d != null &&
23196                 typeof d.resource === "function" &&
23197                 typeof d.tryDispose === "function");
23198     };
23199
23200     function FunctionDisposer(fn, promise, context) {
23201         this.constructor$(fn, promise, context);
23202     }
23203     inherits(FunctionDisposer, Disposer);
23204
23205     FunctionDisposer.prototype.doDispose = function (resource, inspection) {
23206         var fn = this.data();
23207         return fn.call(resource, resource, inspection);
23208     };
23209
23210     function maybeUnwrapDisposer(value) {
23211         if (Disposer.isDisposer(value)) {
23212             this.resources[this.index]._setDisposable(value);
23213             return value.promise();
23214         }
23215         return value;
23216     }
23217
23218     function ResourceList(length) {
23219         this.length = length;
23220         this.promise = null;
23221         this[length-1] = null;
23222     }
23223
23224     ResourceList.prototype._resultCancelled = function() {
23225         var len = this.length;
23226         for (var i = 0; i < len; ++i) {
23227             var item = this[i];
23228             if (item instanceof Promise) {
23229                 item.cancel();
23230             }
23231         }
23232     };
23233
23234     Promise.using = function () {
23235         var len = arguments.length;
23236         if (len < 2) return apiRejection(
23237                         "you must pass at least 2 arguments to Promise.using");
23238         var fn = arguments[len - 1];
23239         if (typeof fn !== "function") {
23240             return apiRejection("expecting a function but got " + util.classString(fn));
23241         }
23242         var input;
23243         var spreadArgs = true;
23244         if (len === 2 && Array.isArray(arguments[0])) {
23245             input = arguments[0];
23246             len = input.length;
23247             spreadArgs = false;
23248         } else {
23249             input = arguments;
23250             len--;
23251         }
23252         var resources = new ResourceList(len);
23253         for (var i = 0; i < len; ++i) {
23254             var resource = input[i];
23255             if (Disposer.isDisposer(resource)) {
23256                 var disposer = resource;
23257                 resource = resource.promise();
23258                 resource._setDisposable(disposer);
23259             } else {
23260                 var maybePromise = tryConvertToPromise(resource);
23261                 if (maybePromise instanceof Promise) {
23262                     resource =
23263                         maybePromise._then(maybeUnwrapDisposer, null, null, {
23264                             resources: resources,
23265                             index: i
23266                     }, undefined);
23267                 }
23268             }
23269             resources[i] = resource;
23270         }
23271
23272         var reflectedResources = new Array(resources.length);
23273         for (var i = 0; i < reflectedResources.length; ++i) {
23274             reflectedResources[i] = Promise.resolve(resources[i]).reflect();
23275         }
23276
23277         var resultPromise = Promise.all(reflectedResources)
23278             .then(function(inspections) {
23279                 for (var i = 0; i < inspections.length; ++i) {
23280                     var inspection = inspections[i];
23281                     if (inspection.isRejected()) {
23282                         errorObj.e = inspection.error();
23283                         return errorObj;
23284                     } else if (!inspection.isFulfilled()) {
23285                         resultPromise.cancel();
23286                         return;
23287                     }
23288                     inspections[i] = inspection.value();
23289                 }
23290                 promise._pushContext();
23291
23292                 fn = tryCatch(fn);
23293                 var ret = spreadArgs
23294                     ? fn.apply(undefined, inspections) : fn(inspections);
23295                 var promiseCreated = promise._popContext();
23296                 debug.checkForgottenReturns(
23297                     ret, promiseCreated, "Promise.using", promise);
23298                 return ret;
23299             });
23300
23301         var promise = resultPromise.lastly(function() {
23302             var inspection = new Promise.PromiseInspection(resultPromise);
23303             return dispose(resources, inspection);
23304         });
23305         resources.promise = promise;
23306         promise._setOnCancel(resources);
23307         return promise;
23308     };
23309
23310     Promise.prototype._setDisposable = function (disposer) {
23311         this._bitField = this._bitField | 131072;
23312         this._disposer = disposer;
23313     };
23314
23315     Promise.prototype._isDisposable = function () {
23316         return (this._bitField & 131072) > 0;
23317     };
23318
23319     Promise.prototype._getDisposer = function () {
23320         return this._disposer;
23321     };
23322
23323     Promise.prototype._unsetDisposable = function () {
23324         this._bitField = this._bitField & (~131072);
23325         this._disposer = undefined;
23326     };
23327
23328     Promise.prototype.disposer = function (fn) {
23329         if (typeof fn === "function") {
23330             return new FunctionDisposer(fn, this, createContext());
23331         }
23332         throw new TypeError();
23333     };
23334
23335 };
23336
23337
23338 /***/ }),
23339 /* 152 */
23340 /***/ (function(module, exports, __webpack_require__) {
23341
23342 "use strict";
23343
23344 module.exports = function(Promise, INTERNAL, debug) {
23345 var util = __webpack_require__(130);
23346 var TimeoutError = Promise.TimeoutError;
23347
23348 function HandleWrapper(handle)  {
23349     this.handle = handle;
23350 }
23351
23352 HandleWrapper.prototype._resultCancelled = function() {
23353     clearTimeout(this.handle);
23354 };
23355
23356 var afterValue = function(value) { return delay(+this).thenReturn(value); };
23357 var delay = Promise.delay = function (ms, value) {
23358     var ret;
23359     var handle;
23360     if (value !== undefined) {
23361         ret = Promise.resolve(value)
23362                 ._then(afterValue, null, null, ms, undefined);
23363         if (debug.cancellation() && value instanceof Promise) {
23364             ret._setOnCancel(value);
23365         }
23366     } else {
23367         ret = new Promise(INTERNAL);
23368         handle = setTimeout(function() { ret._fulfill(); }, +ms);
23369         if (debug.cancellation()) {
23370             ret._setOnCancel(new HandleWrapper(handle));
23371         }
23372         ret._captureStackTrace();
23373     }
23374     ret._setAsyncGuaranteed();
23375     return ret;
23376 };
23377
23378 Promise.prototype.delay = function (ms) {
23379     return delay(ms, this);
23380 };
23381
23382 var afterTimeout = function (promise, message, parent) {
23383     var err;
23384     if (typeof message !== "string") {
23385         if (message instanceof Error) {
23386             err = message;
23387         } else {
23388             err = new TimeoutError("operation timed out");
23389         }
23390     } else {
23391         err = new TimeoutError(message);
23392     }
23393     util.markAsOriginatingFromRejection(err);
23394     promise._attachExtraTrace(err);
23395     promise._reject(err);
23396
23397     if (parent != null) {
23398         parent.cancel();
23399     }
23400 };
23401
23402 function successClear(value) {
23403     clearTimeout(this.handle);
23404     return value;
23405 }
23406
23407 function failureClear(reason) {
23408     clearTimeout(this.handle);
23409     throw reason;
23410 }
23411
23412 Promise.prototype.timeout = function (ms, message) {
23413     ms = +ms;
23414     var ret, parent;
23415
23416     var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
23417         if (ret.isPending()) {
23418             afterTimeout(ret, message, parent);
23419         }
23420     }, ms));
23421
23422     if (debug.cancellation()) {
23423         parent = this.then();
23424         ret = parent._then(successClear, failureClear,
23425                             undefined, handleWrapper, undefined);
23426         ret._setOnCancel(handleWrapper);
23427     } else {
23428         ret = this._then(successClear, failureClear,
23429                             undefined, handleWrapper, undefined);
23430     }
23431
23432     return ret;
23433 };
23434
23435 };
23436
23437
23438 /***/ }),
23439 /* 153 */
23440 /***/ (function(module, exports, __webpack_require__) {
23441
23442 "use strict";
23443
23444 module.exports = function(Promise,
23445                           apiRejection,
23446                           INTERNAL,
23447                           tryConvertToPromise,
23448                           Proxyable,
23449                           debug) {
23450 var errors = __webpack_require__(135);
23451 var TypeError = errors.TypeError;
23452 var util = __webpack_require__(130);
23453 var errorObj = util.errorObj;
23454 var tryCatch = util.tryCatch;
23455 var yieldHandlers = [];
23456
23457 function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
23458     for (var i = 0; i < yieldHandlers.length; ++i) {
23459         traceParent._pushContext();
23460         var result = tryCatch(yieldHandlers[i])(value);
23461         traceParent._popContext();
23462         if (result === errorObj) {
23463             traceParent._pushContext();
23464             var ret = Promise.reject(errorObj.e);
23465             traceParent._popContext();
23466             return ret;
23467         }
23468         var maybePromise = tryConvertToPromise(result, traceParent);
23469         if (maybePromise instanceof Promise) return maybePromise;
23470     }
23471     return null;
23472 }
23473
23474 function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
23475     if (debug.cancellation()) {
23476         var internal = new Promise(INTERNAL);
23477         var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
23478         this._promise = internal.lastly(function() {
23479             return _finallyPromise;
23480         });
23481         internal._captureStackTrace();
23482         internal._setOnCancel(this);
23483     } else {
23484         var promise = this._promise = new Promise(INTERNAL);
23485         promise._captureStackTrace();
23486     }
23487     this._stack = stack;
23488     this._generatorFunction = generatorFunction;
23489     this._receiver = receiver;
23490     this._generator = undefined;
23491     this._yieldHandlers = typeof yieldHandler === "function"
23492         ? [yieldHandler].concat(yieldHandlers)
23493         : yieldHandlers;
23494     this._yieldedPromise = null;
23495     this._cancellationPhase = false;
23496 }
23497 util.inherits(PromiseSpawn, Proxyable);
23498
23499 PromiseSpawn.prototype._isResolved = function() {
23500     return this._promise === null;
23501 };
23502
23503 PromiseSpawn.prototype._cleanup = function() {
23504     this._promise = this._generator = null;
23505     if (debug.cancellation() && this._finallyPromise !== null) {
23506         this._finallyPromise._fulfill();
23507         this._finallyPromise = null;
23508     }
23509 };
23510
23511 PromiseSpawn.prototype._promiseCancelled = function() {
23512     if (this._isResolved()) return;
23513     var implementsReturn = typeof this._generator["return"] !== "undefined";
23514
23515     var result;
23516     if (!implementsReturn) {
23517         var reason = new Promise.CancellationError(
23518             "generator .return() sentinel");
23519         Promise.coroutine.returnSentinel = reason;
23520         this._promise._attachExtraTrace(reason);
23521         this._promise._pushContext();
23522         result = tryCatch(this._generator["throw"]).call(this._generator,
23523                                                          reason);
23524         this._promise._popContext();
23525     } else {
23526         this._promise._pushContext();
23527         result = tryCatch(this._generator["return"]).call(this._generator,
23528                                                           undefined);
23529         this._promise._popContext();
23530     }
23531     this._cancellationPhase = true;
23532     this._yieldedPromise = null;
23533     this._continue(result);
23534 };
23535
23536 PromiseSpawn.prototype._promiseFulfilled = function(value) {
23537     this._yieldedPromise = null;
23538     this._promise._pushContext();
23539     var result = tryCatch(this._generator.next).call(this._generator, value);
23540     this._promise._popContext();
23541     this._continue(result);
23542 };
23543
23544 PromiseSpawn.prototype._promiseRejected = function(reason) {
23545     this._yieldedPromise = null;
23546     this._promise._attachExtraTrace(reason);
23547     this._promise._pushContext();
23548     var result = tryCatch(this._generator["throw"])
23549         .call(this._generator, reason);
23550     this._promise._popContext();
23551     this._continue(result);
23552 };
23553
23554 PromiseSpawn.prototype._resultCancelled = function() {
23555     if (this._yieldedPromise instanceof Promise) {
23556         var promise = this._yieldedPromise;
23557         this._yieldedPromise = null;
23558         promise.cancel();
23559     }
23560 };
23561
23562 PromiseSpawn.prototype.promise = function () {
23563     return this._promise;
23564 };
23565
23566 PromiseSpawn.prototype._run = function () {
23567     this._generator = this._generatorFunction.call(this._receiver);
23568     this._receiver =
23569         this._generatorFunction = undefined;
23570     this._promiseFulfilled(undefined);
23571 };
23572
23573 PromiseSpawn.prototype._continue = function (result) {
23574     var promise = this._promise;
23575     if (result === errorObj) {
23576         this._cleanup();
23577         if (this._cancellationPhase) {
23578             return promise.cancel();
23579         } else {
23580             return promise._rejectCallback(result.e, false);
23581         }
23582     }
23583
23584     var value = result.value;
23585     if (result.done === true) {
23586         this._cleanup();
23587         if (this._cancellationPhase) {
23588             return promise.cancel();
23589         } else {
23590             return promise._resolveCallback(value);
23591         }
23592     } else {
23593         var maybePromise = tryConvertToPromise(value, this._promise);
23594         if (!(maybePromise instanceof Promise)) {
23595             maybePromise =
23596                 promiseFromYieldHandler(maybePromise,
23597                                         this._yieldHandlers,
23598                                         this._promise);
23599             if (maybePromise === null) {
23600                 this._promiseRejected(
23601                     new TypeError(
23602                         "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) +
23603                         "From coroutine:\u000a" +
23604                         this._stack.split("\n").slice(1, -7).join("\n")
23605                     )
23606                 );
23607                 return;
23608             }
23609         }
23610         maybePromise = maybePromise._target();
23611         var bitField = maybePromise._bitField;
23612         ;
23613         if (((bitField & 50397184) === 0)) {
23614             this._yieldedPromise = maybePromise;
23615             maybePromise._proxy(this, null);
23616         } else if (((bitField & 33554432) !== 0)) {
23617             Promise._async.invoke(
23618                 this._promiseFulfilled, this, maybePromise._value()
23619             );
23620         } else if (((bitField & 16777216) !== 0)) {
23621             Promise._async.invoke(
23622                 this._promiseRejected, this, maybePromise._reason()
23623             );
23624         } else {
23625             this._promiseCancelled();
23626         }
23627     }
23628 };
23629
23630 Promise.coroutine = function (generatorFunction, options) {
23631     if (typeof generatorFunction !== "function") {
23632         throw new TypeError("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
23633     }
23634     var yieldHandler = Object(options).yieldHandler;
23635     var PromiseSpawn$ = PromiseSpawn;
23636     var stack = new Error().stack;
23637     return function () {
23638         var generator = generatorFunction.apply(this, arguments);
23639         var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
23640                                       stack);
23641         var ret = spawn.promise();
23642         spawn._generator = generator;
23643         spawn._promiseFulfilled(undefined);
23644         return ret;
23645     };
23646 };
23647
23648 Promise.coroutine.addYieldHandler = function(fn) {
23649     if (typeof fn !== "function") {
23650         throw new TypeError("expecting a function but got " + util.classString(fn));
23651     }
23652     yieldHandlers.push(fn);
23653 };
23654
23655 Promise.spawn = function (generatorFunction) {
23656     debug.deprecated("Promise.spawn()", "Promise.coroutine()");
23657     if (typeof generatorFunction !== "function") {
23658         return apiRejection("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
23659     }
23660     var spawn = new PromiseSpawn(generatorFunction, this);
23661     var ret = spawn.promise();
23662     spawn._run(Promise.spawn);
23663     return ret;
23664 };
23665 };
23666
23667
23668 /***/ }),
23669 /* 154 */
23670 /***/ (function(module, exports, __webpack_require__) {
23671
23672 "use strict";
23673
23674 module.exports = function(Promise) {
23675 var util = __webpack_require__(130);
23676 var async = Promise._async;
23677 var tryCatch = util.tryCatch;
23678 var errorObj = util.errorObj;
23679
23680 function spreadAdapter(val, nodeback) {
23681     var promise = this;
23682     if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
23683     var ret =
23684         tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
23685     if (ret === errorObj) {
23686         async.throwLater(ret.e);
23687     }
23688 }
23689
23690 function successAdapter(val, nodeback) {
23691     var promise = this;
23692     var receiver = promise._boundValue();
23693     var ret = val === undefined
23694         ? tryCatch(nodeback).call(receiver, null)
23695         : tryCatch(nodeback).call(receiver, null, val);
23696     if (ret === errorObj) {
23697         async.throwLater(ret.e);
23698     }
23699 }
23700 function errorAdapter(reason, nodeback) {
23701     var promise = this;
23702     if (!reason) {
23703         var newReason = new Error(reason + "");
23704         newReason.cause = reason;
23705         reason = newReason;
23706     }
23707     var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
23708     if (ret === errorObj) {
23709         async.throwLater(ret.e);
23710     }
23711 }
23712
23713 Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
23714                                                                      options) {
23715     if (typeof nodeback == "function") {
23716         var adapter = successAdapter;
23717         if (options !== undefined && Object(options).spread) {
23718             adapter = spreadAdapter;
23719         }
23720         this._then(
23721             adapter,
23722             errorAdapter,
23723             undefined,
23724             this,
23725             nodeback
23726         );
23727     }
23728     return this;
23729 };
23730 };
23731
23732
23733 /***/ }),
23734 /* 155 */
23735 /***/ (function(module, exports, __webpack_require__) {
23736
23737 "use strict";
23738
23739 module.exports = function(Promise, INTERNAL) {
23740 var THIS = {};
23741 var util = __webpack_require__(130);
23742 var nodebackForPromise = __webpack_require__(142);
23743 var withAppended = util.withAppended;
23744 var maybeWrapAsError = util.maybeWrapAsError;
23745 var canEvaluate = util.canEvaluate;
23746 var TypeError = __webpack_require__(135).TypeError;
23747 var defaultSuffix = "Async";
23748 var defaultPromisified = {__isPromisified__: true};
23749 var noCopyProps = [
23750     "arity",    "length",
23751     "name",
23752     "arguments",
23753     "caller",
23754     "callee",
23755     "prototype",
23756     "__isPromisified__"
23757 ];
23758 var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
23759
23760 var defaultFilter = function(name) {
23761     return util.isIdentifier(name) &&
23762         name.charAt(0) !== "_" &&
23763         name !== "constructor";
23764 };
23765
23766 function propsFilter(key) {
23767     return !noCopyPropsPattern.test(key);
23768 }
23769
23770 function isPromisified(fn) {
23771     try {
23772         return fn.__isPromisified__ === true;
23773     }
23774     catch (e) {
23775         return false;
23776     }
23777 }
23778
23779 function hasPromisified(obj, key, suffix) {
23780     var val = util.getDataPropertyOrDefault(obj, key + suffix,
23781                                             defaultPromisified);
23782     return val ? isPromisified(val) : false;
23783 }
23784 function checkValid(ret, suffix, suffixRegexp) {
23785     for (var i = 0; i < ret.length; i += 2) {
23786         var key = ret[i];
23787         if (suffixRegexp.test(key)) {
23788             var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
23789             for (var j = 0; j < ret.length; j += 2) {
23790                 if (ret[j] === keyWithoutAsyncSuffix) {
23791                     throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a    See http://goo.gl/MqrFmX\u000a"
23792                         .replace("%s", suffix));
23793                 }
23794             }
23795         }
23796     }
23797 }
23798
23799 function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
23800     var keys = util.inheritedDataKeys(obj);
23801     var ret = [];
23802     for (var i = 0; i < keys.length; ++i) {
23803         var key = keys[i];
23804         var value = obj[key];
23805         var passesDefaultFilter = filter === defaultFilter
23806             ? true : defaultFilter(key, value, obj);
23807         if (typeof value === "function" &&
23808             !isPromisified(value) &&
23809             !hasPromisified(obj, key, suffix) &&
23810             filter(key, value, obj, passesDefaultFilter)) {
23811             ret.push(key, value);
23812         }
23813     }
23814     checkValid(ret, suffix, suffixRegexp);
23815     return ret;
23816 }
23817
23818 var escapeIdentRegex = function(str) {
23819     return str.replace(/([$])/, "\\$");
23820 };
23821
23822 var makeNodePromisifiedEval;
23823 if (true) {
23824 var switchCaseArgumentOrder = function(likelyArgumentCount) {
23825     var ret = [likelyArgumentCount];
23826     var min = Math.max(0, likelyArgumentCount - 1 - 3);
23827     for(var i = likelyArgumentCount - 1; i >= min; --i) {
23828         ret.push(i);
23829     }
23830     for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
23831         ret.push(i);
23832     }
23833     return ret;
23834 };
23835
23836 var argumentSequence = function(argumentCount) {
23837     return util.filledRange(argumentCount, "_arg", "");
23838 };
23839
23840 var parameterDeclaration = function(parameterCount) {
23841     return util.filledRange(
23842         Math.max(parameterCount, 3), "_arg", "");
23843 };
23844
23845 var parameterCount = function(fn) {
23846     if (typeof fn.length === "number") {
23847         return Math.max(Math.min(fn.length, 1023 + 1), 0);
23848     }
23849     return 0;
23850 };
23851
23852 makeNodePromisifiedEval =
23853 function(callback, receiver, originalName, fn, _, multiArgs) {
23854     var newParameterCount = Math.max(0, parameterCount(fn) - 1);
23855     var argumentOrder = switchCaseArgumentOrder(newParameterCount);
23856     var shouldProxyThis = typeof callback === "string" || receiver === THIS;
23857
23858     function generateCallForArgumentCount(count) {
23859         var args = argumentSequence(count).join(", ");
23860         var comma = count > 0 ? ", " : "";
23861         var ret;
23862         if (shouldProxyThis) {
23863             ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
23864         } else {
23865             ret = receiver === undefined
23866                 ? "ret = callback({{args}}, nodeback); break;\n"
23867                 : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
23868         }
23869         return ret.replace("{{args}}", args).replace(", ", comma);
23870     }
23871
23872     function generateArgumentSwitchCase() {
23873         var ret = "";
23874         for (var i = 0; i < argumentOrder.length; ++i) {
23875             ret += "case " + argumentOrder[i] +":" +
23876                 generateCallForArgumentCount(argumentOrder[i]);
23877         }
23878
23879         ret += "                                                             \n\
23880         default:                                                             \n\
23881             var args = new Array(len + 1);                                   \n\
23882             var i = 0;                                                       \n\
23883             for (var i = 0; i < len; ++i) {                                  \n\
23884                args[i] = arguments[i];                                       \n\
23885             }                                                                \n\
23886             args[i] = nodeback;                                              \n\
23887             [CodeForCall]                                                    \n\
23888             break;                                                           \n\
23889         ".replace("[CodeForCall]", (shouldProxyThis
23890                                 ? "ret = callback.apply(this, args);\n"
23891                                 : "ret = callback.apply(receiver, args);\n"));
23892         return ret;
23893     }
23894
23895     var getFunctionCode = typeof callback === "string"
23896                                 ? ("this != null ? this['"+callback+"'] : fn")
23897                                 : "fn";
23898     var body = "'use strict';                                                \n\
23899         var ret = function (Parameters) {                                    \n\
23900             'use strict';                                                    \n\
23901             var len = arguments.length;                                      \n\
23902             var promise = new Promise(INTERNAL);                             \n\
23903             promise._captureStackTrace();                                    \n\
23904             var nodeback = nodebackForPromise(promise, " + multiArgs + ");   \n\
23905             var ret;                                                         \n\
23906             var callback = tryCatch([GetFunctionCode]);                      \n\
23907             switch(len) {                                                    \n\
23908                 [CodeForSwitchCase]                                          \n\
23909             }                                                                \n\
23910             if (ret === errorObj) {                                          \n\
23911                 promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
23912             }                                                                \n\
23913             if (!promise._isFateSealed()) promise._setAsyncGuaranteed();     \n\
23914             return promise;                                                  \n\
23915         };                                                                   \n\
23916         notEnumerableProp(ret, '__isPromisified__', true);                   \n\
23917         return ret;                                                          \n\
23918     ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
23919         .replace("[GetFunctionCode]", getFunctionCode);
23920     body = body.replace("Parameters", parameterDeclaration(newParameterCount));
23921     return new Function("Promise",
23922                         "fn",
23923                         "receiver",
23924                         "withAppended",
23925                         "maybeWrapAsError",
23926                         "nodebackForPromise",
23927                         "tryCatch",
23928                         "errorObj",
23929                         "notEnumerableProp",
23930                         "INTERNAL",
23931                         body)(
23932                     Promise,
23933                     fn,
23934                     receiver,
23935                     withAppended,
23936                     maybeWrapAsError,
23937                     nodebackForPromise,
23938                     util.tryCatch,
23939                     util.errorObj,
23940                     util.notEnumerableProp,
23941                     INTERNAL);
23942 };
23943 }
23944
23945 function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
23946     var defaultThis = (function() {return this;})();
23947     var method = callback;
23948     if (typeof method === "string") {
23949         callback = fn;
23950     }
23951     function promisified() {
23952         var _receiver = receiver;
23953         if (receiver === THIS) _receiver = this;
23954         var promise = new Promise(INTERNAL);
23955         promise._captureStackTrace();
23956         var cb = typeof method === "string" && this !== defaultThis
23957             ? this[method] : callback;
23958         var fn = nodebackForPromise(promise, multiArgs);
23959         try {
23960             cb.apply(_receiver, withAppended(arguments, fn));
23961         } catch(e) {
23962             promise._rejectCallback(maybeWrapAsError(e), true, true);
23963         }
23964         if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
23965         return promise;
23966     }
23967     util.notEnumerableProp(promisified, "__isPromisified__", true);
23968     return promisified;
23969 }
23970
23971 var makeNodePromisified = canEvaluate
23972     ? makeNodePromisifiedEval
23973     : makeNodePromisifiedClosure;
23974
23975 function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
23976     var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
23977     var methods =
23978         promisifiableMethods(obj, suffix, suffixRegexp, filter);
23979
23980     for (var i = 0, len = methods.length; i < len; i+= 2) {
23981         var key = methods[i];
23982         var fn = methods[i+1];
23983         var promisifiedKey = key + suffix;
23984         if (promisifier === makeNodePromisified) {
23985             obj[promisifiedKey] =
23986                 makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
23987         } else {
23988             var promisified = promisifier(fn, function() {
23989                 return makeNodePromisified(key, THIS, key,
23990                                            fn, suffix, multiArgs);
23991             });
23992             util.notEnumerableProp(promisified, "__isPromisified__", true);
23993             obj[promisifiedKey] = promisified;
23994         }
23995     }
23996     util.toFastProperties(obj);
23997     return obj;
23998 }
23999
24000 function promisify(callback, receiver, multiArgs) {
24001     return makeNodePromisified(callback, receiver, undefined,
24002                                 callback, null, multiArgs);
24003 }
24004
24005 Promise.promisify = function (fn, options) {
24006     if (typeof fn !== "function") {
24007         throw new TypeError("expecting a function but got " + util.classString(fn));
24008     }
24009     if (isPromisified(fn)) {
24010         return fn;
24011     }
24012     options = Object(options);
24013     var receiver = options.context === undefined ? THIS : options.context;
24014     var multiArgs = !!options.multiArgs;
24015     var ret = promisify(fn, receiver, multiArgs);
24016     util.copyDescriptors(fn, ret, propsFilter);
24017     return ret;
24018 };
24019
24020 Promise.promisifyAll = function (target, options) {
24021     if (typeof target !== "function" && typeof target !== "object") {
24022         throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24023     }
24024     options = Object(options);
24025     var multiArgs = !!options.multiArgs;
24026     var suffix = options.suffix;
24027     if (typeof suffix !== "string") suffix = defaultSuffix;
24028     var filter = options.filter;
24029     if (typeof filter !== "function") filter = defaultFilter;
24030     var promisifier = options.promisifier;
24031     if (typeof promisifier !== "function") promisifier = makeNodePromisified;
24032
24033     if (!util.isIdentifier(suffix)) {
24034         throw new RangeError("suffix must be a valid identifier\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24035     }
24036
24037     var keys = util.inheritedDataKeys(target);
24038     for (var i = 0; i < keys.length; ++i) {
24039         var value = target[keys[i]];
24040         if (keys[i] !== "constructor" &&
24041             util.isClass(value)) {
24042             promisifyAll(value.prototype, suffix, filter, promisifier,
24043                 multiArgs);
24044             promisifyAll(value, suffix, filter, promisifier, multiArgs);
24045         }
24046     }
24047
24048     return promisifyAll(target, suffix, filter, promisifier, multiArgs);
24049 };
24050 };
24051
24052
24053
24054 /***/ }),
24055 /* 156 */
24056 /***/ (function(module, exports, __webpack_require__) {
24057
24058 "use strict";
24059
24060 module.exports = function(
24061     Promise, PromiseArray, tryConvertToPromise, apiRejection) {
24062 var util = __webpack_require__(130);
24063 var isObject = util.isObject;
24064 var es5 = __webpack_require__(131);
24065 var Es6Map;
24066 if (typeof Map === "function") Es6Map = Map;
24067
24068 var mapToEntries = (function() {
24069     var index = 0;
24070     var size = 0;
24071
24072     function extractEntry(value, key) {
24073         this[index] = value;
24074         this[index + size] = key;
24075         index++;
24076     }
24077
24078     return function mapToEntries(map) {
24079         size = map.size;
24080         index = 0;
24081         var ret = new Array(map.size * 2);
24082         map.forEach(extractEntry, ret);
24083         return ret;
24084     };
24085 })();
24086
24087 var entriesToMap = function(entries) {
24088     var ret = new Es6Map();
24089     var length = entries.length / 2 | 0;
24090     for (var i = 0; i < length; ++i) {
24091         var key = entries[length + i];
24092         var value = entries[i];
24093         ret.set(key, value);
24094     }
24095     return ret;
24096 };
24097
24098 function PropertiesPromiseArray(obj) {
24099     var isMap = false;
24100     var entries;
24101     if (Es6Map !== undefined && obj instanceof Es6Map) {
24102         entries = mapToEntries(obj);
24103         isMap = true;
24104     } else {
24105         var keys = es5.keys(obj);
24106         var len = keys.length;
24107         entries = new Array(len * 2);
24108         for (var i = 0; i < len; ++i) {
24109             var key = keys[i];
24110             entries[i] = obj[key];
24111             entries[i + len] = key;
24112         }
24113     }
24114     this.constructor$(entries);
24115     this._isMap = isMap;
24116     this._init$(undefined, -3);
24117 }
24118 util.inherits(PropertiesPromiseArray, PromiseArray);
24119
24120 PropertiesPromiseArray.prototype._init = function () {};
24121
24122 PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
24123     this._values[index] = value;
24124     var totalResolved = ++this._totalResolved;
24125     if (totalResolved >= this._length) {
24126         var val;
24127         if (this._isMap) {
24128             val = entriesToMap(this._values);
24129         } else {
24130             val = {};
24131             var keyOffset = this.length();
24132             for (var i = 0, len = this.length(); i < len; ++i) {
24133                 val[this._values[i + keyOffset]] = this._values[i];
24134             }
24135         }
24136         this._resolve(val);
24137         return true;
24138     }
24139     return false;
24140 };
24141
24142 PropertiesPromiseArray.prototype.shouldCopyValues = function () {
24143     return false;
24144 };
24145
24146 PropertiesPromiseArray.prototype.getActualLength = function (len) {
24147     return len >> 1;
24148 };
24149
24150 function props(promises) {
24151     var ret;
24152     var castValue = tryConvertToPromise(promises);
24153
24154     if (!isObject(castValue)) {
24155         return apiRejection("cannot await properties of a non-object\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24156     } else if (castValue instanceof Promise) {
24157         ret = castValue._then(
24158             Promise.props, undefined, undefined, undefined, undefined);
24159     } else {
24160         ret = new PropertiesPromiseArray(castValue).promise();
24161     }
24162
24163     if (castValue instanceof Promise) {
24164         ret._propagateFrom(castValue, 2);
24165     }
24166     return ret;
24167 }
24168
24169 Promise.prototype.props = function () {
24170     return props(this);
24171 };
24172
24173 Promise.props = function (promises) {
24174     return props(promises);
24175 };
24176 };
24177
24178
24179 /***/ }),
24180 /* 157 */
24181 /***/ (function(module, exports, __webpack_require__) {
24182
24183 "use strict";
24184
24185 module.exports = function(
24186     Promise, INTERNAL, tryConvertToPromise, apiRejection) {
24187 var util = __webpack_require__(130);
24188
24189 var raceLater = function (promise) {
24190     return promise.then(function(array) {
24191         return race(array, promise);
24192     });
24193 };
24194
24195 function race(promises, parent) {
24196     var maybePromise = tryConvertToPromise(promises);
24197
24198     if (maybePromise instanceof Promise) {
24199         return raceLater(maybePromise);
24200     } else {
24201         promises = util.asArray(promises);
24202         if (promises === null)
24203             return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
24204     }
24205
24206     var ret = new Promise(INTERNAL);
24207     if (parent !== undefined) {
24208         ret._propagateFrom(parent, 3);
24209     }
24210     var fulfill = ret._fulfill;
24211     var reject = ret._reject;
24212     for (var i = 0, len = promises.length; i < len; ++i) {
24213         var val = promises[i];
24214
24215         if (val === undefined && !(i in promises)) {
24216             continue;
24217         }
24218
24219         Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
24220     }
24221     return ret;
24222 }
24223
24224 Promise.race = function (promises) {
24225     return race(promises, undefined);
24226 };
24227
24228 Promise.prototype.race = function () {
24229     return race(this, undefined);
24230 };
24231
24232 };
24233
24234
24235 /***/ }),
24236 /* 158 */
24237 /***/ (function(module, exports, __webpack_require__) {
24238
24239 "use strict";
24240
24241 module.exports = function(Promise,
24242                           PromiseArray,
24243                           apiRejection,
24244                           tryConvertToPromise,
24245                           INTERNAL,
24246                           debug) {
24247 var getDomain = Promise._getDomain;
24248 var util = __webpack_require__(130);
24249 var tryCatch = util.tryCatch;
24250
24251 function ReductionPromiseArray(promises, fn, initialValue, _each) {
24252     this.constructor$(promises);
24253     var domain = getDomain();
24254     this._fn = domain === null ? fn : util.domainBind(domain, fn);
24255     if (initialValue !== undefined) {
24256         initialValue = Promise.resolve(initialValue);
24257         initialValue._attachCancellationCallback(this);
24258     }
24259     this._initialValue = initialValue;
24260     this._currentCancellable = null;
24261     if(_each === INTERNAL) {
24262         this._eachValues = Array(this._length);
24263     } else if (_each === 0) {
24264         this._eachValues = null;
24265     } else {
24266         this._eachValues = undefined;
24267     }
24268     this._promise._captureStackTrace();
24269     this._init$(undefined, -5);
24270 }
24271 util.inherits(ReductionPromiseArray, PromiseArray);
24272
24273 ReductionPromiseArray.prototype._gotAccum = function(accum) {
24274     if (this._eachValues !== undefined && 
24275         this._eachValues !== null && 
24276         accum !== INTERNAL) {
24277         this._eachValues.push(accum);
24278     }
24279 };
24280
24281 ReductionPromiseArray.prototype._eachComplete = function(value) {
24282     if (this._eachValues !== null) {
24283         this._eachValues.push(value);
24284     }
24285     return this._eachValues;
24286 };
24287
24288 ReductionPromiseArray.prototype._init = function() {};
24289
24290 ReductionPromiseArray.prototype._resolveEmptyArray = function() {
24291     this._resolve(this._eachValues !== undefined ? this._eachValues
24292                                                  : this._initialValue);
24293 };
24294
24295 ReductionPromiseArray.prototype.shouldCopyValues = function () {
24296     return false;
24297 };
24298
24299 ReductionPromiseArray.prototype._resolve = function(value) {
24300     this._promise._resolveCallback(value);
24301     this._values = null;
24302 };
24303
24304 ReductionPromiseArray.prototype._resultCancelled = function(sender) {
24305     if (sender === this._initialValue) return this._cancel();
24306     if (this._isResolved()) return;
24307     this._resultCancelled$();
24308     if (this._currentCancellable instanceof Promise) {
24309         this._currentCancellable.cancel();
24310     }
24311     if (this._initialValue instanceof Promise) {
24312         this._initialValue.cancel();
24313     }
24314 };
24315
24316 ReductionPromiseArray.prototype._iterate = function (values) {
24317     this._values = values;
24318     var value;
24319     var i;
24320     var length = values.length;
24321     if (this._initialValue !== undefined) {
24322         value = this._initialValue;
24323         i = 0;
24324     } else {
24325         value = Promise.resolve(values[0]);
24326         i = 1;
24327     }
24328
24329     this._currentCancellable = value;
24330
24331     if (!value.isRejected()) {
24332         for (; i < length; ++i) {
24333             var ctx = {
24334                 accum: null,
24335                 value: values[i],
24336                 index: i,
24337                 length: length,
24338                 array: this
24339             };
24340             value = value._then(gotAccum, undefined, undefined, ctx, undefined);
24341         }
24342     }
24343
24344     if (this._eachValues !== undefined) {
24345         value = value
24346             ._then(this._eachComplete, undefined, undefined, this, undefined);
24347     }
24348     value._then(completed, completed, undefined, value, this);
24349 };
24350
24351 Promise.prototype.reduce = function (fn, initialValue) {
24352     return reduce(this, fn, initialValue, null);
24353 };
24354
24355 Promise.reduce = function (promises, fn, initialValue, _each) {
24356     return reduce(promises, fn, initialValue, _each);
24357 };
24358
24359 function completed(valueOrReason, array) {
24360     if (this.isFulfilled()) {
24361         array._resolve(valueOrReason);
24362     } else {
24363         array._reject(valueOrReason);
24364     }
24365 }
24366
24367 function reduce(promises, fn, initialValue, _each) {
24368     if (typeof fn !== "function") {
24369         return apiRejection("expecting a function but got " + util.classString(fn));
24370     }
24371     var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
24372     return array.promise();
24373 }
24374
24375 function gotAccum(accum) {
24376     this.accum = accum;
24377     this.array._gotAccum(accum);
24378     var value = tryConvertToPromise(this.value, this.array._promise);
24379     if (value instanceof Promise) {
24380         this.array._currentCancellable = value;
24381         return value._then(gotValue, undefined, undefined, this, undefined);
24382     } else {
24383         return gotValue.call(this, value);
24384     }
24385 }
24386
24387 function gotValue(value) {
24388     var array = this.array;
24389     var promise = array._promise;
24390     var fn = tryCatch(array._fn);
24391     promise._pushContext();
24392     var ret;
24393     if (array._eachValues !== undefined) {
24394         ret = fn.call(promise._boundValue(), value, this.index, this.length);
24395     } else {
24396         ret = fn.call(promise._boundValue(),
24397                               this.accum, value, this.index, this.length);
24398     }
24399     if (ret instanceof Promise) {
24400         array._currentCancellable = ret;
24401     }
24402     var promiseCreated = promise._popContext();
24403     debug.checkForgottenReturns(
24404         ret,
24405         promiseCreated,
24406         array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
24407         promise
24408     );
24409     return ret;
24410 }
24411 };
24412
24413
24414 /***/ }),
24415 /* 159 */
24416 /***/ (function(module, exports, __webpack_require__) {
24417
24418 "use strict";
24419
24420 module.exports =
24421     function(Promise, PromiseArray, debug) {
24422 var PromiseInspection = Promise.PromiseInspection;
24423 var util = __webpack_require__(130);
24424
24425 function SettledPromiseArray(values) {
24426     this.constructor$(values);
24427 }
24428 util.inherits(SettledPromiseArray, PromiseArray);
24429
24430 SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
24431     this._values[index] = inspection;
24432     var totalResolved = ++this._totalResolved;
24433     if (totalResolved >= this._length) {
24434         this._resolve(this._values);
24435         return true;
24436     }
24437     return false;
24438 };
24439
24440 SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
24441     var ret = new PromiseInspection();
24442     ret._bitField = 33554432;
24443     ret._settledValueField = value;
24444     return this._promiseResolved(index, ret);
24445 };
24446 SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
24447     var ret = new PromiseInspection();
24448     ret._bitField = 16777216;
24449     ret._settledValueField = reason;
24450     return this._promiseResolved(index, ret);
24451 };
24452
24453 Promise.settle = function (promises) {
24454     debug.deprecated(".settle()", ".reflect()");
24455     return new SettledPromiseArray(promises).promise();
24456 };
24457
24458 Promise.prototype.settle = function () {
24459     return Promise.settle(this);
24460 };
24461 };
24462
24463
24464 /***/ }),
24465 /* 160 */
24466 /***/ (function(module, exports, __webpack_require__) {
24467
24468 "use strict";
24469
24470 module.exports =
24471 function(Promise, PromiseArray, apiRejection) {
24472 var util = __webpack_require__(130);
24473 var RangeError = __webpack_require__(135).RangeError;
24474 var AggregateError = __webpack_require__(135).AggregateError;
24475 var isArray = util.isArray;
24476 var CANCELLATION = {};
24477
24478
24479 function SomePromiseArray(values) {
24480     this.constructor$(values);
24481     this._howMany = 0;
24482     this._unwrap = false;
24483     this._initialized = false;
24484 }
24485 util.inherits(SomePromiseArray, PromiseArray);
24486
24487 SomePromiseArray.prototype._init = function () {
24488     if (!this._initialized) {
24489         return;
24490     }
24491     if (this._howMany === 0) {
24492         this._resolve([]);
24493         return;
24494     }
24495     this._init$(undefined, -5);
24496     var isArrayResolved = isArray(this._values);
24497     if (!this._isResolved() &&
24498         isArrayResolved &&
24499         this._howMany > this._canPossiblyFulfill()) {
24500         this._reject(this._getRangeError(this.length()));
24501     }
24502 };
24503
24504 SomePromiseArray.prototype.init = function () {
24505     this._initialized = true;
24506     this._init();
24507 };
24508
24509 SomePromiseArray.prototype.setUnwrap = function () {
24510     this._unwrap = true;
24511 };
24512
24513 SomePromiseArray.prototype.howMany = function () {
24514     return this._howMany;
24515 };
24516
24517 SomePromiseArray.prototype.setHowMany = function (count) {
24518     this._howMany = count;
24519 };
24520
24521 SomePromiseArray.prototype._promiseFulfilled = function (value) {
24522     this._addFulfilled(value);
24523     if (this._fulfilled() === this.howMany()) {
24524         this._values.length = this.howMany();
24525         if (this.howMany() === 1 && this._unwrap) {
24526             this._resolve(this._values[0]);
24527         } else {
24528             this._resolve(this._values);
24529         }
24530         return true;
24531     }
24532     return false;
24533
24534 };
24535 SomePromiseArray.prototype._promiseRejected = function (reason) {
24536     this._addRejected(reason);
24537     return this._checkOutcome();
24538 };
24539
24540 SomePromiseArray.prototype._promiseCancelled = function () {
24541     if (this._values instanceof Promise || this._values == null) {
24542         return this._cancel();
24543     }
24544     this._addRejected(CANCELLATION);
24545     return this._checkOutcome();
24546 };
24547
24548 SomePromiseArray.prototype._checkOutcome = function() {
24549     if (this.howMany() > this._canPossiblyFulfill()) {
24550         var e = new AggregateError();
24551         for (var i = this.length(); i < this._values.length; ++i) {
24552             if (this._values[i] !== CANCELLATION) {
24553                 e.push(this._values[i]);
24554             }
24555         }
24556         if (e.length > 0) {
24557             this._reject(e);
24558         } else {
24559             this._cancel();
24560         }
24561         return true;
24562     }
24563     return false;
24564 };
24565
24566 SomePromiseArray.prototype._fulfilled = function () {
24567     return this._totalResolved;
24568 };
24569
24570 SomePromiseArray.prototype._rejected = function () {
24571     return this._values.length - this.length();
24572 };
24573
24574 SomePromiseArray.prototype._addRejected = function (reason) {
24575     this._values.push(reason);
24576 };
24577
24578 SomePromiseArray.prototype._addFulfilled = function (value) {
24579     this._values[this._totalResolved++] = value;
24580 };
24581
24582 SomePromiseArray.prototype._canPossiblyFulfill = function () {
24583     return this.length() - this._rejected();
24584 };
24585
24586 SomePromiseArray.prototype._getRangeError = function (count) {
24587     var message = "Input array must contain at least " +
24588             this._howMany + " items but contains only " + count + " items";
24589     return new RangeError(message);
24590 };
24591
24592 SomePromiseArray.prototype._resolveEmptyArray = function () {
24593     this._reject(this._getRangeError(0));
24594 };
24595
24596 function some(promises, howMany) {
24597     if ((howMany | 0) !== howMany || howMany < 0) {
24598         return apiRejection("expecting a positive integer\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
24599     }
24600     var ret = new SomePromiseArray(promises);
24601     var promise = ret.promise();
24602     ret.setHowMany(howMany);
24603     ret.init();
24604     return promise;
24605 }
24606
24607 Promise.some = function (promises, howMany) {
24608     return some(promises, howMany);
24609 };
24610
24611 Promise.prototype.some = function (howMany) {
24612     return some(this, howMany);
24613 };
24614
24615 Promise._SomePromiseArray = SomePromiseArray;
24616 };
24617
24618
24619 /***/ }),
24620 /* 161 */
24621 /***/ (function(module, exports, __webpack_require__) {
24622
24623 "use strict";
24624
24625 module.exports = function(Promise, INTERNAL) {
24626 var PromiseMap = Promise.map;
24627
24628 Promise.prototype.filter = function (fn, options) {
24629     return PromiseMap(this, fn, options, INTERNAL);
24630 };
24631
24632 Promise.filter = function (promises, fn, options) {
24633     return PromiseMap(promises, fn, options, INTERNAL);
24634 };
24635 };
24636
24637
24638 /***/ }),
24639 /* 162 */
24640 /***/ (function(module, exports, __webpack_require__) {
24641
24642 "use strict";
24643
24644 module.exports = function(Promise, INTERNAL) {
24645 var PromiseReduce = Promise.reduce;
24646 var PromiseAll = Promise.all;
24647
24648 function promiseAllThis() {
24649     return PromiseAll(this);
24650 }
24651
24652 function PromiseMapSeries(promises, fn) {
24653     return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
24654 }
24655
24656 Promise.prototype.each = function (fn) {
24657     return PromiseReduce(this, fn, INTERNAL, 0)
24658               ._then(promiseAllThis, undefined, undefined, this, undefined);
24659 };
24660
24661 Promise.prototype.mapSeries = function (fn) {
24662     return PromiseReduce(this, fn, INTERNAL, INTERNAL);
24663 };
24664
24665 Promise.each = function (promises, fn) {
24666     return PromiseReduce(promises, fn, INTERNAL, 0)
24667               ._then(promiseAllThis, undefined, undefined, promises, undefined);
24668 };
24669
24670 Promise.mapSeries = PromiseMapSeries;
24671 };
24672
24673
24674
24675 /***/ }),
24676 /* 163 */
24677 /***/ (function(module, exports, __webpack_require__) {
24678
24679 "use strict";
24680
24681 module.exports = function(Promise) {
24682 var SomePromiseArray = Promise._SomePromiseArray;
24683 function any(promises) {
24684     var ret = new SomePromiseArray(promises);
24685     var promise = ret.promise();
24686     ret.setHowMany(1);
24687     ret.setUnwrap();
24688     ret.init();
24689     return promise;
24690 }
24691
24692 Promise.any = function (promises) {
24693     return any(promises);
24694 };
24695
24696 Promise.prototype.any = function () {
24697     return any(this);
24698 };
24699
24700 };
24701
24702
24703 /***/ }),
24704 /* 164 */
24705 /***/ (function(module, exports, __webpack_require__) {
24706
24707 var Stream = __webpack_require__(44);
24708 var Promise = __webpack_require__(128);
24709 var util = __webpack_require__(50);
24710 var Buffer = __webpack_require__(165);
24711 var strFunction = 'function';
24712
24713 // Backwards compatibility for node versions < 8
24714 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
24715   Stream = __webpack_require__(167);
24716
24717 function PullStream() {
24718   if (!(this instanceof PullStream))
24719     return new PullStream();
24720
24721   Stream.Duplex.call(this,{decodeStrings:false, objectMode:true});
24722   this.buffer = Buffer.from('');
24723   var self = this;
24724   self.on('finish',function() {
24725     self.finished = true;
24726     self.emit('chunk',false);
24727   });
24728 }
24729
24730 util.inherits(PullStream,Stream.Duplex);
24731
24732 PullStream.prototype._write = function(chunk,e,cb) {
24733   this.buffer = Buffer.concat([this.buffer,chunk]);
24734   this.cb = cb;
24735   this.emit('chunk');
24736 };
24737
24738
24739 // The `eof` parameter is interpreted as `file_length` if the type is number
24740 // otherwise (i.e. buffer) it is interpreted as a pattern signaling end of stream
24741 PullStream.prototype.stream = function(eof,includeEof) {
24742   var p = Stream.PassThrough();
24743   var done,self= this;
24744
24745   function cb() {
24746     if (typeof self.cb === strFunction) {
24747       var callback = self.cb;
24748       self.cb = undefined;
24749       return callback();
24750     }
24751   }
24752
24753   function pull() {
24754     var packet;
24755     if (self.buffer && self.buffer.length) {
24756       if (typeof eof === 'number') {
24757         packet = self.buffer.slice(0,eof);
24758         self.buffer = self.buffer.slice(eof);
24759         eof -= packet.length;
24760         done = !eof;
24761       } else {
24762         var match = self.buffer.indexOf(eof);
24763         if (match !== -1) {
24764           // store signature match byte offset to allow us to reference
24765           // this for zip64 offset
24766           self.match = match
24767           if (includeEof) match = match + eof.length;
24768           packet = self.buffer.slice(0,match);
24769           self.buffer = self.buffer.slice(match);
24770           done = true;
24771         } else {
24772           var len = self.buffer.length - eof.length;
24773           if (len <= 0) {
24774             cb();
24775           } else {
24776             packet = self.buffer.slice(0,len);
24777             self.buffer = self.buffer.slice(len);
24778           }
24779         }
24780       }
24781       if (packet) p.write(packet,function() {
24782         if (self.buffer.length === 0 || (eof.length && self.buffer.length <= eof.length)) cb();
24783       });
24784     }
24785     
24786     if (!done) {
24787       if (self.finished && !this.__ended) {
24788         self.removeListener('chunk',pull);
24789         self.emit('error', new Error('FILE_ENDED'));
24790         this.__ended = true;
24791         return;
24792       }
24793       
24794     } else {
24795       self.removeListener('chunk',pull);
24796       p.end();
24797     }
24798   }
24799
24800   self.on('chunk',pull);
24801   pull();
24802   return p;
24803 };
24804
24805 PullStream.prototype.pull = function(eof,includeEof) {
24806   if (eof === 0) return Promise.resolve('');
24807
24808   // If we already have the required data in buffer
24809   // we can resolve the request immediately
24810   if (!isNaN(eof) && this.buffer.length > eof) {
24811     var data = this.buffer.slice(0,eof);
24812     this.buffer = this.buffer.slice(eof);
24813     return Promise.resolve(data);
24814   }
24815
24816   // Otherwise we stream until we have it
24817   var buffer = Buffer.from(''),
24818       self = this;
24819
24820   var concatStream = Stream.Transform();
24821   concatStream._transform = function(d,e,cb) {
24822     buffer = Buffer.concat([buffer,d]);
24823     cb();
24824   };
24825   
24826   var rejectHandler;
24827   var pullStreamRejectHandler;
24828   return new Promise(function(resolve,reject) {
24829     rejectHandler = reject;
24830     pullStreamRejectHandler = function(e) {
24831       self.__emittedError = e;
24832       reject(e);
24833     }
24834     if (self.finished)
24835       return reject(new Error('FILE_ENDED'));
24836     self.once('error',pullStreamRejectHandler);  // reject any errors from pullstream itself
24837     self.stream(eof,includeEof)
24838       .on('error',reject)
24839       .pipe(concatStream)
24840       .on('finish',function() {resolve(buffer);})
24841       .on('error',reject);
24842   })
24843   .finally(function() {
24844     self.removeListener('error',rejectHandler);
24845     self.removeListener('error',pullStreamRejectHandler);
24846   });
24847 };
24848
24849 PullStream.prototype._read = function(){};
24850
24851 module.exports = PullStream;
24852
24853
24854 /***/ }),
24855 /* 165 */
24856 /***/ (function(module, exports, __webpack_require__) {
24857
24858 var Buffer = __webpack_require__(166).Buffer;
24859
24860 // Backwards compatibility for node versions < 8
24861 if (Buffer.from === undefined) {
24862   Buffer.from = function (a, b, c) {
24863     return new Buffer(a, b, c)
24864   };
24865
24866   Buffer.alloc = Buffer.from;
24867 }
24868
24869 module.exports = Buffer;
24870
24871 /***/ }),
24872 /* 166 */
24873 /***/ (function(module, exports) {
24874
24875 module.exports = require("buffer");
24876
24877 /***/ }),
24878 /* 167 */
24879 /***/ (function(module, exports, __webpack_require__) {
24880
24881 var Stream = __webpack_require__(44);
24882 if (process.env.READABLE_STREAM === 'disable' && Stream) {
24883   module.exports = Stream;
24884   exports = module.exports = Stream.Readable;
24885   exports.Readable = Stream.Readable;
24886   exports.Writable = Stream.Writable;
24887   exports.Duplex = Stream.Duplex;
24888   exports.Transform = Stream.Transform;
24889   exports.PassThrough = Stream.PassThrough;
24890   exports.Stream = Stream;
24891 } else {
24892   exports = module.exports = __webpack_require__(168);
24893   exports.Stream = Stream || exports;
24894   exports.Readable = exports;
24895   exports.Writable = __webpack_require__(177);
24896   exports.Duplex = __webpack_require__(176);
24897   exports.Transform = __webpack_require__(180);
24898   exports.PassThrough = __webpack_require__(181);
24899 }
24900
24901
24902 /***/ }),
24903 /* 168 */
24904 /***/ (function(module, exports, __webpack_require__) {
24905
24906 "use strict";
24907 // Copyright Joyent, Inc. and other Node contributors.
24908 //
24909 // Permission is hereby granted, free of charge, to any person obtaining a
24910 // copy of this software and associated documentation files (the
24911 // "Software"), to deal in the Software without restriction, including
24912 // without limitation the rights to use, copy, modify, merge, publish,
24913 // distribute, sublicense, and/or sell copies of the Software, and to permit
24914 // persons to whom the Software is furnished to do so, subject to the
24915 // following conditions:
24916 //
24917 // The above copyright notice and this permission notice shall be included
24918 // in all copies or substantial portions of the Software.
24919 //
24920 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24921 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24922 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
24923 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24924 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24925 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24926 // USE OR OTHER DEALINGS IN THE SOFTWARE.
24927
24928
24929
24930 /*<replacement>*/
24931
24932 var pna = __webpack_require__(169);
24933 /*</replacement>*/
24934
24935 module.exports = Readable;
24936
24937 /*<replacement>*/
24938 var isArray = __webpack_require__(170);
24939 /*</replacement>*/
24940
24941 /*<replacement>*/
24942 var Duplex;
24943 /*</replacement>*/
24944
24945 Readable.ReadableState = ReadableState;
24946
24947 /*<replacement>*/
24948 var EE = __webpack_require__(68).EventEmitter;
24949
24950 var EElistenerCount = function (emitter, type) {
24951   return emitter.listeners(type).length;
24952 };
24953 /*</replacement>*/
24954
24955 /*<replacement>*/
24956 var Stream = __webpack_require__(171);
24957 /*</replacement>*/
24958
24959 /*<replacement>*/
24960
24961 var Buffer = __webpack_require__(172).Buffer;
24962 var OurUint8Array = global.Uint8Array || function () {};
24963 function _uint8ArrayToBuffer(chunk) {
24964   return Buffer.from(chunk);
24965 }
24966 function _isUint8Array(obj) {
24967   return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
24968 }
24969
24970 /*</replacement>*/
24971
24972 /*<replacement>*/
24973 var util = Object.create(__webpack_require__(173));
24974 util.inherits = __webpack_require__(66);
24975 /*</replacement>*/
24976
24977 /*<replacement>*/
24978 var debugUtil = __webpack_require__(50);
24979 var debug = void 0;
24980 if (debugUtil && debugUtil.debuglog) {
24981   debug = debugUtil.debuglog('stream');
24982 } else {
24983   debug = function () {};
24984 }
24985 /*</replacement>*/
24986
24987 var BufferList = __webpack_require__(174);
24988 var destroyImpl = __webpack_require__(175);
24989 var StringDecoder;
24990
24991 util.inherits(Readable, Stream);
24992
24993 var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
24994
24995 function prependListener(emitter, event, fn) {
24996   // Sadly this is not cacheable as some libraries bundle their own
24997   // event emitter implementation with them.
24998   if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
24999
25000   // This is a hack to make sure that our error handler is attached before any
25001   // userland ones.  NEVER DO THIS. This is here only because this code needs
25002   // to continue to work with older versions of Node.js that do not include
25003   // the prependListener() method. The goal is to eventually remove this hack.
25004   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]];
25005 }
25006
25007 function ReadableState(options, stream) {
25008   Duplex = Duplex || __webpack_require__(176);
25009
25010   options = options || {};
25011
25012   // Duplex streams are both readable and writable, but share
25013   // the same options object.
25014   // However, some cases require setting options to different
25015   // values for the readable and the writable sides of the duplex stream.
25016   // These options can be provided separately as readableXXX and writableXXX.
25017   var isDuplex = stream instanceof Duplex;
25018
25019   // object stream flag. Used to make read(n) ignore n and to
25020   // make all the buffer merging and length checks go away
25021   this.objectMode = !!options.objectMode;
25022
25023   if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
25024
25025   // the point at which it stops calling _read() to fill the buffer
25026   // Note: 0 is a valid value, means "don't call _read preemptively ever"
25027   var hwm = options.highWaterMark;
25028   var readableHwm = options.readableHighWaterMark;
25029   var defaultHwm = this.objectMode ? 16 : 16 * 1024;
25030
25031   if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
25032
25033   // cast to ints.
25034   this.highWaterMark = Math.floor(this.highWaterMark);
25035
25036   // A linked list is used to store data chunks instead of an array because the
25037   // linked list can remove elements from the beginning faster than
25038   // array.shift()
25039   this.buffer = new BufferList();
25040   this.length = 0;
25041   this.pipes = null;
25042   this.pipesCount = 0;
25043   this.flowing = null;
25044   this.ended = false;
25045   this.endEmitted = false;
25046   this.reading = false;
25047
25048   // a flag to be able to tell if the event 'readable'/'data' is emitted
25049   // immediately, or on a later tick.  We set this to true at first, because
25050   // any actions that shouldn't happen until "later" should generally also
25051   // not happen before the first read call.
25052   this.sync = true;
25053
25054   // whenever we return null, then we set a flag to say
25055   // that we're awaiting a 'readable' event emission.
25056   this.needReadable = false;
25057   this.emittedReadable = false;
25058   this.readableListening = false;
25059   this.resumeScheduled = false;
25060
25061   // has it been destroyed
25062   this.destroyed = false;
25063
25064   // Crypto is kind of old and crusty.  Historically, its default string
25065   // encoding is 'binary' so we have to make this configurable.
25066   // Everything else in the universe uses 'utf8', though.
25067   this.defaultEncoding = options.defaultEncoding || 'utf8';
25068
25069   // the number of writers that are awaiting a drain event in .pipe()s
25070   this.awaitDrain = 0;
25071
25072   // if true, a maybeReadMore has been scheduled
25073   this.readingMore = false;
25074
25075   this.decoder = null;
25076   this.encoding = null;
25077   if (options.encoding) {
25078     if (!StringDecoder) StringDecoder = __webpack_require__(179).StringDecoder;
25079     this.decoder = new StringDecoder(options.encoding);
25080     this.encoding = options.encoding;
25081   }
25082 }
25083
25084 function Readable(options) {
25085   Duplex = Duplex || __webpack_require__(176);
25086
25087   if (!(this instanceof Readable)) return new Readable(options);
25088
25089   this._readableState = new ReadableState(options, this);
25090
25091   // legacy
25092   this.readable = true;
25093
25094   if (options) {
25095     if (typeof options.read === 'function') this._read = options.read;
25096
25097     if (typeof options.destroy === 'function') this._destroy = options.destroy;
25098   }
25099
25100   Stream.call(this);
25101 }
25102
25103 Object.defineProperty(Readable.prototype, 'destroyed', {
25104   get: function () {
25105     if (this._readableState === undefined) {
25106       return false;
25107     }
25108     return this._readableState.destroyed;
25109   },
25110   set: function (value) {
25111     // we ignore the value if the stream
25112     // has not been initialized yet
25113     if (!this._readableState) {
25114       return;
25115     }
25116
25117     // backward compatibility, the user is explicitly
25118     // managing destroyed
25119     this._readableState.destroyed = value;
25120   }
25121 });
25122
25123 Readable.prototype.destroy = destroyImpl.destroy;
25124 Readable.prototype._undestroy = destroyImpl.undestroy;
25125 Readable.prototype._destroy = function (err, cb) {
25126   this.push(null);
25127   cb(err);
25128 };
25129
25130 // Manually shove something into the read() buffer.
25131 // This returns true if the highWaterMark has not been hit yet,
25132 // similar to how Writable.write() returns true if you should
25133 // write() some more.
25134 Readable.prototype.push = function (chunk, encoding) {
25135   var state = this._readableState;
25136   var skipChunkCheck;
25137
25138   if (!state.objectMode) {
25139     if (typeof chunk === 'string') {
25140       encoding = encoding || state.defaultEncoding;
25141       if (encoding !== state.encoding) {
25142         chunk = Buffer.from(chunk, encoding);
25143         encoding = '';
25144       }
25145       skipChunkCheck = true;
25146     }
25147   } else {
25148     skipChunkCheck = true;
25149   }
25150
25151   return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
25152 };
25153
25154 // Unshift should *always* be something directly out of read()
25155 Readable.prototype.unshift = function (chunk) {
25156   return readableAddChunk(this, chunk, null, true, false);
25157 };
25158
25159 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
25160   var state = stream._readableState;
25161   if (chunk === null) {
25162     state.reading = false;
25163     onEofChunk(stream, state);
25164   } else {
25165     var er;
25166     if (!skipChunkCheck) er = chunkInvalid(state, chunk);
25167     if (er) {
25168       stream.emit('error', er);
25169     } else if (state.objectMode || chunk && chunk.length > 0) {
25170       if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
25171         chunk = _uint8ArrayToBuffer(chunk);
25172       }
25173
25174       if (addToFront) {
25175         if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
25176       } else if (state.ended) {
25177         stream.emit('error', new Error('stream.push() after EOF'));
25178       } else {
25179         state.reading = false;
25180         if (state.decoder && !encoding) {
25181           chunk = state.decoder.write(chunk);
25182           if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
25183         } else {
25184           addChunk(stream, state, chunk, false);
25185         }
25186       }
25187     } else if (!addToFront) {
25188       state.reading = false;
25189     }
25190   }
25191
25192   return needMoreData(state);
25193 }
25194
25195 function addChunk(stream, state, chunk, addToFront) {
25196   if (state.flowing && state.length === 0 && !state.sync) {
25197     stream.emit('data', chunk);
25198     stream.read(0);
25199   } else {
25200     // update the buffer info.
25201     state.length += state.objectMode ? 1 : chunk.length;
25202     if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
25203
25204     if (state.needReadable) emitReadable(stream);
25205   }
25206   maybeReadMore(stream, state);
25207 }
25208
25209 function chunkInvalid(state, chunk) {
25210   var er;
25211   if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
25212     er = new TypeError('Invalid non-string/buffer chunk');
25213   }
25214   return er;
25215 }
25216
25217 // if it's past the high water mark, we can push in some more.
25218 // Also, if we have no data yet, we can stand some
25219 // more bytes.  This is to work around cases where hwm=0,
25220 // such as the repl.  Also, if the push() triggered a
25221 // readable event, and the user called read(largeNumber) such that
25222 // needReadable was set, then we ought to push more, so that another
25223 // 'readable' event will be triggered.
25224 function needMoreData(state) {
25225   return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
25226 }
25227
25228 Readable.prototype.isPaused = function () {
25229   return this._readableState.flowing === false;
25230 };
25231
25232 // backwards compatibility.
25233 Readable.prototype.setEncoding = function (enc) {
25234   if (!StringDecoder) StringDecoder = __webpack_require__(179).StringDecoder;
25235   this._readableState.decoder = new StringDecoder(enc);
25236   this._readableState.encoding = enc;
25237   return this;
25238 };
25239
25240 // Don't raise the hwm > 8MB
25241 var MAX_HWM = 0x800000;
25242 function computeNewHighWaterMark(n) {
25243   if (n >= MAX_HWM) {
25244     n = MAX_HWM;
25245   } else {
25246     // Get the next highest power of 2 to prevent increasing hwm excessively in
25247     // tiny amounts
25248     n--;
25249     n |= n >>> 1;
25250     n |= n >>> 2;
25251     n |= n >>> 4;
25252     n |= n >>> 8;
25253     n |= n >>> 16;
25254     n++;
25255   }
25256   return n;
25257 }
25258
25259 // This function is designed to be inlinable, so please take care when making
25260 // changes to the function body.
25261 function howMuchToRead(n, state) {
25262   if (n <= 0 || state.length === 0 && state.ended) return 0;
25263   if (state.objectMode) return 1;
25264   if (n !== n) {
25265     // Only flow one buffer at a time
25266     if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
25267   }
25268   // If we're asking for more than the current hwm, then raise the hwm.
25269   if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
25270   if (n <= state.length) return n;
25271   // Don't have enough
25272   if (!state.ended) {
25273     state.needReadable = true;
25274     return 0;
25275   }
25276   return state.length;
25277 }
25278
25279 // you can override either this method, or the async _read(n) below.
25280 Readable.prototype.read = function (n) {
25281   debug('read', n);
25282   n = parseInt(n, 10);
25283   var state = this._readableState;
25284   var nOrig = n;
25285
25286   if (n !== 0) state.emittedReadable = false;
25287
25288   // if we're doing read(0) to trigger a readable event, but we
25289   // already have a bunch of data in the buffer, then just trigger
25290   // the 'readable' event and move on.
25291   if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
25292     debug('read: emitReadable', state.length, state.ended);
25293     if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
25294     return null;
25295   }
25296
25297   n = howMuchToRead(n, state);
25298
25299   // if we've ended, and we're now clear, then finish it up.
25300   if (n === 0 && state.ended) {
25301     if (state.length === 0) endReadable(this);
25302     return null;
25303   }
25304
25305   // All the actual chunk generation logic needs to be
25306   // *below* the call to _read.  The reason is that in certain
25307   // synthetic stream cases, such as passthrough streams, _read
25308   // may be a completely synchronous operation which may change
25309   // the state of the read buffer, providing enough data when
25310   // before there was *not* enough.
25311   //
25312   // So, the steps are:
25313   // 1. Figure out what the state of things will be after we do
25314   // a read from the buffer.
25315   //
25316   // 2. If that resulting state will trigger a _read, then call _read.
25317   // Note that this may be asynchronous, or synchronous.  Yes, it is
25318   // deeply ugly to write APIs this way, but that still doesn't mean
25319   // that the Readable class should behave improperly, as streams are
25320   // designed to be sync/async agnostic.
25321   // Take note if the _read call is sync or async (ie, if the read call
25322   // has returned yet), so that we know whether or not it's safe to emit
25323   // 'readable' etc.
25324   //
25325   // 3. Actually pull the requested chunks out of the buffer and return.
25326
25327   // if we need a readable event, then we need to do some reading.
25328   var doRead = state.needReadable;
25329   debug('need readable', doRead);
25330
25331   // if we currently have less than the highWaterMark, then also read some
25332   if (state.length === 0 || state.length - n < state.highWaterMark) {
25333     doRead = true;
25334     debug('length less than watermark', doRead);
25335   }
25336
25337   // however, if we've ended, then there's no point, and if we're already
25338   // reading, then it's unnecessary.
25339   if (state.ended || state.reading) {
25340     doRead = false;
25341     debug('reading or ended', doRead);
25342   } else if (doRead) {
25343     debug('do read');
25344     state.reading = true;
25345     state.sync = true;
25346     // if the length is currently zero, then we *need* a readable event.
25347     if (state.length === 0) state.needReadable = true;
25348     // call internal read method
25349     this._read(state.highWaterMark);
25350     state.sync = false;
25351     // If _read pushed data synchronously, then `reading` will be false,
25352     // and we need to re-evaluate how much data we can return to the user.
25353     if (!state.reading) n = howMuchToRead(nOrig, state);
25354   }
25355
25356   var ret;
25357   if (n > 0) ret = fromList(n, state);else ret = null;
25358
25359   if (ret === null) {
25360     state.needReadable = true;
25361     n = 0;
25362   } else {
25363     state.length -= n;
25364   }
25365
25366   if (state.length === 0) {
25367     // If we have nothing in the buffer, then we want to know
25368     // as soon as we *do* get something into the buffer.
25369     if (!state.ended) state.needReadable = true;
25370
25371     // If we tried to read() past the EOF, then emit end on the next tick.
25372     if (nOrig !== n && state.ended) endReadable(this);
25373   }
25374
25375   if (ret !== null) this.emit('data', ret);
25376
25377   return ret;
25378 };
25379
25380 function onEofChunk(stream, state) {
25381   if (state.ended) return;
25382   if (state.decoder) {
25383     var chunk = state.decoder.end();
25384     if (chunk && chunk.length) {
25385       state.buffer.push(chunk);
25386       state.length += state.objectMode ? 1 : chunk.length;
25387     }
25388   }
25389   state.ended = true;
25390
25391   // emit 'readable' now to make sure it gets picked up.
25392   emitReadable(stream);
25393 }
25394
25395 // Don't emit readable right away in sync mode, because this can trigger
25396 // another read() call => stack overflow.  This way, it might trigger
25397 // a nextTick recursion warning, but that's not so bad.
25398 function emitReadable(stream) {
25399   var state = stream._readableState;
25400   state.needReadable = false;
25401   if (!state.emittedReadable) {
25402     debug('emitReadable', state.flowing);
25403     state.emittedReadable = true;
25404     if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
25405   }
25406 }
25407
25408 function emitReadable_(stream) {
25409   debug('emit readable');
25410   stream.emit('readable');
25411   flow(stream);
25412 }
25413
25414 // at this point, the user has presumably seen the 'readable' event,
25415 // and called read() to consume some data.  that may have triggered
25416 // in turn another _read(n) call, in which case reading = true if
25417 // it's in progress.
25418 // However, if we're not ended, or reading, and the length < hwm,
25419 // then go ahead and try to read some more preemptively.
25420 function maybeReadMore(stream, state) {
25421   if (!state.readingMore) {
25422     state.readingMore = true;
25423     pna.nextTick(maybeReadMore_, stream, state);
25424   }
25425 }
25426
25427 function maybeReadMore_(stream, state) {
25428   var len = state.length;
25429   while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
25430     debug('maybeReadMore read 0');
25431     stream.read(0);
25432     if (len === state.length)
25433       // didn't get any data, stop spinning.
25434       break;else len = state.length;
25435   }
25436   state.readingMore = false;
25437 }
25438
25439 // abstract method.  to be overridden in specific implementation classes.
25440 // call cb(er, data) where data is <= n in length.
25441 // for virtual (non-string, non-buffer) streams, "length" is somewhat
25442 // arbitrary, and perhaps not very meaningful.
25443 Readable.prototype._read = function (n) {
25444   this.emit('error', new Error('_read() is not implemented'));
25445 };
25446
25447 Readable.prototype.pipe = function (dest, pipeOpts) {
25448   var src = this;
25449   var state = this._readableState;
25450
25451   switch (state.pipesCount) {
25452     case 0:
25453       state.pipes = dest;
25454       break;
25455     case 1:
25456       state.pipes = [state.pipes, dest];
25457       break;
25458     default:
25459       state.pipes.push(dest);
25460       break;
25461   }
25462   state.pipesCount += 1;
25463   debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
25464
25465   var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
25466
25467   var endFn = doEnd ? onend : unpipe;
25468   if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
25469
25470   dest.on('unpipe', onunpipe);
25471   function onunpipe(readable, unpipeInfo) {
25472     debug('onunpipe');
25473     if (readable === src) {
25474       if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
25475         unpipeInfo.hasUnpiped = true;
25476         cleanup();
25477       }
25478     }
25479   }
25480
25481   function onend() {
25482     debug('onend');
25483     dest.end();
25484   }
25485
25486   // when the dest drains, it reduces the awaitDrain counter
25487   // on the source.  This would be more elegant with a .once()
25488   // handler in flow(), but adding and removing repeatedly is
25489   // too slow.
25490   var ondrain = pipeOnDrain(src);
25491   dest.on('drain', ondrain);
25492
25493   var cleanedUp = false;
25494   function cleanup() {
25495     debug('cleanup');
25496     // cleanup event handlers once the pipe is broken
25497     dest.removeListener('close', onclose);
25498     dest.removeListener('finish', onfinish);
25499     dest.removeListener('drain', ondrain);
25500     dest.removeListener('error', onerror);
25501     dest.removeListener('unpipe', onunpipe);
25502     src.removeListener('end', onend);
25503     src.removeListener('end', unpipe);
25504     src.removeListener('data', ondata);
25505
25506     cleanedUp = true;
25507
25508     // if the reader is waiting for a drain event from this
25509     // specific writer, then it would cause it to never start
25510     // flowing again.
25511     // So, if this is awaiting a drain, then we just call it now.
25512     // If we don't know, then assume that we are waiting for one.
25513     if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
25514   }
25515
25516   // If the user pushes more data while we're writing to dest then we'll end up
25517   // in ondata again. However, we only want to increase awaitDrain once because
25518   // dest will only emit one 'drain' event for the multiple writes.
25519   // => Introduce a guard on increasing awaitDrain.
25520   var increasedAwaitDrain = false;
25521   src.on('data', ondata);
25522   function ondata(chunk) {
25523     debug('ondata');
25524     increasedAwaitDrain = false;
25525     var ret = dest.write(chunk);
25526     if (false === ret && !increasedAwaitDrain) {
25527       // If the user unpiped during `dest.write()`, it is possible
25528       // to get stuck in a permanently paused state if that write
25529       // also returned false.
25530       // => Check whether `dest` is still a piping destination.
25531       if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
25532         debug('false write response, pause', src._readableState.awaitDrain);
25533         src._readableState.awaitDrain++;
25534         increasedAwaitDrain = true;
25535       }
25536       src.pause();
25537     }
25538   }
25539
25540   // if the dest has an error, then stop piping into it.
25541   // however, don't suppress the throwing behavior for this.
25542   function onerror(er) {
25543     debug('onerror', er);
25544     unpipe();
25545     dest.removeListener('error', onerror);
25546     if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
25547   }
25548
25549   // Make sure our error handler is attached before userland ones.
25550   prependListener(dest, 'error', onerror);
25551
25552   // Both close and finish should trigger unpipe, but only once.
25553   function onclose() {
25554     dest.removeListener('finish', onfinish);
25555     unpipe();
25556   }
25557   dest.once('close', onclose);
25558   function onfinish() {
25559     debug('onfinish');
25560     dest.removeListener('close', onclose);
25561     unpipe();
25562   }
25563   dest.once('finish', onfinish);
25564
25565   function unpipe() {
25566     debug('unpipe');
25567     src.unpipe(dest);
25568   }
25569
25570   // tell the dest that it's being piped to
25571   dest.emit('pipe', src);
25572
25573   // start the flow if it hasn't been started already.
25574   if (!state.flowing) {
25575     debug('pipe resume');
25576     src.resume();
25577   }
25578
25579   return dest;
25580 };
25581
25582 function pipeOnDrain(src) {
25583   return function () {
25584     var state = src._readableState;
25585     debug('pipeOnDrain', state.awaitDrain);
25586     if (state.awaitDrain) state.awaitDrain--;
25587     if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
25588       state.flowing = true;
25589       flow(src);
25590     }
25591   };
25592 }
25593
25594 Readable.prototype.unpipe = function (dest) {
25595   var state = this._readableState;
25596   var unpipeInfo = { hasUnpiped: false };
25597
25598   // if we're not piping anywhere, then do nothing.
25599   if (state.pipesCount === 0) return this;
25600
25601   // just one destination.  most common case.
25602   if (state.pipesCount === 1) {
25603     // passed in one, but it's not the right one.
25604     if (dest && dest !== state.pipes) return this;
25605
25606     if (!dest) dest = state.pipes;
25607
25608     // got a match.
25609     state.pipes = null;
25610     state.pipesCount = 0;
25611     state.flowing = false;
25612     if (dest) dest.emit('unpipe', this, unpipeInfo);
25613     return this;
25614   }
25615
25616   // slow case. multiple pipe destinations.
25617
25618   if (!dest) {
25619     // remove all.
25620     var dests = state.pipes;
25621     var len = state.pipesCount;
25622     state.pipes = null;
25623     state.pipesCount = 0;
25624     state.flowing = false;
25625
25626     for (var i = 0; i < len; i++) {
25627       dests[i].emit('unpipe', this, unpipeInfo);
25628     }return this;
25629   }
25630
25631   // try to find the right one.
25632   var index = indexOf(state.pipes, dest);
25633   if (index === -1) return this;
25634
25635   state.pipes.splice(index, 1);
25636   state.pipesCount -= 1;
25637   if (state.pipesCount === 1) state.pipes = state.pipes[0];
25638
25639   dest.emit('unpipe', this, unpipeInfo);
25640
25641   return this;
25642 };
25643
25644 // set up data events if they are asked for
25645 // Ensure readable listeners eventually get something
25646 Readable.prototype.on = function (ev, fn) {
25647   var res = Stream.prototype.on.call(this, ev, fn);
25648
25649   if (ev === 'data') {
25650     // Start flowing on next tick if stream isn't explicitly paused
25651     if (this._readableState.flowing !== false) this.resume();
25652   } else if (ev === 'readable') {
25653     var state = this._readableState;
25654     if (!state.endEmitted && !state.readableListening) {
25655       state.readableListening = state.needReadable = true;
25656       state.emittedReadable = false;
25657       if (!state.reading) {
25658         pna.nextTick(nReadingNextTick, this);
25659       } else if (state.length) {
25660         emitReadable(this);
25661       }
25662     }
25663   }
25664
25665   return res;
25666 };
25667 Readable.prototype.addListener = Readable.prototype.on;
25668
25669 function nReadingNextTick(self) {
25670   debug('readable nexttick read 0');
25671   self.read(0);
25672 }
25673
25674 // pause() and resume() are remnants of the legacy readable stream API
25675 // If the user uses them, then switch into old mode.
25676 Readable.prototype.resume = function () {
25677   var state = this._readableState;
25678   if (!state.flowing) {
25679     debug('resume');
25680     state.flowing = true;
25681     resume(this, state);
25682   }
25683   return this;
25684 };
25685
25686 function resume(stream, state) {
25687   if (!state.resumeScheduled) {
25688     state.resumeScheduled = true;
25689     pna.nextTick(resume_, stream, state);
25690   }
25691 }
25692
25693 function resume_(stream, state) {
25694   if (!state.reading) {
25695     debug('resume read 0');
25696     stream.read(0);
25697   }
25698
25699   state.resumeScheduled = false;
25700   state.awaitDrain = 0;
25701   stream.emit('resume');
25702   flow(stream);
25703   if (state.flowing && !state.reading) stream.read(0);
25704 }
25705
25706 Readable.prototype.pause = function () {
25707   debug('call pause flowing=%j', this._readableState.flowing);
25708   if (false !== this._readableState.flowing) {
25709     debug('pause');
25710     this._readableState.flowing = false;
25711     this.emit('pause');
25712   }
25713   return this;
25714 };
25715
25716 function flow(stream) {
25717   var state = stream._readableState;
25718   debug('flow', state.flowing);
25719   while (state.flowing && stream.read() !== null) {}
25720 }
25721
25722 // wrap an old-style stream as the async data source.
25723 // This is *not* part of the readable stream interface.
25724 // It is an ugly unfortunate mess of history.
25725 Readable.prototype.wrap = function (stream) {
25726   var _this = this;
25727
25728   var state = this._readableState;
25729   var paused = false;
25730
25731   stream.on('end', function () {
25732     debug('wrapped end');
25733     if (state.decoder && !state.ended) {
25734       var chunk = state.decoder.end();
25735       if (chunk && chunk.length) _this.push(chunk);
25736     }
25737
25738     _this.push(null);
25739   });
25740
25741   stream.on('data', function (chunk) {
25742     debug('wrapped data');
25743     if (state.decoder) chunk = state.decoder.write(chunk);
25744
25745     // don't skip over falsy values in objectMode
25746     if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
25747
25748     var ret = _this.push(chunk);
25749     if (!ret) {
25750       paused = true;
25751       stream.pause();
25752     }
25753   });
25754
25755   // proxy all the other methods.
25756   // important when wrapping filters and duplexes.
25757   for (var i in stream) {
25758     if (this[i] === undefined && typeof stream[i] === 'function') {
25759       this[i] = function (method) {
25760         return function () {
25761           return stream[method].apply(stream, arguments);
25762         };
25763       }(i);
25764     }
25765   }
25766
25767   // proxy certain important events.
25768   for (var n = 0; n < kProxyEvents.length; n++) {
25769     stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
25770   }
25771
25772   // when we try to consume some more bytes, simply unpause the
25773   // underlying stream.
25774   this._read = function (n) {
25775     debug('wrapped _read', n);
25776     if (paused) {
25777       paused = false;
25778       stream.resume();
25779     }
25780   };
25781
25782   return this;
25783 };
25784
25785 Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
25786   // making it explicit this property is not enumerable
25787   // because otherwise some prototype manipulation in
25788   // userland will fail
25789   enumerable: false,
25790   get: function () {
25791     return this._readableState.highWaterMark;
25792   }
25793 });
25794
25795 // exposed for testing purposes only.
25796 Readable._fromList = fromList;
25797
25798 // Pluck off n bytes from an array of buffers.
25799 // Length is the combined lengths of all the buffers in the list.
25800 // This function is designed to be inlinable, so please take care when making
25801 // changes to the function body.
25802 function fromList(n, state) {
25803   // nothing buffered
25804   if (state.length === 0) return null;
25805
25806   var ret;
25807   if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
25808     // read it all, truncate the list
25809     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);
25810     state.buffer.clear();
25811   } else {
25812     // read part of list
25813     ret = fromListPartial(n, state.buffer, state.decoder);
25814   }
25815
25816   return ret;
25817 }
25818
25819 // Extracts only enough buffered data to satisfy the amount requested.
25820 // This function is designed to be inlinable, so please take care when making
25821 // changes to the function body.
25822 function fromListPartial(n, list, hasStrings) {
25823   var ret;
25824   if (n < list.head.data.length) {
25825     // slice is the same for buffers and strings
25826     ret = list.head.data.slice(0, n);
25827     list.head.data = list.head.data.slice(n);
25828   } else if (n === list.head.data.length) {
25829     // first chunk is a perfect match
25830     ret = list.shift();
25831   } else {
25832     // result spans more than one buffer
25833     ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
25834   }
25835   return ret;
25836 }
25837
25838 // Copies a specified amount of characters from the list of buffered data
25839 // chunks.
25840 // This function is designed to be inlinable, so please take care when making
25841 // changes to the function body.
25842 function copyFromBufferString(n, list) {
25843   var p = list.head;
25844   var c = 1;
25845   var ret = p.data;
25846   n -= ret.length;
25847   while (p = p.next) {
25848     var str = p.data;
25849     var nb = n > str.length ? str.length : n;
25850     if (nb === str.length) ret += str;else ret += str.slice(0, n);
25851     n -= nb;
25852     if (n === 0) {
25853       if (nb === str.length) {
25854         ++c;
25855         if (p.next) list.head = p.next;else list.head = list.tail = null;
25856       } else {
25857         list.head = p;
25858         p.data = str.slice(nb);
25859       }
25860       break;
25861     }
25862     ++c;
25863   }
25864   list.length -= c;
25865   return ret;
25866 }
25867
25868 // Copies a specified amount of bytes from the list of buffered data chunks.
25869 // This function is designed to be inlinable, so please take care when making
25870 // changes to the function body.
25871 function copyFromBuffer(n, list) {
25872   var ret = Buffer.allocUnsafe(n);
25873   var p = list.head;
25874   var c = 1;
25875   p.data.copy(ret);
25876   n -= p.data.length;
25877   while (p = p.next) {
25878     var buf = p.data;
25879     var nb = n > buf.length ? buf.length : n;
25880     buf.copy(ret, ret.length - n, 0, nb);
25881     n -= nb;
25882     if (n === 0) {
25883       if (nb === buf.length) {
25884         ++c;
25885         if (p.next) list.head = p.next;else list.head = list.tail = null;
25886       } else {
25887         list.head = p;
25888         p.data = buf.slice(nb);
25889       }
25890       break;
25891     }
25892     ++c;
25893   }
25894   list.length -= c;
25895   return ret;
25896 }
25897
25898 function endReadable(stream) {
25899   var state = stream._readableState;
25900
25901   // If we get here before consuming all the bytes, then that is a
25902   // bug in node.  Should never happen.
25903   if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
25904
25905   if (!state.endEmitted) {
25906     state.ended = true;
25907     pna.nextTick(endReadableNT, state, stream);
25908   }
25909 }
25910
25911 function endReadableNT(state, stream) {
25912   // Check that we didn't get one last unshift.
25913   if (!state.endEmitted && state.length === 0) {
25914     state.endEmitted = true;
25915     stream.readable = false;
25916     stream.emit('end');
25917   }
25918 }
25919
25920 function indexOf(xs, x) {
25921   for (var i = 0, l = xs.length; i < l; i++) {
25922     if (xs[i] === x) return i;
25923   }
25924   return -1;
25925 }
25926
25927 /***/ }),
25928 /* 169 */
25929 /***/ (function(module, exports, __webpack_require__) {
25930
25931 "use strict";
25932
25933
25934 if (typeof process === 'undefined' ||
25935     !process.version ||
25936     process.version.indexOf('v0.') === 0 ||
25937     process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
25938   module.exports = { nextTick: nextTick };
25939 } else {
25940   module.exports = process
25941 }
25942
25943 function nextTick(fn, arg1, arg2, arg3) {
25944   if (typeof fn !== 'function') {
25945     throw new TypeError('"callback" argument must be a function');
25946   }
25947   var len = arguments.length;
25948   var args, i;
25949   switch (len) {
25950   case 0:
25951   case 1:
25952     return process.nextTick(fn);
25953   case 2:
25954     return process.nextTick(function afterTickOne() {
25955       fn.call(null, arg1);
25956     });
25957   case 3:
25958     return process.nextTick(function afterTickTwo() {
25959       fn.call(null, arg1, arg2);
25960     });
25961   case 4:
25962     return process.nextTick(function afterTickThree() {
25963       fn.call(null, arg1, arg2, arg3);
25964     });
25965   default:
25966     args = new Array(len - 1);
25967     i = 0;
25968     while (i < args.length) {
25969       args[i++] = arguments[i];
25970     }
25971     return process.nextTick(function afterTick() {
25972       fn.apply(null, args);
25973     });
25974   }
25975 }
25976
25977
25978
25979 /***/ }),
25980 /* 170 */
25981 /***/ (function(module, exports) {
25982
25983 var toString = {}.toString;
25984
25985 module.exports = Array.isArray || function (arr) {
25986   return toString.call(arr) == '[object Array]';
25987 };
25988
25989
25990 /***/ }),
25991 /* 171 */
25992 /***/ (function(module, exports, __webpack_require__) {
25993
25994 module.exports = __webpack_require__(44);
25995
25996
25997 /***/ }),
25998 /* 172 */
25999 /***/ (function(module, exports, __webpack_require__) {
26000
26001 /* eslint-disable node/no-deprecated-api */
26002 var buffer = __webpack_require__(166)
26003 var Buffer = buffer.Buffer
26004
26005 // alternative to using Object.keys for old browsers
26006 function copyProps (src, dst) {
26007   for (var key in src) {
26008     dst[key] = src[key]
26009   }
26010 }
26011 if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
26012   module.exports = buffer
26013 } else {
26014   // Copy properties from require('buffer')
26015   copyProps(buffer, exports)
26016   exports.Buffer = SafeBuffer
26017 }
26018
26019 function SafeBuffer (arg, encodingOrOffset, length) {
26020   return Buffer(arg, encodingOrOffset, length)
26021 }
26022
26023 // Copy static methods from Buffer
26024 copyProps(Buffer, SafeBuffer)
26025
26026 SafeBuffer.from = function (arg, encodingOrOffset, length) {
26027   if (typeof arg === 'number') {
26028     throw new TypeError('Argument must not be a number')
26029   }
26030   return Buffer(arg, encodingOrOffset, length)
26031 }
26032
26033 SafeBuffer.alloc = function (size, fill, encoding) {
26034   if (typeof size !== 'number') {
26035     throw new TypeError('Argument must be a number')
26036   }
26037   var buf = Buffer(size)
26038   if (fill !== undefined) {
26039     if (typeof encoding === 'string') {
26040       buf.fill(fill, encoding)
26041     } else {
26042       buf.fill(fill)
26043     }
26044   } else {
26045     buf.fill(0)
26046   }
26047   return buf
26048 }
26049
26050 SafeBuffer.allocUnsafe = function (size) {
26051   if (typeof size !== 'number') {
26052     throw new TypeError('Argument must be a number')
26053   }
26054   return Buffer(size)
26055 }
26056
26057 SafeBuffer.allocUnsafeSlow = function (size) {
26058   if (typeof size !== 'number') {
26059     throw new TypeError('Argument must be a number')
26060   }
26061   return buffer.SlowBuffer(size)
26062 }
26063
26064
26065 /***/ }),
26066 /* 173 */
26067 /***/ (function(module, exports) {
26068
26069 // Copyright Joyent, Inc. and other Node contributors.
26070 //
26071 // Permission is hereby granted, free of charge, to any person obtaining a
26072 // copy of this software and associated documentation files (the
26073 // "Software"), to deal in the Software without restriction, including
26074 // without limitation the rights to use, copy, modify, merge, publish,
26075 // distribute, sublicense, and/or sell copies of the Software, and to permit
26076 // persons to whom the Software is furnished to do so, subject to the
26077 // following conditions:
26078 //
26079 // The above copyright notice and this permission notice shall be included
26080 // in all copies or substantial portions of the Software.
26081 //
26082 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26083 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26084 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26085 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26086 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26087 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26088 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26089
26090 // NOTE: These type checking functions intentionally don't use `instanceof`
26091 // because it is fragile and can be easily faked with `Object.create()`.
26092
26093 function isArray(arg) {
26094   if (Array.isArray) {
26095     return Array.isArray(arg);
26096   }
26097   return objectToString(arg) === '[object Array]';
26098 }
26099 exports.isArray = isArray;
26100
26101 function isBoolean(arg) {
26102   return typeof arg === 'boolean';
26103 }
26104 exports.isBoolean = isBoolean;
26105
26106 function isNull(arg) {
26107   return arg === null;
26108 }
26109 exports.isNull = isNull;
26110
26111 function isNullOrUndefined(arg) {
26112   return arg == null;
26113 }
26114 exports.isNullOrUndefined = isNullOrUndefined;
26115
26116 function isNumber(arg) {
26117   return typeof arg === 'number';
26118 }
26119 exports.isNumber = isNumber;
26120
26121 function isString(arg) {
26122   return typeof arg === 'string';
26123 }
26124 exports.isString = isString;
26125
26126 function isSymbol(arg) {
26127   return typeof arg === 'symbol';
26128 }
26129 exports.isSymbol = isSymbol;
26130
26131 function isUndefined(arg) {
26132   return arg === void 0;
26133 }
26134 exports.isUndefined = isUndefined;
26135
26136 function isRegExp(re) {
26137   return objectToString(re) === '[object RegExp]';
26138 }
26139 exports.isRegExp = isRegExp;
26140
26141 function isObject(arg) {
26142   return typeof arg === 'object' && arg !== null;
26143 }
26144 exports.isObject = isObject;
26145
26146 function isDate(d) {
26147   return objectToString(d) === '[object Date]';
26148 }
26149 exports.isDate = isDate;
26150
26151 function isError(e) {
26152   return (objectToString(e) === '[object Error]' || e instanceof Error);
26153 }
26154 exports.isError = isError;
26155
26156 function isFunction(arg) {
26157   return typeof arg === 'function';
26158 }
26159 exports.isFunction = isFunction;
26160
26161 function isPrimitive(arg) {
26162   return arg === null ||
26163          typeof arg === 'boolean' ||
26164          typeof arg === 'number' ||
26165          typeof arg === 'string' ||
26166          typeof arg === 'symbol' ||  // ES6 symbol
26167          typeof arg === 'undefined';
26168 }
26169 exports.isPrimitive = isPrimitive;
26170
26171 exports.isBuffer = Buffer.isBuffer;
26172
26173 function objectToString(o) {
26174   return Object.prototype.toString.call(o);
26175 }
26176
26177
26178 /***/ }),
26179 /* 174 */
26180 /***/ (function(module, exports, __webpack_require__) {
26181
26182 "use strict";
26183
26184
26185 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26186
26187 var Buffer = __webpack_require__(172).Buffer;
26188 var util = __webpack_require__(50);
26189
26190 function copyBuffer(src, target, offset) {
26191   src.copy(target, offset);
26192 }
26193
26194 module.exports = function () {
26195   function BufferList() {
26196     _classCallCheck(this, BufferList);
26197
26198     this.head = null;
26199     this.tail = null;
26200     this.length = 0;
26201   }
26202
26203   BufferList.prototype.push = function push(v) {
26204     var entry = { data: v, next: null };
26205     if (this.length > 0) this.tail.next = entry;else this.head = entry;
26206     this.tail = entry;
26207     ++this.length;
26208   };
26209
26210   BufferList.prototype.unshift = function unshift(v) {
26211     var entry = { data: v, next: this.head };
26212     if (this.length === 0) this.tail = entry;
26213     this.head = entry;
26214     ++this.length;
26215   };
26216
26217   BufferList.prototype.shift = function shift() {
26218     if (this.length === 0) return;
26219     var ret = this.head.data;
26220     if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
26221     --this.length;
26222     return ret;
26223   };
26224
26225   BufferList.prototype.clear = function clear() {
26226     this.head = this.tail = null;
26227     this.length = 0;
26228   };
26229
26230   BufferList.prototype.join = function join(s) {
26231     if (this.length === 0) return '';
26232     var p = this.head;
26233     var ret = '' + p.data;
26234     while (p = p.next) {
26235       ret += s + p.data;
26236     }return ret;
26237   };
26238
26239   BufferList.prototype.concat = function concat(n) {
26240     if (this.length === 0) return Buffer.alloc(0);
26241     if (this.length === 1) return this.head.data;
26242     var ret = Buffer.allocUnsafe(n >>> 0);
26243     var p = this.head;
26244     var i = 0;
26245     while (p) {
26246       copyBuffer(p.data, ret, i);
26247       i += p.data.length;
26248       p = p.next;
26249     }
26250     return ret;
26251   };
26252
26253   return BufferList;
26254 }();
26255
26256 if (util && util.inspect && util.inspect.custom) {
26257   module.exports.prototype[util.inspect.custom] = function () {
26258     var obj = util.inspect({ length: this.length });
26259     return this.constructor.name + ' ' + obj;
26260   };
26261 }
26262
26263 /***/ }),
26264 /* 175 */
26265 /***/ (function(module, exports, __webpack_require__) {
26266
26267 "use strict";
26268
26269
26270 /*<replacement>*/
26271
26272 var pna = __webpack_require__(169);
26273 /*</replacement>*/
26274
26275 // undocumented cb() API, needed for core, not for public API
26276 function destroy(err, cb) {
26277   var _this = this;
26278
26279   var readableDestroyed = this._readableState && this._readableState.destroyed;
26280   var writableDestroyed = this._writableState && this._writableState.destroyed;
26281
26282   if (readableDestroyed || writableDestroyed) {
26283     if (cb) {
26284       cb(err);
26285     } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
26286       pna.nextTick(emitErrorNT, this, err);
26287     }
26288     return this;
26289   }
26290
26291   // we set destroyed to true before firing error callbacks in order
26292   // to make it re-entrance safe in case destroy() is called within callbacks
26293
26294   if (this._readableState) {
26295     this._readableState.destroyed = true;
26296   }
26297
26298   // if this is a duplex stream mark the writable part as destroyed as well
26299   if (this._writableState) {
26300     this._writableState.destroyed = true;
26301   }
26302
26303   this._destroy(err || null, function (err) {
26304     if (!cb && err) {
26305       pna.nextTick(emitErrorNT, _this, err);
26306       if (_this._writableState) {
26307         _this._writableState.errorEmitted = true;
26308       }
26309     } else if (cb) {
26310       cb(err);
26311     }
26312   });
26313
26314   return this;
26315 }
26316
26317 function undestroy() {
26318   if (this._readableState) {
26319     this._readableState.destroyed = false;
26320     this._readableState.reading = false;
26321     this._readableState.ended = false;
26322     this._readableState.endEmitted = false;
26323   }
26324
26325   if (this._writableState) {
26326     this._writableState.destroyed = false;
26327     this._writableState.ended = false;
26328     this._writableState.ending = false;
26329     this._writableState.finished = false;
26330     this._writableState.errorEmitted = false;
26331   }
26332 }
26333
26334 function emitErrorNT(self, err) {
26335   self.emit('error', err);
26336 }
26337
26338 module.exports = {
26339   destroy: destroy,
26340   undestroy: undestroy
26341 };
26342
26343 /***/ }),
26344 /* 176 */
26345 /***/ (function(module, exports, __webpack_require__) {
26346
26347 "use strict";
26348 // Copyright Joyent, Inc. and other Node contributors.
26349 //
26350 // Permission is hereby granted, free of charge, to any person obtaining a
26351 // copy of this software and associated documentation files (the
26352 // "Software"), to deal in the Software without restriction, including
26353 // without limitation the rights to use, copy, modify, merge, publish,
26354 // distribute, sublicense, and/or sell copies of the Software, and to permit
26355 // persons to whom the Software is furnished to do so, subject to the
26356 // following conditions:
26357 //
26358 // The above copyright notice and this permission notice shall be included
26359 // in all copies or substantial portions of the Software.
26360 //
26361 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26362 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26363 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26364 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26365 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26366 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26367 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26368
26369 // a duplex stream is just a stream that is both readable and writable.
26370 // Since JS doesn't have multiple prototypal inheritance, this class
26371 // prototypally inherits from Readable, and then parasitically from
26372 // Writable.
26373
26374
26375
26376 /*<replacement>*/
26377
26378 var pna = __webpack_require__(169);
26379 /*</replacement>*/
26380
26381 /*<replacement>*/
26382 var objectKeys = Object.keys || function (obj) {
26383   var keys = [];
26384   for (var key in obj) {
26385     keys.push(key);
26386   }return keys;
26387 };
26388 /*</replacement>*/
26389
26390 module.exports = Duplex;
26391
26392 /*<replacement>*/
26393 var util = Object.create(__webpack_require__(173));
26394 util.inherits = __webpack_require__(66);
26395 /*</replacement>*/
26396
26397 var Readable = __webpack_require__(168);
26398 var Writable = __webpack_require__(177);
26399
26400 util.inherits(Duplex, Readable);
26401
26402 {
26403   // avoid scope creep, the keys array can then be collected
26404   var keys = objectKeys(Writable.prototype);
26405   for (var v = 0; v < keys.length; v++) {
26406     var method = keys[v];
26407     if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
26408   }
26409 }
26410
26411 function Duplex(options) {
26412   if (!(this instanceof Duplex)) return new Duplex(options);
26413
26414   Readable.call(this, options);
26415   Writable.call(this, options);
26416
26417   if (options && options.readable === false) this.readable = false;
26418
26419   if (options && options.writable === false) this.writable = false;
26420
26421   this.allowHalfOpen = true;
26422   if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
26423
26424   this.once('end', onend);
26425 }
26426
26427 Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
26428   // making it explicit this property is not enumerable
26429   // because otherwise some prototype manipulation in
26430   // userland will fail
26431   enumerable: false,
26432   get: function () {
26433     return this._writableState.highWaterMark;
26434   }
26435 });
26436
26437 // the no-half-open enforcer
26438 function onend() {
26439   // if we allow half-open state, or if the writable side ended,
26440   // then we're ok.
26441   if (this.allowHalfOpen || this._writableState.ended) return;
26442
26443   // no more data can be written.
26444   // But allow more writes to happen in this tick.
26445   pna.nextTick(onEndNT, this);
26446 }
26447
26448 function onEndNT(self) {
26449   self.end();
26450 }
26451
26452 Object.defineProperty(Duplex.prototype, 'destroyed', {
26453   get: function () {
26454     if (this._readableState === undefined || this._writableState === undefined) {
26455       return false;
26456     }
26457     return this._readableState.destroyed && this._writableState.destroyed;
26458   },
26459   set: function (value) {
26460     // we ignore the value if the stream
26461     // has not been initialized yet
26462     if (this._readableState === undefined || this._writableState === undefined) {
26463       return;
26464     }
26465
26466     // backward compatibility, the user is explicitly
26467     // managing destroyed
26468     this._readableState.destroyed = value;
26469     this._writableState.destroyed = value;
26470   }
26471 });
26472
26473 Duplex.prototype._destroy = function (err, cb) {
26474   this.push(null);
26475   this.end();
26476
26477   pna.nextTick(cb, err);
26478 };
26479
26480 /***/ }),
26481 /* 177 */
26482 /***/ (function(module, exports, __webpack_require__) {
26483
26484 "use strict";
26485 // Copyright Joyent, Inc. and other Node contributors.
26486 //
26487 // Permission is hereby granted, free of charge, to any person obtaining a
26488 // copy of this software and associated documentation files (the
26489 // "Software"), to deal in the Software without restriction, including
26490 // without limitation the rights to use, copy, modify, merge, publish,
26491 // distribute, sublicense, and/or sell copies of the Software, and to permit
26492 // persons to whom the Software is furnished to do so, subject to the
26493 // following conditions:
26494 //
26495 // The above copyright notice and this permission notice shall be included
26496 // in all copies or substantial portions of the Software.
26497 //
26498 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26499 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26500 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26501 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26502 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26503 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26504 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26505
26506 // A bit simpler than readable streams.
26507 // Implement an async ._write(chunk, encoding, cb), and it'll handle all
26508 // the drain event emission and buffering.
26509
26510
26511
26512 /*<replacement>*/
26513
26514 var pna = __webpack_require__(169);
26515 /*</replacement>*/
26516
26517 module.exports = Writable;
26518
26519 /* <replacement> */
26520 function WriteReq(chunk, encoding, cb) {
26521   this.chunk = chunk;
26522   this.encoding = encoding;
26523   this.callback = cb;
26524   this.next = null;
26525 }
26526
26527 // It seems a linked list but it is not
26528 // there will be only 2 of these for each stream
26529 function CorkedRequest(state) {
26530   var _this = this;
26531
26532   this.next = null;
26533   this.entry = null;
26534   this.finish = function () {
26535     onCorkedFinish(_this, state);
26536   };
26537 }
26538 /* </replacement> */
26539
26540 /*<replacement>*/
26541 var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
26542 /*</replacement>*/
26543
26544 /*<replacement>*/
26545 var Duplex;
26546 /*</replacement>*/
26547
26548 Writable.WritableState = WritableState;
26549
26550 /*<replacement>*/
26551 var util = Object.create(__webpack_require__(173));
26552 util.inherits = __webpack_require__(66);
26553 /*</replacement>*/
26554
26555 /*<replacement>*/
26556 var internalUtil = {
26557   deprecate: __webpack_require__(178)
26558 };
26559 /*</replacement>*/
26560
26561 /*<replacement>*/
26562 var Stream = __webpack_require__(171);
26563 /*</replacement>*/
26564
26565 /*<replacement>*/
26566
26567 var Buffer = __webpack_require__(172).Buffer;
26568 var OurUint8Array = global.Uint8Array || function () {};
26569 function _uint8ArrayToBuffer(chunk) {
26570   return Buffer.from(chunk);
26571 }
26572 function _isUint8Array(obj) {
26573   return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
26574 }
26575
26576 /*</replacement>*/
26577
26578 var destroyImpl = __webpack_require__(175);
26579
26580 util.inherits(Writable, Stream);
26581
26582 function nop() {}
26583
26584 function WritableState(options, stream) {
26585   Duplex = Duplex || __webpack_require__(176);
26586
26587   options = options || {};
26588
26589   // Duplex streams are both readable and writable, but share
26590   // the same options object.
26591   // However, some cases require setting options to different
26592   // values for the readable and the writable sides of the duplex stream.
26593   // These options can be provided separately as readableXXX and writableXXX.
26594   var isDuplex = stream instanceof Duplex;
26595
26596   // object stream flag to indicate whether or not this stream
26597   // contains buffers or objects.
26598   this.objectMode = !!options.objectMode;
26599
26600   if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
26601
26602   // the point at which write() starts returning false
26603   // Note: 0 is a valid value, means that we always return false if
26604   // the entire buffer is not flushed immediately on write()
26605   var hwm = options.highWaterMark;
26606   var writableHwm = options.writableHighWaterMark;
26607   var defaultHwm = this.objectMode ? 16 : 16 * 1024;
26608
26609   if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
26610
26611   // cast to ints.
26612   this.highWaterMark = Math.floor(this.highWaterMark);
26613
26614   // if _final has been called
26615   this.finalCalled = false;
26616
26617   // drain event flag.
26618   this.needDrain = false;
26619   // at the start of calling end()
26620   this.ending = false;
26621   // when end() has been called, and returned
26622   this.ended = false;
26623   // when 'finish' is emitted
26624   this.finished = false;
26625
26626   // has it been destroyed
26627   this.destroyed = false;
26628
26629   // should we decode strings into buffers before passing to _write?
26630   // this is here so that some node-core streams can optimize string
26631   // handling at a lower level.
26632   var noDecode = options.decodeStrings === false;
26633   this.decodeStrings = !noDecode;
26634
26635   // Crypto is kind of old and crusty.  Historically, its default string
26636   // encoding is 'binary' so we have to make this configurable.
26637   // Everything else in the universe uses 'utf8', though.
26638   this.defaultEncoding = options.defaultEncoding || 'utf8';
26639
26640   // not an actual buffer we keep track of, but a measurement
26641   // of how much we're waiting to get pushed to some underlying
26642   // socket or file.
26643   this.length = 0;
26644
26645   // a flag to see when we're in the middle of a write.
26646   this.writing = false;
26647
26648   // when true all writes will be buffered until .uncork() call
26649   this.corked = 0;
26650
26651   // a flag to be able to tell if the onwrite cb is called immediately,
26652   // or on a later tick.  We set this to true at first, because any
26653   // actions that shouldn't happen until "later" should generally also
26654   // not happen before the first write call.
26655   this.sync = true;
26656
26657   // a flag to know if we're processing previously buffered items, which
26658   // may call the _write() callback in the same tick, so that we don't
26659   // end up in an overlapped onwrite situation.
26660   this.bufferProcessing = false;
26661
26662   // the callback that's passed to _write(chunk,cb)
26663   this.onwrite = function (er) {
26664     onwrite(stream, er);
26665   };
26666
26667   // the callback that the user supplies to write(chunk,encoding,cb)
26668   this.writecb = null;
26669
26670   // the amount that is being written when _write is called.
26671   this.writelen = 0;
26672
26673   this.bufferedRequest = null;
26674   this.lastBufferedRequest = null;
26675
26676   // number of pending user-supplied write callbacks
26677   // this must be 0 before 'finish' can be emitted
26678   this.pendingcb = 0;
26679
26680   // emit prefinish if the only thing we're waiting for is _write cbs
26681   // This is relevant for synchronous Transform streams
26682   this.prefinished = false;
26683
26684   // True if the error was already emitted and should not be thrown again
26685   this.errorEmitted = false;
26686
26687   // count buffered requests
26688   this.bufferedRequestCount = 0;
26689
26690   // allocate the first CorkedRequest, there is always
26691   // one allocated and free to use, and we maintain at most two
26692   this.corkedRequestsFree = new CorkedRequest(this);
26693 }
26694
26695 WritableState.prototype.getBuffer = function getBuffer() {
26696   var current = this.bufferedRequest;
26697   var out = [];
26698   while (current) {
26699     out.push(current);
26700     current = current.next;
26701   }
26702   return out;
26703 };
26704
26705 (function () {
26706   try {
26707     Object.defineProperty(WritableState.prototype, 'buffer', {
26708       get: internalUtil.deprecate(function () {
26709         return this.getBuffer();
26710       }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
26711     });
26712   } catch (_) {}
26713 })();
26714
26715 // Test _writableState for inheritance to account for Duplex streams,
26716 // whose prototype chain only points to Readable.
26717 var realHasInstance;
26718 if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
26719   realHasInstance = Function.prototype[Symbol.hasInstance];
26720   Object.defineProperty(Writable, Symbol.hasInstance, {
26721     value: function (object) {
26722       if (realHasInstance.call(this, object)) return true;
26723       if (this !== Writable) return false;
26724
26725       return object && object._writableState instanceof WritableState;
26726     }
26727   });
26728 } else {
26729   realHasInstance = function (object) {
26730     return object instanceof this;
26731   };
26732 }
26733
26734 function Writable(options) {
26735   Duplex = Duplex || __webpack_require__(176);
26736
26737   // Writable ctor is applied to Duplexes, too.
26738   // `realHasInstance` is necessary because using plain `instanceof`
26739   // would return false, as no `_writableState` property is attached.
26740
26741   // Trying to use the custom `instanceof` for Writable here will also break the
26742   // Node.js LazyTransform implementation, which has a non-trivial getter for
26743   // `_writableState` that would lead to infinite recursion.
26744   if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
26745     return new Writable(options);
26746   }
26747
26748   this._writableState = new WritableState(options, this);
26749
26750   // legacy.
26751   this.writable = true;
26752
26753   if (options) {
26754     if (typeof options.write === 'function') this._write = options.write;
26755
26756     if (typeof options.writev === 'function') this._writev = options.writev;
26757
26758     if (typeof options.destroy === 'function') this._destroy = options.destroy;
26759
26760     if (typeof options.final === 'function') this._final = options.final;
26761   }
26762
26763   Stream.call(this);
26764 }
26765
26766 // Otherwise people can pipe Writable streams, which is just wrong.
26767 Writable.prototype.pipe = function () {
26768   this.emit('error', new Error('Cannot pipe, not readable'));
26769 };
26770
26771 function writeAfterEnd(stream, cb) {
26772   var er = new Error('write after end');
26773   // TODO: defer error events consistently everywhere, not just the cb
26774   stream.emit('error', er);
26775   pna.nextTick(cb, er);
26776 }
26777
26778 // Checks that a user-supplied chunk is valid, especially for the particular
26779 // mode the stream is in. Currently this means that `null` is never accepted
26780 // and undefined/non-string values are only allowed in object mode.
26781 function validChunk(stream, state, chunk, cb) {
26782   var valid = true;
26783   var er = false;
26784
26785   if (chunk === null) {
26786     er = new TypeError('May not write null values to stream');
26787   } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
26788     er = new TypeError('Invalid non-string/buffer chunk');
26789   }
26790   if (er) {
26791     stream.emit('error', er);
26792     pna.nextTick(cb, er);
26793     valid = false;
26794   }
26795   return valid;
26796 }
26797
26798 Writable.prototype.write = function (chunk, encoding, cb) {
26799   var state = this._writableState;
26800   var ret = false;
26801   var isBuf = !state.objectMode && _isUint8Array(chunk);
26802
26803   if (isBuf && !Buffer.isBuffer(chunk)) {
26804     chunk = _uint8ArrayToBuffer(chunk);
26805   }
26806
26807   if (typeof encoding === 'function') {
26808     cb = encoding;
26809     encoding = null;
26810   }
26811
26812   if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
26813
26814   if (typeof cb !== 'function') cb = nop;
26815
26816   if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
26817     state.pendingcb++;
26818     ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
26819   }
26820
26821   return ret;
26822 };
26823
26824 Writable.prototype.cork = function () {
26825   var state = this._writableState;
26826
26827   state.corked++;
26828 };
26829
26830 Writable.prototype.uncork = function () {
26831   var state = this._writableState;
26832
26833   if (state.corked) {
26834     state.corked--;
26835
26836     if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
26837   }
26838 };
26839
26840 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
26841   // node::ParseEncoding() requires lower case.
26842   if (typeof encoding === 'string') encoding = encoding.toLowerCase();
26843   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);
26844   this._writableState.defaultEncoding = encoding;
26845   return this;
26846 };
26847
26848 function decodeChunk(state, chunk, encoding) {
26849   if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
26850     chunk = Buffer.from(chunk, encoding);
26851   }
26852   return chunk;
26853 }
26854
26855 Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
26856   // making it explicit this property is not enumerable
26857   // because otherwise some prototype manipulation in
26858   // userland will fail
26859   enumerable: false,
26860   get: function () {
26861     return this._writableState.highWaterMark;
26862   }
26863 });
26864
26865 // if we're already writing something, then just put this
26866 // in the queue, and wait our turn.  Otherwise, call _write
26867 // If we return false, then we need a drain event, so set that flag.
26868 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
26869   if (!isBuf) {
26870     var newChunk = decodeChunk(state, chunk, encoding);
26871     if (chunk !== newChunk) {
26872       isBuf = true;
26873       encoding = 'buffer';
26874       chunk = newChunk;
26875     }
26876   }
26877   var len = state.objectMode ? 1 : chunk.length;
26878
26879   state.length += len;
26880
26881   var ret = state.length < state.highWaterMark;
26882   // we must ensure that previous needDrain will not be reset to false.
26883   if (!ret) state.needDrain = true;
26884
26885   if (state.writing || state.corked) {
26886     var last = state.lastBufferedRequest;
26887     state.lastBufferedRequest = {
26888       chunk: chunk,
26889       encoding: encoding,
26890       isBuf: isBuf,
26891       callback: cb,
26892       next: null
26893     };
26894     if (last) {
26895       last.next = state.lastBufferedRequest;
26896     } else {
26897       state.bufferedRequest = state.lastBufferedRequest;
26898     }
26899     state.bufferedRequestCount += 1;
26900   } else {
26901     doWrite(stream, state, false, len, chunk, encoding, cb);
26902   }
26903
26904   return ret;
26905 }
26906
26907 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
26908   state.writelen = len;
26909   state.writecb = cb;
26910   state.writing = true;
26911   state.sync = true;
26912   if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
26913   state.sync = false;
26914 }
26915
26916 function onwriteError(stream, state, sync, er, cb) {
26917   --state.pendingcb;
26918
26919   if (sync) {
26920     // defer the callback if we are being called synchronously
26921     // to avoid piling up things on the stack
26922     pna.nextTick(cb, er);
26923     // this can emit finish, and it will always happen
26924     // after error
26925     pna.nextTick(finishMaybe, stream, state);
26926     stream._writableState.errorEmitted = true;
26927     stream.emit('error', er);
26928   } else {
26929     // the caller expect this to happen before if
26930     // it is async
26931     cb(er);
26932     stream._writableState.errorEmitted = true;
26933     stream.emit('error', er);
26934     // this can emit finish, but finish must
26935     // always follow error
26936     finishMaybe(stream, state);
26937   }
26938 }
26939
26940 function onwriteStateUpdate(state) {
26941   state.writing = false;
26942   state.writecb = null;
26943   state.length -= state.writelen;
26944   state.writelen = 0;
26945 }
26946
26947 function onwrite(stream, er) {
26948   var state = stream._writableState;
26949   var sync = state.sync;
26950   var cb = state.writecb;
26951
26952   onwriteStateUpdate(state);
26953
26954   if (er) onwriteError(stream, state, sync, er, cb);else {
26955     // Check if we're actually ready to finish, but don't emit yet
26956     var finished = needFinish(state);
26957
26958     if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
26959       clearBuffer(stream, state);
26960     }
26961
26962     if (sync) {
26963       /*<replacement>*/
26964       asyncWrite(afterWrite, stream, state, finished, cb);
26965       /*</replacement>*/
26966     } else {
26967       afterWrite(stream, state, finished, cb);
26968     }
26969   }
26970 }
26971
26972 function afterWrite(stream, state, finished, cb) {
26973   if (!finished) onwriteDrain(stream, state);
26974   state.pendingcb--;
26975   cb();
26976   finishMaybe(stream, state);
26977 }
26978
26979 // Must force callback to be called on nextTick, so that we don't
26980 // emit 'drain' before the write() consumer gets the 'false' return
26981 // value, and has a chance to attach a 'drain' listener.
26982 function onwriteDrain(stream, state) {
26983   if (state.length === 0 && state.needDrain) {
26984     state.needDrain = false;
26985     stream.emit('drain');
26986   }
26987 }
26988
26989 // if there's something in the buffer waiting, then process it
26990 function clearBuffer(stream, state) {
26991   state.bufferProcessing = true;
26992   var entry = state.bufferedRequest;
26993
26994   if (stream._writev && entry && entry.next) {
26995     // Fast case, write everything using _writev()
26996     var l = state.bufferedRequestCount;
26997     var buffer = new Array(l);
26998     var holder = state.corkedRequestsFree;
26999     holder.entry = entry;
27000
27001     var count = 0;
27002     var allBuffers = true;
27003     while (entry) {
27004       buffer[count] = entry;
27005       if (!entry.isBuf) allBuffers = false;
27006       entry = entry.next;
27007       count += 1;
27008     }
27009     buffer.allBuffers = allBuffers;
27010
27011     doWrite(stream, state, true, state.length, buffer, '', holder.finish);
27012
27013     // doWrite is almost always async, defer these to save a bit of time
27014     // as the hot path ends with doWrite
27015     state.pendingcb++;
27016     state.lastBufferedRequest = null;
27017     if (holder.next) {
27018       state.corkedRequestsFree = holder.next;
27019       holder.next = null;
27020     } else {
27021       state.corkedRequestsFree = new CorkedRequest(state);
27022     }
27023     state.bufferedRequestCount = 0;
27024   } else {
27025     // Slow case, write chunks one-by-one
27026     while (entry) {
27027       var chunk = entry.chunk;
27028       var encoding = entry.encoding;
27029       var cb = entry.callback;
27030       var len = state.objectMode ? 1 : chunk.length;
27031
27032       doWrite(stream, state, false, len, chunk, encoding, cb);
27033       entry = entry.next;
27034       state.bufferedRequestCount--;
27035       // if we didn't call the onwrite immediately, then
27036       // it means that we need to wait until it does.
27037       // also, that means that the chunk and cb are currently
27038       // being processed, so move the buffer counter past them.
27039       if (state.writing) {
27040         break;
27041       }
27042     }
27043
27044     if (entry === null) state.lastBufferedRequest = null;
27045   }
27046
27047   state.bufferedRequest = entry;
27048   state.bufferProcessing = false;
27049 }
27050
27051 Writable.prototype._write = function (chunk, encoding, cb) {
27052   cb(new Error('_write() is not implemented'));
27053 };
27054
27055 Writable.prototype._writev = null;
27056
27057 Writable.prototype.end = function (chunk, encoding, cb) {
27058   var state = this._writableState;
27059
27060   if (typeof chunk === 'function') {
27061     cb = chunk;
27062     chunk = null;
27063     encoding = null;
27064   } else if (typeof encoding === 'function') {
27065     cb = encoding;
27066     encoding = null;
27067   }
27068
27069   if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
27070
27071   // .end() fully uncorks
27072   if (state.corked) {
27073     state.corked = 1;
27074     this.uncork();
27075   }
27076
27077   // ignore unnecessary end() calls.
27078   if (!state.ending && !state.finished) endWritable(this, state, cb);
27079 };
27080
27081 function needFinish(state) {
27082   return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
27083 }
27084 function callFinal(stream, state) {
27085   stream._final(function (err) {
27086     state.pendingcb--;
27087     if (err) {
27088       stream.emit('error', err);
27089     }
27090     state.prefinished = true;
27091     stream.emit('prefinish');
27092     finishMaybe(stream, state);
27093   });
27094 }
27095 function prefinish(stream, state) {
27096   if (!state.prefinished && !state.finalCalled) {
27097     if (typeof stream._final === 'function') {
27098       state.pendingcb++;
27099       state.finalCalled = true;
27100       pna.nextTick(callFinal, stream, state);
27101     } else {
27102       state.prefinished = true;
27103       stream.emit('prefinish');
27104     }
27105   }
27106 }
27107
27108 function finishMaybe(stream, state) {
27109   var need = needFinish(state);
27110   if (need) {
27111     prefinish(stream, state);
27112     if (state.pendingcb === 0) {
27113       state.finished = true;
27114       stream.emit('finish');
27115     }
27116   }
27117   return need;
27118 }
27119
27120 function endWritable(stream, state, cb) {
27121   state.ending = true;
27122   finishMaybe(stream, state);
27123   if (cb) {
27124     if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
27125   }
27126   state.ended = true;
27127   stream.writable = false;
27128 }
27129
27130 function onCorkedFinish(corkReq, state, err) {
27131   var entry = corkReq.entry;
27132   corkReq.entry = null;
27133   while (entry) {
27134     var cb = entry.callback;
27135     state.pendingcb--;
27136     cb(err);
27137     entry = entry.next;
27138   }
27139   if (state.corkedRequestsFree) {
27140     state.corkedRequestsFree.next = corkReq;
27141   } else {
27142     state.corkedRequestsFree = corkReq;
27143   }
27144 }
27145
27146 Object.defineProperty(Writable.prototype, 'destroyed', {
27147   get: function () {
27148     if (this._writableState === undefined) {
27149       return false;
27150     }
27151     return this._writableState.destroyed;
27152   },
27153   set: function (value) {
27154     // we ignore the value if the stream
27155     // has not been initialized yet
27156     if (!this._writableState) {
27157       return;
27158     }
27159
27160     // backward compatibility, the user is explicitly
27161     // managing destroyed
27162     this._writableState.destroyed = value;
27163   }
27164 });
27165
27166 Writable.prototype.destroy = destroyImpl.destroy;
27167 Writable.prototype._undestroy = destroyImpl.undestroy;
27168 Writable.prototype._destroy = function (err, cb) {
27169   this.end();
27170   cb(err);
27171 };
27172
27173 /***/ }),
27174 /* 178 */
27175 /***/ (function(module, exports, __webpack_require__) {
27176
27177
27178 /**
27179  * For Node.js, simply re-export the core `util.deprecate` function.
27180  */
27181
27182 module.exports = __webpack_require__(50).deprecate;
27183
27184
27185 /***/ }),
27186 /* 179 */
27187 /***/ (function(module, exports, __webpack_require__) {
27188
27189 "use strict";
27190 // Copyright Joyent, Inc. and other Node contributors.
27191 //
27192 // Permission is hereby granted, free of charge, to any person obtaining a
27193 // copy of this software and associated documentation files (the
27194 // "Software"), to deal in the Software without restriction, including
27195 // without limitation the rights to use, copy, modify, merge, publish,
27196 // distribute, sublicense, and/or sell copies of the Software, and to permit
27197 // persons to whom the Software is furnished to do so, subject to the
27198 // following conditions:
27199 //
27200 // The above copyright notice and this permission notice shall be included
27201 // in all copies or substantial portions of the Software.
27202 //
27203 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27204 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27205 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27206 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27207 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27208 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27209 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27210
27211
27212
27213 /*<replacement>*/
27214
27215 var Buffer = __webpack_require__(172).Buffer;
27216 /*</replacement>*/
27217
27218 var isEncoding = Buffer.isEncoding || function (encoding) {
27219   encoding = '' + encoding;
27220   switch (encoding && encoding.toLowerCase()) {
27221     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':
27222       return true;
27223     default:
27224       return false;
27225   }
27226 };
27227
27228 function _normalizeEncoding(enc) {
27229   if (!enc) return 'utf8';
27230   var retried;
27231   while (true) {
27232     switch (enc) {
27233       case 'utf8':
27234       case 'utf-8':
27235         return 'utf8';
27236       case 'ucs2':
27237       case 'ucs-2':
27238       case 'utf16le':
27239       case 'utf-16le':
27240         return 'utf16le';
27241       case 'latin1':
27242       case 'binary':
27243         return 'latin1';
27244       case 'base64':
27245       case 'ascii':
27246       case 'hex':
27247         return enc;
27248       default:
27249         if (retried) return; // undefined
27250         enc = ('' + enc).toLowerCase();
27251         retried = true;
27252     }
27253   }
27254 };
27255
27256 // Do not cache `Buffer.isEncoding` when checking encoding names as some
27257 // modules monkey-patch it to support additional encodings
27258 function normalizeEncoding(enc) {
27259   var nenc = _normalizeEncoding(enc);
27260   if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
27261   return nenc || enc;
27262 }
27263
27264 // StringDecoder provides an interface for efficiently splitting a series of
27265 // buffers into a series of JS strings without breaking apart multi-byte
27266 // characters.
27267 exports.StringDecoder = StringDecoder;
27268 function StringDecoder(encoding) {
27269   this.encoding = normalizeEncoding(encoding);
27270   var nb;
27271   switch (this.encoding) {
27272     case 'utf16le':
27273       this.text = utf16Text;
27274       this.end = utf16End;
27275       nb = 4;
27276       break;
27277     case 'utf8':
27278       this.fillLast = utf8FillLast;
27279       nb = 4;
27280       break;
27281     case 'base64':
27282       this.text = base64Text;
27283       this.end = base64End;
27284       nb = 3;
27285       break;
27286     default:
27287       this.write = simpleWrite;
27288       this.end = simpleEnd;
27289       return;
27290   }
27291   this.lastNeed = 0;
27292   this.lastTotal = 0;
27293   this.lastChar = Buffer.allocUnsafe(nb);
27294 }
27295
27296 StringDecoder.prototype.write = function (buf) {
27297   if (buf.length === 0) return '';
27298   var r;
27299   var i;
27300   if (this.lastNeed) {
27301     r = this.fillLast(buf);
27302     if (r === undefined) return '';
27303     i = this.lastNeed;
27304     this.lastNeed = 0;
27305   } else {
27306     i = 0;
27307   }
27308   if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
27309   return r || '';
27310 };
27311
27312 StringDecoder.prototype.end = utf8End;
27313
27314 // Returns only complete characters in a Buffer
27315 StringDecoder.prototype.text = utf8Text;
27316
27317 // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
27318 StringDecoder.prototype.fillLast = function (buf) {
27319   if (this.lastNeed <= buf.length) {
27320     buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
27321     return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27322   }
27323   buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
27324   this.lastNeed -= buf.length;
27325 };
27326
27327 // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
27328 // continuation byte. If an invalid byte is detected, -2 is returned.
27329 function utf8CheckByte(byte) {
27330   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;
27331   return byte >> 6 === 0x02 ? -1 : -2;
27332 }
27333
27334 // Checks at most 3 bytes at the end of a Buffer in order to detect an
27335 // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
27336 // needed to complete the UTF-8 character (if applicable) are returned.
27337 function utf8CheckIncomplete(self, buf, i) {
27338   var j = buf.length - 1;
27339   if (j < i) return 0;
27340   var nb = utf8CheckByte(buf[j]);
27341   if (nb >= 0) {
27342     if (nb > 0) self.lastNeed = nb - 1;
27343     return nb;
27344   }
27345   if (--j < i || nb === -2) return 0;
27346   nb = utf8CheckByte(buf[j]);
27347   if (nb >= 0) {
27348     if (nb > 0) self.lastNeed = nb - 2;
27349     return nb;
27350   }
27351   if (--j < i || nb === -2) return 0;
27352   nb = utf8CheckByte(buf[j]);
27353   if (nb >= 0) {
27354     if (nb > 0) {
27355       if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
27356     }
27357     return nb;
27358   }
27359   return 0;
27360 }
27361
27362 // Validates as many continuation bytes for a multi-byte UTF-8 character as
27363 // needed or are available. If we see a non-continuation byte where we expect
27364 // one, we "replace" the validated continuation bytes we've seen so far with
27365 // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
27366 // behavior. The continuation byte check is included three times in the case
27367 // where all of the continuation bytes for a character exist in the same buffer.
27368 // It is also done this way as a slight performance increase instead of using a
27369 // loop.
27370 function utf8CheckExtraBytes(self, buf, p) {
27371   if ((buf[0] & 0xC0) !== 0x80) {
27372     self.lastNeed = 0;
27373     return '\ufffd';
27374   }
27375   if (self.lastNeed > 1 && buf.length > 1) {
27376     if ((buf[1] & 0xC0) !== 0x80) {
27377       self.lastNeed = 1;
27378       return '\ufffd';
27379     }
27380     if (self.lastNeed > 2 && buf.length > 2) {
27381       if ((buf[2] & 0xC0) !== 0x80) {
27382         self.lastNeed = 2;
27383         return '\ufffd';
27384       }
27385     }
27386   }
27387 }
27388
27389 // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
27390 function utf8FillLast(buf) {
27391   var p = this.lastTotal - this.lastNeed;
27392   var r = utf8CheckExtraBytes(this, buf, p);
27393   if (r !== undefined) return r;
27394   if (this.lastNeed <= buf.length) {
27395     buf.copy(this.lastChar, p, 0, this.lastNeed);
27396     return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27397   }
27398   buf.copy(this.lastChar, p, 0, buf.length);
27399   this.lastNeed -= buf.length;
27400 }
27401
27402 // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
27403 // partial character, the character's bytes are buffered until the required
27404 // number of bytes are available.
27405 function utf8Text(buf, i) {
27406   var total = utf8CheckIncomplete(this, buf, i);
27407   if (!this.lastNeed) return buf.toString('utf8', i);
27408   this.lastTotal = total;
27409   var end = buf.length - (total - this.lastNeed);
27410   buf.copy(this.lastChar, 0, end);
27411   return buf.toString('utf8', i, end);
27412 }
27413
27414 // For UTF-8, a replacement character is added when ending on a partial
27415 // character.
27416 function utf8End(buf) {
27417   var r = buf && buf.length ? this.write(buf) : '';
27418   if (this.lastNeed) return r + '\ufffd';
27419   return r;
27420 }
27421
27422 // UTF-16LE typically needs two bytes per character, but even if we have an even
27423 // number of bytes available, we need to check if we end on a leading/high
27424 // surrogate. In that case, we need to wait for the next two bytes in order to
27425 // decode the last character properly.
27426 function utf16Text(buf, i) {
27427   if ((buf.length - i) % 2 === 0) {
27428     var r = buf.toString('utf16le', i);
27429     if (r) {
27430       var c = r.charCodeAt(r.length - 1);
27431       if (c >= 0xD800 && c <= 0xDBFF) {
27432         this.lastNeed = 2;
27433         this.lastTotal = 4;
27434         this.lastChar[0] = buf[buf.length - 2];
27435         this.lastChar[1] = buf[buf.length - 1];
27436         return r.slice(0, -1);
27437       }
27438     }
27439     return r;
27440   }
27441   this.lastNeed = 1;
27442   this.lastTotal = 2;
27443   this.lastChar[0] = buf[buf.length - 1];
27444   return buf.toString('utf16le', i, buf.length - 1);
27445 }
27446
27447 // For UTF-16LE we do not explicitly append special replacement characters if we
27448 // end on a partial character, we simply let v8 handle that.
27449 function utf16End(buf) {
27450   var r = buf && buf.length ? this.write(buf) : '';
27451   if (this.lastNeed) {
27452     var end = this.lastTotal - this.lastNeed;
27453     return r + this.lastChar.toString('utf16le', 0, end);
27454   }
27455   return r;
27456 }
27457
27458 function base64Text(buf, i) {
27459   var n = (buf.length - i) % 3;
27460   if (n === 0) return buf.toString('base64', i);
27461   this.lastNeed = 3 - n;
27462   this.lastTotal = 3;
27463   if (n === 1) {
27464     this.lastChar[0] = buf[buf.length - 1];
27465   } else {
27466     this.lastChar[0] = buf[buf.length - 2];
27467     this.lastChar[1] = buf[buf.length - 1];
27468   }
27469   return buf.toString('base64', i, buf.length - n);
27470 }
27471
27472 function base64End(buf) {
27473   var r = buf && buf.length ? this.write(buf) : '';
27474   if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
27475   return r;
27476 }
27477
27478 // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
27479 function simpleWrite(buf) {
27480   return buf.toString(this.encoding);
27481 }
27482
27483 function simpleEnd(buf) {
27484   return buf && buf.length ? this.write(buf) : '';
27485 }
27486
27487 /***/ }),
27488 /* 180 */
27489 /***/ (function(module, exports, __webpack_require__) {
27490
27491 "use strict";
27492 // Copyright Joyent, Inc. and other Node contributors.
27493 //
27494 // Permission is hereby granted, free of charge, to any person obtaining a
27495 // copy of this software and associated documentation files (the
27496 // "Software"), to deal in the Software without restriction, including
27497 // without limitation the rights to use, copy, modify, merge, publish,
27498 // distribute, sublicense, and/or sell copies of the Software, and to permit
27499 // persons to whom the Software is furnished to do so, subject to the
27500 // following conditions:
27501 //
27502 // The above copyright notice and this permission notice shall be included
27503 // in all copies or substantial portions of the Software.
27504 //
27505 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27506 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27507 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27508 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27509 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27510 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27511 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27512
27513 // a transform stream is a readable/writable stream where you do
27514 // something with the data.  Sometimes it's called a "filter",
27515 // but that's not a great name for it, since that implies a thing where
27516 // some bits pass through, and others are simply ignored.  (That would
27517 // be a valid example of a transform, of course.)
27518 //
27519 // While the output is causally related to the input, it's not a
27520 // necessarily symmetric or synchronous transformation.  For example,
27521 // a zlib stream might take multiple plain-text writes(), and then
27522 // emit a single compressed chunk some time in the future.
27523 //
27524 // Here's how this works:
27525 //
27526 // The Transform stream has all the aspects of the readable and writable
27527 // stream classes.  When you write(chunk), that calls _write(chunk,cb)
27528 // internally, and returns false if there's a lot of pending writes
27529 // buffered up.  When you call read(), that calls _read(n) until
27530 // there's enough pending readable data buffered up.
27531 //
27532 // In a transform stream, the written data is placed in a buffer.  When
27533 // _read(n) is called, it transforms the queued up data, calling the
27534 // buffered _write cb's as it consumes chunks.  If consuming a single
27535 // written chunk would result in multiple output chunks, then the first
27536 // outputted bit calls the readcb, and subsequent chunks just go into
27537 // the read buffer, and will cause it to emit 'readable' if necessary.
27538 //
27539 // This way, back-pressure is actually determined by the reading side,
27540 // since _read has to be called to start processing a new chunk.  However,
27541 // a pathological inflate type of transform can cause excessive buffering
27542 // here.  For example, imagine a stream where every byte of input is
27543 // interpreted as an integer from 0-255, and then results in that many
27544 // bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
27545 // 1kb of data being output.  In this case, you could write a very small
27546 // amount of input, and end up with a very large amount of output.  In
27547 // such a pathological inflating mechanism, there'd be no way to tell
27548 // the system to stop doing the transform.  A single 4MB write could
27549 // cause the system to run out of memory.
27550 //
27551 // However, even in such a pathological case, only a single written chunk
27552 // would be consumed, and then the rest would wait (un-transformed) until
27553 // the results of the previous transformed chunk were consumed.
27554
27555
27556
27557 module.exports = Transform;
27558
27559 var Duplex = __webpack_require__(176);
27560
27561 /*<replacement>*/
27562 var util = Object.create(__webpack_require__(173));
27563 util.inherits = __webpack_require__(66);
27564 /*</replacement>*/
27565
27566 util.inherits(Transform, Duplex);
27567
27568 function afterTransform(er, data) {
27569   var ts = this._transformState;
27570   ts.transforming = false;
27571
27572   var cb = ts.writecb;
27573
27574   if (!cb) {
27575     return this.emit('error', new Error('write callback called multiple times'));
27576   }
27577
27578   ts.writechunk = null;
27579   ts.writecb = null;
27580
27581   if (data != null) // single equals check for both `null` and `undefined`
27582     this.push(data);
27583
27584   cb(er);
27585
27586   var rs = this._readableState;
27587   rs.reading = false;
27588   if (rs.needReadable || rs.length < rs.highWaterMark) {
27589     this._read(rs.highWaterMark);
27590   }
27591 }
27592
27593 function Transform(options) {
27594   if (!(this instanceof Transform)) return new Transform(options);
27595
27596   Duplex.call(this, options);
27597
27598   this._transformState = {
27599     afterTransform: afterTransform.bind(this),
27600     needTransform: false,
27601     transforming: false,
27602     writecb: null,
27603     writechunk: null,
27604     writeencoding: null
27605   };
27606
27607   // start out asking for a readable event once data is transformed.
27608   this._readableState.needReadable = true;
27609
27610   // we have implemented the _read method, and done the other things
27611   // that Readable wants before the first _read call, so unset the
27612   // sync guard flag.
27613   this._readableState.sync = false;
27614
27615   if (options) {
27616     if (typeof options.transform === 'function') this._transform = options.transform;
27617
27618     if (typeof options.flush === 'function') this._flush = options.flush;
27619   }
27620
27621   // When the writable side finishes, then flush out anything remaining.
27622   this.on('prefinish', prefinish);
27623 }
27624
27625 function prefinish() {
27626   var _this = this;
27627
27628   if (typeof this._flush === 'function') {
27629     this._flush(function (er, data) {
27630       done(_this, er, data);
27631     });
27632   } else {
27633     done(this, null, null);
27634   }
27635 }
27636
27637 Transform.prototype.push = function (chunk, encoding) {
27638   this._transformState.needTransform = false;
27639   return Duplex.prototype.push.call(this, chunk, encoding);
27640 };
27641
27642 // This is the part where you do stuff!
27643 // override this function in implementation classes.
27644 // 'chunk' is an input chunk.
27645 //
27646 // Call `push(newChunk)` to pass along transformed output
27647 // to the readable side.  You may call 'push' zero or more times.
27648 //
27649 // Call `cb(err)` when you are done with this chunk.  If you pass
27650 // an error, then that'll put the hurt on the whole operation.  If you
27651 // never call cb(), then you'll never get another chunk.
27652 Transform.prototype._transform = function (chunk, encoding, cb) {
27653   throw new Error('_transform() is not implemented');
27654 };
27655
27656 Transform.prototype._write = function (chunk, encoding, cb) {
27657   var ts = this._transformState;
27658   ts.writecb = cb;
27659   ts.writechunk = chunk;
27660   ts.writeencoding = encoding;
27661   if (!ts.transforming) {
27662     var rs = this._readableState;
27663     if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
27664   }
27665 };
27666
27667 // Doesn't matter what the args are here.
27668 // _transform does all the work.
27669 // That we got here means that the readable side wants more data.
27670 Transform.prototype._read = function (n) {
27671   var ts = this._transformState;
27672
27673   if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
27674     ts.transforming = true;
27675     this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
27676   } else {
27677     // mark that we need a transform, so that any data that comes in
27678     // will get processed, now that we've asked for it.
27679     ts.needTransform = true;
27680   }
27681 };
27682
27683 Transform.prototype._destroy = function (err, cb) {
27684   var _this2 = this;
27685
27686   Duplex.prototype._destroy.call(this, err, function (err2) {
27687     cb(err2);
27688     _this2.emit('close');
27689   });
27690 };
27691
27692 function done(stream, er, data) {
27693   if (er) return stream.emit('error', er);
27694
27695   if (data != null) // single equals check for both `null` and `undefined`
27696     stream.push(data);
27697
27698   // if there's nothing in the write buffer, then that means
27699   // that nothing more will ever be provided
27700   if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
27701
27702   if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
27703
27704   return stream.push(null);
27705 }
27706
27707 /***/ }),
27708 /* 181 */
27709 /***/ (function(module, exports, __webpack_require__) {
27710
27711 "use strict";
27712 // Copyright Joyent, Inc. and other Node contributors.
27713 //
27714 // Permission is hereby granted, free of charge, to any person obtaining a
27715 // copy of this software and associated documentation files (the
27716 // "Software"), to deal in the Software without restriction, including
27717 // without limitation the rights to use, copy, modify, merge, publish,
27718 // distribute, sublicense, and/or sell copies of the Software, and to permit
27719 // persons to whom the Software is furnished to do so, subject to the
27720 // following conditions:
27721 //
27722 // The above copyright notice and this permission notice shall be included
27723 // in all copies or substantial portions of the Software.
27724 //
27725 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27726 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27727 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27728 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27729 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27730 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27731 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27732
27733 // a passthrough stream.
27734 // basically just the most minimal sort of Transform stream.
27735 // Every written chunk gets output as-is.
27736
27737
27738
27739 module.exports = PassThrough;
27740
27741 var Transform = __webpack_require__(180);
27742
27743 /*<replacement>*/
27744 var util = Object.create(__webpack_require__(173));
27745 util.inherits = __webpack_require__(66);
27746 /*</replacement>*/
27747
27748 util.inherits(PassThrough, Transform);
27749
27750 function PassThrough(options) {
27751   if (!(this instanceof PassThrough)) return new PassThrough(options);
27752
27753   Transform.call(this, options);
27754 }
27755
27756 PassThrough.prototype._transform = function (chunk, encoding, cb) {
27757   cb(null, chunk);
27758 };
27759
27760 /***/ }),
27761 /* 182 */
27762 /***/ (function(module, exports, __webpack_require__) {
27763
27764 var Stream = __webpack_require__(44);
27765 var util = __webpack_require__(50);
27766
27767 // Backwards compatibility for node versions < 8
27768 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27769   Stream = __webpack_require__(167);
27770
27771 function NoopStream() {
27772   if (!(this instanceof NoopStream)) {
27773     return new NoopStream();
27774   }
27775   Stream.Transform.call(this);
27776 }
27777
27778 util.inherits(NoopStream,Stream.Transform);
27779
27780 NoopStream.prototype._transform = function(d,e,cb) { cb() ;};
27781   
27782 module.exports = NoopStream;
27783
27784 /***/ }),
27785 /* 183 */
27786 /***/ (function(module, exports, __webpack_require__) {
27787
27788 var Promise = __webpack_require__(128);
27789 var Stream = __webpack_require__(44);
27790 var Buffer = __webpack_require__(165);
27791
27792 // Backwards compatibility for node versions < 8
27793 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27794   Stream = __webpack_require__(167);
27795
27796 module.exports = function(entry) {
27797   return new Promise(function(resolve,reject) {
27798     var chunks = [];
27799     var bufferStream = Stream.Transform()
27800       .on('finish',function() {
27801         resolve(Buffer.concat(chunks));
27802       })
27803       .on('error',reject);
27804         
27805     bufferStream._transform = function(d,e,cb) {
27806       chunks.push(d);
27807       cb();
27808     };
27809     entry.on('error',reject)
27810       .pipe(bufferStream);
27811   });
27812 };
27813
27814
27815 /***/ }),
27816 /* 184 */
27817 /***/ (function(module, exports, __webpack_require__) {
27818
27819 var binary = __webpack_require__(123);
27820
27821 module.exports = function(extraField, vars) {
27822   var extra;
27823   // Find the ZIP64 header, if present.
27824   while(!extra && extraField && extraField.length) {
27825     var candidateExtra = binary.parse(extraField)
27826       .word16lu('signature')
27827       .word16lu('partsize')
27828       .word64lu('uncompressedSize')
27829       .word64lu('compressedSize')
27830       .word64lu('offset')
27831       .word64lu('disknum')
27832       .vars;
27833
27834     if(candidateExtra.signature === 0x0001) {
27835       extra = candidateExtra;
27836     } else {
27837       // Advance the buffer to the next part.
27838       // The total size of this part is the 4 byte header + partsize.
27839       extraField = extraField.slice(candidateExtra.partsize + 4);
27840     }
27841   }
27842
27843   extra = extra || {};
27844
27845   if (vars.compressedSize === 0xffffffff)
27846     vars.compressedSize = extra.compressedSize;
27847
27848   if (vars.uncompressedSize  === 0xffffffff)
27849     vars.uncompressedSize= extra.uncompressedSize;
27850
27851   if (vars.offsetToLocalFileHeader === 0xffffffff)
27852     vars.offsetToLocalFileHeader= extra.offset;
27853
27854   return extra;
27855 };
27856
27857
27858 /***/ }),
27859 /* 185 */
27860 /***/ (function(module, exports) {
27861
27862 // Dates in zip file entries are stored as DosDateTime
27863 // Spec is here: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-dosdatetimetofiletime
27864
27865 module.exports = function parseDateTime(date, time) {
27866   const day = date & 0x1F;
27867   const month = date >> 5 & 0x0F;
27868   const year = (date >> 9 & 0x7F) + 1980;
27869   const seconds = time ? (time & 0x1F) * 2 : 0;
27870   const minutes = time ? (time >> 5) & 0x3F : 0;
27871   const hours = time ? (time >> 11): 0;
27872
27873   return new Date(Date.UTC(year, month-1, day, hours, minutes, seconds));
27874 };
27875
27876 /***/ }),
27877 /* 186 */
27878 /***/ (function(module, exports, __webpack_require__) {
27879
27880 var Stream = __webpack_require__(44);
27881 var Parse = __webpack_require__(122);
27882 var duplexer2 = __webpack_require__(187);
27883 var BufferStream = __webpack_require__(183);
27884
27885 // Backwards compatibility for node versions < 8
27886 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27887   Stream = __webpack_require__(167);
27888
27889 function parseOne(match,opts) {
27890   var inStream = Stream.PassThrough({objectMode:true});
27891   var outStream = Stream.PassThrough();
27892   var transform = Stream.Transform({objectMode:true});
27893   var re = match instanceof RegExp ? match : (match && new RegExp(match));
27894   var found;
27895
27896   transform._transform = function(entry,e,cb) {
27897     if (found || (re && !re.exec(entry.path))) {
27898       entry.autodrain();
27899       return cb();
27900     } else {
27901       found = true;
27902       out.emit('entry',entry);
27903       entry.on('error',function(e) {
27904         outStream.emit('error',e);
27905       });
27906       entry.pipe(outStream)
27907         .on('error',function(err) {
27908           cb(err);
27909         })
27910         .on('finish',function(d) {
27911           cb(null,d);
27912         });
27913     }
27914   };
27915
27916   inStream.pipe(Parse(opts))
27917     .on('error',function(err) {
27918       outStream.emit('error',err);
27919     })
27920     .pipe(transform)
27921     .on('error',Object)  // Silence error as its already addressed in transform
27922     .on('finish',function() {
27923       if (!found)
27924         outStream.emit('error',new Error('PATTERN_NOT_FOUND'));
27925       else
27926         outStream.end();
27927     });
27928
27929   var out = duplexer2(inStream,outStream);
27930   out.buffer = function() {
27931     return BufferStream(outStream);
27932   };
27933
27934   return out;
27935 }
27936
27937 module.exports = parseOne;
27938
27939
27940 /***/ }),
27941 /* 187 */
27942 /***/ (function(module, exports, __webpack_require__) {
27943
27944 "use strict";
27945
27946
27947 var stream = __webpack_require__(167);
27948
27949 function DuplexWrapper(options, writable, readable) {
27950   if (typeof readable === "undefined") {
27951     readable = writable;
27952     writable = options;
27953     options = null;
27954   }
27955
27956   stream.Duplex.call(this, options);
27957
27958   if (typeof readable.read !== "function") {
27959     readable = (new stream.Readable(options)).wrap(readable);
27960   }
27961
27962   this._writable = writable;
27963   this._readable = readable;
27964   this._waiting = false;
27965
27966   var self = this;
27967
27968   writable.once("finish", function() {
27969     self.end();
27970   });
27971
27972   this.once("finish", function() {
27973     writable.end();
27974   });
27975
27976   readable.on("readable", function() {
27977     if (self._waiting) {
27978       self._waiting = false;
27979       self._read();
27980     }
27981   });
27982
27983   readable.once("end", function() {
27984     self.push(null);
27985   });
27986
27987   if (!options || typeof options.bubbleErrors === "undefined" || options.bubbleErrors) {
27988     writable.on("error", function(err) {
27989       self.emit("error", err);
27990     });
27991
27992     readable.on("error", function(err) {
27993       self.emit("error", err);
27994     });
27995   }
27996 }
27997
27998 DuplexWrapper.prototype = Object.create(stream.Duplex.prototype, {constructor: {value: DuplexWrapper}});
27999
28000 DuplexWrapper.prototype._write = function _write(input, encoding, done) {
28001   this._writable.write(input, encoding, done);
28002 };
28003
28004 DuplexWrapper.prototype._read = function _read() {
28005   var buf;
28006   var reads = 0;
28007   while ((buf = this._readable.read()) !== null) {
28008     this.push(buf);
28009     reads++;
28010   }
28011   if (reads === 0) {
28012     this._waiting = true;
28013   }
28014 };
28015
28016 module.exports = function duplex2(options, writable, readable) {
28017   return new DuplexWrapper(options, writable, readable);
28018 };
28019
28020 module.exports.DuplexWrapper = DuplexWrapper;
28021
28022
28023 /***/ }),
28024 /* 188 */
28025 /***/ (function(module, exports, __webpack_require__) {
28026
28027 module.exports = Extract;
28028
28029 var Parse = __webpack_require__(122);
28030 var Writer = __webpack_require__(189).Writer;
28031 var path = __webpack_require__(2);
28032 var stream = __webpack_require__(44);
28033 var duplexer2 = __webpack_require__(187);
28034 var Promise = __webpack_require__(128);
28035
28036 function Extract (opts) {
28037   // make sure path is normalized before using it
28038   opts.path = path.resolve(path.normalize(opts.path));
28039
28040   var parser = new Parse(opts);
28041
28042   var outStream = new stream.Writable({objectMode: true});
28043   outStream._write = function(entry, encoding, cb) {
28044
28045     if (entry.type == 'Directory') return cb();
28046
28047     // to avoid zip slip (writing outside of the destination), we resolve
28048     // the target path, and make sure it's nested in the intended
28049     // destination, or not extract it otherwise.
28050     var extractPath = path.join(opts.path, entry.path);
28051     if (extractPath.indexOf(opts.path) != 0) {
28052       return cb();
28053     }
28054
28055     const writer = opts.getWriter ? opts.getWriter({path: extractPath}) :  Writer({ path: extractPath });
28056
28057     entry.pipe(writer)
28058       .on('error', cb)
28059       .on('close', cb);
28060   };
28061
28062   var extract = duplexer2(parser,outStream);
28063   parser.once('crx-header', function(crxHeader) {
28064     extract.crxHeader = crxHeader;
28065   });
28066
28067   parser
28068     .pipe(outStream)
28069     .on('finish',function() {
28070       extract.emit('close');
28071     });
28072   
28073   extract.promise = function() {
28074     return new Promise(function(resolve, reject) {
28075       extract.on('close', resolve);
28076       extract.on('error',reject);
28077     });
28078   };
28079
28080   return extract;
28081 }
28082
28083
28084 /***/ }),
28085 /* 189 */
28086 /***/ (function(module, exports, __webpack_require__) {
28087
28088 exports.Abstract = __webpack_require__(190)
28089 exports.Reader = __webpack_require__(191)
28090 exports.Writer = __webpack_require__(203)
28091
28092 exports.File = {
28093   Reader: __webpack_require__(200),
28094   Writer: __webpack_require__(209)
28095 }
28096
28097 exports.Dir = {
28098   Reader: __webpack_require__(199),
28099   Writer: __webpack_require__(206)
28100 }
28101
28102 exports.Link = {
28103   Reader: __webpack_require__(198),
28104   Writer: __webpack_require__(208)
28105 }
28106
28107 exports.Proxy = {
28108   Reader: __webpack_require__(202),
28109   Writer: __webpack_require__(210)
28110 }
28111
28112 exports.Reader.Dir = exports.DirReader = exports.Dir.Reader
28113 exports.Reader.File = exports.FileReader = exports.File.Reader
28114 exports.Reader.Link = exports.LinkReader = exports.Link.Reader
28115 exports.Reader.Proxy = exports.ProxyReader = exports.Proxy.Reader
28116
28117 exports.Writer.Dir = exports.DirWriter = exports.Dir.Writer
28118 exports.Writer.File = exports.FileWriter = exports.File.Writer
28119 exports.Writer.Link = exports.LinkWriter = exports.Link.Writer
28120 exports.Writer.Proxy = exports.ProxyWriter = exports.Proxy.Writer
28121
28122 exports.collect = __webpack_require__(207)
28123
28124
28125 /***/ }),
28126 /* 190 */
28127 /***/ (function(module, exports, __webpack_require__) {
28128
28129 // the parent class for all fstreams.
28130
28131 module.exports = Abstract
28132
28133 var Stream = __webpack_require__(44).Stream
28134 var inherits = __webpack_require__(66)
28135
28136 function Abstract () {
28137   Stream.call(this)
28138 }
28139
28140 inherits(Abstract, Stream)
28141
28142 Abstract.prototype.on = function (ev, fn) {
28143   if (ev === 'ready' && this.ready) {
28144     process.nextTick(fn.bind(this))
28145   } else {
28146     Stream.prototype.on.call(this, ev, fn)
28147   }
28148   return this
28149 }
28150
28151 Abstract.prototype.abort = function () {
28152   this._aborted = true
28153   this.emit('abort')
28154 }
28155
28156 Abstract.prototype.destroy = function () {}
28157
28158 Abstract.prototype.warn = function (msg, code) {
28159   var self = this
28160   var er = decorate(msg, code, self)
28161   if (!self.listeners('warn')) {
28162     console.error('%s %s\n' +
28163     'path = %s\n' +
28164     'syscall = %s\n' +
28165     'fstream_type = %s\n' +
28166     'fstream_path = %s\n' +
28167     'fstream_unc_path = %s\n' +
28168     'fstream_class = %s\n' +
28169     'fstream_stack =\n%s\n',
28170       code || 'UNKNOWN',
28171       er.stack,
28172       er.path,
28173       er.syscall,
28174       er.fstream_type,
28175       er.fstream_path,
28176       er.fstream_unc_path,
28177       er.fstream_class,
28178       er.fstream_stack.join('\n'))
28179   } else {
28180     self.emit('warn', er)
28181   }
28182 }
28183
28184 Abstract.prototype.info = function (msg, code) {
28185   this.emit('info', msg, code)
28186 }
28187
28188 Abstract.prototype.error = function (msg, code, th) {
28189   var er = decorate(msg, code, this)
28190   if (th) throw er
28191   else this.emit('error', er)
28192 }
28193
28194 function decorate (er, code, self) {
28195   if (!(er instanceof Error)) er = new Error(er)
28196   er.code = er.code || code
28197   er.path = er.path || self.path
28198   er.fstream_type = er.fstream_type || self.type
28199   er.fstream_path = er.fstream_path || self.path
28200   if (self._path !== self.path) {
28201     er.fstream_unc_path = er.fstream_unc_path || self._path
28202   }
28203   if (self.linkpath) {
28204     er.fstream_linkpath = er.fstream_linkpath || self.linkpath
28205   }
28206   er.fstream_class = er.fstream_class || self.constructor.name
28207   er.fstream_stack = er.fstream_stack ||
28208     new Error().stack.split(/\n/).slice(3).map(function (s) {
28209       return s.replace(/^ {4}at /, '')
28210     })
28211
28212   return er
28213 }
28214
28215
28216 /***/ }),
28217 /* 191 */
28218 /***/ (function(module, exports, __webpack_require__) {
28219
28220 module.exports = Reader
28221
28222 var fs = __webpack_require__(192)
28223 var Stream = __webpack_require__(44).Stream
28224 var inherits = __webpack_require__(66)
28225 var path = __webpack_require__(2)
28226 var getType = __webpack_require__(197)
28227 var hardLinks = Reader.hardLinks = {}
28228 var Abstract = __webpack_require__(190)
28229
28230 // Must do this *before* loading the child classes
28231 inherits(Reader, Abstract)
28232
28233 var LinkReader = __webpack_require__(198)
28234
28235 function Reader (props, currentStat) {
28236   var self = this
28237   if (!(self instanceof Reader)) return new Reader(props, currentStat)
28238
28239   if (typeof props === 'string') {
28240     props = { path: props }
28241   }
28242
28243   // polymorphism.
28244   // call fstream.Reader(dir) to get a DirReader object, etc.
28245   // Note that, unlike in the Writer case, ProxyReader is going
28246   // to be the *normal* state of affairs, since we rarely know
28247   // the type of a file prior to reading it.
28248
28249   var type
28250   var ClassType
28251
28252   if (props.type && typeof props.type === 'function') {
28253     type = props.type
28254     ClassType = type
28255   } else {
28256     type = getType(props)
28257     ClassType = Reader
28258   }
28259
28260   if (currentStat && !type) {
28261     type = getType(currentStat)
28262     props[type] = true
28263     props.type = type
28264   }
28265
28266   switch (type) {
28267     case 'Directory':
28268       ClassType = __webpack_require__(199)
28269       break
28270
28271     case 'Link':
28272     // XXX hard links are just files.
28273     // However, it would be good to keep track of files' dev+inode
28274     // and nlink values, and create a HardLinkReader that emits
28275     // a linkpath value of the original copy, so that the tar
28276     // writer can preserve them.
28277     // ClassType = HardLinkReader
28278     // break
28279
28280     case 'File':
28281       ClassType = __webpack_require__(200)
28282       break
28283
28284     case 'SymbolicLink':
28285       ClassType = LinkReader
28286       break
28287
28288     case 'Socket':
28289       ClassType = __webpack_require__(201)
28290       break
28291
28292     case null:
28293       ClassType = __webpack_require__(202)
28294       break
28295   }
28296
28297   if (!(self instanceof ClassType)) {
28298     return new ClassType(props)
28299   }
28300
28301   Abstract.call(self)
28302
28303   if (!props.path) {
28304     self.error('Must provide a path', null, true)
28305   }
28306
28307   self.readable = true
28308   self.writable = false
28309
28310   self.type = type
28311   self.props = props
28312   self.depth = props.depth = props.depth || 0
28313   self.parent = props.parent || null
28314   self.root = props.root || (props.parent && props.parent.root) || self
28315
28316   self._path = self.path = path.resolve(props.path)
28317   if (process.platform === 'win32') {
28318     self.path = self._path = self.path.replace(/\?/g, '_')
28319     if (self._path.length >= 260) {
28320       // how DOES one create files on the moon?
28321       // if the path has spaces in it, then UNC will fail.
28322       self._swallowErrors = true
28323       // if (self._path.indexOf(" ") === -1) {
28324       self._path = '\\\\?\\' + self.path.replace(/\//g, '\\')
28325     // }
28326     }
28327   }
28328   self.basename = props.basename = path.basename(self.path)
28329   self.dirname = props.dirname = path.dirname(self.path)
28330
28331   // these have served their purpose, and are now just noisy clutter
28332   props.parent = props.root = null
28333
28334   // console.error("\n\n\n%s setting size to", props.path, props.size)
28335   self.size = props.size
28336   self.filter = typeof props.filter === 'function' ? props.filter : null
28337   if (props.sort === 'alpha') props.sort = alphasort
28338
28339   // start the ball rolling.
28340   // this will stat the thing, and then call self._read()
28341   // to start reading whatever it is.
28342   // console.error("calling stat", props.path, currentStat)
28343   self._stat(currentStat)
28344 }
28345
28346 function alphasort (a, b) {
28347   return a === b ? 0
28348     : a.toLowerCase() > b.toLowerCase() ? 1
28349       : a.toLowerCase() < b.toLowerCase() ? -1
28350         : a > b ? 1
28351           : -1
28352 }
28353
28354 Reader.prototype._stat = function (currentStat) {
28355   var self = this
28356   var props = self.props
28357   var stat = props.follow ? 'stat' : 'lstat'
28358   // console.error("Reader._stat", self._path, currentStat)
28359   if (currentStat) process.nextTick(statCb.bind(null, null, currentStat))
28360   else fs[stat](self._path, statCb)
28361
28362   function statCb (er, props_) {
28363     // console.error("Reader._stat, statCb", self._path, props_, props_.nlink)
28364     if (er) return self.error(er)
28365
28366     Object.keys(props_).forEach(function (k) {
28367       props[k] = props_[k]
28368     })
28369
28370     // if it's not the expected size, then abort here.
28371     if (undefined !== self.size && props.size !== self.size) {
28372       return self.error('incorrect size')
28373     }
28374     self.size = props.size
28375
28376     var type = getType(props)
28377     var handleHardlinks = props.hardlinks !== false
28378
28379     // special little thing for handling hardlinks.
28380     if (handleHardlinks && type !== 'Directory' && props.nlink && props.nlink > 1) {
28381       var k = props.dev + ':' + props.ino
28382       // console.error("Reader has nlink", self._path, k)
28383       if (hardLinks[k] === self._path || !hardLinks[k]) {
28384         hardLinks[k] = self._path
28385       } else {
28386         // switch into hardlink mode.
28387         type = self.type = self.props.type = 'Link'
28388         self.Link = self.props.Link = true
28389         self.linkpath = self.props.linkpath = hardLinks[k]
28390         // console.error("Hardlink detected, switching mode", self._path, self.linkpath)
28391         // Setting __proto__ would arguably be the "correct"
28392         // approach here, but that just seems too wrong.
28393         self._stat = self._read = LinkReader.prototype._read
28394       }
28395     }
28396
28397     if (self.type && self.type !== type) {
28398       self.error('Unexpected type: ' + type)
28399     }
28400
28401     // if the filter doesn't pass, then just skip over this one.
28402     // still have to emit end so that dir-walking can move on.
28403     if (self.filter) {
28404       var who = self._proxy || self
28405       // special handling for ProxyReaders
28406       if (!self.filter.call(who, who, props)) {
28407         if (!self._disowned) {
28408           self.abort()
28409           self.emit('end')
28410           self.emit('close')
28411         }
28412         return
28413       }
28414     }
28415
28416     // last chance to abort or disown before the flow starts!
28417     var events = ['_stat', 'stat', 'ready']
28418     var e = 0
28419     ;(function go () {
28420       if (self._aborted) {
28421         self.emit('end')
28422         self.emit('close')
28423         return
28424       }
28425
28426       if (self._paused && self.type !== 'Directory') {
28427         self.once('resume', go)
28428         return
28429       }
28430
28431       var ev = events[e++]
28432       if (!ev) {
28433         return self._read()
28434       }
28435       self.emit(ev, props)
28436       go()
28437     })()
28438   }
28439 }
28440
28441 Reader.prototype.pipe = function (dest) {
28442   var self = this
28443   if (typeof dest.add === 'function') {
28444     // piping to a multi-compatible, and we've got directory entries.
28445     self.on('entry', function (entry) {
28446       var ret = dest.add(entry)
28447       if (ret === false) {
28448         self.pause()
28449       }
28450     })
28451   }
28452
28453   // console.error("R Pipe apply Stream Pipe")
28454   return Stream.prototype.pipe.apply(this, arguments)
28455 }
28456
28457 Reader.prototype.pause = function (who) {
28458   this._paused = true
28459   who = who || this
28460   this.emit('pause', who)
28461   if (this._stream) this._stream.pause(who)
28462 }
28463
28464 Reader.prototype.resume = function (who) {
28465   this._paused = false
28466   who = who || this
28467   this.emit('resume', who)
28468   if (this._stream) this._stream.resume(who)
28469   this._read()
28470 }
28471
28472 Reader.prototype._read = function () {
28473   this.error('Cannot read unknown type: ' + this.type)
28474 }
28475
28476
28477 /***/ }),
28478 /* 192 */
28479 /***/ (function(module, exports, __webpack_require__) {
28480
28481 var fs = __webpack_require__(42)
28482 var polyfills = __webpack_require__(193)
28483 var legacy = __webpack_require__(195)
28484 var clone = __webpack_require__(196)
28485
28486 var util = __webpack_require__(50)
28487
28488 /* istanbul ignore next - node 0.x polyfill */
28489 var gracefulQueue
28490 var previousSymbol
28491
28492 /* istanbul ignore else - node 0.x polyfill */
28493 if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
28494   gracefulQueue = Symbol.for('graceful-fs.queue')
28495   // This is used in testing by future versions
28496   previousSymbol = Symbol.for('graceful-fs.previous')
28497 } else {
28498   gracefulQueue = '___graceful-fs.queue'
28499   previousSymbol = '___graceful-fs.previous'
28500 }
28501
28502 function noop () {}
28503
28504 var debug = noop
28505 if (util.debuglog)
28506   debug = util.debuglog('gfs4')
28507 else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
28508   debug = function() {
28509     var m = util.format.apply(util, arguments)
28510     m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
28511     console.error(m)
28512   }
28513
28514 // Once time initialization
28515 if (!global[gracefulQueue]) {
28516   // This queue can be shared by multiple loaded instances
28517   var queue = []
28518   Object.defineProperty(global, gracefulQueue, {
28519     get: function() {
28520       return queue
28521     }
28522   })
28523
28524   // Patch fs.close/closeSync to shared queue version, because we need
28525   // to retry() whenever a close happens *anywhere* in the program.
28526   // This is essential when multiple graceful-fs instances are
28527   // in play at the same time.
28528   fs.close = (function (fs$close) {
28529     function close (fd, cb) {
28530       return fs$close.call(fs, fd, function (err) {
28531         // This function uses the graceful-fs shared queue
28532         if (!err) {
28533           retry()
28534         }
28535
28536         if (typeof cb === 'function')
28537           cb.apply(this, arguments)
28538       })
28539     }
28540
28541     Object.defineProperty(close, previousSymbol, {
28542       value: fs$close
28543     })
28544     return close
28545   })(fs.close)
28546
28547   fs.closeSync = (function (fs$closeSync) {
28548     function closeSync (fd) {
28549       // This function uses the graceful-fs shared queue
28550       fs$closeSync.apply(fs, arguments)
28551       retry()
28552     }
28553
28554     Object.defineProperty(closeSync, previousSymbol, {
28555       value: fs$closeSync
28556     })
28557     return closeSync
28558   })(fs.closeSync)
28559
28560   if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
28561     process.on('exit', function() {
28562       debug(global[gracefulQueue])
28563       __webpack_require__(58).equal(global[gracefulQueue].length, 0)
28564     })
28565   }
28566 }
28567
28568 module.exports = patch(clone(fs))
28569 if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
28570     module.exports = patch(fs)
28571     fs.__patched = true;
28572 }
28573
28574 function patch (fs) {
28575   // Everything that references the open() function needs to be in here
28576   polyfills(fs)
28577   fs.gracefulify = patch
28578
28579   fs.createReadStream = createReadStream
28580   fs.createWriteStream = createWriteStream
28581   var fs$readFile = fs.readFile
28582   fs.readFile = readFile
28583   function readFile (path, options, cb) {
28584     if (typeof options === 'function')
28585       cb = options, options = null
28586
28587     return go$readFile(path, options, cb)
28588
28589     function go$readFile (path, options, cb) {
28590       return fs$readFile(path, options, function (err) {
28591         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28592           enqueue([go$readFile, [path, options, cb]])
28593         else {
28594           if (typeof cb === 'function')
28595             cb.apply(this, arguments)
28596           retry()
28597         }
28598       })
28599     }
28600   }
28601
28602   var fs$writeFile = fs.writeFile
28603   fs.writeFile = writeFile
28604   function writeFile (path, data, options, cb) {
28605     if (typeof options === 'function')
28606       cb = options, options = null
28607
28608     return go$writeFile(path, data, options, cb)
28609
28610     function go$writeFile (path, data, options, cb) {
28611       return fs$writeFile(path, data, options, function (err) {
28612         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28613           enqueue([go$writeFile, [path, data, options, cb]])
28614         else {
28615           if (typeof cb === 'function')
28616             cb.apply(this, arguments)
28617           retry()
28618         }
28619       })
28620     }
28621   }
28622
28623   var fs$appendFile = fs.appendFile
28624   if (fs$appendFile)
28625     fs.appendFile = appendFile
28626   function appendFile (path, data, options, cb) {
28627     if (typeof options === 'function')
28628       cb = options, options = null
28629
28630     return go$appendFile(path, data, options, cb)
28631
28632     function go$appendFile (path, data, options, cb) {
28633       return fs$appendFile(path, data, options, function (err) {
28634         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28635           enqueue([go$appendFile, [path, data, options, cb]])
28636         else {
28637           if (typeof cb === 'function')
28638             cb.apply(this, arguments)
28639           retry()
28640         }
28641       })
28642     }
28643   }
28644
28645   var fs$readdir = fs.readdir
28646   fs.readdir = readdir
28647   function readdir (path, options, cb) {
28648     var args = [path]
28649     if (typeof options !== 'function') {
28650       args.push(options)
28651     } else {
28652       cb = options
28653     }
28654     args.push(go$readdir$cb)
28655
28656     return go$readdir(args)
28657
28658     function go$readdir$cb (err, files) {
28659       if (files && files.sort)
28660         files.sort()
28661
28662       if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28663         enqueue([go$readdir, [args]])
28664
28665       else {
28666         if (typeof cb === 'function')
28667           cb.apply(this, arguments)
28668         retry()
28669       }
28670     }
28671   }
28672
28673   function go$readdir (args) {
28674     return fs$readdir.apply(fs, args)
28675   }
28676
28677   if (process.version.substr(0, 4) === 'v0.8') {
28678     var legStreams = legacy(fs)
28679     ReadStream = legStreams.ReadStream
28680     WriteStream = legStreams.WriteStream
28681   }
28682
28683   var fs$ReadStream = fs.ReadStream
28684   if (fs$ReadStream) {
28685     ReadStream.prototype = Object.create(fs$ReadStream.prototype)
28686     ReadStream.prototype.open = ReadStream$open
28687   }
28688
28689   var fs$WriteStream = fs.WriteStream
28690   if (fs$WriteStream) {
28691     WriteStream.prototype = Object.create(fs$WriteStream.prototype)
28692     WriteStream.prototype.open = WriteStream$open
28693   }
28694
28695   Object.defineProperty(fs, 'ReadStream', {
28696     get: function () {
28697       return ReadStream
28698     },
28699     set: function (val) {
28700       ReadStream = val
28701     },
28702     enumerable: true,
28703     configurable: true
28704   })
28705   Object.defineProperty(fs, 'WriteStream', {
28706     get: function () {
28707       return WriteStream
28708     },
28709     set: function (val) {
28710       WriteStream = val
28711     },
28712     enumerable: true,
28713     configurable: true
28714   })
28715
28716   // legacy names
28717   var FileReadStream = ReadStream
28718   Object.defineProperty(fs, 'FileReadStream', {
28719     get: function () {
28720       return FileReadStream
28721     },
28722     set: function (val) {
28723       FileReadStream = val
28724     },
28725     enumerable: true,
28726     configurable: true
28727   })
28728   var FileWriteStream = WriteStream
28729   Object.defineProperty(fs, 'FileWriteStream', {
28730     get: function () {
28731       return FileWriteStream
28732     },
28733     set: function (val) {
28734       FileWriteStream = val
28735     },
28736     enumerable: true,
28737     configurable: true
28738   })
28739
28740   function ReadStream (path, options) {
28741     if (this instanceof ReadStream)
28742       return fs$ReadStream.apply(this, arguments), this
28743     else
28744       return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
28745   }
28746
28747   function ReadStream$open () {
28748     var that = this
28749     open(that.path, that.flags, that.mode, function (err, fd) {
28750       if (err) {
28751         if (that.autoClose)
28752           that.destroy()
28753
28754         that.emit('error', err)
28755       } else {
28756         that.fd = fd
28757         that.emit('open', fd)
28758         that.read()
28759       }
28760     })
28761   }
28762
28763   function WriteStream (path, options) {
28764     if (this instanceof WriteStream)
28765       return fs$WriteStream.apply(this, arguments), this
28766     else
28767       return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
28768   }
28769
28770   function WriteStream$open () {
28771     var that = this
28772     open(that.path, that.flags, that.mode, function (err, fd) {
28773       if (err) {
28774         that.destroy()
28775         that.emit('error', err)
28776       } else {
28777         that.fd = fd
28778         that.emit('open', fd)
28779       }
28780     })
28781   }
28782
28783   function createReadStream (path, options) {
28784     return new fs.ReadStream(path, options)
28785   }
28786
28787   function createWriteStream (path, options) {
28788     return new fs.WriteStream(path, options)
28789   }
28790
28791   var fs$open = fs.open
28792   fs.open = open
28793   function open (path, flags, mode, cb) {
28794     if (typeof mode === 'function')
28795       cb = mode, mode = null
28796
28797     return go$open(path, flags, mode, cb)
28798
28799     function go$open (path, flags, mode, cb) {
28800       return fs$open(path, flags, mode, function (err, fd) {
28801         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28802           enqueue([go$open, [path, flags, mode, cb]])
28803         else {
28804           if (typeof cb === 'function')
28805             cb.apply(this, arguments)
28806           retry()
28807         }
28808       })
28809     }
28810   }
28811
28812   return fs
28813 }
28814
28815 function enqueue (elem) {
28816   debug('ENQUEUE', elem[0].name, elem[1])
28817   global[gracefulQueue].push(elem)
28818 }
28819
28820 function retry () {
28821   var elem = global[gracefulQueue].shift()
28822   if (elem) {
28823     debug('RETRY', elem[0].name, elem[1])
28824     elem[0].apply(null, elem[1])
28825   }
28826 }
28827
28828
28829 /***/ }),
28830 /* 193 */
28831 /***/ (function(module, exports, __webpack_require__) {
28832
28833 var constants = __webpack_require__(194)
28834
28835 var origCwd = process.cwd
28836 var cwd = null
28837
28838 var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
28839
28840 process.cwd = function() {
28841   if (!cwd)
28842     cwd = origCwd.call(process)
28843   return cwd
28844 }
28845 try {
28846   process.cwd()
28847 } catch (er) {}
28848
28849 var chdir = process.chdir
28850 process.chdir = function(d) {
28851   cwd = null
28852   chdir.call(process, d)
28853 }
28854
28855 module.exports = patch
28856
28857 function patch (fs) {
28858   // (re-)implement some things that are known busted or missing.
28859
28860   // lchmod, broken prior to 0.6.2
28861   // back-port the fix here.
28862   if (constants.hasOwnProperty('O_SYMLINK') &&
28863       process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
28864     patchLchmod(fs)
28865   }
28866
28867   // lutimes implementation, or no-op
28868   if (!fs.lutimes) {
28869     patchLutimes(fs)
28870   }
28871
28872   // https://github.com/isaacs/node-graceful-fs/issues/4
28873   // Chown should not fail on einval or eperm if non-root.
28874   // It should not fail on enosys ever, as this just indicates
28875   // that a fs doesn't support the intended operation.
28876
28877   fs.chown = chownFix(fs.chown)
28878   fs.fchown = chownFix(fs.fchown)
28879   fs.lchown = chownFix(fs.lchown)
28880
28881   fs.chmod = chmodFix(fs.chmod)
28882   fs.fchmod = chmodFix(fs.fchmod)
28883   fs.lchmod = chmodFix(fs.lchmod)
28884
28885   fs.chownSync = chownFixSync(fs.chownSync)
28886   fs.fchownSync = chownFixSync(fs.fchownSync)
28887   fs.lchownSync = chownFixSync(fs.lchownSync)
28888
28889   fs.chmodSync = chmodFixSync(fs.chmodSync)
28890   fs.fchmodSync = chmodFixSync(fs.fchmodSync)
28891   fs.lchmodSync = chmodFixSync(fs.lchmodSync)
28892
28893   fs.stat = statFix(fs.stat)
28894   fs.fstat = statFix(fs.fstat)
28895   fs.lstat = statFix(fs.lstat)
28896
28897   fs.statSync = statFixSync(fs.statSync)
28898   fs.fstatSync = statFixSync(fs.fstatSync)
28899   fs.lstatSync = statFixSync(fs.lstatSync)
28900
28901   // if lchmod/lchown do not exist, then make them no-ops
28902   if (!fs.lchmod) {
28903     fs.lchmod = function (path, mode, cb) {
28904       if (cb) process.nextTick(cb)
28905     }
28906     fs.lchmodSync = function () {}
28907   }
28908   if (!fs.lchown) {
28909     fs.lchown = function (path, uid, gid, cb) {
28910       if (cb) process.nextTick(cb)
28911     }
28912     fs.lchownSync = function () {}
28913   }
28914
28915   // on Windows, A/V software can lock the directory, causing this
28916   // to fail with an EACCES or EPERM if the directory contains newly
28917   // created files.  Try again on failure, for up to 60 seconds.
28918
28919   // Set the timeout this long because some Windows Anti-Virus, such as Parity
28920   // bit9, may lock files for up to a minute, causing npm package install
28921   // failures. Also, take care to yield the scheduler. Windows scheduling gives
28922   // CPU to a busy looping process, which can cause the program causing the lock
28923   // contention to be starved of CPU by node, so the contention doesn't resolve.
28924   if (platform === "win32") {
28925     fs.rename = (function (fs$rename) { return function (from, to, cb) {
28926       var start = Date.now()
28927       var backoff = 0;
28928       fs$rename(from, to, function CB (er) {
28929         if (er
28930             && (er.code === "EACCES" || er.code === "EPERM")
28931             && Date.now() - start < 60000) {
28932           setTimeout(function() {
28933             fs.stat(to, function (stater, st) {
28934               if (stater && stater.code === "ENOENT")
28935                 fs$rename(from, to, CB);
28936               else
28937                 cb(er)
28938             })
28939           }, backoff)
28940           if (backoff < 100)
28941             backoff += 10;
28942           return;
28943         }
28944         if (cb) cb(er)
28945       })
28946     }})(fs.rename)
28947   }
28948
28949   // if read() returns EAGAIN, then just try it again.
28950   fs.read = (function (fs$read) {
28951     function read (fd, buffer, offset, length, position, callback_) {
28952       var callback
28953       if (callback_ && typeof callback_ === 'function') {
28954         var eagCounter = 0
28955         callback = function (er, _, __) {
28956           if (er && er.code === 'EAGAIN' && eagCounter < 10) {
28957             eagCounter ++
28958             return fs$read.call(fs, fd, buffer, offset, length, position, callback)
28959           }
28960           callback_.apply(this, arguments)
28961         }
28962       }
28963       return fs$read.call(fs, fd, buffer, offset, length, position, callback)
28964     }
28965
28966     // This ensures `util.promisify` works as it does for native `fs.read`.
28967     read.__proto__ = fs$read
28968     return read
28969   })(fs.read)
28970
28971   fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
28972     var eagCounter = 0
28973     while (true) {
28974       try {
28975         return fs$readSync.call(fs, fd, buffer, offset, length, position)
28976       } catch (er) {
28977         if (er.code === 'EAGAIN' && eagCounter < 10) {
28978           eagCounter ++
28979           continue
28980         }
28981         throw er
28982       }
28983     }
28984   }})(fs.readSync)
28985
28986   function patchLchmod (fs) {
28987     fs.lchmod = function (path, mode, callback) {
28988       fs.open( path
28989              , constants.O_WRONLY | constants.O_SYMLINK
28990              , mode
28991              , function (err, fd) {
28992         if (err) {
28993           if (callback) callback(err)
28994           return
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         fs.fchmod(fd, mode, function (err) {
28999           fs.close(fd, function(err2) {
29000             if (callback) callback(err || err2)
29001           })
29002         })
29003       })
29004     }
29005
29006     fs.lchmodSync = function (path, mode) {
29007       var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
29008
29009       // prefer to return the chmod error, if one occurs,
29010       // but still try to close, and report closing errors if they occur.
29011       var threw = true
29012       var ret
29013       try {
29014         ret = fs.fchmodSync(fd, mode)
29015         threw = false
29016       } finally {
29017         if (threw) {
29018           try {
29019             fs.closeSync(fd)
29020           } catch (er) {}
29021         } else {
29022           fs.closeSync(fd)
29023         }
29024       }
29025       return ret
29026     }
29027   }
29028
29029   function patchLutimes (fs) {
29030     if (constants.hasOwnProperty("O_SYMLINK")) {
29031       fs.lutimes = function (path, at, mt, cb) {
29032         fs.open(path, constants.O_SYMLINK, function (er, fd) {
29033           if (er) {
29034             if (cb) cb(er)
29035             return
29036           }
29037           fs.futimes(fd, at, mt, function (er) {
29038             fs.close(fd, function (er2) {
29039               if (cb) cb(er || er2)
29040             })
29041           })
29042         })
29043       }
29044
29045       fs.lutimesSync = function (path, at, mt) {
29046         var fd = fs.openSync(path, constants.O_SYMLINK)
29047         var ret
29048         var threw = true
29049         try {
29050           ret = fs.futimesSync(fd, at, mt)
29051           threw = false
29052         } finally {
29053           if (threw) {
29054             try {
29055               fs.closeSync(fd)
29056             } catch (er) {}
29057           } else {
29058             fs.closeSync(fd)
29059           }
29060         }
29061         return ret
29062       }
29063
29064     } else {
29065       fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
29066       fs.lutimesSync = function () {}
29067     }
29068   }
29069
29070   function chmodFix (orig) {
29071     if (!orig) return orig
29072     return function (target, mode, cb) {
29073       return orig.call(fs, target, mode, function (er) {
29074         if (chownErOk(er)) er = null
29075         if (cb) cb.apply(this, arguments)
29076       })
29077     }
29078   }
29079
29080   function chmodFixSync (orig) {
29081     if (!orig) return orig
29082     return function (target, mode) {
29083       try {
29084         return orig.call(fs, target, mode)
29085       } catch (er) {
29086         if (!chownErOk(er)) throw er
29087       }
29088     }
29089   }
29090
29091
29092   function chownFix (orig) {
29093     if (!orig) return orig
29094     return function (target, uid, gid, cb) {
29095       return orig.call(fs, target, uid, gid, function (er) {
29096         if (chownErOk(er)) er = null
29097         if (cb) cb.apply(this, arguments)
29098       })
29099     }
29100   }
29101
29102   function chownFixSync (orig) {
29103     if (!orig) return orig
29104     return function (target, uid, gid) {
29105       try {
29106         return orig.call(fs, target, uid, gid)
29107       } catch (er) {
29108         if (!chownErOk(er)) throw er
29109       }
29110     }
29111   }
29112
29113   function statFix (orig) {
29114     if (!orig) return orig
29115     // Older versions of Node erroneously returned signed integers for
29116     // uid + gid.
29117     return function (target, options, cb) {
29118       if (typeof options === 'function') {
29119         cb = options
29120         options = null
29121       }
29122       function callback (er, stats) {
29123         if (stats) {
29124           if (stats.uid < 0) stats.uid += 0x100000000
29125           if (stats.gid < 0) stats.gid += 0x100000000
29126         }
29127         if (cb) cb.apply(this, arguments)
29128       }
29129       return options ? orig.call(fs, target, options, callback)
29130         : orig.call(fs, target, callback)
29131     }
29132   }
29133
29134   function statFixSync (orig) {
29135     if (!orig) return orig
29136     // Older versions of Node erroneously returned signed integers for
29137     // uid + gid.
29138     return function (target, options) {
29139       var stats = options ? orig.call(fs, target, options)
29140         : orig.call(fs, target)
29141       if (stats.uid < 0) stats.uid += 0x100000000
29142       if (stats.gid < 0) stats.gid += 0x100000000
29143       return stats;
29144     }
29145   }
29146
29147   // ENOSYS means that the fs doesn't support the op. Just ignore
29148   // that, because it doesn't matter.
29149   //
29150   // if there's no getuid, or if getuid() is something other
29151   // than 0, and the error is EINVAL or EPERM, then just ignore
29152   // it.
29153   //
29154   // This specific case is a silent failure in cp, install, tar,
29155   // and most other unix tools that manage permissions.
29156   //
29157   // When running as root, or if other types of errors are
29158   // encountered, then it's strict.
29159   function chownErOk (er) {
29160     if (!er)
29161       return true
29162
29163     if (er.code === "ENOSYS")
29164       return true
29165
29166     var nonroot = !process.getuid || process.getuid() !== 0
29167     if (nonroot) {
29168       if (er.code === "EINVAL" || er.code === "EPERM")
29169         return true
29170     }
29171
29172     return false
29173   }
29174 }
29175
29176
29177 /***/ }),
29178 /* 194 */
29179 /***/ (function(module, exports) {
29180
29181 module.exports = require("constants");
29182
29183 /***/ }),
29184 /* 195 */
29185 /***/ (function(module, exports, __webpack_require__) {
29186
29187 var Stream = __webpack_require__(44).Stream
29188
29189 module.exports = legacy
29190
29191 function legacy (fs) {
29192   return {
29193     ReadStream: ReadStream,
29194     WriteStream: WriteStream
29195   }
29196
29197   function ReadStream (path, options) {
29198     if (!(this instanceof ReadStream)) return new ReadStream(path, options);
29199
29200     Stream.call(this);
29201
29202     var self = this;
29203
29204     this.path = path;
29205     this.fd = null;
29206     this.readable = true;
29207     this.paused = false;
29208
29209     this.flags = 'r';
29210     this.mode = 438; /*=0666*/
29211     this.bufferSize = 64 * 1024;
29212
29213     options = options || {};
29214
29215     // Mixin options into this
29216     var keys = Object.keys(options);
29217     for (var index = 0, length = keys.length; index < length; index++) {
29218       var key = keys[index];
29219       this[key] = options[key];
29220     }
29221
29222     if (this.encoding) this.setEncoding(this.encoding);
29223
29224     if (this.start !== undefined) {
29225       if ('number' !== typeof this.start) {
29226         throw TypeError('start must be a Number');
29227       }
29228       if (this.end === undefined) {
29229         this.end = Infinity;
29230       } else if ('number' !== typeof this.end) {
29231         throw TypeError('end must be a Number');
29232       }
29233
29234       if (this.start > this.end) {
29235         throw new Error('start must be <= end');
29236       }
29237
29238       this.pos = this.start;
29239     }
29240
29241     if (this.fd !== null) {
29242       process.nextTick(function() {
29243         self._read();
29244       });
29245       return;
29246     }
29247
29248     fs.open(this.path, this.flags, this.mode, function (err, fd) {
29249       if (err) {
29250         self.emit('error', err);
29251         self.readable = false;
29252         return;
29253       }
29254
29255       self.fd = fd;
29256       self.emit('open', fd);
29257       self._read();
29258     })
29259   }
29260
29261   function WriteStream (path, options) {
29262     if (!(this instanceof WriteStream)) return new WriteStream(path, options);
29263
29264     Stream.call(this);
29265
29266     this.path = path;
29267     this.fd = null;
29268     this.writable = true;
29269
29270     this.flags = 'w';
29271     this.encoding = 'binary';
29272     this.mode = 438; /*=0666*/
29273     this.bytesWritten = 0;
29274
29275     options = options || {};
29276
29277     // Mixin options into this
29278     var keys = Object.keys(options);
29279     for (var index = 0, length = keys.length; index < length; index++) {
29280       var key = keys[index];
29281       this[key] = options[key];
29282     }
29283
29284     if (this.start !== undefined) {
29285       if ('number' !== typeof this.start) {
29286         throw TypeError('start must be a Number');
29287       }
29288       if (this.start < 0) {
29289         throw new Error('start must be >= zero');
29290       }
29291
29292       this.pos = this.start;
29293     }
29294
29295     this.busy = false;
29296     this._queue = [];
29297
29298     if (this.fd === null) {
29299       this._open = fs.open;
29300       this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
29301       this.flush();
29302     }
29303   }
29304 }
29305
29306
29307 /***/ }),
29308 /* 196 */
29309 /***/ (function(module, exports, __webpack_require__) {
29310
29311 "use strict";
29312
29313
29314 module.exports = clone
29315
29316 function clone (obj) {
29317   if (obj === null || typeof obj !== 'object')
29318     return obj
29319
29320   if (obj instanceof Object)
29321     var copy = { __proto__: obj.__proto__ }
29322   else
29323     var copy = Object.create(null)
29324
29325   Object.getOwnPropertyNames(obj).forEach(function (key) {
29326     Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
29327   })
29328
29329   return copy
29330 }
29331
29332
29333 /***/ }),
29334 /* 197 */
29335 /***/ (function(module, exports) {
29336
29337 module.exports = getType
29338
29339 function getType (st) {
29340   var types = [
29341     'Directory',
29342     'File',
29343     'SymbolicLink',
29344     'Link', // special for hardlinks from tarballs
29345     'BlockDevice',
29346     'CharacterDevice',
29347     'FIFO',
29348     'Socket'
29349   ]
29350   var type
29351
29352   if (st.type && types.indexOf(st.type) !== -1) {
29353     st[st.type] = true
29354     return st.type
29355   }
29356
29357   for (var i = 0, l = types.length; i < l; i++) {
29358     type = types[i]
29359     var is = st[type] || st['is' + type]
29360     if (typeof is === 'function') is = is.call(st)
29361     if (is) {
29362       st[type] = true
29363       st.type = type
29364       return type
29365     }
29366   }
29367
29368   return null
29369 }
29370
29371
29372 /***/ }),
29373 /* 198 */
29374 /***/ (function(module, exports, __webpack_require__) {
29375
29376 // Basically just a wrapper around an fs.readlink
29377 //
29378 // XXX: Enhance this to support the Link type, by keeping
29379 // a lookup table of {<dev+inode>:<path>}, so that hardlinks
29380 // can be preserved in tarballs.
29381
29382 module.exports = LinkReader
29383
29384 var fs = __webpack_require__(192)
29385 var inherits = __webpack_require__(66)
29386 var Reader = __webpack_require__(191)
29387
29388 inherits(LinkReader, Reader)
29389
29390 function LinkReader (props) {
29391   var self = this
29392   if (!(self instanceof LinkReader)) {
29393     throw new Error('LinkReader must be called as constructor.')
29394   }
29395
29396   if (!((props.type === 'Link' && props.Link) ||
29397     (props.type === 'SymbolicLink' && props.SymbolicLink))) {
29398     throw new Error('Non-link type ' + props.type)
29399   }
29400
29401   Reader.call(self, props)
29402 }
29403
29404 // When piping a LinkReader into a LinkWriter, we have to
29405 // already have the linkpath property set, so that has to
29406 // happen *before* the "ready" event, which means we need to
29407 // override the _stat method.
29408 LinkReader.prototype._stat = function (currentStat) {
29409   var self = this
29410   fs.readlink(self._path, function (er, linkpath) {
29411     if (er) return self.error(er)
29412     self.linkpath = self.props.linkpath = linkpath
29413     self.emit('linkpath', linkpath)
29414     Reader.prototype._stat.call(self, currentStat)
29415   })
29416 }
29417
29418 LinkReader.prototype._read = function () {
29419   var self = this
29420   if (self._paused) return
29421   // basically just a no-op, since we got all the info we need
29422   // from the _stat method
29423   if (!self._ended) {
29424     self.emit('end')
29425     self.emit('close')
29426     self._ended = true
29427   }
29428 }
29429
29430
29431 /***/ }),
29432 /* 199 */
29433 /***/ (function(module, exports, __webpack_require__) {
29434
29435 // A thing that emits "entry" events with Reader objects
29436 // Pausing it causes it to stop emitting entry events, and also
29437 // pauses the current entry if there is one.
29438
29439 module.exports = DirReader
29440
29441 var fs = __webpack_require__(192)
29442 var inherits = __webpack_require__(66)
29443 var path = __webpack_require__(2)
29444 var Reader = __webpack_require__(191)
29445 var assert = __webpack_require__(58).ok
29446
29447 inherits(DirReader, Reader)
29448
29449 function DirReader (props) {
29450   var self = this
29451   if (!(self instanceof DirReader)) {
29452     throw new Error('DirReader must be called as constructor.')
29453   }
29454
29455   // should already be established as a Directory type
29456   if (props.type !== 'Directory' || !props.Directory) {
29457     throw new Error('Non-directory type ' + props.type)
29458   }
29459
29460   self.entries = null
29461   self._index = -1
29462   self._paused = false
29463   self._length = -1
29464
29465   if (props.sort) {
29466     this.sort = props.sort
29467   }
29468
29469   Reader.call(this, props)
29470 }
29471
29472 DirReader.prototype._getEntries = function () {
29473   var self = this
29474
29475   // race condition.  might pause() before calling _getEntries,
29476   // and then resume, and try to get them a second time.
29477   if (self._gotEntries) return
29478   self._gotEntries = true
29479
29480   fs.readdir(self._path, function (er, entries) {
29481     if (er) return self.error(er)
29482
29483     self.entries = entries
29484
29485     self.emit('entries', entries)
29486     if (self._paused) self.once('resume', processEntries)
29487     else processEntries()
29488
29489     function processEntries () {
29490       self._length = self.entries.length
29491       if (typeof self.sort === 'function') {
29492         self.entries = self.entries.sort(self.sort.bind(self))
29493       }
29494       self._read()
29495     }
29496   })
29497 }
29498
29499 // start walking the dir, and emit an "entry" event for each one.
29500 DirReader.prototype._read = function () {
29501   var self = this
29502
29503   if (!self.entries) return self._getEntries()
29504
29505   if (self._paused || self._currentEntry || self._aborted) {
29506     // console.error('DR paused=%j, current=%j, aborted=%j', self._paused, !!self._currentEntry, self._aborted)
29507     return
29508   }
29509
29510   self._index++
29511   if (self._index >= self.entries.length) {
29512     if (!self._ended) {
29513       self._ended = true
29514       self.emit('end')
29515       self.emit('close')
29516     }
29517     return
29518   }
29519
29520   // ok, handle this one, then.
29521
29522   // save creating a proxy, by stat'ing the thing now.
29523   var p = path.resolve(self._path, self.entries[self._index])
29524   assert(p !== self._path)
29525   assert(self.entries[self._index])
29526
29527   // set this to prevent trying to _read() again in the stat time.
29528   self._currentEntry = p
29529   fs[ self.props.follow ? 'stat' : 'lstat' ](p, function (er, stat) {
29530     if (er) return self.error(er)
29531
29532     var who = self._proxy || self
29533
29534     stat.path = p
29535     stat.basename = path.basename(p)
29536     stat.dirname = path.dirname(p)
29537     var childProps = self.getChildProps.call(who, stat)
29538     childProps.path = p
29539     childProps.basename = path.basename(p)
29540     childProps.dirname = path.dirname(p)
29541
29542     var entry = Reader(childProps, stat)
29543
29544     // console.error("DR Entry", p, stat.size)
29545
29546     self._currentEntry = entry
29547
29548     // "entry" events are for direct entries in a specific dir.
29549     // "child" events are for any and all children at all levels.
29550     // This nomenclature is not completely final.
29551
29552     entry.on('pause', function (who) {
29553       if (!self._paused && !entry._disowned) {
29554         self.pause(who)
29555       }
29556     })
29557
29558     entry.on('resume', function (who) {
29559       if (self._paused && !entry._disowned) {
29560         self.resume(who)
29561       }
29562     })
29563
29564     entry.on('stat', function (props) {
29565       self.emit('_entryStat', entry, props)
29566       if (entry._aborted) return
29567       if (entry._paused) {
29568         entry.once('resume', function () {
29569           self.emit('entryStat', entry, props)
29570         })
29571       } else self.emit('entryStat', entry, props)
29572     })
29573
29574     entry.on('ready', function EMITCHILD () {
29575       // console.error("DR emit child", entry._path)
29576       if (self._paused) {
29577         // console.error("  DR emit child - try again later")
29578         // pause the child, and emit the "entry" event once we drain.
29579         // console.error("DR pausing child entry")
29580         entry.pause(self)
29581         return self.once('resume', EMITCHILD)
29582       }
29583
29584       // skip over sockets.  they can't be piped around properly,
29585       // so there's really no sense even acknowledging them.
29586       // if someone really wants to see them, they can listen to
29587       // the "socket" events.
29588       if (entry.type === 'Socket') {
29589         self.emit('socket', entry)
29590       } else {
29591         self.emitEntry(entry)
29592       }
29593     })
29594
29595     var ended = false
29596     entry.on('close', onend)
29597     entry.on('disown', onend)
29598     function onend () {
29599       if (ended) return
29600       ended = true
29601       self.emit('childEnd', entry)
29602       self.emit('entryEnd', entry)
29603       self._currentEntry = null
29604       if (!self._paused) {
29605         self._read()
29606       }
29607     }
29608
29609     // XXX Remove this.  Works in node as of 0.6.2 or so.
29610     // Long filenames should not break stuff.
29611     entry.on('error', function (er) {
29612       if (entry._swallowErrors) {
29613         self.warn(er)
29614         entry.emit('end')
29615         entry.emit('close')
29616       } else {
29617         self.emit('error', er)
29618       }
29619     })
29620
29621     // proxy up some events.
29622     ;[
29623       'child',
29624       'childEnd',
29625       'warn'
29626     ].forEach(function (ev) {
29627       entry.on(ev, self.emit.bind(self, ev))
29628     })
29629   })
29630 }
29631
29632 DirReader.prototype.disown = function (entry) {
29633   entry.emit('beforeDisown')
29634   entry._disowned = true
29635   entry.parent = entry.root = null
29636   if (entry === this._currentEntry) {
29637     this._currentEntry = null
29638   }
29639   entry.emit('disown')
29640 }
29641
29642 DirReader.prototype.getChildProps = function () {
29643   return {
29644     depth: this.depth + 1,
29645     root: this.root || this,
29646     parent: this,
29647     follow: this.follow,
29648     filter: this.filter,
29649     sort: this.props.sort,
29650     hardlinks: this.props.hardlinks
29651   }
29652 }
29653
29654 DirReader.prototype.pause = function (who) {
29655   var self = this
29656   if (self._paused) return
29657   who = who || self
29658   self._paused = true
29659   if (self._currentEntry && self._currentEntry.pause) {
29660     self._currentEntry.pause(who)
29661   }
29662   self.emit('pause', who)
29663 }
29664
29665 DirReader.prototype.resume = function (who) {
29666   var self = this
29667   if (!self._paused) return
29668   who = who || self
29669
29670   self._paused = false
29671   // console.error('DR Emit Resume', self._path)
29672   self.emit('resume', who)
29673   if (self._paused) {
29674     // console.error('DR Re-paused', self._path)
29675     return
29676   }
29677
29678   if (self._currentEntry) {
29679     if (self._currentEntry.resume) self._currentEntry.resume(who)
29680   } else self._read()
29681 }
29682
29683 DirReader.prototype.emitEntry = function (entry) {
29684   this.emit('entry', entry)
29685   this.emit('child', entry)
29686 }
29687
29688
29689 /***/ }),
29690 /* 200 */
29691 /***/ (function(module, exports, __webpack_require__) {
29692
29693 // Basically just a wrapper around an fs.ReadStream
29694
29695 module.exports = FileReader
29696
29697 var fs = __webpack_require__(192)
29698 var inherits = __webpack_require__(66)
29699 var Reader = __webpack_require__(191)
29700 var EOF = {EOF: true}
29701 var CLOSE = {CLOSE: true}
29702
29703 inherits(FileReader, Reader)
29704
29705 function FileReader (props) {
29706   // console.error("    FR create", props.path, props.size, new Error().stack)
29707   var self = this
29708   if (!(self instanceof FileReader)) {
29709     throw new Error('FileReader must be called as constructor.')
29710   }
29711
29712   // should already be established as a File type
29713   // XXX Todo: preserve hardlinks by tracking dev+inode+nlink,
29714   // with a HardLinkReader class.
29715   if (!((props.type === 'Link' && props.Link) ||
29716     (props.type === 'File' && props.File))) {
29717     throw new Error('Non-file type ' + props.type)
29718   }
29719
29720   self._buffer = []
29721   self._bytesEmitted = 0
29722   Reader.call(self, props)
29723 }
29724
29725 FileReader.prototype._getStream = function () {
29726   var self = this
29727   var stream = self._stream = fs.createReadStream(self._path, self.props)
29728
29729   if (self.props.blksize) {
29730     stream.bufferSize = self.props.blksize
29731   }
29732
29733   stream.on('open', self.emit.bind(self, 'open'))
29734
29735   stream.on('data', function (c) {
29736     // console.error('\t\t%d %s', c.length, self.basename)
29737     self._bytesEmitted += c.length
29738     // no point saving empty chunks
29739     if (!c.length) {
29740       return
29741     } else if (self._paused || self._buffer.length) {
29742       self._buffer.push(c)
29743       self._read()
29744     } else self.emit('data', c)
29745   })
29746
29747   stream.on('end', function () {
29748     if (self._paused || self._buffer.length) {
29749       // console.error('FR Buffering End', self._path)
29750       self._buffer.push(EOF)
29751       self._read()
29752     } else {
29753       self.emit('end')
29754     }
29755
29756     if (self._bytesEmitted !== self.props.size) {
29757       self.error("Didn't get expected byte count\n" +
29758         'expect: ' + self.props.size + '\n' +
29759         'actual: ' + self._bytesEmitted)
29760     }
29761   })
29762
29763   stream.on('close', function () {
29764     if (self._paused || self._buffer.length) {
29765       // console.error('FR Buffering Close', self._path)
29766       self._buffer.push(CLOSE)
29767       self._read()
29768     } else {
29769       // console.error('FR close 1', self._path)
29770       self.emit('close')
29771     }
29772   })
29773
29774   stream.on('error', function (e) {
29775     self.emit('error', e)
29776   })
29777
29778   self._read()
29779 }
29780
29781 FileReader.prototype._read = function () {
29782   var self = this
29783   // console.error('FR _read', self._path)
29784   if (self._paused) {
29785     // console.error('FR _read paused', self._path)
29786     return
29787   }
29788
29789   if (!self._stream) {
29790     // console.error('FR _getStream calling', self._path)
29791     return self._getStream()
29792   }
29793
29794   // clear out the buffer, if there is one.
29795   if (self._buffer.length) {
29796     // console.error('FR _read has buffer', self._buffer.length, self._path)
29797     var buf = self._buffer
29798     for (var i = 0, l = buf.length; i < l; i++) {
29799       var c = buf[i]
29800       if (c === EOF) {
29801         // console.error('FR Read emitting buffered end', self._path)
29802         self.emit('end')
29803       } else if (c === CLOSE) {
29804         // console.error('FR Read emitting buffered close', self._path)
29805         self.emit('close')
29806       } else {
29807         // console.error('FR Read emitting buffered data', self._path)
29808         self.emit('data', c)
29809       }
29810
29811       if (self._paused) {
29812         // console.error('FR Read Re-pausing at '+i, self._path)
29813         self._buffer = buf.slice(i)
29814         return
29815       }
29816     }
29817     self._buffer.length = 0
29818   }
29819 // console.error("FR _read done")
29820 // that's about all there is to it.
29821 }
29822
29823 FileReader.prototype.pause = function (who) {
29824   var self = this
29825   // console.error('FR Pause', self._path)
29826   if (self._paused) return
29827   who = who || self
29828   self._paused = true
29829   if (self._stream) self._stream.pause()
29830   self.emit('pause', who)
29831 }
29832
29833 FileReader.prototype.resume = function (who) {
29834   var self = this
29835   // console.error('FR Resume', self._path)
29836   if (!self._paused) return
29837   who = who || self
29838   self.emit('resume', who)
29839   self._paused = false
29840   if (self._stream) self._stream.resume()
29841   self._read()
29842 }
29843
29844
29845 /***/ }),
29846 /* 201 */
29847 /***/ (function(module, exports, __webpack_require__) {
29848
29849 // Just get the stats, and then don't do anything.
29850 // You can't really "read" from a socket.  You "connect" to it.
29851 // Mostly, this is here so that reading a dir with a socket in it
29852 // doesn't blow up.
29853
29854 module.exports = SocketReader
29855
29856 var inherits = __webpack_require__(66)
29857 var Reader = __webpack_require__(191)
29858
29859 inherits(SocketReader, Reader)
29860
29861 function SocketReader (props) {
29862   var self = this
29863   if (!(self instanceof SocketReader)) {
29864     throw new Error('SocketReader must be called as constructor.')
29865   }
29866
29867   if (!(props.type === 'Socket' && props.Socket)) {
29868     throw new Error('Non-socket type ' + props.type)
29869   }
29870
29871   Reader.call(self, props)
29872 }
29873
29874 SocketReader.prototype._read = function () {
29875   var self = this
29876   if (self._paused) return
29877   // basically just a no-op, since we got all the info we have
29878   // from the _stat method
29879   if (!self._ended) {
29880     self.emit('end')
29881     self.emit('close')
29882     self._ended = true
29883   }
29884 }
29885
29886
29887 /***/ }),
29888 /* 202 */
29889 /***/ (function(module, exports, __webpack_require__) {
29890
29891 // A reader for when we don't yet know what kind of thing
29892 // the thing is.
29893
29894 module.exports = ProxyReader
29895
29896 var Reader = __webpack_require__(191)
29897 var getType = __webpack_require__(197)
29898 var inherits = __webpack_require__(66)
29899 var fs = __webpack_require__(192)
29900
29901 inherits(ProxyReader, Reader)
29902
29903 function ProxyReader (props) {
29904   var self = this
29905   if (!(self instanceof ProxyReader)) {
29906     throw new Error('ProxyReader must be called as constructor.')
29907   }
29908
29909   self.props = props
29910   self._buffer = []
29911   self.ready = false
29912
29913   Reader.call(self, props)
29914 }
29915
29916 ProxyReader.prototype._stat = function () {
29917   var self = this
29918   var props = self.props
29919   // stat the thing to see what the proxy should be.
29920   var stat = props.follow ? 'stat' : 'lstat'
29921
29922   fs[stat](props.path, function (er, current) {
29923     var type
29924     if (er || !current) {
29925       type = 'File'
29926     } else {
29927       type = getType(current)
29928     }
29929
29930     props[type] = true
29931     props.type = self.type = type
29932
29933     self._old = current
29934     self._addProxy(Reader(props, current))
29935   })
29936 }
29937
29938 ProxyReader.prototype._addProxy = function (proxy) {
29939   var self = this
29940   if (self._proxyTarget) {
29941     return self.error('proxy already set')
29942   }
29943
29944   self._proxyTarget = proxy
29945   proxy._proxy = self
29946
29947   ;[
29948     'error',
29949     'data',
29950     'end',
29951     'close',
29952     'linkpath',
29953     'entry',
29954     'entryEnd',
29955     'child',
29956     'childEnd',
29957     'warn',
29958     'stat'
29959   ].forEach(function (ev) {
29960     // console.error('~~ proxy event', ev, self.path)
29961     proxy.on(ev, self.emit.bind(self, ev))
29962   })
29963
29964   self.emit('proxy', proxy)
29965
29966   proxy.on('ready', function () {
29967     // console.error("~~ proxy is ready!", self.path)
29968     self.ready = true
29969     self.emit('ready')
29970   })
29971
29972   var calls = self._buffer
29973   self._buffer.length = 0
29974   calls.forEach(function (c) {
29975     proxy[c[0]].apply(proxy, c[1])
29976   })
29977 }
29978
29979 ProxyReader.prototype.pause = function () {
29980   return this._proxyTarget ? this._proxyTarget.pause() : false
29981 }
29982
29983 ProxyReader.prototype.resume = function () {
29984   return this._proxyTarget ? this._proxyTarget.resume() : false
29985 }
29986
29987
29988 /***/ }),
29989 /* 203 */
29990 /***/ (function(module, exports, __webpack_require__) {
29991
29992 module.exports = Writer
29993
29994 var fs = __webpack_require__(192)
29995 var inherits = __webpack_require__(66)
29996 var rimraf = __webpack_require__(204)
29997 var mkdir = __webpack_require__(205)
29998 var path = __webpack_require__(2)
29999 var umask = process.platform === 'win32' ? 0 : process.umask()
30000 var getType = __webpack_require__(197)
30001 var Abstract = __webpack_require__(190)
30002
30003 // Must do this *before* loading the child classes
30004 inherits(Writer, Abstract)
30005
30006 Writer.dirmode = parseInt('0777', 8) & (~umask)
30007 Writer.filemode = parseInt('0666', 8) & (~umask)
30008
30009 var DirWriter = __webpack_require__(206)
30010 var LinkWriter = __webpack_require__(208)
30011 var FileWriter = __webpack_require__(209)
30012 var ProxyWriter = __webpack_require__(210)
30013
30014 // props is the desired state.  current is optionally the current stat,
30015 // provided here so that subclasses can avoid statting the target
30016 // more than necessary.
30017 function Writer (props, current) {
30018   var self = this
30019
30020   if (typeof props === 'string') {
30021     props = { path: props }
30022   }
30023
30024   // polymorphism.
30025   // call fstream.Writer(dir) to get a DirWriter object, etc.
30026   var type = getType(props)
30027   var ClassType = Writer
30028
30029   switch (type) {
30030     case 'Directory':
30031       ClassType = DirWriter
30032       break
30033     case 'File':
30034       ClassType = FileWriter
30035       break
30036     case 'Link':
30037     case 'SymbolicLink':
30038       ClassType = LinkWriter
30039       break
30040     case null:
30041     default:
30042       // Don't know yet what type to create, so we wrap in a proxy.
30043       ClassType = ProxyWriter
30044       break
30045   }
30046
30047   if (!(self instanceof ClassType)) return new ClassType(props)
30048
30049   // now get down to business.
30050
30051   Abstract.call(self)
30052
30053   if (!props.path) self.error('Must provide a path', null, true)
30054
30055   // props is what we want to set.
30056   // set some convenience properties as well.
30057   self.type = props.type
30058   self.props = props
30059   self.depth = props.depth || 0
30060   self.clobber = props.clobber === false ? props.clobber : true
30061   self.parent = props.parent || null
30062   self.root = props.root || (props.parent && props.parent.root) || self
30063
30064   self._path = self.path = path.resolve(props.path)
30065   if (process.platform === 'win32') {
30066     self.path = self._path = self.path.replace(/\?/g, '_')
30067     if (self._path.length >= 260) {
30068       self._swallowErrors = true
30069       self._path = '\\\\?\\' + self.path.replace(/\//g, '\\')
30070     }
30071   }
30072   self.basename = path.basename(props.path)
30073   self.dirname = path.dirname(props.path)
30074   self.linkpath = props.linkpath || null
30075
30076   props.parent = props.root = null
30077
30078   // console.error("\n\n\n%s setting size to", props.path, props.size)
30079   self.size = props.size
30080
30081   if (typeof props.mode === 'string') {
30082     props.mode = parseInt(props.mode, 8)
30083   }
30084
30085   self.readable = false
30086   self.writable = true
30087
30088   // buffer until ready, or while handling another entry
30089   self._buffer = []
30090   self.ready = false
30091
30092   self.filter = typeof props.filter === 'function' ? props.filter : null
30093
30094   // start the ball rolling.
30095   // this checks what's there already, and then calls
30096   // self._create() to call the impl-specific creation stuff.
30097   self._stat(current)
30098 }
30099
30100 // Calling this means that it's something we can't create.
30101 // Just assert that it's already there, otherwise raise a warning.
30102 Writer.prototype._create = function () {
30103   var self = this
30104   fs[self.props.follow ? 'stat' : 'lstat'](self._path, function (er) {
30105     if (er) {
30106       return self.warn('Cannot create ' + self._path + '\n' +
30107         'Unsupported type: ' + self.type, 'ENOTSUP')
30108     }
30109     self._finish()
30110   })
30111 }
30112
30113 Writer.prototype._stat = function (current) {
30114   var self = this
30115   var props = self.props
30116   var stat = props.follow ? 'stat' : 'lstat'
30117   var who = self._proxy || self
30118
30119   if (current) statCb(null, current)
30120   else fs[stat](self._path, statCb)
30121
30122   function statCb (er, current) {
30123     if (self.filter && !self.filter.call(who, who, current)) {
30124       self._aborted = true
30125       self.emit('end')
30126       self.emit('close')
30127       return
30128     }
30129
30130     // if it's not there, great.  We'll just create it.
30131     // if it is there, then we'll need to change whatever differs
30132     if (er || !current) {
30133       return create(self)
30134     }
30135
30136     self._old = current
30137     var currentType = getType(current)
30138
30139     // if it's a type change, then we need to clobber or error.
30140     // if it's not a type change, then let the impl take care of it.
30141     if (currentType !== self.type || self.type === 'File' && current.nlink > 1) {
30142       return rimraf(self._path, function (er) {
30143         if (er) return self.error(er)
30144         self._old = null
30145         create(self)
30146       })
30147     }
30148
30149     // otherwise, just handle in the app-specific way
30150     // this creates a fs.WriteStream, or mkdir's, or whatever
30151     create(self)
30152   }
30153 }
30154
30155 function create (self) {
30156   // console.error("W create", self._path, Writer.dirmode)
30157
30158   // XXX Need to clobber non-dirs that are in the way,
30159   // unless { clobber: false } in the props.
30160   mkdir(path.dirname(self._path), Writer.dirmode, function (er, made) {
30161     // console.error("W created", path.dirname(self._path), er)
30162     if (er) return self.error(er)
30163
30164     // later on, we have to set the mode and owner for these
30165     self._madeDir = made
30166     return self._create()
30167   })
30168 }
30169
30170 function endChmod (self, want, current, path, cb) {
30171   var wantMode = want.mode
30172   var chmod = want.follow || self.type !== 'SymbolicLink'
30173     ? 'chmod' : 'lchmod'
30174
30175   if (!fs[chmod]) return cb()
30176   if (typeof wantMode !== 'number') return cb()
30177
30178   var curMode = current.mode & parseInt('0777', 8)
30179   wantMode = wantMode & parseInt('0777', 8)
30180   if (wantMode === curMode) return cb()
30181
30182   fs[chmod](path, wantMode, cb)
30183 }
30184
30185 function endChown (self, want, current, path, cb) {
30186   // Don't even try it unless root.  Too easy to EPERM.
30187   if (process.platform === 'win32') return cb()
30188   if (!process.getuid || process.getuid() !== 0) return cb()
30189   if (typeof want.uid !== 'number' &&
30190     typeof want.gid !== 'number') return cb()
30191
30192   if (current.uid === want.uid &&
30193     current.gid === want.gid) return cb()
30194
30195   var chown = (self.props.follow || self.type !== 'SymbolicLink')
30196     ? 'chown' : 'lchown'
30197   if (!fs[chown]) return cb()
30198
30199   if (typeof want.uid !== 'number') want.uid = current.uid
30200   if (typeof want.gid !== 'number') want.gid = current.gid
30201
30202   fs[chown](path, want.uid, want.gid, cb)
30203 }
30204
30205 function endUtimes (self, want, current, path, cb) {
30206   if (!fs.utimes || process.platform === 'win32') return cb()
30207
30208   var utimes = (want.follow || self.type !== 'SymbolicLink')
30209     ? 'utimes' : 'lutimes'
30210
30211   if (utimes === 'lutimes' && !fs[utimes]) {
30212     utimes = 'utimes'
30213   }
30214
30215   if (!fs[utimes]) return cb()
30216
30217   var curA = current.atime
30218   var curM = current.mtime
30219   var meA = want.atime
30220   var meM = want.mtime
30221
30222   if (meA === undefined) meA = curA
30223   if (meM === undefined) meM = curM
30224
30225   if (!isDate(meA)) meA = new Date(meA)
30226   if (!isDate(meM)) meA = new Date(meM)
30227
30228   if (meA.getTime() === curA.getTime() &&
30229     meM.getTime() === curM.getTime()) return cb()
30230
30231   fs[utimes](path, meA, meM, cb)
30232 }
30233
30234 // XXX This function is beastly.  Break it up!
30235 Writer.prototype._finish = function () {
30236   var self = this
30237
30238   if (self._finishing) return
30239   self._finishing = true
30240
30241   // console.error(" W Finish", self._path, self.size)
30242
30243   // set up all the things.
30244   // At this point, we're already done writing whatever we've gotta write,
30245   // adding files to the dir, etc.
30246   var todo = 0
30247   var errState = null
30248   var done = false
30249
30250   if (self._old) {
30251     // the times will almost *certainly* have changed.
30252     // adds the utimes syscall, but remove another stat.
30253     self._old.atime = new Date(0)
30254     self._old.mtime = new Date(0)
30255     // console.error(" W Finish Stale Stat", self._path, self.size)
30256     setProps(self._old)
30257   } else {
30258     var stat = self.props.follow ? 'stat' : 'lstat'
30259     // console.error(" W Finish Stating", self._path, self.size)
30260     fs[stat](self._path, function (er, current) {
30261       // console.error(" W Finish Stated", self._path, self.size, current)
30262       if (er) {
30263         // if we're in the process of writing out a
30264         // directory, it's very possible that the thing we're linking to
30265         // doesn't exist yet (especially if it was intended as a symlink),
30266         // so swallow ENOENT errors here and just soldier on.
30267         if (er.code === 'ENOENT' &&
30268           (self.type === 'Link' || self.type === 'SymbolicLink') &&
30269           process.platform === 'win32') {
30270           self.ready = true
30271           self.emit('ready')
30272           self.emit('end')
30273           self.emit('close')
30274           self.end = self._finish = function () {}
30275           return
30276         } else return self.error(er)
30277       }
30278       setProps(self._old = current)
30279     })
30280   }
30281
30282   return
30283
30284   function setProps (current) {
30285     todo += 3
30286     endChmod(self, self.props, current, self._path, next('chmod'))
30287     endChown(self, self.props, current, self._path, next('chown'))
30288     endUtimes(self, self.props, current, self._path, next('utimes'))
30289   }
30290
30291   function next (what) {
30292     return function (er) {
30293       // console.error("   W Finish", what, todo)
30294       if (errState) return
30295       if (er) {
30296         er.fstream_finish_call = what
30297         return self.error(errState = er)
30298       }
30299       if (--todo > 0) return
30300       if (done) return
30301       done = true
30302
30303       // we may still need to set the mode/etc. on some parent dirs
30304       // that were created previously.  delay end/close until then.
30305       if (!self._madeDir) return end()
30306       else endMadeDir(self, self._path, end)
30307
30308       function end (er) {
30309         if (er) {
30310           er.fstream_finish_call = 'setupMadeDir'
30311           return self.error(er)
30312         }
30313         // all the props have been set, so we're completely done.
30314         self.emit('end')
30315         self.emit('close')
30316       }
30317     }
30318   }
30319 }
30320
30321 function endMadeDir (self, p, cb) {
30322   var made = self._madeDir
30323   // everything *between* made and path.dirname(self._path)
30324   // needs to be set up.  Note that this may just be one dir.
30325   var d = path.dirname(p)
30326
30327   endMadeDir_(self, d, function (er) {
30328     if (er) return cb(er)
30329     if (d === made) {
30330       return cb()
30331     }
30332     endMadeDir(self, d, cb)
30333   })
30334 }
30335
30336 function endMadeDir_ (self, p, cb) {
30337   var dirProps = {}
30338   Object.keys(self.props).forEach(function (k) {
30339     dirProps[k] = self.props[k]
30340
30341     // only make non-readable dirs if explicitly requested.
30342     if (k === 'mode' && self.type !== 'Directory') {
30343       dirProps[k] = dirProps[k] | parseInt('0111', 8)
30344     }
30345   })
30346
30347   var todo = 3
30348   var errState = null
30349   fs.stat(p, function (er, current) {
30350     if (er) return cb(errState = er)
30351     endChmod(self, dirProps, current, p, next)
30352     endChown(self, dirProps, current, p, next)
30353     endUtimes(self, dirProps, current, p, next)
30354   })
30355
30356   function next (er) {
30357     if (errState) return
30358     if (er) return cb(errState = er)
30359     if (--todo === 0) return cb()
30360   }
30361 }
30362
30363 Writer.prototype.pipe = function () {
30364   this.error("Can't pipe from writable stream")
30365 }
30366
30367 Writer.prototype.add = function () {
30368   this.error("Can't add to non-Directory type")
30369 }
30370
30371 Writer.prototype.write = function () {
30372   return true
30373 }
30374
30375 function objectToString (d) {
30376   return Object.prototype.toString.call(d)
30377 }
30378
30379 function isDate (d) {
30380   return typeof d === 'object' && objectToString(d) === '[object Date]'
30381 }
30382
30383
30384 /***/ }),
30385 /* 204 */
30386 /***/ (function(module, exports, __webpack_require__) {
30387
30388 module.exports = rimraf
30389 rimraf.sync = rimrafSync
30390
30391 var assert = __webpack_require__(58)
30392 var path = __webpack_require__(2)
30393 var fs = __webpack_require__(42)
30394 var glob = undefined
30395 try {
30396   glob = __webpack_require__(59)
30397 } catch (_err) {
30398   // treat glob as optional.
30399 }
30400 var _0666 = parseInt('666', 8)
30401
30402 var defaultGlobOpts = {
30403   nosort: true,
30404   silent: true
30405 }
30406
30407 // for EMFILE handling
30408 var timeout = 0
30409
30410 var isWindows = (process.platform === "win32")
30411
30412 function defaults (options) {
30413   var methods = [
30414     'unlink',
30415     'chmod',
30416     'stat',
30417     'lstat',
30418     'rmdir',
30419     'readdir'
30420   ]
30421   methods.forEach(function(m) {
30422     options[m] = options[m] || fs[m]
30423     m = m + 'Sync'
30424     options[m] = options[m] || fs[m]
30425   })
30426
30427   options.maxBusyTries = options.maxBusyTries || 3
30428   options.emfileWait = options.emfileWait || 1000
30429   if (options.glob === false) {
30430     options.disableGlob = true
30431   }
30432   if (options.disableGlob !== true && glob === undefined) {
30433     throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
30434   }
30435   options.disableGlob = options.disableGlob || false
30436   options.glob = options.glob || defaultGlobOpts
30437 }
30438
30439 function rimraf (p, options, cb) {
30440   if (typeof options === 'function') {
30441     cb = options
30442     options = {}
30443   }
30444
30445   assert(p, 'rimraf: missing path')
30446   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
30447   assert.equal(typeof cb, 'function', 'rimraf: callback function required')
30448   assert(options, 'rimraf: invalid options argument provided')
30449   assert.equal(typeof options, 'object', 'rimraf: options should be object')
30450
30451   defaults(options)
30452
30453   var busyTries = 0
30454   var errState = null
30455   var n = 0
30456
30457   if (options.disableGlob || !glob.hasMagic(p))
30458     return afterGlob(null, [p])
30459
30460   options.lstat(p, function (er, stat) {
30461     if (!er)
30462       return afterGlob(null, [p])
30463
30464     glob(p, options.glob, afterGlob)
30465   })
30466
30467   function next (er) {
30468     errState = errState || er
30469     if (--n === 0)
30470       cb(errState)
30471   }
30472
30473   function afterGlob (er, results) {
30474     if (er)
30475       return cb(er)
30476
30477     n = results.length
30478     if (n === 0)
30479       return cb()
30480
30481     results.forEach(function (p) {
30482       rimraf_(p, options, function CB (er) {
30483         if (er) {
30484           if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
30485               busyTries < options.maxBusyTries) {
30486             busyTries ++
30487             var time = busyTries * 100
30488             // try again, with the same exact callback as this one.
30489             return setTimeout(function () {
30490               rimraf_(p, options, CB)
30491             }, time)
30492           }
30493
30494           // this one won't happen if graceful-fs is used.
30495           if (er.code === "EMFILE" && timeout < options.emfileWait) {
30496             return setTimeout(function () {
30497               rimraf_(p, options, CB)
30498             }, timeout ++)
30499           }
30500
30501           // already gone
30502           if (er.code === "ENOENT") er = null
30503         }
30504
30505         timeout = 0
30506         next(er)
30507       })
30508     })
30509   }
30510 }
30511
30512 // Two possible strategies.
30513 // 1. Assume it's a file.  unlink it, then do the dir stuff on EPERM or EISDIR
30514 // 2. Assume it's a directory.  readdir, then do the file stuff on ENOTDIR
30515 //
30516 // Both result in an extra syscall when you guess wrong.  However, there
30517 // are likely far more normal files in the world than directories.  This
30518 // is based on the assumption that a the average number of files per
30519 // directory is >= 1.
30520 //
30521 // If anyone ever complains about this, then I guess the strategy could
30522 // be made configurable somehow.  But until then, YAGNI.
30523 function rimraf_ (p, options, cb) {
30524   assert(p)
30525   assert(options)
30526   assert(typeof cb === 'function')
30527
30528   // sunos lets the root user unlink directories, which is... weird.
30529   // so we have to lstat here and make sure it's not a dir.
30530   options.lstat(p, function (er, st) {
30531     if (er && er.code === "ENOENT")
30532       return cb(null)
30533
30534     // Windows can EPERM on stat.  Life is suffering.
30535     if (er && er.code === "EPERM" && isWindows)
30536       fixWinEPERM(p, options, er, cb)
30537
30538     if (st && st.isDirectory())
30539       return rmdir(p, options, er, cb)
30540
30541     options.unlink(p, function (er) {
30542       if (er) {
30543         if (er.code === "ENOENT")
30544           return cb(null)
30545         if (er.code === "EPERM")
30546           return (isWindows)
30547             ? fixWinEPERM(p, options, er, cb)
30548             : rmdir(p, options, er, cb)
30549         if (er.code === "EISDIR")
30550           return rmdir(p, options, er, cb)
30551       }
30552       return cb(er)
30553     })
30554   })
30555 }
30556
30557 function fixWinEPERM (p, options, er, cb) {
30558   assert(p)
30559   assert(options)
30560   assert(typeof cb === 'function')
30561   if (er)
30562     assert(er instanceof Error)
30563
30564   options.chmod(p, _0666, function (er2) {
30565     if (er2)
30566       cb(er2.code === "ENOENT" ? null : er)
30567     else
30568       options.stat(p, function(er3, stats) {
30569         if (er3)
30570           cb(er3.code === "ENOENT" ? null : er)
30571         else if (stats.isDirectory())
30572           rmdir(p, options, er, cb)
30573         else
30574           options.unlink(p, cb)
30575       })
30576   })
30577 }
30578
30579 function fixWinEPERMSync (p, options, er) {
30580   assert(p)
30581   assert(options)
30582   if (er)
30583     assert(er instanceof Error)
30584
30585   try {
30586     options.chmodSync(p, _0666)
30587   } catch (er2) {
30588     if (er2.code === "ENOENT")
30589       return
30590     else
30591       throw er
30592   }
30593
30594   try {
30595     var stats = options.statSync(p)
30596   } catch (er3) {
30597     if (er3.code === "ENOENT")
30598       return
30599     else
30600       throw er
30601   }
30602
30603   if (stats.isDirectory())
30604     rmdirSync(p, options, er)
30605   else
30606     options.unlinkSync(p)
30607 }
30608
30609 function rmdir (p, options, originalEr, cb) {
30610   assert(p)
30611   assert(options)
30612   if (originalEr)
30613     assert(originalEr instanceof Error)
30614   assert(typeof cb === 'function')
30615
30616   // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
30617   // if we guessed wrong, and it's not a directory, then
30618   // raise the original error.
30619   options.rmdir(p, function (er) {
30620     if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
30621       rmkids(p, options, cb)
30622     else if (er && er.code === "ENOTDIR")
30623       cb(originalEr)
30624     else
30625       cb(er)
30626   })
30627 }
30628
30629 function rmkids(p, options, cb) {
30630   assert(p)
30631   assert(options)
30632   assert(typeof cb === 'function')
30633
30634   options.readdir(p, function (er, files) {
30635     if (er)
30636       return cb(er)
30637     var n = files.length
30638     if (n === 0)
30639       return options.rmdir(p, cb)
30640     var errState
30641     files.forEach(function (f) {
30642       rimraf(path.join(p, f), options, function (er) {
30643         if (errState)
30644           return
30645         if (er)
30646           return cb(errState = er)
30647         if (--n === 0)
30648           options.rmdir(p, cb)
30649       })
30650     })
30651   })
30652 }
30653
30654 // this looks simpler, and is strictly *faster*, but will
30655 // tie up the JavaScript thread and fail on excessively
30656 // deep directory trees.
30657 function rimrafSync (p, options) {
30658   options = options || {}
30659   defaults(options)
30660
30661   assert(p, 'rimraf: missing path')
30662   assert.equal(typeof p, 'string', 'rimraf: path should be a string')
30663   assert(options, 'rimraf: missing options')
30664   assert.equal(typeof options, 'object', 'rimraf: options should be object')
30665
30666   var results
30667
30668   if (options.disableGlob || !glob.hasMagic(p)) {
30669     results = [p]
30670   } else {
30671     try {
30672       options.lstatSync(p)
30673       results = [p]
30674     } catch (er) {
30675       results = glob.sync(p, options.glob)
30676     }
30677   }
30678
30679   if (!results.length)
30680     return
30681
30682   for (var i = 0; i < results.length; i++) {
30683     var p = results[i]
30684
30685     try {
30686       var st = options.lstatSync(p)
30687     } catch (er) {
30688       if (er.code === "ENOENT")
30689         return
30690
30691       // Windows can EPERM on stat.  Life is suffering.
30692       if (er.code === "EPERM" && isWindows)
30693         fixWinEPERMSync(p, options, er)
30694     }
30695
30696     try {
30697       // sunos lets the root user unlink directories, which is... weird.
30698       if (st && st.isDirectory())
30699         rmdirSync(p, options, null)
30700       else
30701         options.unlinkSync(p)
30702     } catch (er) {
30703       if (er.code === "ENOENT")
30704         return
30705       if (er.code === "EPERM")
30706         return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
30707       if (er.code !== "EISDIR")
30708         throw er
30709
30710       rmdirSync(p, options, er)
30711     }
30712   }
30713 }
30714
30715 function rmdirSync (p, options, originalEr) {
30716   assert(p)
30717   assert(options)
30718   if (originalEr)
30719     assert(originalEr instanceof Error)
30720
30721   try {
30722     options.rmdirSync(p)
30723   } catch (er) {
30724     if (er.code === "ENOENT")
30725       return
30726     if (er.code === "ENOTDIR")
30727       throw originalEr
30728     if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
30729       rmkidsSync(p, options)
30730   }
30731 }
30732
30733 function rmkidsSync (p, options) {
30734   assert(p)
30735   assert(options)
30736   options.readdirSync(p).forEach(function (f) {
30737     rimrafSync(path.join(p, f), options)
30738   })
30739
30740   // We only end up here once we got ENOTEMPTY at least once, and
30741   // at this point, we are guaranteed to have removed all the kids.
30742   // So, we know that it won't be ENOENT or ENOTDIR or anything else.
30743   // try really hard to delete stuff on windows, because it has a
30744   // PROFOUNDLY annoying habit of not closing handles promptly when
30745   // files are deleted, resulting in spurious ENOTEMPTY errors.
30746   var retries = isWindows ? 100 : 1
30747   var i = 0
30748   do {
30749     var threw = true
30750     try {
30751       var ret = options.rmdirSync(p, options)
30752       threw = false
30753       return ret
30754     } finally {
30755       if (++i < retries && threw)
30756         continue
30757     }
30758   } while (true)
30759 }
30760
30761
30762 /***/ }),
30763 /* 205 */
30764 /***/ (function(module, exports, __webpack_require__) {
30765
30766 var path = __webpack_require__(2);
30767 var fs = __webpack_require__(42);
30768 var _0777 = parseInt('0777', 8);
30769
30770 module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
30771
30772 function mkdirP (p, opts, f, made) {
30773     if (typeof opts === 'function') {
30774         f = opts;
30775         opts = {};
30776     }
30777     else if (!opts || typeof opts !== 'object') {
30778         opts = { mode: opts };
30779     }
30780     
30781     var mode = opts.mode;
30782     var xfs = opts.fs || fs;
30783     
30784     if (mode === undefined) {
30785         mode = _0777
30786     }
30787     if (!made) made = null;
30788     
30789     var cb = f || function () {};
30790     p = path.resolve(p);
30791     
30792     xfs.mkdir(p, mode, function (er) {
30793         if (!er) {
30794             made = made || p;
30795             return cb(null, made);
30796         }
30797         switch (er.code) {
30798             case 'ENOENT':
30799                 if (path.dirname(p) === p) return cb(er);
30800                 mkdirP(path.dirname(p), opts, function (er, made) {
30801                     if (er) cb(er, made);
30802                     else mkdirP(p, opts, cb, made);
30803                 });
30804                 break;
30805
30806             // In the case of any other error, just see if there's a dir
30807             // there already.  If so, then hooray!  If not, then something
30808             // is borked.
30809             default:
30810                 xfs.stat(p, function (er2, stat) {
30811                     // if the stat fails, then that's super weird.
30812                     // let the original error be the failure reason.
30813                     if (er2 || !stat.isDirectory()) cb(er, made)
30814                     else cb(null, made);
30815                 });
30816                 break;
30817         }
30818     });
30819 }
30820
30821 mkdirP.sync = function sync (p, opts, made) {
30822     if (!opts || typeof opts !== 'object') {
30823         opts = { mode: opts };
30824     }
30825     
30826     var mode = opts.mode;
30827     var xfs = opts.fs || fs;
30828     
30829     if (mode === undefined) {
30830         mode = _0777
30831     }
30832     if (!made) made = null;
30833
30834     p = path.resolve(p);
30835
30836     try {
30837         xfs.mkdirSync(p, mode);
30838         made = made || p;
30839     }
30840     catch (err0) {
30841         switch (err0.code) {
30842             case 'ENOENT' :
30843                 made = sync(path.dirname(p), opts, made);
30844                 sync(p, opts, made);
30845                 break;
30846
30847             // In the case of any other error, just see if there's a dir
30848             // there already.  If so, then hooray!  If not, then something
30849             // is borked.
30850             default:
30851                 var stat;
30852                 try {
30853                     stat = xfs.statSync(p);
30854                 }
30855                 catch (err1) {
30856                     throw err0;
30857                 }
30858                 if (!stat.isDirectory()) throw err0;
30859                 break;
30860         }
30861     }
30862
30863     return made;
30864 };
30865
30866
30867 /***/ }),
30868 /* 206 */
30869 /***/ (function(module, exports, __webpack_require__) {
30870
30871 // It is expected that, when .add() returns false, the consumer
30872 // of the DirWriter will pause until a "drain" event occurs. Note
30873 // that this is *almost always going to be the case*, unless the
30874 // thing being written is some sort of unsupported type, and thus
30875 // skipped over.
30876
30877 module.exports = DirWriter
30878
30879 var Writer = __webpack_require__(203)
30880 var inherits = __webpack_require__(66)
30881 var mkdir = __webpack_require__(205)
30882 var path = __webpack_require__(2)
30883 var collect = __webpack_require__(207)
30884
30885 inherits(DirWriter, Writer)
30886
30887 function DirWriter (props) {
30888   var self = this
30889   if (!(self instanceof DirWriter)) {
30890     self.error('DirWriter must be called as constructor.', null, true)
30891   }
30892
30893   // should already be established as a Directory type
30894   if (props.type !== 'Directory' || !props.Directory) {
30895     self.error('Non-directory type ' + props.type + ' ' +
30896       JSON.stringify(props), null, true)
30897   }
30898
30899   Writer.call(this, props)
30900 }
30901
30902 DirWriter.prototype._create = function () {
30903   var self = this
30904   mkdir(self._path, Writer.dirmode, function (er) {
30905     if (er) return self.error(er)
30906     // ready to start getting entries!
30907     self.ready = true
30908     self.emit('ready')
30909     self._process()
30910   })
30911 }
30912
30913 // a DirWriter has an add(entry) method, but its .write() doesn't
30914 // do anything.  Why a no-op rather than a throw?  Because this
30915 // leaves open the door for writing directory metadata for
30916 // gnu/solaris style dumpdirs.
30917 DirWriter.prototype.write = function () {
30918   return true
30919 }
30920
30921 DirWriter.prototype.end = function () {
30922   this._ended = true
30923   this._process()
30924 }
30925
30926 DirWriter.prototype.add = function (entry) {
30927   var self = this
30928
30929   // console.error('\tadd', entry._path, '->', self._path)
30930   collect(entry)
30931   if (!self.ready || self._currentEntry) {
30932     self._buffer.push(entry)
30933     return false
30934   }
30935
30936   // create a new writer, and pipe the incoming entry into it.
30937   if (self._ended) {
30938     return self.error('add after end')
30939   }
30940
30941   self._buffer.push(entry)
30942   self._process()
30943
30944   return this._buffer.length === 0
30945 }
30946
30947 DirWriter.prototype._process = function () {
30948   var self = this
30949
30950   // console.error('DW Process p=%j', self._processing, self.basename)
30951
30952   if (self._processing) return
30953
30954   var entry = self._buffer.shift()
30955   if (!entry) {
30956     // console.error("DW Drain")
30957     self.emit('drain')
30958     if (self._ended) self._finish()
30959     return
30960   }
30961
30962   self._processing = true
30963   // console.error("DW Entry", entry._path)
30964
30965   self.emit('entry', entry)
30966
30967   // ok, add this entry
30968   //
30969   // don't allow recursive copying
30970   var p = entry
30971   var pp
30972   do {
30973     pp = p._path || p.path
30974     if (pp === self.root._path || pp === self._path ||
30975       (pp && pp.indexOf(self._path) === 0)) {
30976       // console.error('DW Exit (recursive)', entry.basename, self._path)
30977       self._processing = false
30978       if (entry._collected) entry.pipe()
30979       return self._process()
30980     }
30981     p = p.parent
30982   } while (p)
30983
30984   // console.error("DW not recursive")
30985
30986   // chop off the entry's root dir, replace with ours
30987   var props = {
30988     parent: self,
30989     root: self.root || self,
30990     type: entry.type,
30991     depth: self.depth + 1
30992   }
30993
30994   pp = entry._path || entry.path || entry.props.path
30995   if (entry.parent) {
30996     pp = pp.substr(entry.parent._path.length + 1)
30997   }
30998   // get rid of any ../../ shenanigans
30999   props.path = path.join(self.path, path.join('/', pp))
31000
31001   // if i have a filter, the child should inherit it.
31002   props.filter = self.filter
31003
31004   // all the rest of the stuff, copy over from the source.
31005   Object.keys(entry.props).forEach(function (k) {
31006     if (!props.hasOwnProperty(k)) {
31007       props[k] = entry.props[k]
31008     }
31009   })
31010
31011   // not sure at this point what kind of writer this is.
31012   var child = self._currentChild = new Writer(props)
31013   child.on('ready', function () {
31014     // console.error("DW Child Ready", child.type, child._path)
31015     // console.error("  resuming", entry._path)
31016     entry.pipe(child)
31017     entry.resume()
31018   })
31019
31020   // XXX Make this work in node.
31021   // Long filenames should not break stuff.
31022   child.on('error', function (er) {
31023     if (child._swallowErrors) {
31024       self.warn(er)
31025       child.emit('end')
31026       child.emit('close')
31027     } else {
31028       self.emit('error', er)
31029     }
31030   })
31031
31032   // we fire _end internally *after* end, so that we don't move on
31033   // until any "end" listeners have had their chance to do stuff.
31034   child.on('close', onend)
31035   var ended = false
31036   function onend () {
31037     if (ended) return
31038     ended = true
31039     // console.error("* DW Child end", child.basename)
31040     self._currentChild = null
31041     self._processing = false
31042     self._process()
31043   }
31044 }
31045
31046
31047 /***/ }),
31048 /* 207 */
31049 /***/ (function(module, exports) {
31050
31051 module.exports = collect
31052
31053 function collect (stream) {
31054   if (stream._collected) return
31055
31056   if (stream._paused) return stream.on('resume', collect.bind(null, stream))
31057
31058   stream._collected = true
31059   stream.pause()
31060
31061   stream.on('data', save)
31062   stream.on('end', save)
31063   var buf = []
31064   function save (b) {
31065     if (typeof b === 'string') b = new Buffer(b)
31066     if (Buffer.isBuffer(b) && !b.length) return
31067     buf.push(b)
31068   }
31069
31070   stream.on('entry', saveEntry)
31071   var entryBuffer = []
31072   function saveEntry (e) {
31073     collect(e)
31074     entryBuffer.push(e)
31075   }
31076
31077   stream.on('proxy', proxyPause)
31078   function proxyPause (p) {
31079     p.pause()
31080   }
31081
31082   // replace the pipe method with a new version that will
31083   // unlock the buffered stuff.  if you just call .pipe()
31084   // without a destination, then it'll re-play the events.
31085   stream.pipe = (function (orig) {
31086     return function (dest) {
31087       // console.error(' === open the pipes', dest && dest.path)
31088
31089       // let the entries flow through one at a time.
31090       // Once they're all done, then we can resume completely.
31091       var e = 0
31092       ;(function unblockEntry () {
31093         var entry = entryBuffer[e++]
31094         // console.error(" ==== unblock entry", entry && entry.path)
31095         if (!entry) return resume()
31096         entry.on('end', unblockEntry)
31097         if (dest) dest.add(entry)
31098         else stream.emit('entry', entry)
31099       })()
31100
31101       function resume () {
31102         stream.removeListener('entry', saveEntry)
31103         stream.removeListener('data', save)
31104         stream.removeListener('end', save)
31105
31106         stream.pipe = orig
31107         if (dest) stream.pipe(dest)
31108
31109         buf.forEach(function (b) {
31110           if (b) stream.emit('data', b)
31111           else stream.emit('end')
31112         })
31113
31114         stream.resume()
31115       }
31116
31117       return dest
31118     }
31119   })(stream.pipe)
31120 }
31121
31122
31123 /***/ }),
31124 /* 208 */
31125 /***/ (function(module, exports, __webpack_require__) {
31126
31127 module.exports = LinkWriter
31128
31129 var fs = __webpack_require__(192)
31130 var Writer = __webpack_require__(203)
31131 var inherits = __webpack_require__(66)
31132 var path = __webpack_require__(2)
31133 var rimraf = __webpack_require__(204)
31134
31135 inherits(LinkWriter, Writer)
31136
31137 function LinkWriter (props) {
31138   var self = this
31139   if (!(self instanceof LinkWriter)) {
31140     throw new Error('LinkWriter must be called as constructor.')
31141   }
31142
31143   // should already be established as a Link type
31144   if (!((props.type === 'Link' && props.Link) ||
31145     (props.type === 'SymbolicLink' && props.SymbolicLink))) {
31146     throw new Error('Non-link type ' + props.type)
31147   }
31148
31149   if (props.linkpath === '') props.linkpath = '.'
31150   if (!props.linkpath) {
31151     self.error('Need linkpath property to create ' + props.type)
31152   }
31153
31154   Writer.call(this, props)
31155 }
31156
31157 LinkWriter.prototype._create = function () {
31158   // console.error(" LW _create")
31159   var self = this
31160   var hard = self.type === 'Link' || process.platform === 'win32'
31161   var link = hard ? 'link' : 'symlink'
31162   var lp = hard ? path.resolve(self.dirname, self.linkpath) : self.linkpath
31163
31164   // can only change the link path by clobbering
31165   // For hard links, let's just assume that's always the case, since
31166   // there's no good way to read them if we don't already know.
31167   if (hard) return clobber(self, lp, link)
31168
31169   fs.readlink(self._path, function (er, p) {
31170     // only skip creation if it's exactly the same link
31171     if (p && p === lp) return finish(self)
31172     clobber(self, lp, link)
31173   })
31174 }
31175
31176 function clobber (self, lp, link) {
31177   rimraf(self._path, function (er) {
31178     if (er) return self.error(er)
31179     create(self, lp, link)
31180   })
31181 }
31182
31183 function create (self, lp, link) {
31184   fs[link](lp, self._path, function (er) {
31185     // if this is a hard link, and we're in the process of writing out a
31186     // directory, it's very possible that the thing we're linking to
31187     // doesn't exist yet (especially if it was intended as a symlink),
31188     // so swallow ENOENT errors here and just soldier in.
31189     // Additionally, an EPERM or EACCES can happen on win32 if it's trying
31190     // to make a link to a directory.  Again, just skip it.
31191     // A better solution would be to have fs.symlink be supported on
31192     // windows in some nice fashion.
31193     if (er) {
31194       if ((er.code === 'ENOENT' ||
31195         er.code === 'EACCES' ||
31196         er.code === 'EPERM') && process.platform === 'win32') {
31197         self.ready = true
31198         self.emit('ready')
31199         self.emit('end')
31200         self.emit('close')
31201         self.end = self._finish = function () {}
31202       } else return self.error(er)
31203     }
31204     finish(self)
31205   })
31206 }
31207
31208 function finish (self) {
31209   self.ready = true
31210   self.emit('ready')
31211   if (self._ended && !self._finished) self._finish()
31212 }
31213
31214 LinkWriter.prototype.end = function () {
31215   // console.error("LW finish in end")
31216   this._ended = true
31217   if (this.ready) {
31218     this._finished = true
31219     this._finish()
31220   }
31221 }
31222
31223
31224 /***/ }),
31225 /* 209 */
31226 /***/ (function(module, exports, __webpack_require__) {
31227
31228 module.exports = FileWriter
31229
31230 var fs = __webpack_require__(192)
31231 var Writer = __webpack_require__(203)
31232 var inherits = __webpack_require__(66)
31233 var EOF = {}
31234
31235 inherits(FileWriter, Writer)
31236
31237 function FileWriter (props) {
31238   var self = this
31239   if (!(self instanceof FileWriter)) {
31240     throw new Error('FileWriter must be called as constructor.')
31241   }
31242
31243   // should already be established as a File type
31244   if (props.type !== 'File' || !props.File) {
31245     throw new Error('Non-file type ' + props.type)
31246   }
31247
31248   self._buffer = []
31249   self._bytesWritten = 0
31250
31251   Writer.call(this, props)
31252 }
31253
31254 FileWriter.prototype._create = function () {
31255   var self = this
31256   if (self._stream) return
31257
31258   var so = {}
31259   if (self.props.flags) so.flags = self.props.flags
31260   so.mode = Writer.filemode
31261   if (self._old && self._old.blksize) so.bufferSize = self._old.blksize
31262
31263   self._stream = fs.createWriteStream(self._path, so)
31264
31265   self._stream.on('open', function () {
31266     // console.error("FW open", self._buffer, self._path)
31267     self.ready = true
31268     self._buffer.forEach(function (c) {
31269       if (c === EOF) self._stream.end()
31270       else self._stream.write(c)
31271     })
31272     self.emit('ready')
31273     // give this a kick just in case it needs it.
31274     self.emit('drain')
31275   })
31276
31277   self._stream.on('error', function (er) { self.emit('error', er) })
31278
31279   self._stream.on('drain', function () { self.emit('drain') })
31280
31281   self._stream.on('close', function () {
31282     // console.error('\n\nFW Stream Close', self._path, self.size)
31283     self._finish()
31284   })
31285 }
31286
31287 FileWriter.prototype.write = function (c) {
31288   var self = this
31289
31290   self._bytesWritten += c.length
31291
31292   if (!self.ready) {
31293     if (!Buffer.isBuffer(c) && typeof c !== 'string') {
31294       throw new Error('invalid write data')
31295     }
31296     self._buffer.push(c)
31297     return false
31298   }
31299
31300   var ret = self._stream.write(c)
31301   // console.error('\t-- fw wrote, _stream says', ret, self._stream._queue.length)
31302
31303   // allow 2 buffered writes, because otherwise there's just too
31304   // much stop and go bs.
31305   if (ret === false && self._stream._queue) {
31306     return self._stream._queue.length <= 2
31307   } else {
31308     return ret
31309   }
31310 }
31311
31312 FileWriter.prototype.end = function (c) {
31313   var self = this
31314
31315   if (c) self.write(c)
31316
31317   if (!self.ready) {
31318     self._buffer.push(EOF)
31319     return false
31320   }
31321
31322   return self._stream.end()
31323 }
31324
31325 FileWriter.prototype._finish = function () {
31326   var self = this
31327   if (typeof self.size === 'number' && self._bytesWritten !== self.size) {
31328     self.error(
31329       'Did not get expected byte count.\n' +
31330       'expect: ' + self.size + '\n' +
31331       'actual: ' + self._bytesWritten)
31332   }
31333   Writer.prototype._finish.call(self)
31334 }
31335
31336
31337 /***/ }),
31338 /* 210 */
31339 /***/ (function(module, exports, __webpack_require__) {
31340
31341 // A writer for when we don't know what kind of thing
31342 // the thing is.  That is, it's not explicitly set,
31343 // so we're going to make it whatever the thing already
31344 // is, or "File"
31345 //
31346 // Until then, collect all events.
31347
31348 module.exports = ProxyWriter
31349
31350 var Writer = __webpack_require__(203)
31351 var getType = __webpack_require__(197)
31352 var inherits = __webpack_require__(66)
31353 var collect = __webpack_require__(207)
31354 var fs = __webpack_require__(42)
31355
31356 inherits(ProxyWriter, Writer)
31357
31358 function ProxyWriter (props) {
31359   var self = this
31360   if (!(self instanceof ProxyWriter)) {
31361     throw new Error('ProxyWriter must be called as constructor.')
31362   }
31363
31364   self.props = props
31365   self._needDrain = false
31366
31367   Writer.call(self, props)
31368 }
31369
31370 ProxyWriter.prototype._stat = function () {
31371   var self = this
31372   var props = self.props
31373   // stat the thing to see what the proxy should be.
31374   var stat = props.follow ? 'stat' : 'lstat'
31375
31376   fs[stat](props.path, function (er, current) {
31377     var type
31378     if (er || !current) {
31379       type = 'File'
31380     } else {
31381       type = getType(current)
31382     }
31383
31384     props[type] = true
31385     props.type = self.type = type
31386
31387     self._old = current
31388     self._addProxy(Writer(props, current))
31389   })
31390 }
31391
31392 ProxyWriter.prototype._addProxy = function (proxy) {
31393   // console.error("~~ set proxy", this.path)
31394   var self = this
31395   if (self._proxy) {
31396     return self.error('proxy already set')
31397   }
31398
31399   self._proxy = proxy
31400   ;[
31401     'ready',
31402     'error',
31403     'close',
31404     'pipe',
31405     'drain',
31406     'warn'
31407   ].forEach(function (ev) {
31408     proxy.on(ev, self.emit.bind(self, ev))
31409   })
31410
31411   self.emit('proxy', proxy)
31412
31413   var calls = self._buffer
31414   calls.forEach(function (c) {
31415     // console.error("~~ ~~ proxy buffered call", c[0], c[1])
31416     proxy[c[0]].apply(proxy, c[1])
31417   })
31418   self._buffer.length = 0
31419   if (self._needsDrain) self.emit('drain')
31420 }
31421
31422 ProxyWriter.prototype.add = function (entry) {
31423   // console.error("~~ proxy add")
31424   collect(entry)
31425
31426   if (!this._proxy) {
31427     this._buffer.push(['add', [entry]])
31428     this._needDrain = true
31429     return false
31430   }
31431   return this._proxy.add(entry)
31432 }
31433
31434 ProxyWriter.prototype.write = function (c) {
31435   // console.error('~~ proxy write')
31436   if (!this._proxy) {
31437     this._buffer.push(['write', [c]])
31438     this._needDrain = true
31439     return false
31440   }
31441   return this._proxy.write(c)
31442 }
31443
31444 ProxyWriter.prototype.end = function (c) {
31445   // console.error('~~ proxy end')
31446   if (!this._proxy) {
31447     this._buffer.push(['end', [c]])
31448     return false
31449   }
31450   return this._proxy.end(c)
31451 }
31452
31453
31454 /***/ }),
31455 /* 211 */
31456 /***/ (function(module, exports, __webpack_require__) {
31457
31458 var fs = __webpack_require__(212);
31459 var Promise = __webpack_require__(128);
31460 var directory = __webpack_require__(216);
31461 var Stream = __webpack_require__(44);
31462
31463 // Backwards compatibility for node versions < 8
31464 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
31465   Stream = __webpack_require__(167);
31466
31467 module.exports = {
31468   buffer: function(buffer, options) {
31469     var source = {
31470       stream: function(offset, length) {
31471         var stream = Stream.PassThrough();
31472         stream.end(buffer.slice(offset, length));
31473         return stream;
31474       },
31475       size: function() {
31476         return Promise.resolve(buffer.length);
31477       }
31478     };
31479     return directory(source, options);
31480   },
31481   file: function(filename, options) {
31482     var source = {
31483       stream: function(offset,length) {
31484         return fs.createReadStream(filename,{start: offset, end: length && offset+length});
31485       },
31486       size: function() {
31487         return new Promise(function(resolve,reject) {
31488           fs.stat(filename,function(err,d) {
31489             if (err)
31490               reject(err);
31491             else
31492               resolve(d.size);
31493           });
31494         });
31495       }
31496     };
31497     return directory(source, options);
31498   },
31499
31500   url: function(request, params, options) {
31501     if (typeof params === 'string')
31502       params = {url: params};
31503     if (!params.url)
31504       throw 'URL missing';
31505     params.headers = params.headers || {};
31506
31507     var source = {
31508       stream : function(offset,length) {
31509         var options = Object.create(params);
31510         options.headers = Object.create(params.headers);
31511         options.headers.range = 'bytes='+offset+'-' + (length ? length : '');
31512         return request(options);
31513       },
31514       size: function() {
31515         return new Promise(function(resolve,reject) {
31516           var req = request(params);
31517           req.on('response',function(d) {
31518             req.abort();
31519             if (!d.headers['content-length'])
31520               reject(new Error('Missing content length header'));
31521             else
31522               resolve(d.headers['content-length']);
31523           }).on('error',reject);
31524         });
31525       }
31526     };
31527
31528     return directory(source, options);
31529   },
31530
31531   s3 : function(client,params, options) {
31532     var source = {
31533       size: function() {
31534         return new Promise(function(resolve,reject) {
31535           client.headObject(params, function(err,d) {
31536             if (err)
31537               reject(err);
31538             else
31539               resolve(d.ContentLength);
31540           });
31541         });
31542       },
31543       stream: function(offset,length) {
31544         var d = {};
31545         for (var key in params)
31546           d[key] = params[key];
31547         d.Range = 'bytes='+offset+'-' + (length ? length : '');
31548         return client.getObject(d).createReadStream();
31549       }
31550     };
31551
31552     return directory(source, options);
31553   }
31554 };
31555
31556
31557 /***/ }),
31558 /* 212 */
31559 /***/ (function(module, exports, __webpack_require__) {
31560
31561 var fs = __webpack_require__(42)
31562 var polyfills = __webpack_require__(213)
31563 var legacy = __webpack_require__(214)
31564 var clone = __webpack_require__(215)
31565
31566 var util = __webpack_require__(50)
31567
31568 /* istanbul ignore next - node 0.x polyfill */
31569 var gracefulQueue
31570 var previousSymbol
31571
31572 /* istanbul ignore else - node 0.x polyfill */
31573 if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
31574   gracefulQueue = Symbol.for('graceful-fs.queue')
31575   // This is used in testing by future versions
31576   previousSymbol = Symbol.for('graceful-fs.previous')
31577 } else {
31578   gracefulQueue = '___graceful-fs.queue'
31579   previousSymbol = '___graceful-fs.previous'
31580 }
31581
31582 function noop () {}
31583
31584 function publishQueue(context, queue) {
31585   Object.defineProperty(context, gracefulQueue, {
31586     get: function() {
31587       return queue
31588     }
31589   })
31590 }
31591
31592 var debug = noop
31593 if (util.debuglog)
31594   debug = util.debuglog('gfs4')
31595 else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
31596   debug = function() {
31597     var m = util.format.apply(util, arguments)
31598     m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
31599     console.error(m)
31600   }
31601
31602 // Once time initialization
31603 if (!fs[gracefulQueue]) {
31604   // This queue can be shared by multiple loaded instances
31605   var queue = global[gracefulQueue] || []
31606   publishQueue(fs, queue)
31607
31608   // Patch fs.close/closeSync to shared queue version, because we need
31609   // to retry() whenever a close happens *anywhere* in the program.
31610   // This is essential when multiple graceful-fs instances are
31611   // in play at the same time.
31612   fs.close = (function (fs$close) {
31613     function close (fd, cb) {
31614       return fs$close.call(fs, fd, function (err) {
31615         // This function uses the graceful-fs shared queue
31616         if (!err) {
31617           retry()
31618         }
31619
31620         if (typeof cb === 'function')
31621           cb.apply(this, arguments)
31622       })
31623     }
31624
31625     Object.defineProperty(close, previousSymbol, {
31626       value: fs$close
31627     })
31628     return close
31629   })(fs.close)
31630
31631   fs.closeSync = (function (fs$closeSync) {
31632     function closeSync (fd) {
31633       // This function uses the graceful-fs shared queue
31634       fs$closeSync.apply(fs, arguments)
31635       retry()
31636     }
31637
31638     Object.defineProperty(closeSync, previousSymbol, {
31639       value: fs$closeSync
31640     })
31641     return closeSync
31642   })(fs.closeSync)
31643
31644   if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
31645     process.on('exit', function() {
31646       debug(fs[gracefulQueue])
31647       __webpack_require__(58).equal(fs[gracefulQueue].length, 0)
31648     })
31649   }
31650 }
31651
31652 if (!global[gracefulQueue]) {
31653   publishQueue(global, fs[gracefulQueue]);
31654 }
31655
31656 module.exports = patch(clone(fs))
31657 if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
31658     module.exports = patch(fs)
31659     fs.__patched = true;
31660 }
31661
31662 function patch (fs) {
31663   // Everything that references the open() function needs to be in here
31664   polyfills(fs)
31665   fs.gracefulify = patch
31666
31667   fs.createReadStream = createReadStream
31668   fs.createWriteStream = createWriteStream
31669   var fs$readFile = fs.readFile
31670   fs.readFile = readFile
31671   function readFile (path, options, cb) {
31672     if (typeof options === 'function')
31673       cb = options, options = null
31674
31675     return go$readFile(path, options, cb)
31676
31677     function go$readFile (path, options, cb) {
31678       return fs$readFile(path, options, function (err) {
31679         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
31680           enqueue([go$readFile, [path, options, cb]])
31681         else {
31682           if (typeof cb === 'function')
31683             cb.apply(this, arguments)
31684           retry()
31685         }
31686       })
31687     }
31688   }
31689
31690   var fs$writeFile = fs.writeFile
31691   fs.writeFile = writeFile
31692   function writeFile (path, data, options, cb) {
31693     if (typeof options === 'function')
31694       cb = options, options = null
31695
31696     return go$writeFile(path, data, options, cb)
31697
31698     function go$writeFile (path, data, options, cb) {
31699       return fs$writeFile(path, data, options, function (err) {
31700         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
31701           enqueue([go$writeFile, [path, data, options, cb]])
31702         else {
31703           if (typeof cb === 'function')
31704             cb.apply(this, arguments)
31705           retry()
31706         }
31707       })
31708     }
31709   }
31710
31711   var fs$appendFile = fs.appendFile
31712   if (fs$appendFile)
31713     fs.appendFile = appendFile
31714   function appendFile (path, data, options, cb) {
31715     if (typeof options === 'function')
31716       cb = options, options = null
31717
31718     return go$appendFile(path, data, options, cb)
31719
31720     function go$appendFile (path, data, options, cb) {
31721       return fs$appendFile(path, data, options, function (err) {
31722         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
31723           enqueue([go$appendFile, [path, data, options, cb]])
31724         else {
31725           if (typeof cb === 'function')
31726             cb.apply(this, arguments)
31727           retry()
31728         }
31729       })
31730     }
31731   }
31732
31733   var fs$readdir = fs.readdir
31734   fs.readdir = readdir
31735   function readdir (path, options, cb) {
31736     var args = [path]
31737     if (typeof options !== 'function') {
31738       args.push(options)
31739     } else {
31740       cb = options
31741     }
31742     args.push(go$readdir$cb)
31743
31744     return go$readdir(args)
31745
31746     function go$readdir$cb (err, files) {
31747       if (files && files.sort)
31748         files.sort()
31749
31750       if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
31751         enqueue([go$readdir, [args]])
31752
31753       else {
31754         if (typeof cb === 'function')
31755           cb.apply(this, arguments)
31756         retry()
31757       }
31758     }
31759   }
31760
31761   function go$readdir (args) {
31762     return fs$readdir.apply(fs, args)
31763   }
31764
31765   if (process.version.substr(0, 4) === 'v0.8') {
31766     var legStreams = legacy(fs)
31767     ReadStream = legStreams.ReadStream
31768     WriteStream = legStreams.WriteStream
31769   }
31770
31771   var fs$ReadStream = fs.ReadStream
31772   if (fs$ReadStream) {
31773     ReadStream.prototype = Object.create(fs$ReadStream.prototype)
31774     ReadStream.prototype.open = ReadStream$open
31775   }
31776
31777   var fs$WriteStream = fs.WriteStream
31778   if (fs$WriteStream) {
31779     WriteStream.prototype = Object.create(fs$WriteStream.prototype)
31780     WriteStream.prototype.open = WriteStream$open
31781   }
31782
31783   Object.defineProperty(fs, 'ReadStream', {
31784     get: function () {
31785       return ReadStream
31786     },
31787     set: function (val) {
31788       ReadStream = val
31789     },
31790     enumerable: true,
31791     configurable: true
31792   })
31793   Object.defineProperty(fs, 'WriteStream', {
31794     get: function () {
31795       return WriteStream
31796     },
31797     set: function (val) {
31798       WriteStream = val
31799     },
31800     enumerable: true,
31801     configurable: true
31802   })
31803
31804   // legacy names
31805   var FileReadStream = ReadStream
31806   Object.defineProperty(fs, 'FileReadStream', {
31807     get: function () {
31808       return FileReadStream
31809     },
31810     set: function (val) {
31811       FileReadStream = val
31812     },
31813     enumerable: true,
31814     configurable: true
31815   })
31816   var FileWriteStream = WriteStream
31817   Object.defineProperty(fs, 'FileWriteStream', {
31818     get: function () {
31819       return FileWriteStream
31820     },
31821     set: function (val) {
31822       FileWriteStream = val
31823     },
31824     enumerable: true,
31825     configurable: true
31826   })
31827
31828   function ReadStream (path, options) {
31829     if (this instanceof ReadStream)
31830       return fs$ReadStream.apply(this, arguments), this
31831     else
31832       return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
31833   }
31834
31835   function ReadStream$open () {
31836     var that = this
31837     open(that.path, that.flags, that.mode, function (err, fd) {
31838       if (err) {
31839         if (that.autoClose)
31840           that.destroy()
31841
31842         that.emit('error', err)
31843       } else {
31844         that.fd = fd
31845         that.emit('open', fd)
31846         that.read()
31847       }
31848     })
31849   }
31850
31851   function WriteStream (path, options) {
31852     if (this instanceof WriteStream)
31853       return fs$WriteStream.apply(this, arguments), this
31854     else
31855       return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
31856   }
31857
31858   function WriteStream$open () {
31859     var that = this
31860     open(that.path, that.flags, that.mode, function (err, fd) {
31861       if (err) {
31862         that.destroy()
31863         that.emit('error', err)
31864       } else {
31865         that.fd = fd
31866         that.emit('open', fd)
31867       }
31868     })
31869   }
31870
31871   function createReadStream (path, options) {
31872     return new fs.ReadStream(path, options)
31873   }
31874
31875   function createWriteStream (path, options) {
31876     return new fs.WriteStream(path, options)
31877   }
31878
31879   var fs$open = fs.open
31880   fs.open = open
31881   function open (path, flags, mode, cb) {
31882     if (typeof mode === 'function')
31883       cb = mode, mode = null
31884
31885     return go$open(path, flags, mode, cb)
31886
31887     function go$open (path, flags, mode, cb) {
31888       return fs$open(path, flags, mode, function (err, fd) {
31889         if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
31890           enqueue([go$open, [path, flags, mode, cb]])
31891         else {
31892           if (typeof cb === 'function')
31893             cb.apply(this, arguments)
31894           retry()
31895         }
31896       })
31897     }
31898   }
31899
31900   return fs
31901 }
31902
31903 function enqueue (elem) {
31904   debug('ENQUEUE', elem[0].name, elem[1])
31905   fs[gracefulQueue].push(elem)
31906 }
31907
31908 function retry () {
31909   var elem = fs[gracefulQueue].shift()
31910   if (elem) {
31911     debug('RETRY', elem[0].name, elem[1])
31912     elem[0].apply(null, elem[1])
31913   }
31914 }
31915
31916
31917 /***/ }),
31918 /* 213 */
31919 /***/ (function(module, exports, __webpack_require__) {
31920
31921 var constants = __webpack_require__(194)
31922
31923 var origCwd = process.cwd
31924 var cwd = null
31925
31926 var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
31927
31928 process.cwd = function() {
31929   if (!cwd)
31930     cwd = origCwd.call(process)
31931   return cwd
31932 }
31933 try {
31934   process.cwd()
31935 } catch (er) {}
31936
31937 var chdir = process.chdir
31938 process.chdir = function(d) {
31939   cwd = null
31940   chdir.call(process, d)
31941 }
31942
31943 module.exports = patch
31944
31945 function patch (fs) {
31946   // (re-)implement some things that are known busted or missing.
31947
31948   // lchmod, broken prior to 0.6.2
31949   // back-port the fix here.
31950   if (constants.hasOwnProperty('O_SYMLINK') &&
31951       process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
31952     patchLchmod(fs)
31953   }
31954
31955   // lutimes implementation, or no-op
31956   if (!fs.lutimes) {
31957     patchLutimes(fs)
31958   }
31959
31960   // https://github.com/isaacs/node-graceful-fs/issues/4
31961   // Chown should not fail on einval or eperm if non-root.
31962   // It should not fail on enosys ever, as this just indicates
31963   // that a fs doesn't support the intended operation.
31964
31965   fs.chown = chownFix(fs.chown)
31966   fs.fchown = chownFix(fs.fchown)
31967   fs.lchown = chownFix(fs.lchown)
31968
31969   fs.chmod = chmodFix(fs.chmod)
31970   fs.fchmod = chmodFix(fs.fchmod)
31971   fs.lchmod = chmodFix(fs.lchmod)
31972
31973   fs.chownSync = chownFixSync(fs.chownSync)
31974   fs.fchownSync = chownFixSync(fs.fchownSync)
31975   fs.lchownSync = chownFixSync(fs.lchownSync)
31976
31977   fs.chmodSync = chmodFixSync(fs.chmodSync)
31978   fs.fchmodSync = chmodFixSync(fs.fchmodSync)
31979   fs.lchmodSync = chmodFixSync(fs.lchmodSync)
31980
31981   fs.stat = statFix(fs.stat)
31982   fs.fstat = statFix(fs.fstat)
31983   fs.lstat = statFix(fs.lstat)
31984
31985   fs.statSync = statFixSync(fs.statSync)
31986   fs.fstatSync = statFixSync(fs.fstatSync)
31987   fs.lstatSync = statFixSync(fs.lstatSync)
31988
31989   // if lchmod/lchown do not exist, then make them no-ops
31990   if (!fs.lchmod) {
31991     fs.lchmod = function (path, mode, cb) {
31992       if (cb) process.nextTick(cb)
31993     }
31994     fs.lchmodSync = function () {}
31995   }
31996   if (!fs.lchown) {
31997     fs.lchown = function (path, uid, gid, cb) {
31998       if (cb) process.nextTick(cb)
31999     }
32000     fs.lchownSync = function () {}
32001   }
32002
32003   // on Windows, A/V software can lock the directory, causing this
32004   // to fail with an EACCES or EPERM if the directory contains newly
32005   // created files.  Try again on failure, for up to 60 seconds.
32006
32007   // Set the timeout this long because some Windows Anti-Virus, such as Parity
32008   // bit9, may lock files for up to a minute, causing npm package install
32009   // failures. Also, take care to yield the scheduler. Windows scheduling gives
32010   // CPU to a busy looping process, which can cause the program causing the lock
32011   // contention to be starved of CPU by node, so the contention doesn't resolve.
32012   if (platform === "win32") {
32013     fs.rename = (function (fs$rename) { return function (from, to, cb) {
32014       var start = Date.now()
32015       var backoff = 0;
32016       fs$rename(from, to, function CB (er) {
32017         if (er
32018             && (er.code === "EACCES" || er.code === "EPERM")
32019             && Date.now() - start < 60000) {
32020           setTimeout(function() {
32021             fs.stat(to, function (stater, st) {
32022               if (stater && stater.code === "ENOENT")
32023                 fs$rename(from, to, CB);
32024               else
32025                 cb(er)
32026             })
32027           }, backoff)
32028           if (backoff < 100)
32029             backoff += 10;
32030           return;
32031         }
32032         if (cb) cb(er)
32033       })
32034     }})(fs.rename)
32035   }
32036
32037   // if read() returns EAGAIN, then just try it again.
32038   fs.read = (function (fs$read) {
32039     function read (fd, buffer, offset, length, position, callback_) {
32040       var callback
32041       if (callback_ && typeof callback_ === 'function') {
32042         var eagCounter = 0
32043         callback = function (er, _, __) {
32044           if (er && er.code === 'EAGAIN' && eagCounter < 10) {
32045             eagCounter ++
32046             return fs$read.call(fs, fd, buffer, offset, length, position, callback)
32047           }
32048           callback_.apply(this, arguments)
32049         }
32050       }
32051       return fs$read.call(fs, fd, buffer, offset, length, position, callback)
32052     }
32053
32054     // This ensures `util.promisify` works as it does for native `fs.read`.
32055     read.__proto__ = fs$read
32056     return read
32057   })(fs.read)
32058
32059   fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
32060     var eagCounter = 0
32061     while (true) {
32062       try {
32063         return fs$readSync.call(fs, fd, buffer, offset, length, position)
32064       } catch (er) {
32065         if (er.code === 'EAGAIN' && eagCounter < 10) {
32066           eagCounter ++
32067           continue
32068         }
32069         throw er
32070       }
32071     }
32072   }})(fs.readSync)
32073
32074   function patchLchmod (fs) {
32075     fs.lchmod = function (path, mode, callback) {
32076       fs.open( path
32077              , constants.O_WRONLY | constants.O_SYMLINK
32078              , mode
32079              , function (err, fd) {
32080         if (err) {
32081           if (callback) callback(err)
32082           return
32083         }
32084         // prefer to return the chmod error, if one occurs,
32085         // but still try to close, and report closing errors if they occur.
32086         fs.fchmod(fd, mode, function (err) {
32087           fs.close(fd, function(err2) {
32088             if (callback) callback(err || err2)
32089           })
32090         })
32091       })
32092     }
32093
32094     fs.lchmodSync = function (path, mode) {
32095       var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
32096
32097       // prefer to return the chmod error, if one occurs,
32098       // but still try to close, and report closing errors if they occur.
32099       var threw = true
32100       var ret
32101       try {
32102         ret = fs.fchmodSync(fd, mode)
32103         threw = false
32104       } finally {
32105         if (threw) {
32106           try {
32107             fs.closeSync(fd)
32108           } catch (er) {}
32109         } else {
32110           fs.closeSync(fd)
32111         }
32112       }
32113       return ret
32114     }
32115   }
32116
32117   function patchLutimes (fs) {
32118     if (constants.hasOwnProperty("O_SYMLINK")) {
32119       fs.lutimes = function (path, at, mt, cb) {
32120         fs.open(path, constants.O_SYMLINK, function (er, fd) {
32121           if (er) {
32122             if (cb) cb(er)
32123             return
32124           }
32125           fs.futimes(fd, at, mt, function (er) {
32126             fs.close(fd, function (er2) {
32127               if (cb) cb(er || er2)
32128             })
32129           })
32130         })
32131       }
32132
32133       fs.lutimesSync = function (path, at, mt) {
32134         var fd = fs.openSync(path, constants.O_SYMLINK)
32135         var ret
32136         var threw = true
32137         try {
32138           ret = fs.futimesSync(fd, at, mt)
32139           threw = false
32140         } finally {
32141           if (threw) {
32142             try {
32143               fs.closeSync(fd)
32144             } catch (er) {}
32145           } else {
32146             fs.closeSync(fd)
32147           }
32148         }
32149         return ret
32150       }
32151
32152     } else {
32153       fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
32154       fs.lutimesSync = function () {}
32155     }
32156   }
32157
32158   function chmodFix (orig) {
32159     if (!orig) return orig
32160     return function (target, mode, cb) {
32161       return orig.call(fs, target, mode, function (er) {
32162         if (chownErOk(er)) er = null
32163         if (cb) cb.apply(this, arguments)
32164       })
32165     }
32166   }
32167
32168   function chmodFixSync (orig) {
32169     if (!orig) return orig
32170     return function (target, mode) {
32171       try {
32172         return orig.call(fs, target, mode)
32173       } catch (er) {
32174         if (!chownErOk(er)) throw er
32175       }
32176     }
32177   }
32178
32179
32180   function chownFix (orig) {
32181     if (!orig) return orig
32182     return function (target, uid, gid, cb) {
32183       return orig.call(fs, target, uid, gid, function (er) {
32184         if (chownErOk(er)) er = null
32185         if (cb) cb.apply(this, arguments)
32186       })
32187     }
32188   }
32189
32190   function chownFixSync (orig) {
32191     if (!orig) return orig
32192     return function (target, uid, gid) {
32193       try {
32194         return orig.call(fs, target, uid, gid)
32195       } catch (er) {
32196         if (!chownErOk(er)) throw er
32197       }
32198     }
32199   }
32200
32201   function statFix (orig) {
32202     if (!orig) return orig
32203     // Older versions of Node erroneously returned signed integers for
32204     // uid + gid.
32205     return function (target, options, cb) {
32206       if (typeof options === 'function') {
32207         cb = options
32208         options = null
32209       }
32210       function callback (er, stats) {
32211         if (stats) {
32212           if (stats.uid < 0) stats.uid += 0x100000000
32213           if (stats.gid < 0) stats.gid += 0x100000000
32214         }
32215         if (cb) cb.apply(this, arguments)
32216       }
32217       return options ? orig.call(fs, target, options, callback)
32218         : orig.call(fs, target, callback)
32219     }
32220   }
32221
32222   function statFixSync (orig) {
32223     if (!orig) return orig
32224     // Older versions of Node erroneously returned signed integers for
32225     // uid + gid.
32226     return function (target, options) {
32227       var stats = options ? orig.call(fs, target, options)
32228         : orig.call(fs, target)
32229       if (stats.uid < 0) stats.uid += 0x100000000
32230       if (stats.gid < 0) stats.gid += 0x100000000
32231       return stats;
32232     }
32233   }
32234
32235   // ENOSYS means that the fs doesn't support the op. Just ignore
32236   // that, because it doesn't matter.
32237   //
32238   // if there's no getuid, or if getuid() is something other
32239   // than 0, and the error is EINVAL or EPERM, then just ignore
32240   // it.
32241   //
32242   // This specific case is a silent failure in cp, install, tar,
32243   // and most other unix tools that manage permissions.
32244   //
32245   // When running as root, or if other types of errors are
32246   // encountered, then it's strict.
32247   function chownErOk (er) {
32248     if (!er)
32249       return true
32250
32251     if (er.code === "ENOSYS")
32252       return true
32253
32254     var nonroot = !process.getuid || process.getuid() !== 0
32255     if (nonroot) {
32256       if (er.code === "EINVAL" || er.code === "EPERM")
32257         return true
32258     }
32259
32260     return false
32261   }
32262 }
32263
32264
32265 /***/ }),
32266 /* 214 */
32267 /***/ (function(module, exports, __webpack_require__) {
32268
32269 var Stream = __webpack_require__(44).Stream
32270
32271 module.exports = legacy
32272
32273 function legacy (fs) {
32274   return {
32275     ReadStream: ReadStream,
32276     WriteStream: WriteStream
32277   }
32278
32279   function ReadStream (path, options) {
32280     if (!(this instanceof ReadStream)) return new ReadStream(path, options);
32281
32282     Stream.call(this);
32283
32284     var self = this;
32285
32286     this.path = path;
32287     this.fd = null;
32288     this.readable = true;
32289     this.paused = false;
32290
32291     this.flags = 'r';
32292     this.mode = 438; /*=0666*/
32293     this.bufferSize = 64 * 1024;
32294
32295     options = options || {};
32296
32297     // Mixin options into this
32298     var keys = Object.keys(options);
32299     for (var index = 0, length = keys.length; index < length; index++) {
32300       var key = keys[index];
32301       this[key] = options[key];
32302     }
32303
32304     if (this.encoding) this.setEncoding(this.encoding);
32305
32306     if (this.start !== undefined) {
32307       if ('number' !== typeof this.start) {
32308         throw TypeError('start must be a Number');
32309       }
32310       if (this.end === undefined) {
32311         this.end = Infinity;
32312       } else if ('number' !== typeof this.end) {
32313         throw TypeError('end must be a Number');
32314       }
32315
32316       if (this.start > this.end) {
32317         throw new Error('start must be <= end');
32318       }
32319
32320       this.pos = this.start;
32321     }
32322
32323     if (this.fd !== null) {
32324       process.nextTick(function() {
32325         self._read();
32326       });
32327       return;
32328     }
32329
32330     fs.open(this.path, this.flags, this.mode, function (err, fd) {
32331       if (err) {
32332         self.emit('error', err);
32333         self.readable = false;
32334         return;
32335       }
32336
32337       self.fd = fd;
32338       self.emit('open', fd);
32339       self._read();
32340     })
32341   }
32342
32343   function WriteStream (path, options) {
32344     if (!(this instanceof WriteStream)) return new WriteStream(path, options);
32345
32346     Stream.call(this);
32347
32348     this.path = path;
32349     this.fd = null;
32350     this.writable = true;
32351
32352     this.flags = 'w';
32353     this.encoding = 'binary';
32354     this.mode = 438; /*=0666*/
32355     this.bytesWritten = 0;
32356
32357     options = options || {};
32358
32359     // Mixin options into this
32360     var keys = Object.keys(options);
32361     for (var index = 0, length = keys.length; index < length; index++) {
32362       var key = keys[index];
32363       this[key] = options[key];
32364     }
32365
32366     if (this.start !== undefined) {
32367       if ('number' !== typeof this.start) {
32368         throw TypeError('start must be a Number');
32369       }
32370       if (this.start < 0) {
32371         throw new Error('start must be >= zero');
32372       }
32373
32374       this.pos = this.start;
32375     }
32376
32377     this.busy = false;
32378     this._queue = [];
32379
32380     if (this.fd === null) {
32381       this._open = fs.open;
32382       this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
32383       this.flush();
32384     }
32385   }
32386 }
32387
32388
32389 /***/ }),
32390 /* 215 */
32391 /***/ (function(module, exports, __webpack_require__) {
32392
32393 "use strict";
32394
32395
32396 module.exports = clone
32397
32398 function clone (obj) {
32399   if (obj === null || typeof obj !== 'object')
32400     return obj
32401
32402   if (obj instanceof Object)
32403     var copy = { __proto__: obj.__proto__ }
32404   else
32405     var copy = Object.create(null)
32406
32407   Object.getOwnPropertyNames(obj).forEach(function (key) {
32408     Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
32409   })
32410
32411   return copy
32412 }
32413
32414
32415 /***/ }),
32416 /* 216 */
32417 /***/ (function(module, exports, __webpack_require__) {
32418
32419 var binary = __webpack_require__(123);
32420 var PullStream = __webpack_require__(164);
32421 var unzip = __webpack_require__(217);
32422 var Promise = __webpack_require__(128);
32423 var BufferStream = __webpack_require__(183);
32424 var parseExtraField = __webpack_require__(184);
32425 var Buffer = __webpack_require__(165);
32426 var path = __webpack_require__(2);
32427 var Writer = __webpack_require__(189).Writer;
32428 var parseDateTime = __webpack_require__(185);
32429
32430 var signature = Buffer.alloc(4);
32431 signature.writeUInt32LE(0x06054b50,0);
32432
32433 function getCrxHeader(source) {
32434   var sourceStream = source.stream(0).pipe(PullStream());
32435
32436   return sourceStream.pull(4).then(function(data) {
32437     var signature = data.readUInt32LE(0);
32438     if (signature === 0x34327243) {
32439       var crxHeader;
32440       return sourceStream.pull(12).then(function(data) {
32441         crxHeader = binary.parse(data)
32442           .word32lu('version')
32443           .word32lu('pubKeyLength')
32444           .word32lu('signatureLength')
32445           .vars;
32446       }).then(function() {
32447         return sourceStream.pull(crxHeader.pubKeyLength +crxHeader.signatureLength);
32448       }).then(function(data) {
32449         crxHeader.publicKey = data.slice(0,crxHeader.pubKeyLength);
32450         crxHeader.signature = data.slice(crxHeader.pubKeyLength);
32451         crxHeader.size = 16 + crxHeader.pubKeyLength +crxHeader.signatureLength;
32452         return crxHeader;
32453       });
32454     }
32455   });
32456 }
32457
32458 // Zip64 File Format Notes: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
32459 function getZip64CentralDirectory(source, zip64CDL) {
32460   var d64loc = binary.parse(zip64CDL)
32461     .word32lu('signature')
32462     .word32lu('diskNumber')
32463     .word64lu('offsetToStartOfCentralDirectory')
32464     .word32lu('numberOfDisks')
32465     .vars;
32466
32467   if (d64loc.signature != 0x07064b50) {
32468     throw new Error('invalid zip64 end of central dir locator signature (0x07064b50): 0x' + d64loc.signature.toString(16));
32469   }
32470
32471   var dir64 = PullStream();
32472   source.stream(d64loc.offsetToStartOfCentralDirectory).pipe(dir64);
32473
32474   return dir64.pull(56)
32475 }
32476
32477 // Zip64 File Format Notes: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
32478 function parseZip64DirRecord (dir64record) {
32479   var vars = binary.parse(dir64record)
32480     .word32lu('signature')
32481     .word64lu('sizeOfCentralDirectory')
32482     .word16lu('version')
32483     .word16lu('versionsNeededToExtract')
32484     .word32lu('diskNumber')
32485     .word32lu('diskStart')
32486     .word64lu('numberOfRecordsOnDisk')
32487     .word64lu('numberOfRecords')
32488     .word64lu('sizeOfCentralDirectory')
32489     .word64lu('offsetToStartOfCentralDirectory')
32490     .vars;
32491
32492   if (vars.signature != 0x06064b50) {
32493     throw new Error('invalid zip64 end of central dir locator signature (0x06064b50): 0x0' + vars.signature.toString(16));
32494   }
32495
32496   return vars
32497 }
32498
32499 module.exports = function centralDirectory(source, options) {
32500   var endDir = PullStream(),
32501       records = PullStream(),
32502       tailSize = (options && options.tailSize) || 80,
32503       sourceSize,
32504       crxHeader,
32505       startOffset,
32506       vars;
32507
32508   if (options && options.crx)
32509     crxHeader = getCrxHeader(source);
32510
32511   return source.size()
32512     .then(function(size) {
32513       sourceSize = size;
32514
32515       source.stream(Math.max(0,size-tailSize))
32516         .on('error', function (error) { endDir.emit('error', error) })
32517         .pipe(endDir);
32518
32519       return endDir.pull(signature);
32520     })
32521     .then(function() {
32522       return Promise.props({directory: endDir.pull(22), crxHeader: crxHeader});
32523     })
32524     .then(function(d) {
32525       var data = d.directory;
32526       startOffset = d.crxHeader && d.crxHeader.size || 0;
32527
32528       vars = binary.parse(data)
32529         .word32lu('signature')
32530         .word16lu('diskNumber')
32531         .word16lu('diskStart')
32532         .word16lu('numberOfRecordsOnDisk')
32533         .word16lu('numberOfRecords')
32534         .word32lu('sizeOfCentralDirectory')
32535         .word32lu('offsetToStartOfCentralDirectory')
32536         .word16lu('commentLength')
32537         .vars;
32538
32539       // Is this zip file using zip64 format? Use same check as Go:
32540       // https://github.com/golang/go/blob/master/src/archive/zip/reader.go#L503
32541       // For zip64 files, need to find zip64 central directory locator header to extract
32542       // relative offset for zip64 central directory record.
32543       if (vars.numberOfRecords == 0xffff|| vars.numberOfRecords == 0xffff ||
32544         vars.offsetToStartOfCentralDirectory == 0xffffffff) {
32545
32546         // Offset to zip64 CDL is 20 bytes before normal CDR
32547         const zip64CDLSize = 20
32548         const zip64CDLOffset = sourceSize - (tailSize - endDir.match + zip64CDLSize)
32549         const zip64CDLStream = PullStream();
32550
32551         source.stream(zip64CDLOffset).pipe(zip64CDLStream);
32552
32553         return zip64CDLStream.pull(zip64CDLSize)
32554           .then(function (d) { return getZip64CentralDirectory(source, d) })
32555           .then(function (dir64record) {
32556             vars = parseZip64DirRecord(dir64record)
32557           })
32558       } else {
32559         vars.offsetToStartOfCentralDirectory += startOffset;
32560       }
32561     })
32562     .then(function() {
32563       source.stream(vars.offsetToStartOfCentralDirectory).pipe(records);
32564
32565       vars.extract = function(opts) {
32566         if (!opts || !opts.path) throw new Error('PATH_MISSING');
32567         return vars.files.then(function(files) {
32568           return Promise.map(files, function(entry) {
32569             if (entry.type == 'Directory') return;
32570
32571             // to avoid zip slip (writing outside of the destination), we resolve
32572             // the target path, and make sure it's nested in the intended
32573             // destination, or not extract it otherwise.
32574             var extractPath = path.join(opts.path, entry.path);
32575             if (extractPath.indexOf(opts.path) != 0) {
32576               return;
32577             }
32578             var writer = opts.getWriter ? opts.getWriter({path: extractPath}) :  Writer({ path: extractPath });
32579
32580             return new Promise(function(resolve, reject) {
32581               entry.stream(opts.password)
32582                 .on('error',reject)
32583                 .pipe(writer)
32584                 .on('close',resolve)
32585                 .on('error',reject);
32586             });
32587           }, opts.concurrency > 1 ? {concurrency: opts.concurrency || undefined} : undefined);
32588         });
32589       };
32590
32591       vars.files = Promise.mapSeries(Array(vars.numberOfRecords),function() {
32592         return records.pull(46).then(function(data) {    
32593           var vars = binary.parse(data)
32594             .word32lu('signature')
32595             .word16lu('versionMadeBy')
32596             .word16lu('versionsNeededToExtract')
32597             .word16lu('flags')
32598             .word16lu('compressionMethod')
32599             .word16lu('lastModifiedTime')
32600             .word16lu('lastModifiedDate')
32601             .word32lu('crc32')
32602             .word32lu('compressedSize')
32603             .word32lu('uncompressedSize')
32604             .word16lu('fileNameLength')
32605             .word16lu('extraFieldLength')
32606             .word16lu('fileCommentLength')
32607             .word16lu('diskNumber')
32608             .word16lu('internalFileAttributes')
32609             .word32lu('externalFileAttributes')
32610             .word32lu('offsetToLocalFileHeader')
32611             .vars;
32612
32613         vars.offsetToLocalFileHeader += startOffset;
32614         vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
32615
32616         return records.pull(vars.fileNameLength).then(function(fileNameBuffer) {
32617           vars.pathBuffer = fileNameBuffer;
32618           vars.path = fileNameBuffer.toString('utf8');
32619           vars.isUnicode = vars.flags & 0x11;
32620           return records.pull(vars.extraFieldLength);
32621         })
32622         .then(function(extraField) {
32623           vars.extra = parseExtraField(extraField, vars);
32624           return records.pull(vars.fileCommentLength);
32625         })
32626         .then(function(comment) {
32627           vars.comment = comment;
32628           vars.type = (vars.uncompressedSize === 0 && /[\/\\]$/.test(vars.path)) ? 'Directory' : 'File';
32629           vars.stream = function(_password) {
32630             return unzip(source, vars.offsetToLocalFileHeader,_password, vars);
32631           };
32632           vars.buffer = function(_password) {
32633             return BufferStream(vars.stream(_password));
32634           };
32635           return vars;
32636         });
32637       });
32638     });
32639
32640     return Promise.props(vars);
32641   });
32642 };
32643
32644
32645 /***/ }),
32646 /* 217 */
32647 /***/ (function(module, exports, __webpack_require__) {
32648
32649 var Promise = __webpack_require__(128);
32650 var Decrypt = __webpack_require__(218);
32651 var PullStream = __webpack_require__(164);
32652 var Stream = __webpack_require__(44);
32653 var binary = __webpack_require__(123);
32654 var zlib = __webpack_require__(48);
32655 var parseExtraField = __webpack_require__(184);
32656 var Buffer = __webpack_require__(165);
32657 var parseDateTime = __webpack_require__(185);
32658
32659 // Backwards compatibility for node versions < 8
32660 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
32661   Stream = __webpack_require__(167);
32662
32663 module.exports = function unzip(source,offset,_password, directoryVars) {
32664   var file = PullStream(),
32665       entry = Stream.PassThrough();
32666
32667   var req = source.stream(offset);
32668   req.pipe(file).on('error', function(e) {
32669     entry.emit('error', e);
32670   });
32671
32672   entry.vars = file.pull(30)
32673     .then(function(data) {
32674       var vars = binary.parse(data)
32675         .word32lu('signature')
32676         .word16lu('versionsNeededToExtract')
32677         .word16lu('flags')
32678         .word16lu('compressionMethod')
32679         .word16lu('lastModifiedTime')
32680         .word16lu('lastModifiedDate')
32681         .word32lu('crc32')
32682         .word32lu('compressedSize')
32683         .word32lu('uncompressedSize')
32684         .word16lu('fileNameLength')
32685         .word16lu('extraFieldLength')
32686         .vars;
32687
32688       vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
32689
32690       return file.pull(vars.fileNameLength)
32691         .then(function(fileName) {
32692           vars.fileName = fileName.toString('utf8');
32693           return file.pull(vars.extraFieldLength);
32694         })
32695         .then(function(extraField) {
32696           var checkEncryption;
32697           vars.extra = parseExtraField(extraField, vars);
32698           // Ignore logal file header vars if the directory vars are available
32699           if (directoryVars && directoryVars.compressedSize) vars = directoryVars;
32700
32701           if (vars.flags & 0x01) checkEncryption = file.pull(12)
32702             .then(function(header) {
32703               if (!_password)
32704                 throw new Error('MISSING_PASSWORD');
32705
32706               var decrypt = Decrypt();
32707
32708               String(_password).split('').forEach(function(d) {
32709                 decrypt.update(d);
32710               });
32711
32712               for (var i=0; i < header.length; i++)
32713                 header[i] = decrypt.decryptByte(header[i]);
32714
32715               vars.decrypt = decrypt;
32716               vars.compressedSize -= 12;
32717
32718               var check = (vars.flags & 0x8) ? (vars.lastModifiedTime >> 8) & 0xff : (vars.crc32 >> 24) & 0xff;
32719               if (header[11] !== check)
32720                 throw new Error('BAD_PASSWORD');
32721
32722               return vars;
32723             });
32724
32725           return Promise.resolve(checkEncryption)
32726             .then(function() {
32727               entry.emit('vars',vars);
32728               return vars;
32729             });
32730         });
32731     });
32732
32733     entry.vars.then(function(vars) {
32734       var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0,
32735           eof;
32736
32737       var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough();
32738
32739       if (fileSizeKnown) {
32740         entry.size = vars.uncompressedSize;
32741         eof = vars.compressedSize;
32742       } else {
32743         eof = Buffer.alloc(4);
32744         eof.writeUInt32LE(0x08074b50, 0);
32745       }
32746
32747       var stream = file.stream(eof);
32748
32749       if (vars.decrypt)
32750         stream = stream.pipe(vars.decrypt.stream());
32751
32752       stream
32753         .pipe(inflater)
32754         .on('error',function(err) { entry.emit('error',err);})
32755         .pipe(entry)
32756         .on('finish', function() {
32757           if (req.abort)
32758             req.abort();
32759           else if (req.close)
32760             req.close();
32761           else if (req.push)
32762             req.push();
32763           else
32764             console.log('warning - unable to close stream');
32765         });
32766     })
32767     .catch(function(e) {
32768       entry.emit('error',e);
32769     });
32770
32771   return entry;
32772 };
32773
32774
32775 /***/ }),
32776 /* 218 */
32777 /***/ (function(module, exports, __webpack_require__) {
32778
32779 var bigInt = __webpack_require__(219);
32780 var Stream = __webpack_require__(44);
32781
32782 // Backwards compatibility for node versions < 8
32783 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
32784   Stream = __webpack_require__(167);
32785
32786 var table;
32787
32788 function generateTable() {
32789   var poly = 0xEDB88320,c,n,k;
32790   table = [];
32791   for (n = 0; n < 256; n++) {
32792     c = n;
32793     for (k = 0; k < 8; k++)
32794       c = (c & 1) ? poly ^ (c >>> 1) :  c = c >>> 1;
32795     table[n] = c >>> 0;
32796   }
32797 }
32798
32799 function crc(ch,crc) {
32800   if (!table)
32801     generateTable();
32802
32803   if (ch.charCodeAt)
32804     ch = ch.charCodeAt(0);        
32805
32806   return (bigInt(crc).shiftRight(8).and(0xffffff)).xor(table[bigInt(crc).xor(ch).and(0xff)]).value;
32807 }
32808
32809 function Decrypt() {
32810   if (!(this instanceof Decrypt))
32811     return new Decrypt();
32812
32813   this.key0 = 305419896;
32814   this.key1 = 591751049;
32815   this.key2 = 878082192;
32816 }
32817
32818 Decrypt.prototype.update = function(h) {            
32819   this.key0 = crc(h,this.key0);
32820   this.key1 = bigInt(this.key0).and(255).and(4294967295).add(this.key1)
32821   this.key1 = bigInt(this.key1).multiply(134775813).add(1).and(4294967295).value;
32822   this.key2 = crc(bigInt(this.key1).shiftRight(24).and(255), this.key2);
32823 }
32824
32825
32826 Decrypt.prototype.decryptByte = function(c) {
32827   var k = bigInt(this.key2).or(2);
32828   c = c ^ bigInt(k).multiply(bigInt(k^1)).shiftRight(8).and(255);
32829   this.update(c);
32830   return c;
32831 };
32832
32833  Decrypt.prototype.stream = function() {
32834   var stream = Stream.Transform(),
32835       self = this;
32836
32837   stream._transform = function(d,e,cb) {
32838     for (var i = 0; i<d.length;i++) {
32839       d[i] = self.decryptByte(d[i]);
32840     }
32841     this.push(d);
32842     cb();
32843   };
32844   return stream;
32845 };
32846
32847
32848
32849
32850 module.exports = Decrypt;
32851
32852 /***/ }),
32853 /* 219 */
32854 /***/ (function(module, exports, __webpack_require__) {
32855
32856 /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;var bigInt = (function (undefined) {\r
32857     "use strict";\r
32858 \r
32859     var BASE = 1e7,\r
32860         LOG_BASE = 7,\r
32861         MAX_INT = 9007199254740992,\r
32862         MAX_INT_ARR = smallToArray(MAX_INT),\r
32863         DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";\r
32864 \r
32865     var supportsNativeBigInt = typeof BigInt === "function";\r
32866 \r
32867     function Integer(v, radix, alphabet, caseSensitive) {\r
32868         if (typeof v === "undefined") return Integer[0];\r
32869         if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);\r
32870         return parseValue(v);\r
32871     }\r
32872 \r
32873     function BigInteger(value, sign) {\r
32874         this.value = value;\r
32875         this.sign = sign;\r
32876         this.isSmall = false;\r
32877     }\r
32878     BigInteger.prototype = Object.create(Integer.prototype);\r
32879 \r
32880     function SmallInteger(value) {\r
32881         this.value = value;\r
32882         this.sign = value < 0;\r
32883         this.isSmall = true;\r
32884     }\r
32885     SmallInteger.prototype = Object.create(Integer.prototype);\r
32886 \r
32887     function NativeBigInt(value) {\r
32888         this.value = value;\r
32889     }\r
32890     NativeBigInt.prototype = Object.create(Integer.prototype);\r
32891 \r
32892     function isPrecise(n) {\r
32893         return -MAX_INT < n && n < MAX_INT;\r
32894     }\r
32895 \r
32896     function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes\r
32897         if (n < 1e7)\r
32898             return [n];\r
32899         if (n < 1e14)\r
32900             return [n % 1e7, Math.floor(n / 1e7)];\r
32901         return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\r
32902     }\r
32903 \r
32904     function arrayToSmall(arr) { // If BASE changes this function may need to change\r
32905         trim(arr);\r
32906         var length = arr.length;\r
32907         if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\r
32908             switch (length) {\r
32909                 case 0: return 0;\r
32910                 case 1: return arr[0];\r
32911                 case 2: return arr[0] + arr[1] * BASE;\r
32912                 default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\r
32913             }\r
32914         }\r
32915         return arr;\r
32916     }\r
32917 \r
32918     function trim(v) {\r
32919         var i = v.length;\r
32920         while (v[--i] === 0);\r
32921         v.length = i + 1;\r
32922     }\r
32923 \r
32924     function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger\r
32925         var x = new Array(length);\r
32926         var i = -1;\r
32927         while (++i < length) {\r
32928             x[i] = 0;\r
32929         }\r
32930         return x;\r
32931     }\r
32932 \r
32933     function truncate(n) {\r
32934         if (n > 0) return Math.floor(n);\r
32935         return Math.ceil(n);\r
32936     }\r
32937 \r
32938     function add(a, b) { // assumes a and b are arrays with a.length >= b.length\r
32939         var l_a = a.length,\r
32940             l_b = b.length,\r
32941             r = new Array(l_a),\r
32942             carry = 0,\r
32943             base = BASE,\r
32944             sum, i;\r
32945         for (i = 0; i < l_b; i++) {\r
32946             sum = a[i] + b[i] + carry;\r
32947             carry = sum >= base ? 1 : 0;\r
32948             r[i] = sum - carry * base;\r
32949         }\r
32950         while (i < l_a) {\r
32951             sum = a[i] + carry;\r
32952             carry = sum === base ? 1 : 0;\r
32953             r[i++] = sum - carry * base;\r
32954         }\r
32955         if (carry > 0) r.push(carry);\r
32956         return r;\r
32957     }\r
32958 \r
32959     function addAny(a, b) {\r
32960         if (a.length >= b.length) return add(a, b);\r
32961         return add(b, a);\r
32962     }\r
32963 \r
32964     function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT\r
32965         var l = a.length,\r
32966             r = new Array(l),\r
32967             base = BASE,\r
32968             sum, i;\r
32969         for (i = 0; i < l; i++) {\r
32970             sum = a[i] - base + carry;\r
32971             carry = Math.floor(sum / base);\r
32972             r[i] = sum - carry * base;\r
32973             carry += 1;\r
32974         }\r
32975         while (carry > 0) {\r
32976             r[i++] = carry % base;\r
32977             carry = Math.floor(carry / base);\r
32978         }\r
32979         return r;\r
32980     }\r
32981 \r
32982     BigInteger.prototype.add = function (v) {\r
32983         var n = parseValue(v);\r
32984         if (this.sign !== n.sign) {\r
32985             return this.subtract(n.negate());\r
32986         }\r
32987         var a = this.value, b = n.value;\r
32988         if (n.isSmall) {\r
32989             return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\r
32990         }\r
32991         return new BigInteger(addAny(a, b), this.sign);\r
32992     };\r
32993     BigInteger.prototype.plus = BigInteger.prototype.add;\r
32994 \r
32995     SmallInteger.prototype.add = function (v) {\r
32996         var n = parseValue(v);\r
32997         var a = this.value;\r
32998         if (a < 0 !== n.sign) {\r
32999             return this.subtract(n.negate());\r
33000         }\r
33001         var b = n.value;\r
33002         if (n.isSmall) {\r
33003             if (isPrecise(a + b)) return new SmallInteger(a + b);\r
33004             b = smallToArray(Math.abs(b));\r
33005         }\r
33006         return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\r
33007     };\r
33008     SmallInteger.prototype.plus = SmallInteger.prototype.add;\r
33009 \r
33010     NativeBigInt.prototype.add = function (v) {\r
33011         return new NativeBigInt(this.value + parseValue(v).value);\r
33012     }\r
33013     NativeBigInt.prototype.plus = NativeBigInt.prototype.add;\r
33014 \r
33015     function subtract(a, b) { // assumes a and b are arrays with a >= b\r
33016         var a_l = a.length,\r
33017             b_l = b.length,\r
33018             r = new Array(a_l),\r
33019             borrow = 0,\r
33020             base = BASE,\r
33021             i, difference;\r
33022         for (i = 0; i < b_l; i++) {\r
33023             difference = a[i] - borrow - b[i];\r
33024             if (difference < 0) {\r
33025                 difference += base;\r
33026                 borrow = 1;\r
33027             } else borrow = 0;\r
33028             r[i] = difference;\r
33029         }\r
33030         for (i = b_l; i < a_l; i++) {\r
33031             difference = a[i] - borrow;\r
33032             if (difference < 0) difference += base;\r
33033             else {\r
33034                 r[i++] = difference;\r
33035                 break;\r
33036             }\r
33037             r[i] = difference;\r
33038         }\r
33039         for (; i < a_l; i++) {\r
33040             r[i] = a[i];\r
33041         }\r
33042         trim(r);\r
33043         return r;\r
33044     }\r
33045 \r
33046     function subtractAny(a, b, sign) {\r
33047         var value;\r
33048         if (compareAbs(a, b) >= 0) {\r
33049             value = subtract(a, b);\r
33050         } else {\r
33051             value = subtract(b, a);\r
33052             sign = !sign;\r
33053         }\r
33054         value = arrayToSmall(value);\r
33055         if (typeof value === "number") {\r
33056             if (sign) value = -value;\r
33057             return new SmallInteger(value);\r
33058         }\r
33059         return new BigInteger(value, sign);\r
33060     }\r
33061 \r
33062     function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT\r
33063         var l = a.length,\r
33064             r = new Array(l),\r
33065             carry = -b,\r
33066             base = BASE,\r
33067             i, difference;\r
33068         for (i = 0; i < l; i++) {\r
33069             difference = a[i] + carry;\r
33070             carry = Math.floor(difference / base);\r
33071             difference %= base;\r
33072             r[i] = difference < 0 ? difference + base : difference;\r
33073         }\r
33074         r = arrayToSmall(r);\r
33075         if (typeof r === "number") {\r
33076             if (sign) r = -r;\r
33077             return new SmallInteger(r);\r
33078         } return new BigInteger(r, sign);\r
33079     }\r
33080 \r
33081     BigInteger.prototype.subtract = function (v) {\r
33082         var n = parseValue(v);\r
33083         if (this.sign !== n.sign) {\r
33084             return this.add(n.negate());\r
33085         }\r
33086         var a = this.value, b = n.value;\r
33087         if (n.isSmall)\r
33088             return subtractSmall(a, Math.abs(b), this.sign);\r
33089         return subtractAny(a, b, this.sign);\r
33090     };\r
33091     BigInteger.prototype.minus = BigInteger.prototype.subtract;\r
33092 \r
33093     SmallInteger.prototype.subtract = function (v) {\r
33094         var n = parseValue(v);\r
33095         var a = this.value;\r
33096         if (a < 0 !== n.sign) {\r
33097             return this.add(n.negate());\r
33098         }\r
33099         var b = n.value;\r
33100         if (n.isSmall) {\r
33101             return new SmallInteger(a - b);\r
33102         }\r
33103         return subtractSmall(b, Math.abs(a), a >= 0);\r
33104     };\r
33105     SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\r
33106 \r
33107     NativeBigInt.prototype.subtract = function (v) {\r
33108         return new NativeBigInt(this.value - parseValue(v).value);\r
33109     }\r
33110     NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;\r
33111 \r
33112     BigInteger.prototype.negate = function () {\r
33113         return new BigInteger(this.value, !this.sign);\r
33114     };\r
33115     SmallInteger.prototype.negate = function () {\r
33116         var sign = this.sign;\r
33117         var small = new SmallInteger(-this.value);\r
33118         small.sign = !sign;\r
33119         return small;\r
33120     };\r
33121     NativeBigInt.prototype.negate = function () {\r
33122         return new NativeBigInt(-this.value);\r
33123     }\r
33124 \r
33125     BigInteger.prototype.abs = function () {\r
33126         return new BigInteger(this.value, false);\r
33127     };\r
33128     SmallInteger.prototype.abs = function () {\r
33129         return new SmallInteger(Math.abs(this.value));\r
33130     };\r
33131     NativeBigInt.prototype.abs = function () {\r
33132         return new NativeBigInt(this.value >= 0 ? this.value : -this.value);\r
33133     }\r
33134 \r
33135 \r
33136     function multiplyLong(a, b) {\r
33137         var a_l = a.length,\r
33138             b_l = b.length,\r
33139             l = a_l + b_l,\r
33140             r = createArray(l),\r
33141             base = BASE,\r
33142             product, carry, i, a_i, b_j;\r
33143         for (i = 0; i < a_l; ++i) {\r
33144             a_i = a[i];\r
33145             for (var j = 0; j < b_l; ++j) {\r
33146                 b_j = b[j];\r
33147                 product = a_i * b_j + r[i + j];\r
33148                 carry = Math.floor(product / base);\r
33149                 r[i + j] = product - carry * base;\r
33150                 r[i + j + 1] += carry;\r
33151             }\r
33152         }\r
33153         trim(r);\r
33154         return r;\r
33155     }\r
33156 \r
33157     function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE\r
33158         var l = a.length,\r
33159             r = new Array(l),\r
33160             base = BASE,\r
33161             carry = 0,\r
33162             product, i;\r
33163         for (i = 0; i < l; i++) {\r
33164             product = a[i] * b + carry;\r
33165             carry = Math.floor(product / base);\r
33166             r[i] = product - carry * base;\r
33167         }\r
33168         while (carry > 0) {\r
33169             r[i++] = carry % base;\r
33170             carry = Math.floor(carry / base);\r
33171         }\r
33172         return r;\r
33173     }\r
33174 \r
33175     function shiftLeft(x, n) {\r
33176         var r = [];\r
33177         while (n-- > 0) r.push(0);\r
33178         return r.concat(x);\r
33179     }\r
33180 \r
33181     function multiplyKaratsuba(x, y) {\r
33182         var n = Math.max(x.length, y.length);\r
33183 \r
33184         if (n <= 30) return multiplyLong(x, y);\r
33185         n = Math.ceil(n / 2);\r
33186 \r
33187         var b = x.slice(n),\r
33188             a = x.slice(0, n),\r
33189             d = y.slice(n),\r
33190             c = y.slice(0, n);\r
33191 \r
33192         var ac = multiplyKaratsuba(a, c),\r
33193             bd = multiplyKaratsuba(b, d),\r
33194             abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\r
33195 \r
33196         var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));\r
33197         trim(product);\r
33198         return product;\r
33199     }\r
33200 \r
33201     // The following function is derived from a surface fit of a graph plotting the performance difference\r
33202     // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.\r
33203     function useKaratsuba(l1, l2) {\r
33204         return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;\r
33205     }\r
33206 \r
33207     BigInteger.prototype.multiply = function (v) {\r
33208         var n = parseValue(v),\r
33209             a = this.value, b = n.value,\r
33210             sign = this.sign !== n.sign,\r
33211             abs;\r
33212         if (n.isSmall) {\r
33213             if (b === 0) return Integer[0];\r
33214             if (b === 1) return this;\r
33215             if (b === -1) return this.negate();\r
33216             abs = Math.abs(b);\r
33217             if (abs < BASE) {\r
33218                 return new BigInteger(multiplySmall(a, abs), sign);\r
33219             }\r
33220             b = smallToArray(abs);\r
33221         }\r
33222         if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes\r
33223             return new BigInteger(multiplyKaratsuba(a, b), sign);\r
33224         return new BigInteger(multiplyLong(a, b), sign);\r
33225     };\r
33226 \r
33227     BigInteger.prototype.times = BigInteger.prototype.multiply;\r
33228 \r
33229     function multiplySmallAndArray(a, b, sign) { // a >= 0\r
33230         if (a < BASE) {\r
33231             return new BigInteger(multiplySmall(b, a), sign);\r
33232         }\r
33233         return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\r
33234     }\r
33235     SmallInteger.prototype._multiplyBySmall = function (a) {\r
33236         if (isPrecise(a.value * this.value)) {\r
33237             return new SmallInteger(a.value * this.value);\r
33238         }\r
33239         return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);\r
33240     };\r
33241     BigInteger.prototype._multiplyBySmall = function (a) {\r
33242         if (a.value === 0) return Integer[0];\r
33243         if (a.value === 1) return this;\r
33244         if (a.value === -1) return this.negate();\r
33245         return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);\r
33246     };\r
33247     SmallInteger.prototype.multiply = function (v) {\r
33248         return parseValue(v)._multiplyBySmall(this);\r
33249     };\r
33250     SmallInteger.prototype.times = SmallInteger.prototype.multiply;\r
33251 \r
33252     NativeBigInt.prototype.multiply = function (v) {\r
33253         return new NativeBigInt(this.value * parseValue(v).value);\r
33254     }\r
33255     NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;\r
33256 \r
33257     function square(a) {\r
33258         //console.assert(2 * BASE * BASE < MAX_INT);\r
33259         var l = a.length,\r
33260             r = createArray(l + l),\r
33261             base = BASE,\r
33262             product, carry, i, a_i, a_j;\r
33263         for (i = 0; i < l; i++) {\r
33264             a_i = a[i];\r
33265             carry = 0 - a_i * a_i;\r
33266             for (var j = i; j < l; j++) {\r
33267                 a_j = a[j];\r
33268                 product = 2 * (a_i * a_j) + r[i + j] + carry;\r
33269                 carry = Math.floor(product / base);\r
33270                 r[i + j] = product - carry * base;\r
33271             }\r
33272             r[i + l] = carry;\r
33273         }\r
33274         trim(r);\r
33275         return r;\r
33276     }\r
33277 \r
33278     BigInteger.prototype.square = function () {\r
33279         return new BigInteger(square(this.value), false);\r
33280     };\r
33281 \r
33282     SmallInteger.prototype.square = function () {\r
33283         var value = this.value * this.value;\r
33284         if (isPrecise(value)) return new SmallInteger(value);\r
33285         return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\r
33286     };\r
33287 \r
33288     NativeBigInt.prototype.square = function (v) {\r
33289         return new NativeBigInt(this.value * this.value);\r
33290     }\r
33291 \r
33292     function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.\r
33293         var a_l = a.length,\r
33294             b_l = b.length,\r
33295             base = BASE,\r
33296             result = createArray(b.length),\r
33297             divisorMostSignificantDigit = b[b_l - 1],\r
33298             // normalization\r
33299             lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\r
33300             remainder = multiplySmall(a, lambda),\r
33301             divisor = multiplySmall(b, lambda),\r
33302             quotientDigit, shift, carry, borrow, i, l, q;\r
33303         if (remainder.length <= a_l) remainder.push(0);\r
33304         divisor.push(0);\r
33305         divisorMostSignificantDigit = divisor[b_l - 1];\r
33306         for (shift = a_l - b_l; shift >= 0; shift--) {\r
33307             quotientDigit = base - 1;\r
33308             if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\r
33309                 quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);\r
33310             }\r
33311             // quotientDigit <= base - 1\r
33312             carry = 0;\r
33313             borrow = 0;\r
33314             l = divisor.length;\r
33315             for (i = 0; i < l; i++) {\r
33316                 carry += quotientDigit * divisor[i];\r
33317                 q = Math.floor(carry / base);\r
33318                 borrow += remainder[shift + i] - (carry - q * base);\r
33319                 carry = q;\r
33320                 if (borrow < 0) {\r
33321                     remainder[shift + i] = borrow + base;\r
33322                     borrow = -1;\r
33323                 } else {\r
33324                     remainder[shift + i] = borrow;\r
33325                     borrow = 0;\r
33326                 }\r
33327             }\r
33328             while (borrow !== 0) {\r
33329                 quotientDigit -= 1;\r
33330                 carry = 0;\r
33331                 for (i = 0; i < l; i++) {\r
33332                     carry += remainder[shift + i] - base + divisor[i];\r
33333                     if (carry < 0) {\r
33334                         remainder[shift + i] = carry + base;\r
33335                         carry = 0;\r
33336                     } else {\r
33337                         remainder[shift + i] = carry;\r
33338                         carry = 1;\r
33339                     }\r
33340                 }\r
33341                 borrow += carry;\r
33342             }\r
33343             result[shift] = quotientDigit;\r
33344         }\r
33345         // denormalization\r
33346         remainder = divModSmall(remainder, lambda)[0];\r
33347         return [arrayToSmall(result), arrayToSmall(remainder)];\r
33348     }\r
33349 \r
33350     function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/\r
33351         // Performs faster than divMod1 on larger input sizes.\r
33352         var a_l = a.length,\r
33353             b_l = b.length,\r
33354             result = [],\r
33355             part = [],\r
33356             base = BASE,\r
33357             guess, xlen, highx, highy, check;\r
33358         while (a_l) {\r
33359             part.unshift(a[--a_l]);\r
33360             trim(part);\r
33361             if (compareAbs(part, b) < 0) {\r
33362                 result.push(0);\r
33363                 continue;\r
33364             }\r
33365             xlen = part.length;\r
33366             highx = part[xlen - 1] * base + part[xlen - 2];\r
33367             highy = b[b_l - 1] * base + b[b_l - 2];\r
33368             if (xlen > b_l) {\r
33369                 highx = (highx + 1) * base;\r
33370             }\r
33371             guess = Math.ceil(highx / highy);\r
33372             do {\r
33373                 check = multiplySmall(b, guess);\r
33374                 if (compareAbs(check, part) <= 0) break;\r
33375                 guess--;\r
33376             } while (guess);\r
33377             result.push(guess);\r
33378             part = subtract(part, check);\r
33379         }\r
33380         result.reverse();\r
33381         return [arrayToSmall(result), arrayToSmall(part)];\r
33382     }\r
33383 \r
33384     function divModSmall(value, lambda) {\r
33385         var length = value.length,\r
33386             quotient = createArray(length),\r
33387             base = BASE,\r
33388             i, q, remainder, divisor;\r
33389         remainder = 0;\r
33390         for (i = length - 1; i >= 0; --i) {\r
33391             divisor = remainder * base + value[i];\r
33392             q = truncate(divisor / lambda);\r
33393             remainder = divisor - q * lambda;\r
33394             quotient[i] = q | 0;\r
33395         }\r
33396         return [quotient, remainder | 0];\r
33397     }\r
33398 \r
33399     function divModAny(self, v) {\r
33400         var value, n = parseValue(v);\r
33401         if (supportsNativeBigInt) {\r
33402             return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];\r
33403         }\r
33404         var a = self.value, b = n.value;\r
33405         var quotient;\r
33406         if (b === 0) throw new Error("Cannot divide by zero");\r
33407         if (self.isSmall) {\r
33408             if (n.isSmall) {\r
33409                 return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\r
33410             }\r
33411             return [Integer[0], self];\r
33412         }\r
33413         if (n.isSmall) {\r
33414             if (b === 1) return [self, Integer[0]];\r
33415             if (b == -1) return [self.negate(), Integer[0]];\r
33416             var abs = Math.abs(b);\r
33417             if (abs < BASE) {\r
33418                 value = divModSmall(a, abs);\r
33419                 quotient = arrayToSmall(value[0]);\r
33420                 var remainder = value[1];\r
33421                 if (self.sign) remainder = -remainder;\r
33422                 if (typeof quotient === "number") {\r
33423                     if (self.sign !== n.sign) quotient = -quotient;\r
33424                     return [new SmallInteger(quotient), new SmallInteger(remainder)];\r
33425                 }\r
33426                 return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];\r
33427             }\r
33428             b = smallToArray(abs);\r
33429         }\r
33430         var comparison = compareAbs(a, b);\r
33431         if (comparison === -1) return [Integer[0], self];\r
33432         if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\r
33433 \r
33434         // divMod1 is faster on smaller input sizes\r
33435         if (a.length + b.length <= 200)\r
33436             value = divMod1(a, b);\r
33437         else value = divMod2(a, b);\r
33438 \r
33439         quotient = value[0];\r
33440         var qSign = self.sign !== n.sign,\r
33441             mod = value[1],\r
33442             mSign = self.sign;\r
33443         if (typeof quotient === "number") {\r
33444             if (qSign) quotient = -quotient;\r
33445             quotient = new SmallInteger(quotient);\r
33446         } else quotient = new BigInteger(quotient, qSign);\r
33447         if (typeof mod === "number") {\r
33448             if (mSign) mod = -mod;\r
33449             mod = new SmallInteger(mod);\r
33450         } else mod = new BigInteger(mod, mSign);\r
33451         return [quotient, mod];\r
33452     }\r
33453 \r
33454     BigInteger.prototype.divmod = function (v) {\r
33455         var result = divModAny(this, v);\r
33456         return {\r
33457             quotient: result[0],\r
33458             remainder: result[1]\r
33459         };\r
33460     };\r
33461     NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\r
33462 \r
33463 \r
33464     BigInteger.prototype.divide = function (v) {\r
33465         return divModAny(this, v)[0];\r
33466     };\r
33467     NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {\r
33468         return new NativeBigInt(this.value / parseValue(v).value);\r
33469     };\r
33470     SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;\r
33471 \r
33472     BigInteger.prototype.mod = function (v) {\r
33473         return divModAny(this, v)[1];\r
33474     };\r
33475     NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {\r
33476         return new NativeBigInt(this.value % parseValue(v).value);\r
33477     };\r
33478     SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;\r
33479 \r
33480     BigInteger.prototype.pow = function (v) {\r
33481         var n = parseValue(v),\r
33482             a = this.value,\r
33483             b = n.value,\r
33484             value, x, y;\r
33485         if (b === 0) return Integer[1];\r
33486         if (a === 0) return Integer[0];\r
33487         if (a === 1) return Integer[1];\r
33488         if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\r
33489         if (n.sign) {\r
33490             return Integer[0];\r
33491         }\r
33492         if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");\r
33493         if (this.isSmall) {\r
33494             if (isPrecise(value = Math.pow(a, b)))\r
33495                 return new SmallInteger(truncate(value));\r
33496         }\r
33497         x = this;\r
33498         y = Integer[1];\r
33499         while (true) {\r
33500             if (b & 1 === 1) {\r
33501                 y = y.times(x);\r
33502                 --b;\r
33503             }\r
33504             if (b === 0) break;\r
33505             b /= 2;\r
33506             x = x.square();\r
33507         }\r
33508         return y;\r
33509     };\r
33510     SmallInteger.prototype.pow = BigInteger.prototype.pow;\r
33511 \r
33512     NativeBigInt.prototype.pow = function (v) {\r
33513         var n = parseValue(v);\r
33514         var a = this.value, b = n.value;\r
33515         var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);\r
33516         if (b === _0) return Integer[1];\r
33517         if (a === _0) return Integer[0];\r
33518         if (a === _1) return Integer[1];\r
33519         if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];\r
33520         if (n.isNegative()) return new NativeBigInt(_0);\r
33521         var x = this;\r
33522         var y = Integer[1];\r
33523         while (true) {\r
33524             if ((b & _1) === _1) {\r
33525                 y = y.times(x);\r
33526                 --b;\r
33527             }\r
33528             if (b === _0) break;\r
33529             b /= _2;\r
33530             x = x.square();\r
33531         }\r
33532         return y;\r
33533     }\r
33534 \r
33535     BigInteger.prototype.modPow = function (exp, mod) {\r
33536         exp = parseValue(exp);\r
33537         mod = parseValue(mod);\r
33538         if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");\r
33539         var r = Integer[1],\r
33540             base = this.mod(mod);\r
33541         if (exp.isNegative()) {\r
33542             exp = exp.multiply(Integer[-1]);\r
33543             base = base.modInv(mod);\r
33544         }\r
33545         while (exp.isPositive()) {\r
33546             if (base.isZero()) return Integer[0];\r
33547             if (exp.isOdd()) r = r.multiply(base).mod(mod);\r
33548             exp = exp.divide(2);\r
33549             base = base.square().mod(mod);\r
33550         }\r
33551         return r;\r
33552     };\r
33553     NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\r
33554 \r
33555     function compareAbs(a, b) {\r
33556         if (a.length !== b.length) {\r
33557             return a.length > b.length ? 1 : -1;\r
33558         }\r
33559         for (var i = a.length - 1; i >= 0; i--) {\r
33560             if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\r
33561         }\r
33562         return 0;\r
33563     }\r
33564 \r
33565     BigInteger.prototype.compareAbs = function (v) {\r
33566         var n = parseValue(v),\r
33567             a = this.value,\r
33568             b = n.value;\r
33569         if (n.isSmall) return 1;\r
33570         return compareAbs(a, b);\r
33571     };\r
33572     SmallInteger.prototype.compareAbs = function (v) {\r
33573         var n = parseValue(v),\r
33574             a = Math.abs(this.value),\r
33575             b = n.value;\r
33576         if (n.isSmall) {\r
33577             b = Math.abs(b);\r
33578             return a === b ? 0 : a > b ? 1 : -1;\r
33579         }\r
33580         return -1;\r
33581     };\r
33582     NativeBigInt.prototype.compareAbs = function (v) {\r
33583         var a = this.value;\r
33584         var b = parseValue(v).value;\r
33585         a = a >= 0 ? a : -a;\r
33586         b = b >= 0 ? b : -b;\r
33587         return a === b ? 0 : a > b ? 1 : -1;\r
33588     }\r
33589 \r
33590     BigInteger.prototype.compare = function (v) {\r
33591         // See discussion about comparison with Infinity:\r
33592         // https://github.com/peterolson/BigInteger.js/issues/61\r
33593         if (v === Infinity) {\r
33594             return -1;\r
33595         }\r
33596         if (v === -Infinity) {\r
33597             return 1;\r
33598         }\r
33599 \r
33600         var n = parseValue(v),\r
33601             a = this.value,\r
33602             b = n.value;\r
33603         if (this.sign !== n.sign) {\r
33604             return n.sign ? 1 : -1;\r
33605         }\r
33606         if (n.isSmall) {\r
33607             return this.sign ? -1 : 1;\r
33608         }\r
33609         return compareAbs(a, b) * (this.sign ? -1 : 1);\r
33610     };\r
33611     BigInteger.prototype.compareTo = BigInteger.prototype.compare;\r
33612 \r
33613     SmallInteger.prototype.compare = function (v) {\r
33614         if (v === Infinity) {\r
33615             return -1;\r
33616         }\r
33617         if (v === -Infinity) {\r
33618             return 1;\r
33619         }\r
33620 \r
33621         var n = parseValue(v),\r
33622             a = this.value,\r
33623             b = n.value;\r
33624         if (n.isSmall) {\r
33625             return a == b ? 0 : a > b ? 1 : -1;\r
33626         }\r
33627         if (a < 0 !== n.sign) {\r
33628             return a < 0 ? -1 : 1;\r
33629         }\r
33630         return a < 0 ? 1 : -1;\r
33631     };\r
33632     SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\r
33633 \r
33634     NativeBigInt.prototype.compare = function (v) {\r
33635         if (v === Infinity) {\r
33636             return -1;\r
33637         }\r
33638         if (v === -Infinity) {\r
33639             return 1;\r
33640         }\r
33641         var a = this.value;\r
33642         var b = parseValue(v).value;\r
33643         return a === b ? 0 : a > b ? 1 : -1;\r
33644     }\r
33645     NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;\r
33646 \r
33647     BigInteger.prototype.equals = function (v) {\r
33648         return this.compare(v) === 0;\r
33649     };\r
33650     NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;\r
33651 \r
33652     BigInteger.prototype.notEquals = function (v) {\r
33653         return this.compare(v) !== 0;\r
33654     };\r
33655     NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;\r
33656 \r
33657     BigInteger.prototype.greater = function (v) {\r
33658         return this.compare(v) > 0;\r
33659     };\r
33660     NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;\r
33661 \r
33662     BigInteger.prototype.lesser = function (v) {\r
33663         return this.compare(v) < 0;\r
33664     };\r
33665     NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;\r
33666 \r
33667     BigInteger.prototype.greaterOrEquals = function (v) {\r
33668         return this.compare(v) >= 0;\r
33669     };\r
33670     NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;\r
33671 \r
33672     BigInteger.prototype.lesserOrEquals = function (v) {\r
33673         return this.compare(v) <= 0;\r
33674     };\r
33675     NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;\r
33676 \r
33677     BigInteger.prototype.isEven = function () {\r
33678         return (this.value[0] & 1) === 0;\r
33679     };\r
33680     SmallInteger.prototype.isEven = function () {\r
33681         return (this.value & 1) === 0;\r
33682     };\r
33683     NativeBigInt.prototype.isEven = function () {\r
33684         return (this.value & BigInt(1)) === BigInt(0);\r
33685     }\r
33686 \r
33687     BigInteger.prototype.isOdd = function () {\r
33688         return (this.value[0] & 1) === 1;\r
33689     };\r
33690     SmallInteger.prototype.isOdd = function () {\r
33691         return (this.value & 1) === 1;\r
33692     };\r
33693     NativeBigInt.prototype.isOdd = function () {\r
33694         return (this.value & BigInt(1)) === BigInt(1);\r
33695     }\r
33696 \r
33697     BigInteger.prototype.isPositive = function () {\r
33698         return !this.sign;\r
33699     };\r
33700     SmallInteger.prototype.isPositive = function () {\r
33701         return this.value > 0;\r
33702     };\r
33703     NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;\r
33704 \r
33705     BigInteger.prototype.isNegative = function () {\r
33706         return this.sign;\r
33707     };\r
33708     SmallInteger.prototype.isNegative = function () {\r
33709         return this.value < 0;\r
33710     };\r
33711     NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;\r
33712 \r
33713     BigInteger.prototype.isUnit = function () {\r
33714         return false;\r
33715     };\r
33716     SmallInteger.prototype.isUnit = function () {\r
33717         return Math.abs(this.value) === 1;\r
33718     };\r
33719     NativeBigInt.prototype.isUnit = function () {\r
33720         return this.abs().value === BigInt(1);\r
33721     }\r
33722 \r
33723     BigInteger.prototype.isZero = function () {\r
33724         return false;\r
33725     };\r
33726     SmallInteger.prototype.isZero = function () {\r
33727         return this.value === 0;\r
33728     };\r
33729     NativeBigInt.prototype.isZero = function () {\r
33730         return this.value === BigInt(0);\r
33731     }\r
33732 \r
33733     BigInteger.prototype.isDivisibleBy = function (v) {\r
33734         var n = parseValue(v);\r
33735         if (n.isZero()) return false;\r
33736         if (n.isUnit()) return true;\r
33737         if (n.compareAbs(2) === 0) return this.isEven();\r
33738         return this.mod(n).isZero();\r
33739     };\r
33740     NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\r
33741 \r
33742     function isBasicPrime(v) {\r
33743         var n = v.abs();\r
33744         if (n.isUnit()) return false;\r
33745         if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\r
33746         if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\r
33747         if (n.lesser(49)) return true;\r
33748         // we don't know if it's prime: let the other functions figure it out\r
33749     }\r
33750 \r
33751     function millerRabinTest(n, a) {\r
33752         var nPrev = n.prev(),\r
33753             b = nPrev,\r
33754             r = 0,\r
33755             d, t, i, x;\r
33756         while (b.isEven()) b = b.divide(2), r++;\r
33757         next: for (i = 0; i < a.length; i++) {\r
33758             if (n.lesser(a[i])) continue;\r
33759             x = bigInt(a[i]).modPow(b, n);\r
33760             if (x.isUnit() || x.equals(nPrev)) continue;\r
33761             for (d = r - 1; d != 0; d--) {\r
33762                 x = x.square().mod(n);\r
33763                 if (x.isUnit()) return false;\r
33764                 if (x.equals(nPrev)) continue next;\r
33765             }\r
33766             return false;\r
33767         }\r
33768         return true;\r
33769     }\r
33770 \r
33771     // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2\r
33772     BigInteger.prototype.isPrime = function (strict) {\r
33773         var isPrime = isBasicPrime(this);\r
33774         if (isPrime !== undefined) return isPrime;\r
33775         var n = this.abs();\r
33776         var bits = n.bitLength();\r
33777         if (bits <= 64)\r
33778             return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);\r
33779         var logN = Math.log(2) * bits.toJSNumber();\r
33780         var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);\r
33781         for (var a = [], i = 0; i < t; i++) {\r
33782             a.push(bigInt(i + 2));\r
33783         }\r
33784         return millerRabinTest(n, a);\r
33785     };\r
33786     NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\r
33787 \r
33788     BigInteger.prototype.isProbablePrime = function (iterations, rng) {\r
33789         var isPrime = isBasicPrime(this);\r
33790         if (isPrime !== undefined) return isPrime;\r
33791         var n = this.abs();\r
33792         var t = iterations === undefined ? 5 : iterations;\r
33793         for (var a = [], i = 0; i < t; i++) {\r
33794             a.push(bigInt.randBetween(2, n.minus(2), rng));\r
33795         }\r
33796         return millerRabinTest(n, a);\r
33797     };\r
33798     NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\r
33799 \r
33800     BigInteger.prototype.modInv = function (n) {\r
33801         var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;\r
33802         while (!newR.isZero()) {\r
33803             q = r.divide(newR);\r
33804             lastT = t;\r
33805             lastR = r;\r
33806             t = newT;\r
33807             r = newR;\r
33808             newT = lastT.subtract(q.multiply(newT));\r
33809             newR = lastR.subtract(q.multiply(newR));\r
33810         }\r
33811         if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");\r
33812         if (t.compare(0) === -1) {\r
33813             t = t.add(n);\r
33814         }\r
33815         if (this.isNegative()) {\r
33816             return t.negate();\r
33817         }\r
33818         return t;\r
33819     };\r
33820 \r
33821     NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\r
33822 \r
33823     BigInteger.prototype.next = function () {\r
33824         var value = this.value;\r
33825         if (this.sign) {\r
33826             return subtractSmall(value, 1, this.sign);\r
33827         }\r
33828         return new BigInteger(addSmall(value, 1), this.sign);\r
33829     };\r
33830     SmallInteger.prototype.next = function () {\r
33831         var value = this.value;\r
33832         if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\r
33833         return new BigInteger(MAX_INT_ARR, false);\r
33834     };\r
33835     NativeBigInt.prototype.next = function () {\r
33836         return new NativeBigInt(this.value + BigInt(1));\r
33837     }\r
33838 \r
33839     BigInteger.prototype.prev = function () {\r
33840         var value = this.value;\r
33841         if (this.sign) {\r
33842             return new BigInteger(addSmall(value, 1), true);\r
33843         }\r
33844         return subtractSmall(value, 1, this.sign);\r
33845     };\r
33846     SmallInteger.prototype.prev = function () {\r
33847         var value = this.value;\r
33848         if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\r
33849         return new BigInteger(MAX_INT_ARR, true);\r
33850     };\r
33851     NativeBigInt.prototype.prev = function () {\r
33852         return new NativeBigInt(this.value - BigInt(1));\r
33853     }\r
33854 \r
33855     var powersOfTwo = [1];\r
33856     while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\r
33857     var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];\r
33858 \r
33859     function shift_isSmall(n) {\r
33860         return Math.abs(n) <= BASE;\r
33861     }\r
33862 \r
33863     BigInteger.prototype.shiftLeft = function (v) {\r
33864         var n = parseValue(v).toJSNumber();\r
33865         if (!shift_isSmall(n)) {\r
33866             throw new Error(String(n) + " is too large for shifting.");\r
33867         }\r
33868         if (n < 0) return this.shiftRight(-n);\r
33869         var result = this;\r
33870         if (result.isZero()) return result;\r
33871         while (n >= powers2Length) {\r
33872             result = result.multiply(highestPower2);\r
33873             n -= powers2Length - 1;\r
33874         }\r
33875         return result.multiply(powersOfTwo[n]);\r
33876     };\r
33877     NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\r
33878 \r
33879     BigInteger.prototype.shiftRight = function (v) {\r
33880         var remQuo;\r
33881         var n = parseValue(v).toJSNumber();\r
33882         if (!shift_isSmall(n)) {\r
33883             throw new Error(String(n) + " is too large for shifting.");\r
33884         }\r
33885         if (n < 0) return this.shiftLeft(-n);\r
33886         var result = this;\r
33887         while (n >= powers2Length) {\r
33888             if (result.isZero() || (result.isNegative() && result.isUnit())) return result;\r
33889             remQuo = divModAny(result, highestPower2);\r
33890             result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r
33891             n -= powers2Length - 1;\r
33892         }\r
33893         remQuo = divModAny(result, powersOfTwo[n]);\r
33894         return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r
33895     };\r
33896     NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\r
33897 \r
33898     function bitwise(x, y, fn) {\r
33899         y = parseValue(y);\r
33900         var xSign = x.isNegative(), ySign = y.isNegative();\r
33901         var xRem = xSign ? x.not() : x,\r
33902             yRem = ySign ? y.not() : y;\r
33903         var xDigit = 0, yDigit = 0;\r
33904         var xDivMod = null, yDivMod = null;\r
33905         var result = [];\r
33906         while (!xRem.isZero() || !yRem.isZero()) {\r
33907             xDivMod = divModAny(xRem, highestPower2);\r
33908             xDigit = xDivMod[1].toJSNumber();\r
33909             if (xSign) {\r
33910                 xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers\r
33911             }\r
33912 \r
33913             yDivMod = divModAny(yRem, highestPower2);\r
33914             yDigit = yDivMod[1].toJSNumber();\r
33915             if (ySign) {\r
33916                 yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers\r
33917             }\r
33918 \r
33919             xRem = xDivMod[0];\r
33920             yRem = yDivMod[0];\r
33921             result.push(fn(xDigit, yDigit));\r
33922         }\r
33923         var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\r
33924         for (var i = result.length - 1; i >= 0; i -= 1) {\r
33925             sum = sum.multiply(highestPower2).add(bigInt(result[i]));\r
33926         }\r
33927         return sum;\r
33928     }\r
33929 \r
33930     BigInteger.prototype.not = function () {\r
33931         return this.negate().prev();\r
33932     };\r
33933     NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;\r
33934 \r
33935     BigInteger.prototype.and = function (n) {\r
33936         return bitwise(this, n, function (a, b) { return a & b; });\r
33937     };\r
33938     NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;\r
33939 \r
33940     BigInteger.prototype.or = function (n) {\r
33941         return bitwise(this, n, function (a, b) { return a | b; });\r
33942     };\r
33943     NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;\r
33944 \r
33945     BigInteger.prototype.xor = function (n) {\r
33946         return bitwise(this, n, function (a, b) { return a ^ b; });\r
33947     };\r
33948     NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;\r
33949 \r
33950     var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;\r
33951     function roughLOB(n) { // get lowestOneBit (rough)\r
33952         // SmallInteger: return Min(lowestOneBit(n), 1 << 30)\r
33953         // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]\r
33954         var v = n.value,\r
33955             x = typeof v === "number" ? v | LOBMASK_I :\r
33956                 typeof v === "bigint" ? v | BigInt(LOBMASK_I) :\r
33957                     v[0] + v[1] * BASE | LOBMASK_BI;\r
33958         return x & -x;\r
33959     }\r
33960 \r
33961     function integerLogarithm(value, base) {\r
33962         if (base.compareTo(value) <= 0) {\r
33963             var tmp = integerLogarithm(value, base.square(base));\r
33964             var p = tmp.p;\r
33965             var e = tmp.e;\r
33966             var t = p.multiply(base);\r
33967             return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };\r
33968         }\r
33969         return { p: bigInt(1), e: 0 };\r
33970     }\r
33971 \r
33972     BigInteger.prototype.bitLength = function () {\r
33973         var n = this;\r
33974         if (n.compareTo(bigInt(0)) < 0) {\r
33975             n = n.negate().subtract(bigInt(1));\r
33976         }\r
33977         if (n.compareTo(bigInt(0)) === 0) {\r
33978             return bigInt(0);\r
33979         }\r
33980         return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\r
33981     }\r
33982     NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\r
33983 \r
33984     function max(a, b) {\r
33985         a = parseValue(a);\r
33986         b = parseValue(b);\r
33987         return a.greater(b) ? a : b;\r
33988     }\r
33989     function min(a, b) {\r
33990         a = parseValue(a);\r
33991         b = parseValue(b);\r
33992         return a.lesser(b) ? a : b;\r
33993     }\r
33994     function gcd(a, b) {\r
33995         a = parseValue(a).abs();\r
33996         b = parseValue(b).abs();\r
33997         if (a.equals(b)) return a;\r
33998         if (a.isZero()) return b;\r
33999         if (b.isZero()) return a;\r
34000         var c = Integer[1], d, t;\r
34001         while (a.isEven() && b.isEven()) {\r
34002             d = min(roughLOB(a), roughLOB(b));\r
34003             a = a.divide(d);\r
34004             b = b.divide(d);\r
34005             c = c.multiply(d);\r
34006         }\r
34007         while (a.isEven()) {\r
34008             a = a.divide(roughLOB(a));\r
34009         }\r
34010         do {\r
34011             while (b.isEven()) {\r
34012                 b = b.divide(roughLOB(b));\r
34013             }\r
34014             if (a.greater(b)) {\r
34015                 t = b; b = a; a = t;\r
34016             }\r
34017             b = b.subtract(a);\r
34018         } while (!b.isZero());\r
34019         return c.isUnit() ? a : a.multiply(c);\r
34020     }\r
34021     function lcm(a, b) {\r
34022         a = parseValue(a).abs();\r
34023         b = parseValue(b).abs();\r
34024         return a.divide(gcd(a, b)).multiply(b);\r
34025     }\r
34026     function randBetween(a, b, rng) {\r
34027         a = parseValue(a);\r
34028         b = parseValue(b);\r
34029         var usedRNG = rng || Math.random;\r
34030         var low = min(a, b), high = max(a, b);\r
34031         var range = high.subtract(low).add(1);\r
34032         if (range.isSmall) return low.add(Math.floor(usedRNG() * range));\r
34033         var digits = toBase(range, BASE).value;\r
34034         var result = [], restricted = true;\r
34035         for (var i = 0; i < digits.length; i++) {\r
34036             var top = restricted ? digits[i] : BASE;\r
34037             var digit = truncate(usedRNG() * top);\r
34038             result.push(digit);\r
34039             if (digit < top) restricted = false;\r
34040         }\r
34041         return low.add(Integer.fromArray(result, BASE, false));\r
34042     }\r
34043 \r
34044     var parseBase = function (text, base, alphabet, caseSensitive) {\r
34045         alphabet = alphabet || DEFAULT_ALPHABET;\r
34046         text = String(text);\r
34047         if (!caseSensitive) {\r
34048             text = text.toLowerCase();\r
34049             alphabet = alphabet.toLowerCase();\r
34050         }\r
34051         var length = text.length;\r
34052         var i;\r
34053         var absBase = Math.abs(base);\r
34054         var alphabetValues = {};\r
34055         for (i = 0; i < alphabet.length; i++) {\r
34056             alphabetValues[alphabet[i]] = i;\r
34057         }\r
34058         for (i = 0; i < length; i++) {\r
34059             var c = text[i];\r
34060             if (c === "-") continue;\r
34061             if (c in alphabetValues) {\r
34062                 if (alphabetValues[c] >= absBase) {\r
34063                     if (c === "1" && absBase === 1) continue;\r
34064                     throw new Error(c + " is not a valid digit in base " + base + ".");\r
34065                 }\r
34066             }\r
34067         }\r
34068         base = parseValue(base);\r
34069         var digits = [];\r
34070         var isNegative = text[0] === "-";\r
34071         for (i = isNegative ? 1 : 0; i < text.length; i++) {\r
34072             var c = text[i];\r
34073             if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));\r
34074             else if (c === "<") {\r
34075                 var start = i;\r
34076                 do { i++; } while (text[i] !== ">" && i < text.length);\r
34077                 digits.push(parseValue(text.slice(start + 1, i)));\r
34078             }\r
34079             else throw new Error(c + " is not a valid character");\r
34080         }\r
34081         return parseBaseFromArray(digits, base, isNegative);\r
34082     };\r
34083 \r
34084     function parseBaseFromArray(digits, base, isNegative) {\r
34085         var val = Integer[0], pow = Integer[1], i;\r
34086         for (i = digits.length - 1; i >= 0; i--) {\r
34087             val = val.add(digits[i].times(pow));\r
34088             pow = pow.times(base);\r
34089         }\r
34090         return isNegative ? val.negate() : val;\r
34091     }\r
34092 \r
34093     function stringify(digit, alphabet) {\r
34094         alphabet = alphabet || DEFAULT_ALPHABET;\r
34095         if (digit < alphabet.length) {\r
34096             return alphabet[digit];\r
34097         }\r
34098         return "<" + digit + ">";\r
34099     }\r
34100 \r
34101     function toBase(n, base) {\r
34102         base = bigInt(base);\r
34103         if (base.isZero()) {\r
34104             if (n.isZero()) return { value: [0], isNegative: false };\r
34105             throw new Error("Cannot convert nonzero numbers to base 0.");\r
34106         }\r
34107         if (base.equals(-1)) {\r
34108             if (n.isZero()) return { value: [0], isNegative: false };\r
34109             if (n.isNegative())\r
34110                 return {\r
34111                     value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))\r
34112                         .map(Array.prototype.valueOf, [1, 0])\r
34113                     ),\r
34114                     isNegative: false\r
34115                 };\r
34116 \r
34117             var arr = Array.apply(null, Array(n.toJSNumber() - 1))\r
34118                 .map(Array.prototype.valueOf, [0, 1]);\r
34119             arr.unshift([1]);\r
34120             return {\r
34121                 value: [].concat.apply([], arr),\r
34122                 isNegative: false\r
34123             };\r
34124         }\r
34125 \r
34126         var neg = false;\r
34127         if (n.isNegative() && base.isPositive()) {\r
34128             neg = true;\r
34129             n = n.abs();\r
34130         }\r
34131         if (base.isUnit()) {\r
34132             if (n.isZero()) return { value: [0], isNegative: false };\r
34133 \r
34134             return {\r
34135                 value: Array.apply(null, Array(n.toJSNumber()))\r
34136                     .map(Number.prototype.valueOf, 1),\r
34137                 isNegative: neg\r
34138             };\r
34139         }\r
34140         var out = [];\r
34141         var left = n, divmod;\r
34142         while (left.isNegative() || left.compareAbs(base) >= 0) {\r
34143             divmod = left.divmod(base);\r
34144             left = divmod.quotient;\r
34145             var digit = divmod.remainder;\r
34146             if (digit.isNegative()) {\r
34147                 digit = base.minus(digit).abs();\r
34148                 left = left.next();\r
34149             }\r
34150             out.push(digit.toJSNumber());\r
34151         }\r
34152         out.push(left.toJSNumber());\r
34153         return { value: out.reverse(), isNegative: neg };\r
34154     }\r
34155 \r
34156     function toBaseString(n, base, alphabet) {\r
34157         var arr = toBase(n, base);\r
34158         return (arr.isNegative ? "-" : "") + arr.value.map(function (x) {\r
34159             return stringify(x, alphabet);\r
34160         }).join('');\r
34161     }\r
34162 \r
34163     BigInteger.prototype.toArray = function (radix) {\r
34164         return toBase(this, radix);\r
34165     };\r
34166 \r
34167     SmallInteger.prototype.toArray = function (radix) {\r
34168         return toBase(this, radix);\r
34169     };\r
34170 \r
34171     NativeBigInt.prototype.toArray = function (radix) {\r
34172         return toBase(this, radix);\r
34173     };\r
34174 \r
34175     BigInteger.prototype.toString = function (radix, alphabet) {\r
34176         if (radix === undefined) radix = 10;\r
34177         if (radix !== 10) return toBaseString(this, radix, alphabet);\r
34178         var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;\r
34179         while (--l >= 0) {\r
34180             digit = String(v[l]);\r
34181             str += zeros.slice(digit.length) + digit;\r
34182         }\r
34183         var sign = this.sign ? "-" : "";\r
34184         return sign + str;\r
34185     };\r
34186 \r
34187     SmallInteger.prototype.toString = function (radix, alphabet) {\r
34188         if (radix === undefined) radix = 10;\r
34189         if (radix != 10) return toBaseString(this, radix, alphabet);\r
34190         return String(this.value);\r
34191     };\r
34192 \r
34193     NativeBigInt.prototype.toString = SmallInteger.prototype.toString;\r
34194 \r
34195     NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }\r
34196 \r
34197     BigInteger.prototype.valueOf = function () {\r
34198         return parseInt(this.toString(), 10);\r
34199     };\r
34200     BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\r
34201 \r
34202     SmallInteger.prototype.valueOf = function () {\r
34203         return this.value;\r
34204     };\r
34205     SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\r
34206     NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {\r
34207         return parseInt(this.toString(), 10);\r
34208     }\r
34209 \r
34210     function parseStringValue(v) {\r
34211         if (isPrecise(+v)) {\r
34212             var x = +v;\r
34213             if (x === truncate(x))\r
34214                 return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);\r
34215             throw new Error("Invalid integer: " + v);\r
34216         }\r
34217         var sign = v[0] === "-";\r
34218         if (sign) v = v.slice(1);\r
34219         var split = v.split(/e/i);\r
34220         if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));\r
34221         if (split.length === 2) {\r
34222             var exp = split[1];\r
34223             if (exp[0] === "+") exp = exp.slice(1);\r
34224             exp = +exp;\r
34225             if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");\r
34226             var text = split[0];\r
34227             var decimalPlace = text.indexOf(".");\r
34228             if (decimalPlace >= 0) {\r
34229                 exp -= text.length - decimalPlace - 1;\r
34230                 text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\r
34231             }\r
34232             if (exp < 0) throw new Error("Cannot include negative exponent part for integers");\r
34233             text += (new Array(exp + 1)).join("0");\r
34234             v = text;\r
34235         }\r
34236         var isValid = /^([0-9][0-9]*)$/.test(v);\r
34237         if (!isValid) throw new Error("Invalid integer: " + v);\r
34238         if (supportsNativeBigInt) {\r
34239             return new NativeBigInt(BigInt(sign ? "-" + v : v));\r
34240         }\r
34241         var r = [], max = v.length, l = LOG_BASE, min = max - l;\r
34242         while (max > 0) {\r
34243             r.push(+v.slice(min, max));\r
34244             min -= l;\r
34245             if (min < 0) min = 0;\r
34246             max -= l;\r
34247         }\r
34248         trim(r);\r
34249         return new BigInteger(r, sign);\r
34250     }\r
34251 \r
34252     function parseNumberValue(v) {\r
34253         if (supportsNativeBigInt) {\r
34254             return new NativeBigInt(BigInt(v));\r
34255         }\r
34256         if (isPrecise(v)) {\r
34257             if (v !== truncate(v)) throw new Error(v + " is not an integer.");\r
34258             return new SmallInteger(v);\r
34259         }\r
34260         return parseStringValue(v.toString());\r
34261     }\r
34262 \r
34263     function parseValue(v) {\r
34264         if (typeof v === "number") {\r
34265             return parseNumberValue(v);\r
34266         }\r
34267         if (typeof v === "string") {\r
34268             return parseStringValue(v);\r
34269         }\r
34270         if (typeof v === "bigint") {\r
34271             return new NativeBigInt(v);\r
34272         }\r
34273         return v;\r
34274     }\r
34275     // Pre-define numbers in range [-999,999]\r
34276     for (var i = 0; i < 1000; i++) {\r
34277         Integer[i] = parseValue(i);\r
34278         if (i > 0) Integer[-i] = parseValue(-i);\r
34279     }\r
34280     // Backwards compatibility\r
34281     Integer.one = Integer[1];\r
34282     Integer.zero = Integer[0];\r
34283     Integer.minusOne = Integer[-1];\r
34284     Integer.max = max;\r
34285     Integer.min = min;\r
34286     Integer.gcd = gcd;\r
34287     Integer.lcm = lcm;\r
34288     Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };\r
34289     Integer.randBetween = randBetween;\r
34290 \r
34291     Integer.fromArray = function (digits, base, isNegative) {\r
34292         return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);\r
34293     };\r
34294 \r
34295     return Integer;\r
34296 })();\r
34297 \r
34298 // Node.js check\r
34299 if ( true && module.hasOwnProperty("exports")) {\r
34300     module.exports = bigInt;\r
34301 }\r
34302 \r
34303 //amd check\r
34304 if (true) {\r
34305     !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\r
34306         return bigInt;\r
34307     }).call(exports, __webpack_require__, exports, module),
34308                                 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r
34309 }\r
34310
34311 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(220)(module)))
34312
34313 /***/ }),
34314 /* 220 */
34315 /***/ (function(module, exports) {
34316
34317 module.exports = function(module) {
34318         if (!module.webpackPolyfill) {
34319                 module.deprecate = function() {};
34320                 module.paths = [];
34321                 // module.parent = undefined by default
34322                 if (!module.children) module.children = [];
34323                 Object.defineProperty(module, "loaded", {
34324                         enumerable: true,
34325                         get: function() {
34326                                 return module.l;
34327                         }
34328                 });
34329                 Object.defineProperty(module, "id", {
34330                         enumerable: true,
34331                         get: function() {
34332                                 return module.i;
34333                         }
34334                 });
34335                 module.webpackPolyfill = 1;
34336         }
34337         return module;
34338 };
34339
34340
34341 /***/ }),
34342 /* 221 */
34343 /***/ (function(module, exports, __webpack_require__) {
34344
34345 const isWindows = process.platform === 'win32' ||
34346     process.env.OSTYPE === 'cygwin' ||
34347     process.env.OSTYPE === 'msys'
34348
34349 const path = __webpack_require__(2)
34350 const COLON = isWindows ? ';' : ':'
34351 const isexe = __webpack_require__(222)
34352
34353 const getNotFoundError = (cmd) =>
34354   Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
34355
34356 const getPathInfo = (cmd, opt) => {
34357   const colon = opt.colon || COLON
34358
34359   // If it has a slash, then we don't bother searching the pathenv.
34360   // just check the file itself, and that's it.
34361   const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
34362     : (
34363       [
34364         // windows always checks the cwd first
34365         ...(isWindows ? [process.cwd()] : []),
34366         ...(opt.path || process.env.PATH ||
34367           /* istanbul ignore next: very unusual */ '').split(colon),
34368       ]
34369     )
34370   const pathExtExe = isWindows
34371     ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
34372     : ''
34373   const pathExt = isWindows ? pathExtExe.split(colon) : ['']
34374
34375   if (isWindows) {
34376     if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
34377       pathExt.unshift('')
34378   }
34379
34380   return {
34381     pathEnv,
34382     pathExt,
34383     pathExtExe,
34384   }
34385 }
34386
34387 const which = (cmd, opt, cb) => {
34388   if (typeof opt === 'function') {
34389     cb = opt
34390     opt = {}
34391   }
34392   if (!opt)
34393     opt = {}
34394
34395   const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
34396   const found = []
34397
34398   const step = i => new Promise((resolve, reject) => {
34399     if (i === pathEnv.length)
34400       return opt.all && found.length ? resolve(found)
34401         : reject(getNotFoundError(cmd))
34402
34403     const ppRaw = pathEnv[i]
34404     const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
34405
34406     const pCmd = path.join(pathPart, cmd)
34407     const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
34408       : pCmd
34409
34410     resolve(subStep(p, i, 0))
34411   })
34412
34413   const subStep = (p, i, ii) => new Promise((resolve, reject) => {
34414     if (ii === pathExt.length)
34415       return resolve(step(i + 1))
34416     const ext = pathExt[ii]
34417     isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
34418       if (!er && is) {
34419         if (opt.all)
34420           found.push(p + ext)
34421         else
34422           return resolve(p + ext)
34423       }
34424       return resolve(subStep(p, i, ii + 1))
34425     })
34426   })
34427
34428   return cb ? step(0).then(res => cb(null, res), cb) : step(0)
34429 }
34430
34431 const whichSync = (cmd, opt) => {
34432   opt = opt || {}
34433
34434   const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
34435   const found = []
34436
34437   for (let i = 0; i < pathEnv.length; i ++) {
34438     const ppRaw = pathEnv[i]
34439     const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
34440
34441     const pCmd = path.join(pathPart, cmd)
34442     const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
34443       : pCmd
34444
34445     for (let j = 0; j < pathExt.length; j ++) {
34446       const cur = p + pathExt[j]
34447       try {
34448         const is = isexe.sync(cur, { pathExt: pathExtExe })
34449         if (is) {
34450           if (opt.all)
34451             found.push(cur)
34452           else
34453             return cur
34454         }
34455       } catch (ex) {}
34456     }
34457   }
34458
34459   if (opt.all && found.length)
34460     return found
34461
34462   if (opt.nothrow)
34463     return null
34464
34465   throw getNotFoundError(cmd)
34466 }
34467
34468 module.exports = which
34469 which.sync = whichSync
34470
34471
34472 /***/ }),
34473 /* 222 */
34474 /***/ (function(module, exports, __webpack_require__) {
34475
34476 var fs = __webpack_require__(42)
34477 var core
34478 if (process.platform === 'win32' || global.TESTING_WINDOWS) {
34479   core = __webpack_require__(223)
34480 } else {
34481   core = __webpack_require__(224)
34482 }
34483
34484 module.exports = isexe
34485 isexe.sync = sync
34486
34487 function isexe (path, options, cb) {
34488   if (typeof options === 'function') {
34489     cb = options
34490     options = {}
34491   }
34492
34493   if (!cb) {
34494     if (typeof Promise !== 'function') {
34495       throw new TypeError('callback not provided')
34496     }
34497
34498     return new Promise(function (resolve, reject) {
34499       isexe(path, options || {}, function (er, is) {
34500         if (er) {
34501           reject(er)
34502         } else {
34503           resolve(is)
34504         }
34505       })
34506     })
34507   }
34508
34509   core(path, options || {}, function (er, is) {
34510     // ignore EACCES because that just means we aren't allowed to run it
34511     if (er) {
34512       if (er.code === 'EACCES' || options && options.ignoreErrors) {
34513         er = null
34514         is = false
34515       }
34516     }
34517     cb(er, is)
34518   })
34519 }
34520
34521 function sync (path, options) {
34522   // my kingdom for a filtered catch
34523   try {
34524     return core.sync(path, options || {})
34525   } catch (er) {
34526     if (options && options.ignoreErrors || er.code === 'EACCES') {
34527       return false
34528     } else {
34529       throw er
34530     }
34531   }
34532 }
34533
34534
34535 /***/ }),
34536 /* 223 */
34537 /***/ (function(module, exports, __webpack_require__) {
34538
34539 module.exports = isexe
34540 isexe.sync = sync
34541
34542 var fs = __webpack_require__(42)
34543
34544 function checkPathExt (path, options) {
34545   var pathext = options.pathExt !== undefined ?
34546     options.pathExt : process.env.PATHEXT
34547
34548   if (!pathext) {
34549     return true
34550   }
34551
34552   pathext = pathext.split(';')
34553   if (pathext.indexOf('') !== -1) {
34554     return true
34555   }
34556   for (var i = 0; i < pathext.length; i++) {
34557     var p = pathext[i].toLowerCase()
34558     if (p && path.substr(-p.length).toLowerCase() === p) {
34559       return true
34560     }
34561   }
34562   return false
34563 }
34564
34565 function checkStat (stat, path, options) {
34566   if (!stat.isSymbolicLink() && !stat.isFile()) {
34567     return false
34568   }
34569   return checkPathExt(path, options)
34570 }
34571
34572 function isexe (path, options, cb) {
34573   fs.stat(path, function (er, stat) {
34574     cb(er, er ? false : checkStat(stat, path, options))
34575   })
34576 }
34577
34578 function sync (path, options) {
34579   return checkStat(fs.statSync(path), path, options)
34580 }
34581
34582
34583 /***/ }),
34584 /* 224 */
34585 /***/ (function(module, exports, __webpack_require__) {
34586
34587 module.exports = isexe
34588 isexe.sync = sync
34589
34590 var fs = __webpack_require__(42)
34591
34592 function isexe (path, options, cb) {
34593   fs.stat(path, function (er, stat) {
34594     cb(er, er ? false : checkStat(stat, options))
34595   })
34596 }
34597
34598 function sync (path, options) {
34599   return checkStat(fs.statSync(path), options)
34600 }
34601
34602 function checkStat (stat, options) {
34603   return stat.isFile() && checkMode(stat, options)
34604 }
34605
34606 function checkMode (stat, options) {
34607   var mod = stat.mode
34608   var uid = stat.uid
34609   var gid = stat.gid
34610
34611   var myUid = options.uid !== undefined ?
34612     options.uid : process.getuid && process.getuid()
34613   var myGid = options.gid !== undefined ?
34614     options.gid : process.getgid && process.getgid()
34615
34616   var u = parseInt('100', 8)
34617   var g = parseInt('010', 8)
34618   var o = parseInt('001', 8)
34619   var ug = u | g
34620
34621   var ret = (mod & o) ||
34622     (mod & g) && gid === myGid ||
34623     (mod & u) && uid === myUid ||
34624     (mod & ug) && myUid === 0
34625
34626   return ret
34627 }
34628
34629
34630 /***/ })
34631 /******/ ])));