1 var __create = Object.create;
2 var __defProp = Object.defineProperty;
3 var __getProtoOf = Object.getPrototypeOf;
4 var __hasOwnProp = Object.prototype.hasOwnProperty;
5 var __getOwnPropNames = Object.getOwnPropertyNames;
6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7 var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8 var __commonJS = (callback, module2) => () => {
10 module2 = {exports: {}};
11 callback(module2.exports, module2);
13 return module2.exports;
15 var __export = (target, all) => {
17 __defProp(target, name, {get: all[name], enumerable: true});
19 var __exportStar = (target, module2, desc) => {
20 if (module2 && typeof module2 === "object" || typeof module2 === "function") {
21 for (let key of __getOwnPropNames(module2))
22 if (!__hasOwnProp.call(target, key) && key !== "default")
23 __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
27 var __toModule = (module2) => {
28 if (module2 && module2.__esModule)
30 return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", {value: module2, enumerable: true})), module2);
33 // node_modules/vscode-jsonrpc/lib/common/ral.js
34 var require_ral = __commonJS((exports2) => {
36 Object.defineProperty(exports2, "__esModule", {value: true});
39 if (_ral === void 0) {
40 throw new Error(`No runtime abstraction layer installed`);
45 function install2(ral) {
47 throw new Error(`No runtime abstraction layer provided`);
51 RAL2.install = install2;
52 })(RAL || (RAL = {}));
53 exports2.default = RAL;
56 // node_modules/vscode-jsonrpc/lib/common/disposable.js
57 var require_disposable = __commonJS((exports2) => {
59 Object.defineProperty(exports2, "__esModule", {value: true});
60 exports2.Disposable = void 0;
62 (function(Disposable4) {
63 function create(func) {
68 Disposable4.create = create;
69 })(Disposable3 = exports2.Disposable || (exports2.Disposable = {}));
72 // node_modules/vscode-jsonrpc/lib/common/messageBuffer.js
73 var require_messageBuffer = __commonJS((exports2) => {
75 Object.defineProperty(exports2, "__esModule", {value: true});
76 exports2.AbstractMessageBuffer = void 0;
80 var AbstractMessageBuffer = class {
81 constructor(encoding = "utf-8") {
82 this._encoding = encoding;
84 this._totalLength = 0;
87 return this._encoding;
90 const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk;
91 this._chunks.push(toAppend);
92 this._totalLength += toAppend.byteLength;
95 if (this._chunks.length === 0) {
101 let chunkBytesRead = 0;
103 while (chunkIndex < this._chunks.length) {
104 const chunk = this._chunks[chunkIndex];
107 while (offset < chunk.length) {
108 const value = chunk[offset];
140 chunkBytesRead += chunk.byteLength;
146 const buffer = this._read(chunkBytesRead + offset);
147 const result = new Map();
148 const headers = this.toString(buffer, "ascii").split(CRLF);
149 if (headers.length < 2) {
152 for (let i = 0; i < headers.length - 2; i++) {
153 const header = headers[i];
154 const index = header.indexOf(":");
156 throw new Error("Message header must separate key and value using :");
158 const key = header.substr(0, index);
159 const value = header.substr(index + 1).trim();
160 result.set(key, value);
164 tryReadBody(length) {
165 if (this._totalLength < length) {
168 return this._read(length);
170 get numberOfBytes() {
171 return this._totalLength;
174 if (byteCount === 0) {
175 return this.emptyBuffer();
177 if (byteCount > this._totalLength) {
178 throw new Error(`Cannot read so many bytes!`);
180 if (this._chunks[0].byteLength === byteCount) {
181 const chunk = this._chunks[0];
182 this._chunks.shift();
183 this._totalLength -= byteCount;
184 return this.asNative(chunk);
186 if (this._chunks[0].byteLength > byteCount) {
187 const chunk = this._chunks[0];
188 const result2 = this.asNative(chunk, byteCount);
189 this._chunks[0] = chunk.slice(byteCount);
190 this._totalLength -= byteCount;
193 const result = this.allocNative(byteCount);
194 let resultOffset = 0;
196 while (byteCount > 0) {
197 const chunk = this._chunks[chunkIndex];
198 if (chunk.byteLength > byteCount) {
199 const chunkPart = chunk.slice(0, byteCount);
200 result.set(chunkPart, resultOffset);
201 resultOffset += byteCount;
202 this._chunks[chunkIndex] = chunk.slice(byteCount);
203 this._totalLength -= byteCount;
204 byteCount -= byteCount;
206 result.set(chunk, resultOffset);
207 resultOffset += chunk.byteLength;
208 this._chunks.shift();
209 this._totalLength -= chunk.byteLength;
210 byteCount -= chunk.byteLength;
216 exports2.AbstractMessageBuffer = AbstractMessageBuffer;
219 // node_modules/vscode-jsonrpc/lib/node/ril.js
220 var require_ril = __commonJS((exports2) => {
222 Object.defineProperty(exports2, "__esModule", {value: true});
223 var ral_1 = require_ral();
224 var util_1 = require("util");
225 var disposable_1 = require_disposable();
226 var messageBuffer_1 = require_messageBuffer();
227 var MessageBuffer = class extends messageBuffer_1.AbstractMessageBuffer {
228 constructor(encoding = "utf-8") {
232 return MessageBuffer.emptyBuffer;
234 fromString(value, encoding) {
235 return Buffer.from(value, encoding);
237 toString(value, encoding) {
238 if (value instanceof Buffer) {
239 return value.toString(encoding);
241 return new util_1.TextDecoder(encoding).decode(value);
244 asNative(buffer, length) {
245 if (length === void 0) {
246 return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
248 return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
251 allocNative(length) {
252 return Buffer.allocUnsafe(length);
255 MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
256 var ReadableStreamWrapper = class {
257 constructor(stream) {
258 this.stream = stream;
261 this.stream.on("close", listener);
262 return disposable_1.Disposable.create(() => this.stream.off("close", listener));
265 this.stream.on("error", listener);
266 return disposable_1.Disposable.create(() => this.stream.off("error", listener));
269 this.stream.on("end", listener);
270 return disposable_1.Disposable.create(() => this.stream.off("end", listener));
273 this.stream.on("data", listener);
274 return disposable_1.Disposable.create(() => this.stream.off("data", listener));
277 var WritableStreamWrapper = class {
278 constructor(stream) {
279 this.stream = stream;
282 this.stream.on("close", listener);
283 return disposable_1.Disposable.create(() => this.stream.off("close", listener));
286 this.stream.on("error", listener);
287 return disposable_1.Disposable.create(() => this.stream.off("error", listener));
290 this.stream.on("end", listener);
291 return disposable_1.Disposable.create(() => this.stream.off("end", listener));
293 write(data, encoding) {
294 return new Promise((resolve, reject) => {
295 const callback = (error) => {
296 if (error === void 0 || error === null) {
302 if (typeof data === "string") {
303 this.stream.write(data, encoding, callback);
305 this.stream.write(data, callback);
313 var _ril = Object.freeze({
314 messageBuffer: Object.freeze({
315 create: (encoding) => new MessageBuffer(encoding)
317 applicationJson: Object.freeze({
318 encoder: Object.freeze({
319 name: "application/json",
320 encode: (msg, options) => {
322 return Promise.resolve(Buffer.from(JSON.stringify(msg, void 0, 0), options.charset));
324 return Promise.reject(err);
328 decoder: Object.freeze({
329 name: "application/json",
330 decode: (buffer, options) => {
332 if (buffer instanceof Buffer) {
333 return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
335 return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
338 return Promise.reject(err);
343 stream: Object.freeze({
344 asReadableStream: (stream) => new ReadableStreamWrapper(stream),
345 asWritableStream: (stream) => new WritableStreamWrapper(stream)
348 timer: Object.freeze({
349 setTimeout(callback, ms, ...args) {
350 return setTimeout(callback, ms, ...args);
352 clearTimeout(handle) {
353 clearTimeout(handle);
355 setImmediate(callback, ...args) {
356 return setImmediate(callback, ...args);
358 clearImmediate(handle) {
359 clearImmediate(handle);
367 function install2() {
368 ral_1.default.install(_ril);
370 RIL2.install = install2;
371 })(RIL || (RIL = {}));
372 exports2.default = RIL;
375 // node_modules/vscode-jsonrpc/lib/common/is.js
376 var require_is = __commonJS((exports2) => {
378 Object.defineProperty(exports2, "__esModule", {value: true});
379 exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
380 function boolean(value) {
381 return value === true || value === false;
383 exports2.boolean = boolean;
384 function string(value) {
385 return typeof value === "string" || value instanceof String;
387 exports2.string = string;
388 function number(value) {
389 return typeof value === "number" || value instanceof Number;
391 exports2.number = number;
392 function error(value) {
393 return value instanceof Error;
395 exports2.error = error;
396 function func(value) {
397 return typeof value === "function";
399 exports2.func = func;
400 function array(value) {
401 return Array.isArray(value);
403 exports2.array = array;
404 function stringArray(value) {
405 return array(value) && value.every((elem) => string(elem));
407 exports2.stringArray = stringArray;
410 // node_modules/vscode-jsonrpc/lib/common/messages.js
411 var require_messages = __commonJS((exports2) => {
413 Object.defineProperty(exports2, "__esModule", {value: true});
414 exports2.isResponseMessage = exports2.isNotificationMessage = exports2.isRequestMessage = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0;
415 var is = require_is();
417 (function(ErrorCodes2) {
418 ErrorCodes2.ParseError = -32700;
419 ErrorCodes2.InvalidRequest = -32600;
420 ErrorCodes2.MethodNotFound = -32601;
421 ErrorCodes2.InvalidParams = -32602;
422 ErrorCodes2.InternalError = -32603;
423 ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099;
424 ErrorCodes2.serverErrorStart = ErrorCodes2.jsonrpcReservedErrorRangeStart;
425 ErrorCodes2.MessageWriteError = -32099;
426 ErrorCodes2.MessageReadError = -32098;
427 ErrorCodes2.ServerNotInitialized = -32002;
428 ErrorCodes2.UnknownErrorCode = -32001;
429 ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3;
430 ErrorCodes2.serverErrorEnd = ErrorCodes2.jsonrpcReservedErrorRangeEnd;
431 })(ErrorCodes = exports2.ErrorCodes || (exports2.ErrorCodes = {}));
432 var ResponseError = class extends Error {
433 constructor(code, message, data) {
435 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
437 Object.setPrototypeOf(this, ResponseError.prototype);
442 message: this.message,
447 exports2.ResponseError = ResponseError;
448 var ParameterStructures = class {
453 return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
459 exports2.ParameterStructures = ParameterStructures;
460 ParameterStructures.auto = new ParameterStructures("auto");
461 ParameterStructures.byPosition = new ParameterStructures("byPosition");
462 ParameterStructures.byName = new ParameterStructures("byName");
463 var AbstractMessageSignature = class {
464 constructor(method, numberOfParams) {
465 this.method = method;
466 this.numberOfParams = numberOfParams;
468 get parameterStructures() {
469 return ParameterStructures.auto;
472 exports2.AbstractMessageSignature = AbstractMessageSignature;
473 var RequestType0 = class extends AbstractMessageSignature {
474 constructor(method) {
478 exports2.RequestType0 = RequestType0;
479 var RequestType2 = class extends AbstractMessageSignature {
480 constructor(method, _parameterStructures = ParameterStructures.auto) {
482 this._parameterStructures = _parameterStructures;
484 get parameterStructures() {
485 return this._parameterStructures;
488 exports2.RequestType = RequestType2;
489 var RequestType1 = class extends AbstractMessageSignature {
490 constructor(method, _parameterStructures = ParameterStructures.auto) {
492 this._parameterStructures = _parameterStructures;
494 get parameterStructures() {
495 return this._parameterStructures;
498 exports2.RequestType1 = RequestType1;
499 var RequestType22 = class extends AbstractMessageSignature {
500 constructor(method) {
504 exports2.RequestType2 = RequestType22;
505 var RequestType3 = class extends AbstractMessageSignature {
506 constructor(method) {
510 exports2.RequestType3 = RequestType3;
511 var RequestType4 = class extends AbstractMessageSignature {
512 constructor(method) {
516 exports2.RequestType4 = RequestType4;
517 var RequestType5 = class extends AbstractMessageSignature {
518 constructor(method) {
522 exports2.RequestType5 = RequestType5;
523 var RequestType6 = class extends AbstractMessageSignature {
524 constructor(method) {
528 exports2.RequestType6 = RequestType6;
529 var RequestType7 = class extends AbstractMessageSignature {
530 constructor(method) {
534 exports2.RequestType7 = RequestType7;
535 var RequestType8 = class extends AbstractMessageSignature {
536 constructor(method) {
540 exports2.RequestType8 = RequestType8;
541 var RequestType9 = class extends AbstractMessageSignature {
542 constructor(method) {
546 exports2.RequestType9 = RequestType9;
547 var NotificationType2 = class extends AbstractMessageSignature {
548 constructor(method, _parameterStructures = ParameterStructures.auto) {
550 this._parameterStructures = _parameterStructures;
552 get parameterStructures() {
553 return this._parameterStructures;
556 exports2.NotificationType = NotificationType2;
557 var NotificationType0 = class extends AbstractMessageSignature {
558 constructor(method) {
562 exports2.NotificationType0 = NotificationType0;
563 var NotificationType1 = class extends AbstractMessageSignature {
564 constructor(method, _parameterStructures = ParameterStructures.auto) {
566 this._parameterStructures = _parameterStructures;
568 get parameterStructures() {
569 return this._parameterStructures;
572 exports2.NotificationType1 = NotificationType1;
573 var NotificationType22 = class extends AbstractMessageSignature {
574 constructor(method) {
578 exports2.NotificationType2 = NotificationType22;
579 var NotificationType3 = class extends AbstractMessageSignature {
580 constructor(method) {
584 exports2.NotificationType3 = NotificationType3;
585 var NotificationType4 = class extends AbstractMessageSignature {
586 constructor(method) {
590 exports2.NotificationType4 = NotificationType4;
591 var NotificationType5 = class extends AbstractMessageSignature {
592 constructor(method) {
596 exports2.NotificationType5 = NotificationType5;
597 var NotificationType6 = class extends AbstractMessageSignature {
598 constructor(method) {
602 exports2.NotificationType6 = NotificationType6;
603 var NotificationType7 = class extends AbstractMessageSignature {
604 constructor(method) {
608 exports2.NotificationType7 = NotificationType7;
609 var NotificationType8 = class extends AbstractMessageSignature {
610 constructor(method) {
614 exports2.NotificationType8 = NotificationType8;
615 var NotificationType9 = class extends AbstractMessageSignature {
616 constructor(method) {
620 exports2.NotificationType9 = NotificationType9;
621 function isRequestMessage(message) {
622 const candidate = message;
623 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
625 exports2.isRequestMessage = isRequestMessage;
626 function isNotificationMessage(message) {
627 const candidate = message;
628 return candidate && is.string(candidate.method) && message.id === void 0;
630 exports2.isNotificationMessage = isNotificationMessage;
631 function isResponseMessage(message) {
632 const candidate = message;
633 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
635 exports2.isResponseMessage = isResponseMessage;
638 // node_modules/vscode-jsonrpc/lib/common/events.js
639 var require_events = __commonJS((exports2) => {
641 Object.defineProperty(exports2, "__esModule", {value: true});
642 exports2.Emitter = exports2.Event = void 0;
643 var ral_1 = require_ral();
646 const _disposable = {dispose() {
648 Event4.None = function() {
651 })(Event3 = exports2.Event || (exports2.Event = {}));
652 var CallbackList = class {
653 add(callback, context = null, bucket) {
654 if (!this._callbacks) {
655 this._callbacks = [];
658 this._callbacks.push(callback);
659 this._contexts.push(context);
660 if (Array.isArray(bucket)) {
661 bucket.push({dispose: () => this.remove(callback, context)});
664 remove(callback, context = null) {
665 if (!this._callbacks) {
668 let foundCallbackWithDifferentContext = false;
669 for (let i = 0, len = this._callbacks.length; i < len; i++) {
670 if (this._callbacks[i] === callback) {
671 if (this._contexts[i] === context) {
672 this._callbacks.splice(i, 1);
673 this._contexts.splice(i, 1);
676 foundCallbackWithDifferentContext = true;
680 if (foundCallbackWithDifferentContext) {
681 throw new Error("When adding a listener with a context, you should remove it with the same context");
685 if (!this._callbacks) {
688 const ret2 = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
689 for (let i = 0, len = callbacks.length; i < len; i++) {
691 ret2.push(callbacks[i].apply(contexts[i], args));
693 ral_1.default().console.error(e);
699 return !this._callbacks || this._callbacks.length === 0;
702 this._callbacks = void 0;
703 this._contexts = void 0;
706 var Emitter = class {
707 constructor(_options) {
708 this._options = _options;
712 this._event = (listener, thisArgs, disposables) => {
713 if (!this._callbacks) {
714 this._callbacks = new CallbackList();
716 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
717 this._options.onFirstListenerAdd(this);
719 this._callbacks.add(listener, thisArgs);
722 if (!this._callbacks) {
725 this._callbacks.remove(listener, thisArgs);
726 result.dispose = Emitter._noop;
727 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
728 this._options.onLastListenerRemove(this);
732 if (Array.isArray(disposables)) {
733 disposables.push(result);
741 if (this._callbacks) {
742 this._callbacks.invoke.call(this._callbacks, event);
746 if (this._callbacks) {
747 this._callbacks.dispose();
748 this._callbacks = void 0;
752 exports2.Emitter = Emitter;
753 Emitter._noop = function() {
757 // node_modules/vscode-jsonrpc/lib/common/cancellation.js
758 var require_cancellation = __commonJS((exports2) => {
760 Object.defineProperty(exports2, "__esModule", {value: true});
761 exports2.CancellationTokenSource = exports2.CancellationToken = void 0;
762 var ral_1 = require_ral();
763 var Is = require_is();
764 var events_1 = require_events();
765 var CancellationToken;
766 (function(CancellationToken2) {
767 CancellationToken2.None = Object.freeze({
768 isCancellationRequested: false,
769 onCancellationRequested: events_1.Event.None
771 CancellationToken2.Cancelled = Object.freeze({
772 isCancellationRequested: true,
773 onCancellationRequested: events_1.Event.None
776 const candidate = value;
777 return candidate && (candidate === CancellationToken2.None || candidate === CancellationToken2.Cancelled || Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested);
779 CancellationToken2.is = is;
780 })(CancellationToken = exports2.CancellationToken || (exports2.CancellationToken = {}));
781 var shortcutEvent = Object.freeze(function(callback, context) {
782 const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0);
784 ral_1.default().timer.clearTimeout(handle);
787 var MutableToken = class {
789 this._isCancelled = false;
792 if (!this._isCancelled) {
793 this._isCancelled = true;
795 this._emitter.fire(void 0);
800 get isCancellationRequested() {
801 return this._isCancelled;
803 get onCancellationRequested() {
804 if (this._isCancelled) {
805 return shortcutEvent;
807 if (!this._emitter) {
808 this._emitter = new events_1.Emitter();
810 return this._emitter.event;
814 this._emitter.dispose();
815 this._emitter = void 0;
819 var CancellationTokenSource = class {
822 this._token = new MutableToken();
828 this._token = CancellationToken.Cancelled;
830 this._token.cancel();
835 this._token = CancellationToken.None;
836 } else if (this._token instanceof MutableToken) {
837 this._token.dispose();
841 exports2.CancellationTokenSource = CancellationTokenSource;
844 // node_modules/vscode-jsonrpc/lib/common/messageReader.js
845 var require_messageReader = __commonJS((exports2) => {
847 Object.defineProperty(exports2, "__esModule", {value: true});
848 exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0;
849 var ral_1 = require_ral();
850 var Is = require_is();
851 var events_1 = require_events();
853 (function(MessageReader2) {
855 let candidate = value;
856 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
858 MessageReader2.is = is;
859 })(MessageReader = exports2.MessageReader || (exports2.MessageReader = {}));
860 var AbstractMessageReader = class {
862 this.errorEmitter = new events_1.Emitter();
863 this.closeEmitter = new events_1.Emitter();
864 this.partialMessageEmitter = new events_1.Emitter();
867 this.errorEmitter.dispose();
868 this.closeEmitter.dispose();
871 return this.errorEmitter.event;
874 this.errorEmitter.fire(this.asError(error));
877 return this.closeEmitter.event;
880 this.closeEmitter.fire(void 0);
882 get onPartialMessage() {
883 return this.partialMessageEmitter.event;
885 firePartialMessage(info) {
886 this.partialMessageEmitter.fire(info);
889 if (error instanceof Error) {
892 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : "unknown"}`);
896 exports2.AbstractMessageReader = AbstractMessageReader;
897 var ResolvedMessageReaderOptions;
898 (function(ResolvedMessageReaderOptions2) {
899 function fromOptions(options) {
904 const contentDecoders = new Map();
905 let contentTypeDecoder;
906 const contentTypeDecoders = new Map();
907 if (options === void 0 || typeof options === "string") {
908 charset = options !== null && options !== void 0 ? options : "utf-8";
910 charset = (_a = options.charset) !== null && _a !== void 0 ? _a : "utf-8";
911 if (options.contentDecoder !== void 0) {
912 contentDecoder = options.contentDecoder;
913 contentDecoders.set(contentDecoder.name, contentDecoder);
915 if (options.contentDecoders !== void 0) {
916 for (const decoder of options.contentDecoders) {
917 contentDecoders.set(decoder.name, decoder);
920 if (options.contentTypeDecoder !== void 0) {
921 contentTypeDecoder = options.contentTypeDecoder;
922 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
924 if (options.contentTypeDecoders !== void 0) {
925 for (const decoder of options.contentTypeDecoders) {
926 contentTypeDecoders.set(decoder.name, decoder);
930 if (contentTypeDecoder === void 0) {
931 contentTypeDecoder = ral_1.default().applicationJson.decoder;
932 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
934 return {charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders};
936 ResolvedMessageReaderOptions2.fromOptions = fromOptions;
937 })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
938 var ReadableStreamMessageReader = class extends AbstractMessageReader {
939 constructor(readable, options) {
941 this.readable = readable;
942 this.options = ResolvedMessageReaderOptions.fromOptions(options);
943 this.buffer = ral_1.default().messageBuffer.create(this.options.charset);
944 this._partialMessageTimeout = 1e4;
945 this.nextMessageLength = -1;
946 this.messageToken = 0;
948 set partialMessageTimeout(timeout) {
949 this._partialMessageTimeout = timeout;
951 get partialMessageTimeout() {
952 return this._partialMessageTimeout;
955 this.nextMessageLength = -1;
956 this.messageToken = 0;
957 this.partialMessageTimer = void 0;
958 this.callback = callback;
959 const result = this.readable.onData((data) => {
962 this.readable.onError((error) => this.fireError(error));
963 this.readable.onClose(() => this.fireClose());
967 this.buffer.append(data);
969 if (this.nextMessageLength === -1) {
970 const headers = this.buffer.tryReadHeaders();
974 const contentLength = headers.get("Content-Length");
975 if (!contentLength) {
976 throw new Error("Header must provide a Content-Length property.");
978 const length = parseInt(contentLength);
980 throw new Error("Content-Length value must be a number.");
982 this.nextMessageLength = length;
984 const body = this.buffer.tryReadBody(this.nextMessageLength);
985 if (body === void 0) {
986 this.setPartialMessageTimer();
989 this.clearPartialMessageTimer();
990 this.nextMessageLength = -1;
992 if (this.options.contentDecoder !== void 0) {
993 p = this.options.contentDecoder.decode(body);
995 p = Promise.resolve(body);
998 this.options.contentTypeDecoder.decode(value, this.options).then((msg) => {
1001 this.fireError(error);
1004 this.fireError(error);
1008 clearPartialMessageTimer() {
1009 if (this.partialMessageTimer) {
1010 ral_1.default().timer.clearTimeout(this.partialMessageTimer);
1011 this.partialMessageTimer = void 0;
1014 setPartialMessageTimer() {
1015 this.clearPartialMessageTimer();
1016 if (this._partialMessageTimeout <= 0) {
1019 this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => {
1020 this.partialMessageTimer = void 0;
1021 if (token === this.messageToken) {
1022 this.firePartialMessage({messageToken: token, waitingTime: timeout});
1023 this.setPartialMessageTimer();
1025 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
1028 exports2.ReadableStreamMessageReader = ReadableStreamMessageReader;
1031 // node_modules/vscode-jsonrpc/lib/common/semaphore.js
1032 var require_semaphore = __commonJS((exports2) => {
1034 Object.defineProperty(exports2, "__esModule", {value: true});
1035 exports2.Semaphore = void 0;
1036 var ral_1 = require_ral();
1037 var Semaphore = class {
1038 constructor(capacity = 1) {
1039 if (capacity <= 0) {
1040 throw new Error("Capacity must be greater than 0");
1042 this._capacity = capacity;
1047 return new Promise((resolve, reject) => {
1048 this._waiting.push({thunk, resolve, reject});
1053 return this._active;
1056 if (this._waiting.length === 0 || this._active === this._capacity) {
1059 ral_1.default().timer.setImmediate(() => this.doRunNext());
1062 if (this._waiting.length === 0 || this._active === this._capacity) {
1065 const next = this._waiting.shift();
1067 if (this._active > this._capacity) {
1068 throw new Error(`To many thunks active`);
1071 const result = next.thunk();
1072 if (result instanceof Promise) {
1073 result.then((value) => {
1075 next.resolve(value);
1084 next.resolve(result);
1094 exports2.Semaphore = Semaphore;
1097 // node_modules/vscode-jsonrpc/lib/common/messageWriter.js
1098 var require_messageWriter = __commonJS((exports2) => {
1100 Object.defineProperty(exports2, "__esModule", {value: true});
1101 exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0;
1102 var ral_1 = require_ral();
1103 var Is = require_is();
1104 var semaphore_1 = require_semaphore();
1105 var events_1 = require_events();
1106 var ContentLength = "Content-Length: ";
1109 (function(MessageWriter2) {
1110 function is(value) {
1111 let candidate = value;
1112 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) && Is.func(candidate.onError) && Is.func(candidate.write);
1114 MessageWriter2.is = is;
1115 })(MessageWriter = exports2.MessageWriter || (exports2.MessageWriter = {}));
1116 var AbstractMessageWriter = class {
1118 this.errorEmitter = new events_1.Emitter();
1119 this.closeEmitter = new events_1.Emitter();
1122 this.errorEmitter.dispose();
1123 this.closeEmitter.dispose();
1126 return this.errorEmitter.event;
1128 fireError(error, message, count) {
1129 this.errorEmitter.fire([this.asError(error), message, count]);
1132 return this.closeEmitter.event;
1135 this.closeEmitter.fire(void 0);
1138 if (error instanceof Error) {
1141 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : "unknown"}`);
1145 exports2.AbstractMessageWriter = AbstractMessageWriter;
1146 var ResolvedMessageWriterOptions;
1147 (function(ResolvedMessageWriterOptions2) {
1148 function fromOptions(options) {
1150 if (options === void 0 || typeof options === "string") {
1151 return {charset: options !== null && options !== void 0 ? options : "utf-8", contentTypeEncoder: ral_1.default().applicationJson.encoder};
1153 return {charset: (_a = options.charset) !== null && _a !== void 0 ? _a : "utf-8", contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder};
1156 ResolvedMessageWriterOptions2.fromOptions = fromOptions;
1157 })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
1158 var WriteableStreamMessageWriter = class extends AbstractMessageWriter {
1159 constructor(writable, options) {
1161 this.writable = writable;
1162 this.options = ResolvedMessageWriterOptions.fromOptions(options);
1163 this.errorCount = 0;
1164 this.writeSemaphore = new semaphore_1.Semaphore(1);
1165 this.writable.onError((error) => this.fireError(error));
1166 this.writable.onClose(() => this.fireClose());
1169 return this.writeSemaphore.lock(async () => {
1170 const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
1171 if (this.options.contentEncoder !== void 0) {
1172 return this.options.contentEncoder.encode(buffer);
1177 return payload.then((buffer) => {
1179 headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
1181 return this.doWrite(msg, headers, buffer);
1183 this.fireError(error);
1188 async doWrite(msg, headers, data) {
1190 await this.writable.write(headers.join(""), "ascii");
1191 return this.writable.write(data);
1193 this.handleError(error, msg);
1194 return Promise.reject(error);
1197 handleError(error, msg) {
1199 this.fireError(error, msg, this.errorCount);
1202 this.writable.end();
1205 exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
1208 // node_modules/vscode-jsonrpc/lib/common/linkedMap.js
1209 var require_linkedMap = __commonJS((exports2) => {
1211 Object.defineProperty(exports2, "__esModule", {value: true});
1212 exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0;
1217 Touch2.AsOld = Touch2.First;
1219 Touch2.AsNew = Touch2.Last;
1220 })(Touch = exports2.Touch || (exports2.Touch = {}));
1221 var LinkedMap = class {
1223 this[Symbol.toStringTag] = "LinkedMap";
1224 this._map = new Map();
1225 this._head = void 0;
1226 this._tail = void 0;
1232 this._head = void 0;
1233 this._tail = void 0;
1238 return !this._head && !this._tail;
1245 return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value;
1249 return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value;
1252 return this._map.has(key);
1254 get(key, touch = Touch.None) {
1255 const item = this._map.get(key);
1259 if (touch !== Touch.None) {
1260 this.touch(item, touch);
1264 set(key, value, touch = Touch.None) {
1265 let item = this._map.get(key);
1268 if (touch !== Touch.None) {
1269 this.touch(item, touch);
1272 item = {key, value, next: void 0, previous: void 0};
1275 this.addItemLast(item);
1278 this.addItemFirst(item);
1281 this.addItemLast(item);
1284 this.addItemLast(item);
1287 this._map.set(key, item);
1293 return !!this.remove(key);
1296 const item = this._map.get(key);
1300 this._map.delete(key);
1301 this.removeItem(item);
1306 if (!this._head && !this._tail) {
1309 if (!this._head || !this._tail) {
1310 throw new Error("Invalid list");
1312 const item = this._head;
1313 this._map.delete(item.key);
1314 this.removeItem(item);
1318 forEach(callbackfn, thisArg) {
1319 const state = this._state;
1320 let current = this._head;
1323 callbackfn.bind(thisArg)(current.value, current.key, this);
1325 callbackfn(current.value, current.key, this);
1327 if (this._state !== state) {
1328 throw new Error(`LinkedMap got modified during iteration.`);
1330 current = current.next;
1335 const state = this._state;
1336 let current = this._head;
1338 [Symbol.iterator]() {
1342 if (map._state !== state) {
1343 throw new Error(`LinkedMap got modified during iteration.`);
1346 const result = {value: current.key, done: false};
1347 current = current.next;
1350 return {value: void 0, done: true};
1358 const state = this._state;
1359 let current = this._head;
1361 [Symbol.iterator]() {
1365 if (map._state !== state) {
1366 throw new Error(`LinkedMap got modified during iteration.`);
1369 const result = {value: current.value, done: false};
1370 current = current.next;
1373 return {value: void 0, done: true};
1381 const state = this._state;
1382 let current = this._head;
1384 [Symbol.iterator]() {
1388 if (map._state !== state) {
1389 throw new Error(`LinkedMap got modified during iteration.`);
1392 const result = {value: [current.key, current.value], done: false};
1393 current = current.next;
1396 return {value: void 0, done: true};
1402 [Symbol.iterator]() {
1403 return this.entries();
1406 if (newSize >= this.size) {
1409 if (newSize === 0) {
1413 let current = this._head;
1414 let currentSize = this.size;
1415 while (current && currentSize > newSize) {
1416 this._map.delete(current.key);
1417 current = current.next;
1420 this._head = current;
1421 this._size = currentSize;
1423 current.previous = void 0;
1427 addItemFirst(item) {
1428 if (!this._head && !this._tail) {
1430 } else if (!this._head) {
1431 throw new Error("Invalid list");
1433 item.next = this._head;
1434 this._head.previous = item;
1440 if (!this._head && !this._tail) {
1442 } else if (!this._tail) {
1443 throw new Error("Invalid list");
1445 item.previous = this._tail;
1446 this._tail.next = item;
1452 if (item === this._head && item === this._tail) {
1453 this._head = void 0;
1454 this._tail = void 0;
1455 } else if (item === this._head) {
1457 throw new Error("Invalid list");
1459 item.next.previous = void 0;
1460 this._head = item.next;
1461 } else if (item === this._tail) {
1462 if (!item.previous) {
1463 throw new Error("Invalid list");
1465 item.previous.next = void 0;
1466 this._tail = item.previous;
1468 const next = item.next;
1469 const previous = item.previous;
1470 if (!next || !previous) {
1471 throw new Error("Invalid list");
1473 next.previous = previous;
1474 previous.next = next;
1477 item.previous = void 0;
1480 touch(item, touch) {
1481 if (!this._head || !this._tail) {
1482 throw new Error("Invalid list");
1484 if (touch !== Touch.First && touch !== Touch.Last) {
1487 if (touch === Touch.First) {
1488 if (item === this._head) {
1491 const next = item.next;
1492 const previous = item.previous;
1493 if (item === this._tail) {
1494 previous.next = void 0;
1495 this._tail = previous;
1497 next.previous = previous;
1498 previous.next = next;
1500 item.previous = void 0;
1501 item.next = this._head;
1502 this._head.previous = item;
1505 } else if (touch === Touch.Last) {
1506 if (item === this._tail) {
1509 const next = item.next;
1510 const previous = item.previous;
1511 if (item === this._head) {
1512 next.previous = void 0;
1515 next.previous = previous;
1516 previous.next = next;
1519 item.previous = this._tail;
1520 this._tail.next = item;
1527 this.forEach((value, key) => {
1528 data.push([key, value]);
1534 for (const [key, value] of data) {
1535 this.set(key, value);
1539 exports2.LinkedMap = LinkedMap;
1540 var LRUCache = class extends LinkedMap {
1541 constructor(limit, ratio = 1) {
1543 this._limit = limit;
1544 this._ratio = Math.min(Math.max(0, ratio), 1);
1550 this._limit = limit;
1557 this._ratio = Math.min(Math.max(0, ratio), 1);
1560 get(key, touch = Touch.AsNew) {
1561 return super.get(key, touch);
1564 return super.get(key, Touch.None);
1567 super.set(key, value, Touch.Last);
1572 if (this.size > this._limit) {
1573 this.trimOld(Math.round(this._limit * this._ratio));
1577 exports2.LRUCache = LRUCache;
1580 // node_modules/vscode-jsonrpc/lib/common/connection.js
1581 var require_connection = __commonJS((exports2) => {
1583 Object.defineProperty(exports2, "__esModule", {value: true});
1584 exports2.createMessageConnection = exports2.ConnectionOptions = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.NullLogger = exports2.ProgressType = void 0;
1585 var ral_1 = require_ral();
1586 var Is = require_is();
1587 var messages_1 = require_messages();
1588 var linkedMap_1 = require_linkedMap();
1589 var events_1 = require_events();
1590 var cancellation_1 = require_cancellation();
1591 var CancelNotification;
1592 (function(CancelNotification2) {
1593 CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest");
1594 })(CancelNotification || (CancelNotification = {}));
1595 var ProgressNotification;
1596 (function(ProgressNotification2) {
1597 ProgressNotification2.type = new messages_1.NotificationType("$/progress");
1598 })(ProgressNotification || (ProgressNotification = {}));
1599 var ProgressType = class {
1603 exports2.ProgressType = ProgressType;
1604 var StarRequestHandler;
1605 (function(StarRequestHandler2) {
1606 function is(value) {
1607 return Is.func(value);
1609 StarRequestHandler2.is = is;
1610 })(StarRequestHandler || (StarRequestHandler = {}));
1611 exports2.NullLogger = Object.freeze({
1623 Trace2[Trace2["Off"] = 0] = "Off";
1624 Trace2[Trace2["Messages"] = 1] = "Messages";
1625 Trace2[Trace2["Verbose"] = 2] = "Verbose";
1626 })(Trace = exports2.Trace || (exports2.Trace = {}));
1628 function fromString(value) {
1629 if (!Is.string(value)) {
1632 value = value.toLowerCase();
1637 return Trace2.Messages;
1639 return Trace2.Verbose;
1644 Trace2.fromString = fromString;
1645 function toString(value) {
1649 case Trace2.Messages:
1651 case Trace2.Verbose:
1657 Trace2.toString = toString;
1658 })(Trace = exports2.Trace || (exports2.Trace = {}));
1660 (function(TraceFormat2) {
1661 TraceFormat2["Text"] = "text";
1662 TraceFormat2["JSON"] = "json";
1663 })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {}));
1664 (function(TraceFormat2) {
1665 function fromString(value) {
1666 value = value.toLowerCase();
1667 if (value === "json") {
1668 return TraceFormat2.JSON;
1670 return TraceFormat2.Text;
1673 TraceFormat2.fromString = fromString;
1674 })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {}));
1675 var SetTraceNotification;
1676 (function(SetTraceNotification2) {
1677 SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace");
1678 })(SetTraceNotification = exports2.SetTraceNotification || (exports2.SetTraceNotification = {}));
1679 var LogTraceNotification;
1680 (function(LogTraceNotification2) {
1681 LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace");
1682 })(LogTraceNotification = exports2.LogTraceNotification || (exports2.LogTraceNotification = {}));
1683 var ConnectionErrors;
1684 (function(ConnectionErrors2) {
1685 ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed";
1686 ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed";
1687 ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening";
1688 })(ConnectionErrors = exports2.ConnectionErrors || (exports2.ConnectionErrors = {}));
1689 var ConnectionError = class extends Error {
1690 constructor(code, message) {
1693 Object.setPrototypeOf(this, ConnectionError.prototype);
1696 exports2.ConnectionError = ConnectionError;
1697 var ConnectionStrategy;
1698 (function(ConnectionStrategy2) {
1699 function is(value) {
1700 const candidate = value;
1701 return candidate && Is.func(candidate.cancelUndispatched);
1703 ConnectionStrategy2.is = is;
1704 })(ConnectionStrategy = exports2.ConnectionStrategy || (exports2.ConnectionStrategy = {}));
1705 var CancellationReceiverStrategy;
1706 (function(CancellationReceiverStrategy2) {
1707 CancellationReceiverStrategy2.Message = Object.freeze({
1708 createCancellationTokenSource(_) {
1709 return new cancellation_1.CancellationTokenSource();
1712 function is(value) {
1713 const candidate = value;
1714 return candidate && Is.func(candidate.createCancellationTokenSource);
1716 CancellationReceiverStrategy2.is = is;
1717 })(CancellationReceiverStrategy = exports2.CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = {}));
1718 var CancellationSenderStrategy;
1719 (function(CancellationSenderStrategy2) {
1720 CancellationSenderStrategy2.Message = Object.freeze({
1721 sendCancellation(conn, id) {
1722 conn.sendNotification(CancelNotification.type, {id});
1727 function is(value) {
1728 const candidate = value;
1729 return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);
1731 CancellationSenderStrategy2.is = is;
1732 })(CancellationSenderStrategy = exports2.CancellationSenderStrategy || (exports2.CancellationSenderStrategy = {}));
1733 var CancellationStrategy;
1734 (function(CancellationStrategy2) {
1735 CancellationStrategy2.Message = Object.freeze({
1736 receiver: CancellationReceiverStrategy.Message,
1737 sender: CancellationSenderStrategy.Message
1739 function is(value) {
1740 const candidate = value;
1741 return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
1743 CancellationStrategy2.is = is;
1744 })(CancellationStrategy = exports2.CancellationStrategy || (exports2.CancellationStrategy = {}));
1745 var ConnectionOptions;
1746 (function(ConnectionOptions2) {
1747 function is(value) {
1748 const candidate = value;
1749 return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy));
1751 ConnectionOptions2.is = is;
1752 })(ConnectionOptions = exports2.ConnectionOptions || (exports2.ConnectionOptions = {}));
1753 var ConnectionState;
1754 (function(ConnectionState2) {
1755 ConnectionState2[ConnectionState2["New"] = 1] = "New";
1756 ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening";
1757 ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed";
1758 ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed";
1759 })(ConnectionState || (ConnectionState = {}));
1760 function createMessageConnection(messageReader, messageWriter, _logger, options) {
1761 const logger = _logger !== void 0 ? _logger : exports2.NullLogger;
1762 let sequenceNumber = 0;
1763 let notificationSquenceNumber = 0;
1764 let unknownResponseSquenceNumber = 0;
1765 const version = "2.0";
1766 let starRequestHandler = void 0;
1767 const requestHandlers = Object.create(null);
1768 let starNotificationHandler = void 0;
1769 const notificationHandlers = Object.create(null);
1770 const progressHandlers = new Map();
1772 let messageQueue = new linkedMap_1.LinkedMap();
1773 let responsePromises = Object.create(null);
1774 let requestTokens = Object.create(null);
1775 let trace = Trace.Off;
1776 let traceFormat = TraceFormat.Text;
1778 let state = ConnectionState.New;
1779 const errorEmitter = new events_1.Emitter();
1780 const closeEmitter = new events_1.Emitter();
1781 const unhandledNotificationEmitter = new events_1.Emitter();
1782 const unhandledProgressEmitter = new events_1.Emitter();
1783 const disposeEmitter = new events_1.Emitter();
1784 const cancellationStrategy = options && options.cancellationStrategy ? options.cancellationStrategy : CancellationStrategy.Message;
1785 function createRequestQueueKey(id) {
1787 throw new Error(`Can't send requests with id null since the response can't be correlated.`);
1789 return "req-" + id.toString();
1791 function createResponseQueueKey(id) {
1793 return "res-unknown-" + (++unknownResponseSquenceNumber).toString();
1795 return "res-" + id.toString();
1798 function createNotificationQueueKey() {
1799 return "not-" + (++notificationSquenceNumber).toString();
1801 function addMessageToQueue(queue, message) {
1802 if (messages_1.isRequestMessage(message)) {
1803 queue.set(createRequestQueueKey(message.id), message);
1804 } else if (messages_1.isResponseMessage(message)) {
1805 queue.set(createResponseQueueKey(message.id), message);
1807 queue.set(createNotificationQueueKey(), message);
1810 function cancelUndispatched(_message) {
1813 function isListening() {
1814 return state === ConnectionState.Listening;
1816 function isClosed() {
1817 return state === ConnectionState.Closed;
1819 function isDisposed() {
1820 return state === ConnectionState.Disposed;
1822 function closeHandler() {
1823 if (state === ConnectionState.New || state === ConnectionState.Listening) {
1824 state = ConnectionState.Closed;
1825 closeEmitter.fire(void 0);
1828 function readErrorHandler(error) {
1829 errorEmitter.fire([error, void 0, void 0]);
1831 function writeErrorHandler(data) {
1832 errorEmitter.fire(data);
1834 messageReader.onClose(closeHandler);
1835 messageReader.onError(readErrorHandler);
1836 messageWriter.onClose(closeHandler);
1837 messageWriter.onError(writeErrorHandler);
1838 function triggerMessageQueue() {
1839 if (timer || messageQueue.size === 0) {
1842 timer = ral_1.default().timer.setImmediate(() => {
1844 processMessageQueue();
1847 function processMessageQueue() {
1848 if (messageQueue.size === 0) {
1851 const message = messageQueue.shift();
1853 if (messages_1.isRequestMessage(message)) {
1854 handleRequest(message);
1855 } else if (messages_1.isNotificationMessage(message)) {
1856 handleNotification(message);
1857 } else if (messages_1.isResponseMessage(message)) {
1858 handleResponse(message);
1860 handleInvalidMessage(message);
1863 triggerMessageQueue();
1866 const callback = (message) => {
1868 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
1869 const key = createRequestQueueKey(message.params.id);
1870 const toCancel = messageQueue.get(key);
1871 if (messages_1.isRequestMessage(toCancel)) {
1872 const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy;
1873 const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
1874 if (response && (response.error !== void 0 || response.result !== void 0)) {
1875 messageQueue.delete(key);
1876 response.id = toCancel.id;
1877 traceSendingResponse(response, message.method, Date.now());
1878 messageWriter.write(response);
1883 addMessageToQueue(messageQueue, message);
1885 triggerMessageQueue();
1888 function handleRequest(requestMessage) {
1892 function reply(resultOrError, method, startTime2) {
1895 id: requestMessage.id
1897 if (resultOrError instanceof messages_1.ResponseError) {
1898 message.error = resultOrError.toJson();
1900 message.result = resultOrError === void 0 ? null : resultOrError;
1902 traceSendingResponse(message, method, startTime2);
1903 messageWriter.write(message);
1905 function replyError(error, method, startTime2) {
1908 id: requestMessage.id,
1909 error: error.toJson()
1911 traceSendingResponse(message, method, startTime2);
1912 messageWriter.write(message);
1914 function replySuccess(result, method, startTime2) {
1915 if (result === void 0) {
1920 id: requestMessage.id,
1923 traceSendingResponse(message, method, startTime2);
1924 messageWriter.write(message);
1926 traceReceivedRequest(requestMessage);
1927 const element = requestHandlers[requestMessage.method];
1931 type = element.type;
1932 requestHandler = element.handler;
1934 const startTime = Date.now();
1935 if (requestHandler || starRequestHandler) {
1936 const tokenKey = String(requestMessage.id);
1937 const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
1938 requestTokens[tokenKey] = cancellationSource;
1941 if (requestHandler) {
1942 if (requestMessage.params === void 0) {
1943 if (type !== void 0 && type.numberOfParams !== 0) {
1944 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime);
1947 handlerResult = requestHandler(cancellationSource.token);
1948 } else if (Array.isArray(requestMessage.params)) {
1949 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) {
1950 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
1953 handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
1955 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
1956 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
1959 handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
1961 } else if (starRequestHandler) {
1962 handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
1964 const promise = handlerResult;
1965 if (!handlerResult) {
1966 delete requestTokens[tokenKey];
1967 replySuccess(handlerResult, requestMessage.method, startTime);
1968 } else if (promise.then) {
1969 promise.then((resultOrError) => {
1970 delete requestTokens[tokenKey];
1971 reply(resultOrError, requestMessage.method, startTime);
1973 delete requestTokens[tokenKey];
1974 if (error instanceof messages_1.ResponseError) {
1975 replyError(error, requestMessage.method, startTime);
1976 } else if (error && Is.string(error.message)) {
1977 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
1979 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
1983 delete requestTokens[tokenKey];
1984 reply(handlerResult, requestMessage.method, startTime);
1987 delete requestTokens[tokenKey];
1988 if (error instanceof messages_1.ResponseError) {
1989 reply(error, requestMessage.method, startTime);
1990 } else if (error && Is.string(error.message)) {
1991 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
1993 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
1997 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
2000 function handleResponse(responseMessage) {
2004 if (responseMessage.id === null) {
2005 if (responseMessage.error) {
2006 logger.error(`Received response message without id: Error is:
2007 ${JSON.stringify(responseMessage.error, void 0, 4)}`);
2009 logger.error(`Received response message without id. No further error information provided.`);
2012 const key = String(responseMessage.id);
2013 const responsePromise = responsePromises[key];
2014 traceReceivedResponse(responseMessage, responsePromise);
2015 if (responsePromise) {
2016 delete responsePromises[key];
2018 if (responseMessage.error) {
2019 const error = responseMessage.error;
2020 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
2021 } else if (responseMessage.result !== void 0) {
2022 responsePromise.resolve(responseMessage.result);
2024 throw new Error("Should never happen.");
2027 if (error.message) {
2028 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
2030 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
2036 function handleNotification(message) {
2041 let notificationHandler;
2042 if (message.method === CancelNotification.type.method) {
2043 notificationHandler = (params) => {
2044 const id = params.id;
2045 const source = requestTokens[String(id)];
2051 const element = notificationHandlers[message.method];
2053 notificationHandler = element.handler;
2054 type = element.type;
2057 if (notificationHandler || starNotificationHandler) {
2059 traceReceivedNotification(message);
2060 if (notificationHandler) {
2061 if (message.params === void 0) {
2062 if (type !== void 0) {
2063 if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {
2064 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`);
2067 notificationHandler();
2068 } else if (Array.isArray(message.params)) {
2069 if (type !== void 0) {
2070 if (type.parameterStructures === messages_1.ParameterStructures.byName) {
2071 logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);
2073 if (type.numberOfParams !== message.params.length) {
2074 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`);
2077 notificationHandler(...message.params);
2079 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
2080 logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
2082 notificationHandler(message.params);
2084 } else if (starNotificationHandler) {
2085 starNotificationHandler(message.method, message.params);
2088 if (error.message) {
2089 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
2091 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
2095 unhandledNotificationEmitter.fire(message);
2098 function handleInvalidMessage(message) {
2100 logger.error("Received empty message.");
2103 logger.error(`Received message which is neither a response nor a notification message:
2104 ${JSON.stringify(message, null, 4)}`);
2105 const responseMessage = message;
2106 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
2107 const key = String(responseMessage.id);
2108 const responseHandler = responsePromises[key];
2109 if (responseHandler) {
2110 responseHandler.reject(new Error("The received response has neither a result nor an error property."));
2114 function traceSendingRequest(message) {
2115 if (trace === Trace.Off || !tracer) {
2118 if (traceFormat === TraceFormat.Text) {
2120 if (trace === Trace.Verbose && message.params) {
2121 data = `Params: ${JSON.stringify(message.params, null, 4)}
2125 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
2127 logLSPMessage("send-request", message);
2130 function traceSendingNotification(message) {
2131 if (trace === Trace.Off || !tracer) {
2134 if (traceFormat === TraceFormat.Text) {
2136 if (trace === Trace.Verbose) {
2137 if (message.params) {
2138 data = `Params: ${JSON.stringify(message.params, null, 4)}
2142 data = "No parameters provided.\n\n";
2145 tracer.log(`Sending notification '${message.method}'.`, data);
2147 logLSPMessage("send-notification", message);
2150 function traceSendingResponse(message, method, startTime) {
2151 if (trace === Trace.Off || !tracer) {
2154 if (traceFormat === TraceFormat.Text) {
2156 if (trace === Trace.Verbose) {
2157 if (message.error && message.error.data) {
2158 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
2162 if (message.result) {
2163 data = `Result: ${JSON.stringify(message.result, null, 4)}
2166 } else if (message.error === void 0) {
2167 data = "No result returned.\n\n";
2171 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
2173 logLSPMessage("send-response", message);
2176 function traceReceivedRequest(message) {
2177 if (trace === Trace.Off || !tracer) {
2180 if (traceFormat === TraceFormat.Text) {
2182 if (trace === Trace.Verbose && message.params) {
2183 data = `Params: ${JSON.stringify(message.params, null, 4)}
2187 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
2189 logLSPMessage("receive-request", message);
2192 function traceReceivedNotification(message) {
2193 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
2196 if (traceFormat === TraceFormat.Text) {
2198 if (trace === Trace.Verbose) {
2199 if (message.params) {
2200 data = `Params: ${JSON.stringify(message.params, null, 4)}
2204 data = "No parameters provided.\n\n";
2207 tracer.log(`Received notification '${message.method}'.`, data);
2209 logLSPMessage("receive-notification", message);
2212 function traceReceivedResponse(message, responsePromise) {
2213 if (trace === Trace.Off || !tracer) {
2216 if (traceFormat === TraceFormat.Text) {
2218 if (trace === Trace.Verbose) {
2219 if (message.error && message.error.data) {
2220 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
2224 if (message.result) {
2225 data = `Result: ${JSON.stringify(message.result, null, 4)}
2228 } else if (message.error === void 0) {
2229 data = "No result returned.\n\n";
2233 if (responsePromise) {
2234 const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : "";
2235 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
2237 tracer.log(`Received response ${message.id} without active response promise.`, data);
2240 logLSPMessage("receive-response", message);
2243 function logLSPMessage(type, message) {
2244 if (!tracer || trace === Trace.Off) {
2247 const lspMessage = {
2251 timestamp: Date.now()
2253 tracer.log(lspMessage);
2255 function throwIfClosedOrDisposed() {
2257 throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed.");
2260 throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed.");
2263 function throwIfListening() {
2264 if (isListening()) {
2265 throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening");
2268 function throwIfNotListening() {
2269 if (!isListening()) {
2270 throw new Error("Call listen() first.");
2273 function undefinedToNull(param) {
2274 if (param === void 0) {
2280 function nullToUndefined(param) {
2281 if (param === null) {
2287 function isNamedParam(param) {
2288 return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object";
2290 function computeSingleParam(parameterStructures, param) {
2291 switch (parameterStructures) {
2292 case messages_1.ParameterStructures.auto:
2293 if (isNamedParam(param)) {
2294 return nullToUndefined(param);
2296 return [undefinedToNull(param)];
2299 case messages_1.ParameterStructures.byName:
2300 if (!isNamedParam(param)) {
2301 throw new Error(`Recevied parameters by name but param is not an object literal.`);
2303 return nullToUndefined(param);
2304 case messages_1.ParameterStructures.byPosition:
2305 return [undefinedToNull(param)];
2307 throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);
2310 function computeMessageParams(type, params) {
2312 const numberOfParams = type.numberOfParams;
2313 switch (numberOfParams) {
2318 result = computeSingleParam(type.parameterStructures, params[0]);
2322 for (let i = 0; i < params.length && i < numberOfParams; i++) {
2323 result.push(undefinedToNull(params[i]));
2325 if (params.length < numberOfParams) {
2326 for (let i = params.length; i < numberOfParams; i++) {
2334 const connection = {
2335 sendNotification: (type, ...args) => {
2336 throwIfClosedOrDisposed();
2339 if (Is.string(type)) {
2341 const first = args[0];
2343 let parameterStructures = messages_1.ParameterStructures.auto;
2344 if (messages_1.ParameterStructures.is(first)) {
2346 parameterStructures = first;
2348 let paramEnd = args.length;
2349 const numberOfParams = paramEnd - paramStart;
2350 switch (numberOfParams) {
2352 messageParams = void 0;
2355 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2358 if (parameterStructures === messages_1.ParameterStructures.byName) {
2359 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
2361 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value));
2365 const params = args;
2366 method = type.method;
2367 messageParams = computeMessageParams(type, params);
2369 const notificationMessage = {
2372 params: messageParams
2374 traceSendingNotification(notificationMessage);
2375 messageWriter.write(notificationMessage);
2377 onNotification: (type, handler) => {
2378 throwIfClosedOrDisposed();
2380 if (Is.func(type)) {
2381 starNotificationHandler = type;
2382 } else if (handler) {
2383 if (Is.string(type)) {
2385 notificationHandlers[type] = {type: void 0, handler};
2387 method = type.method;
2388 notificationHandlers[type.method] = {type, handler};
2393 if (method !== void 0) {
2394 delete notificationHandlers[method];
2396 starNotificationHandler = void 0;
2401 onProgress: (_type, token, handler) => {
2402 if (progressHandlers.has(token)) {
2403 throw new Error(`Progress handler for token ${token} already registered`);
2405 progressHandlers.set(token, handler);
2408 progressHandlers.delete(token);
2412 sendProgress: (_type, token, value) => {
2413 connection.sendNotification(ProgressNotification.type, {token, value});
2415 onUnhandledProgress: unhandledProgressEmitter.event,
2416 sendRequest: (type, ...args) => {
2417 throwIfClosedOrDisposed();
2418 throwIfNotListening();
2422 if (Is.string(type)) {
2424 const first = args[0];
2425 const last = args[args.length - 1];
2427 let parameterStructures = messages_1.ParameterStructures.auto;
2428 if (messages_1.ParameterStructures.is(first)) {
2430 parameterStructures = first;
2432 let paramEnd = args.length;
2433 if (cancellation_1.CancellationToken.is(last)) {
2434 paramEnd = paramEnd - 1;
2437 const numberOfParams = paramEnd - paramStart;
2438 switch (numberOfParams) {
2440 messageParams = void 0;
2443 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2446 if (parameterStructures === messages_1.ParameterStructures.byName) {
2447 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`);
2449 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value));
2453 const params = args;
2454 method = type.method;
2455 messageParams = computeMessageParams(type, params);
2456 const numberOfParams = type.numberOfParams;
2457 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0;
2459 const id = sequenceNumber++;
2462 disposable = token.onCancellationRequested(() => {
2463 cancellationStrategy.sender.sendCancellation(connection, id);
2466 const result = new Promise((resolve, reject) => {
2467 const requestMessage = {
2471 params: messageParams
2473 const resolveWithCleanup = (r) => {
2475 cancellationStrategy.sender.cleanup(id);
2476 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2478 const rejectWithCleanup = (r) => {
2480 cancellationStrategy.sender.cleanup(id);
2481 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2483 let responsePromise = {method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup};
2484 traceSendingRequest(requestMessage);
2486 messageWriter.write(requestMessage);
2488 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : "Unknown reason"));
2489 responsePromise = null;
2491 if (responsePromise) {
2492 responsePromises[String(id)] = responsePromise;
2497 onRequest: (type, handler) => {
2498 throwIfClosedOrDisposed();
2500 if (StarRequestHandler.is(type)) {
2502 starRequestHandler = type;
2503 } else if (Is.string(type)) {
2505 if (handler !== void 0) {
2507 requestHandlers[type] = {handler, type: void 0};
2510 if (handler !== void 0) {
2511 method = type.method;
2512 requestHandlers[type.method] = {type, handler};
2517 if (method === null) {
2520 if (method !== void 0) {
2521 delete requestHandlers[method];
2523 starRequestHandler = void 0;
2528 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
2529 let _sendNotification = false;
2530 let _traceFormat = TraceFormat.Text;
2531 if (sendNotificationOrTraceOptions !== void 0) {
2532 if (Is.boolean(sendNotificationOrTraceOptions)) {
2533 _sendNotification = sendNotificationOrTraceOptions;
2535 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
2536 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
2540 traceFormat = _traceFormat;
2541 if (trace === Trace.Off) {
2546 if (_sendNotification && !isClosed() && !isDisposed()) {
2547 connection.sendNotification(SetTraceNotification.type, {value: Trace.toString(_value)});
2550 onError: errorEmitter.event,
2551 onClose: closeEmitter.event,
2552 onUnhandledNotification: unhandledNotificationEmitter.event,
2553 onDispose: disposeEmitter.event,
2555 messageWriter.end();
2561 state = ConnectionState.Disposed;
2562 disposeEmitter.fire(void 0);
2563 const error = new Error("Connection got disposed.");
2564 Object.keys(responsePromises).forEach((key) => {
2565 responsePromises[key].reject(error);
2567 responsePromises = Object.create(null);
2568 requestTokens = Object.create(null);
2569 messageQueue = new linkedMap_1.LinkedMap();
2570 if (Is.func(messageWriter.dispose)) {
2571 messageWriter.dispose();
2573 if (Is.func(messageReader.dispose)) {
2574 messageReader.dispose();
2578 throwIfClosedOrDisposed();
2580 state = ConnectionState.Listening;
2581 messageReader.listen(callback);
2584 ral_1.default().console.log("inspect");
2587 connection.onNotification(LogTraceNotification.type, (params) => {
2588 if (trace === Trace.Off || !tracer) {
2591 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : void 0);
2593 connection.onNotification(ProgressNotification.type, (params) => {
2594 const handler = progressHandlers.get(params.token);
2596 handler(params.value);
2598 unhandledProgressEmitter.fire(params);
2603 exports2.createMessageConnection = createMessageConnection;
2606 // node_modules/vscode-jsonrpc/lib/common/api.js
2607 var require_api = __commonJS((exports2) => {
2609 Object.defineProperty(exports2, "__esModule", {value: true});
2610 exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.ProgressType = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.RAL = void 0;
2611 exports2.CancellationStrategy = void 0;
2612 var messages_1 = require_messages();
2613 Object.defineProperty(exports2, "RequestType", {enumerable: true, get: function() {
2614 return messages_1.RequestType;
2616 Object.defineProperty(exports2, "RequestType0", {enumerable: true, get: function() {
2617 return messages_1.RequestType0;
2619 Object.defineProperty(exports2, "RequestType1", {enumerable: true, get: function() {
2620 return messages_1.RequestType1;
2622 Object.defineProperty(exports2, "RequestType2", {enumerable: true, get: function() {
2623 return messages_1.RequestType2;
2625 Object.defineProperty(exports2, "RequestType3", {enumerable: true, get: function() {
2626 return messages_1.RequestType3;
2628 Object.defineProperty(exports2, "RequestType4", {enumerable: true, get: function() {
2629 return messages_1.RequestType4;
2631 Object.defineProperty(exports2, "RequestType5", {enumerable: true, get: function() {
2632 return messages_1.RequestType5;
2634 Object.defineProperty(exports2, "RequestType6", {enumerable: true, get: function() {
2635 return messages_1.RequestType6;
2637 Object.defineProperty(exports2, "RequestType7", {enumerable: true, get: function() {
2638 return messages_1.RequestType7;
2640 Object.defineProperty(exports2, "RequestType8", {enumerable: true, get: function() {
2641 return messages_1.RequestType8;
2643 Object.defineProperty(exports2, "RequestType9", {enumerable: true, get: function() {
2644 return messages_1.RequestType9;
2646 Object.defineProperty(exports2, "ResponseError", {enumerable: true, get: function() {
2647 return messages_1.ResponseError;
2649 Object.defineProperty(exports2, "ErrorCodes", {enumerable: true, get: function() {
2650 return messages_1.ErrorCodes;
2652 Object.defineProperty(exports2, "NotificationType", {enumerable: true, get: function() {
2653 return messages_1.NotificationType;
2655 Object.defineProperty(exports2, "NotificationType0", {enumerable: true, get: function() {
2656 return messages_1.NotificationType0;
2658 Object.defineProperty(exports2, "NotificationType1", {enumerable: true, get: function() {
2659 return messages_1.NotificationType1;
2661 Object.defineProperty(exports2, "NotificationType2", {enumerable: true, get: function() {
2662 return messages_1.NotificationType2;
2664 Object.defineProperty(exports2, "NotificationType3", {enumerable: true, get: function() {
2665 return messages_1.NotificationType3;
2667 Object.defineProperty(exports2, "NotificationType4", {enumerable: true, get: function() {
2668 return messages_1.NotificationType4;
2670 Object.defineProperty(exports2, "NotificationType5", {enumerable: true, get: function() {
2671 return messages_1.NotificationType5;
2673 Object.defineProperty(exports2, "NotificationType6", {enumerable: true, get: function() {
2674 return messages_1.NotificationType6;
2676 Object.defineProperty(exports2, "NotificationType7", {enumerable: true, get: function() {
2677 return messages_1.NotificationType7;
2679 Object.defineProperty(exports2, "NotificationType8", {enumerable: true, get: function() {
2680 return messages_1.NotificationType8;
2682 Object.defineProperty(exports2, "NotificationType9", {enumerable: true, get: function() {
2683 return messages_1.NotificationType9;
2685 Object.defineProperty(exports2, "ParameterStructures", {enumerable: true, get: function() {
2686 return messages_1.ParameterStructures;
2688 var disposable_1 = require_disposable();
2689 Object.defineProperty(exports2, "Disposable", {enumerable: true, get: function() {
2690 return disposable_1.Disposable;
2692 var events_1 = require_events();
2693 Object.defineProperty(exports2, "Event", {enumerable: true, get: function() {
2694 return events_1.Event;
2696 Object.defineProperty(exports2, "Emitter", {enumerable: true, get: function() {
2697 return events_1.Emitter;
2699 var cancellation_1 = require_cancellation();
2700 Object.defineProperty(exports2, "CancellationTokenSource", {enumerable: true, get: function() {
2701 return cancellation_1.CancellationTokenSource;
2703 Object.defineProperty(exports2, "CancellationToken", {enumerable: true, get: function() {
2704 return cancellation_1.CancellationToken;
2706 var messageReader_1 = require_messageReader();
2707 Object.defineProperty(exports2, "MessageReader", {enumerable: true, get: function() {
2708 return messageReader_1.MessageReader;
2710 Object.defineProperty(exports2, "AbstractMessageReader", {enumerable: true, get: function() {
2711 return messageReader_1.AbstractMessageReader;
2713 Object.defineProperty(exports2, "ReadableStreamMessageReader", {enumerable: true, get: function() {
2714 return messageReader_1.ReadableStreamMessageReader;
2716 var messageWriter_1 = require_messageWriter();
2717 Object.defineProperty(exports2, "MessageWriter", {enumerable: true, get: function() {
2718 return messageWriter_1.MessageWriter;
2720 Object.defineProperty(exports2, "AbstractMessageWriter", {enumerable: true, get: function() {
2721 return messageWriter_1.AbstractMessageWriter;
2723 Object.defineProperty(exports2, "WriteableStreamMessageWriter", {enumerable: true, get: function() {
2724 return messageWriter_1.WriteableStreamMessageWriter;
2726 var connection_1 = require_connection();
2727 Object.defineProperty(exports2, "ConnectionStrategy", {enumerable: true, get: function() {
2728 return connection_1.ConnectionStrategy;
2730 Object.defineProperty(exports2, "ConnectionOptions", {enumerable: true, get: function() {
2731 return connection_1.ConnectionOptions;
2733 Object.defineProperty(exports2, "NullLogger", {enumerable: true, get: function() {
2734 return connection_1.NullLogger;
2736 Object.defineProperty(exports2, "createMessageConnection", {enumerable: true, get: function() {
2737 return connection_1.createMessageConnection;
2739 Object.defineProperty(exports2, "ProgressType", {enumerable: true, get: function() {
2740 return connection_1.ProgressType;
2742 Object.defineProperty(exports2, "Trace", {enumerable: true, get: function() {
2743 return connection_1.Trace;
2745 Object.defineProperty(exports2, "TraceFormat", {enumerable: true, get: function() {
2746 return connection_1.TraceFormat;
2748 Object.defineProperty(exports2, "SetTraceNotification", {enumerable: true, get: function() {
2749 return connection_1.SetTraceNotification;
2751 Object.defineProperty(exports2, "LogTraceNotification", {enumerable: true, get: function() {
2752 return connection_1.LogTraceNotification;
2754 Object.defineProperty(exports2, "ConnectionErrors", {enumerable: true, get: function() {
2755 return connection_1.ConnectionErrors;
2757 Object.defineProperty(exports2, "ConnectionError", {enumerable: true, get: function() {
2758 return connection_1.ConnectionError;
2760 Object.defineProperty(exports2, "CancellationReceiverStrategy", {enumerable: true, get: function() {
2761 return connection_1.CancellationReceiverStrategy;
2763 Object.defineProperty(exports2, "CancellationSenderStrategy", {enumerable: true, get: function() {
2764 return connection_1.CancellationSenderStrategy;
2766 Object.defineProperty(exports2, "CancellationStrategy", {enumerable: true, get: function() {
2767 return connection_1.CancellationStrategy;
2769 var ral_1 = require_ral();
2770 exports2.RAL = ral_1.default;
2773 // node_modules/vscode-jsonrpc/lib/node/main.js
2774 var require_main = __commonJS((exports2) => {
2776 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
2779 Object.defineProperty(o, k2, {enumerable: true, get: function() {
2782 } : function(o, m, k, k2) {
2787 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
2789 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
2790 __createBinding(exports3, m, p);
2792 Object.defineProperty(exports2, "__esModule", {value: true});
2793 exports2.createMessageConnection = exports2.createServerSocketTransport = exports2.createClientSocketTransport = exports2.createServerPipeTransport = exports2.createClientPipeTransport = exports2.generateRandomPipeName = exports2.StreamMessageWriter = exports2.StreamMessageReader = exports2.SocketMessageWriter = exports2.SocketMessageReader = exports2.IPCMessageWriter = exports2.IPCMessageReader = void 0;
2794 var ril_1 = require_ril();
2795 ril_1.default.install();
2796 var api_1 = require_api();
2797 var path = require("path");
2798 var os = require("os");
2799 var crypto_1 = require("crypto");
2800 var net_1 = require("net");
2801 __exportStar2(require_api(), exports2);
2802 var IPCMessageReader = class extends api_1.AbstractMessageReader {
2803 constructor(process2) {
2805 this.process = process2;
2806 let eventEmitter = this.process;
2807 eventEmitter.on("error", (error) => this.fireError(error));
2808 eventEmitter.on("close", () => this.fireClose());
2811 this.process.on("message", callback);
2812 return api_1.Disposable.create(() => this.process.off("message", callback));
2815 exports2.IPCMessageReader = IPCMessageReader;
2816 var IPCMessageWriter = class extends api_1.AbstractMessageWriter {
2817 constructor(process2) {
2819 this.process = process2;
2820 this.errorCount = 0;
2821 let eventEmitter = this.process;
2822 eventEmitter.on("error", (error) => this.fireError(error));
2823 eventEmitter.on("close", () => this.fireClose);
2827 if (typeof this.process.send === "function") {
2828 this.process.send(msg, void 0, void 0, (error) => {
2831 this.handleError(error, msg);
2833 this.errorCount = 0;
2837 return Promise.resolve();
2839 this.handleError(error, msg);
2840 return Promise.reject(error);
2843 handleError(error, msg) {
2845 this.fireError(error, msg, this.errorCount);
2850 exports2.IPCMessageWriter = IPCMessageWriter;
2851 var SocketMessageReader = class extends api_1.ReadableStreamMessageReader {
2852 constructor(socket, encoding = "utf-8") {
2853 super(ril_1.default().stream.asReadableStream(socket), encoding);
2856 exports2.SocketMessageReader = SocketMessageReader;
2857 var SocketMessageWriter = class extends api_1.WriteableStreamMessageWriter {
2858 constructor(socket, options) {
2859 super(ril_1.default().stream.asWritableStream(socket), options);
2860 this.socket = socket;
2864 this.socket.destroy();
2867 exports2.SocketMessageWriter = SocketMessageWriter;
2868 var StreamMessageReader = class extends api_1.ReadableStreamMessageReader {
2869 constructor(readble, encoding) {
2870 super(ril_1.default().stream.asReadableStream(readble), encoding);
2873 exports2.StreamMessageReader = StreamMessageReader;
2874 var StreamMessageWriter = class extends api_1.WriteableStreamMessageWriter {
2875 constructor(writable, options) {
2876 super(ril_1.default().stream.asWritableStream(writable), options);
2879 exports2.StreamMessageWriter = StreamMessageWriter;
2880 var XDG_RUNTIME_DIR = process.env["XDG_RUNTIME_DIR"];
2881 var safeIpcPathLengths = new Map([
2885 function generateRandomPipeName() {
2886 const randomSuffix = crypto_1.randomBytes(21).toString("hex");
2887 if (process.platform === "win32") {
2888 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
2891 if (XDG_RUNTIME_DIR) {
2892 result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
2894 result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
2896 const limit = safeIpcPathLengths.get(process.platform);
2897 if (limit !== void 0 && result.length >= limit) {
2898 ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`);
2902 exports2.generateRandomPipeName = generateRandomPipeName;
2903 function createClientPipeTransport(pipeName, encoding = "utf-8") {
2905 const connected = new Promise((resolve, _reject) => {
2906 connectResolve = resolve;
2908 return new Promise((resolve, reject) => {
2909 let server = net_1.createServer((socket) => {
2912 new SocketMessageReader(socket, encoding),
2913 new SocketMessageWriter(socket, encoding)
2916 server.on("error", reject);
2917 server.listen(pipeName, () => {
2918 server.removeListener("error", reject);
2920 onConnected: () => {
2927 exports2.createClientPipeTransport = createClientPipeTransport;
2928 function createServerPipeTransport(pipeName, encoding = "utf-8") {
2929 const socket = net_1.createConnection(pipeName);
2931 new SocketMessageReader(socket, encoding),
2932 new SocketMessageWriter(socket, encoding)
2935 exports2.createServerPipeTransport = createServerPipeTransport;
2936 function createClientSocketTransport(port, encoding = "utf-8") {
2938 const connected = new Promise((resolve, _reject) => {
2939 connectResolve = resolve;
2941 return new Promise((resolve, reject) => {
2942 const server = net_1.createServer((socket) => {
2945 new SocketMessageReader(socket, encoding),
2946 new SocketMessageWriter(socket, encoding)
2949 server.on("error", reject);
2950 server.listen(port, "127.0.0.1", () => {
2951 server.removeListener("error", reject);
2953 onConnected: () => {
2960 exports2.createClientSocketTransport = createClientSocketTransport;
2961 function createServerSocketTransport(port, encoding = "utf-8") {
2962 const socket = net_1.createConnection(port, "127.0.0.1");
2964 new SocketMessageReader(socket, encoding),
2965 new SocketMessageWriter(socket, encoding)
2968 exports2.createServerSocketTransport = createServerSocketTransport;
2969 function isReadableStream(value) {
2970 const candidate = value;
2971 return candidate.read !== void 0 && candidate.addListener !== void 0;
2973 function isWritableStream(value) {
2974 const candidate = value;
2975 return candidate.write !== void 0 && candidate.addListener !== void 0;
2977 function createMessageConnection(input, output, logger, options) {
2979 logger = api_1.NullLogger;
2981 const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;
2982 const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;
2983 if (api_1.ConnectionStrategy.is(options)) {
2984 options = {connectionStrategy: options};
2986 return api_1.createMessageConnection(reader, writer, logger, options);
2988 exports2.createMessageConnection = createMessageConnection;
2991 // node_modules/vscode-jsonrpc/node.js
2992 var require_node = __commonJS((exports2, module2) => {
2994 module2.exports = require_main();
2997 // node_modules/vscode-languageserver-types/lib/esm/main.js
2998 var require_main2 = __commonJS((exports2) => {
2999 __markAsModule(exports2);
3000 __export(exports2, {
3001 AnnotatedTextEdit: () => AnnotatedTextEdit,
3002 ChangeAnnotation: () => ChangeAnnotation,
3003 ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier,
3004 CodeAction: () => CodeAction,
3005 CodeActionContext: () => CodeActionContext,
3006 CodeActionKind: () => CodeActionKind,
3007 CodeDescription: () => CodeDescription,
3008 CodeLens: () => CodeLens,
3010 ColorInformation: () => ColorInformation,
3011 ColorPresentation: () => ColorPresentation,
3012 Command: () => Command,
3013 CompletionItem: () => CompletionItem,
3014 CompletionItemKind: () => CompletionItemKind,
3015 CompletionItemTag: () => CompletionItemTag,
3016 CompletionList: () => CompletionList,
3017 CreateFile: () => CreateFile,
3018 DeleteFile: () => DeleteFile,
3019 Diagnostic: () => Diagnostic,
3020 DiagnosticRelatedInformation: () => DiagnosticRelatedInformation,
3021 DiagnosticSeverity: () => DiagnosticSeverity,
3022 DiagnosticTag: () => DiagnosticTag,
3023 DocumentHighlight: () => DocumentHighlight,
3024 DocumentHighlightKind: () => DocumentHighlightKind,
3025 DocumentLink: () => DocumentLink,
3026 DocumentSymbol: () => DocumentSymbol,
3028 FoldingRange: () => FoldingRange,
3029 FoldingRangeKind: () => FoldingRangeKind,
3030 FormattingOptions: () => FormattingOptions,
3032 InsertReplaceEdit: () => InsertReplaceEdit,
3033 InsertTextFormat: () => InsertTextFormat,
3034 InsertTextMode: () => InsertTextMode,
3035 Location: () => Location,
3036 LocationLink: () => LocationLink,
3037 MarkedString: () => MarkedString,
3038 MarkupContent: () => MarkupContent,
3039 MarkupKind: () => MarkupKind,
3040 OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier,
3041 ParameterInformation: () => ParameterInformation,
3042 Position: () => Position,
3043 Range: () => Range3,
3044 RenameFile: () => RenameFile,
3045 SelectionRange: () => SelectionRange,
3046 SignatureInformation: () => SignatureInformation,
3047 SymbolInformation: () => SymbolInformation,
3048 SymbolKind: () => SymbolKind,
3049 SymbolTag: () => SymbolTag,
3050 TextDocument: () => TextDocument,
3051 TextDocumentEdit: () => TextDocumentEdit,
3052 TextDocumentIdentifier: () => TextDocumentIdentifier2,
3053 TextDocumentItem: () => TextDocumentItem,
3054 TextEdit: () => TextEdit,
3055 VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier2,
3056 WorkspaceChange: () => WorkspaceChange,
3057 WorkspaceEdit: () => WorkspaceEdit,
3058 integer: () => integer,
3059 uinteger: () => uinteger
3063 (function(integer2) {
3064 integer2.MIN_VALUE = -2147483648;
3065 integer2.MAX_VALUE = 2147483647;
3066 })(integer || (integer = {}));
3068 (function(uinteger2) {
3069 uinteger2.MIN_VALUE = 0;
3070 uinteger2.MAX_VALUE = 2147483647;
3071 })(uinteger || (uinteger = {}));
3073 (function(Position2) {
3074 function create(line, character) {
3075 if (line === Number.MAX_VALUE) {
3076 line = uinteger.MAX_VALUE;
3078 if (character === Number.MAX_VALUE) {
3079 character = uinteger.MAX_VALUE;
3081 return {line, character};
3083 Position2.create = create;
3084 function is(value) {
3085 var candidate = value;
3086 return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
3089 })(Position || (Position = {}));
3092 function create(one, two, three, four) {
3093 if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
3094 return {start: Position.create(one, two), end: Position.create(three, four)};
3095 } else if (Position.is(one) && Position.is(two)) {
3096 return {start: one, end: two};
3098 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
3101 Range4.create = create;
3102 function is(value) {
3103 var candidate = value;
3104 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
3107 })(Range3 || (Range3 = {}));
3109 (function(Location2) {
3110 function create(uri, range) {
3111 return {uri, range};
3113 Location2.create = create;
3114 function is(value) {
3115 var candidate = value;
3116 return Is.defined(candidate) && Range3.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
3119 })(Location || (Location = {}));
3121 (function(LocationLink2) {
3122 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
3123 return {targetUri, targetRange, targetSelectionRange, originSelectionRange};
3125 LocationLink2.create = create;
3126 function is(value) {
3127 var candidate = value;
3128 return Is.defined(candidate) && Range3.is(candidate.targetRange) && Is.string(candidate.targetUri) && (Range3.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) && (Range3.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
3130 LocationLink2.is = is;
3131 })(LocationLink || (LocationLink = {}));
3134 function create(red, green, blue, alpha) {
3142 Color2.create = create;
3143 function is(value) {
3144 var candidate = value;
3145 return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
3148 })(Color || (Color = {}));
3149 var ColorInformation;
3150 (function(ColorInformation2) {
3151 function create(range, color) {
3157 ColorInformation2.create = create;
3158 function is(value) {
3159 var candidate = value;
3160 return Range3.is(candidate.range) && Color.is(candidate.color);
3162 ColorInformation2.is = is;
3163 })(ColorInformation || (ColorInformation = {}));
3164 var ColorPresentation;
3165 (function(ColorPresentation2) {
3166 function create(label, textEdit, additionalTextEdits) {
3173 ColorPresentation2.create = create;
3174 function is(value) {
3175 var candidate = value;
3176 return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
3178 ColorPresentation2.is = is;
3179 })(ColorPresentation || (ColorPresentation = {}));
3180 var FoldingRangeKind;
3181 (function(FoldingRangeKind2) {
3182 FoldingRangeKind2["Comment"] = "comment";
3183 FoldingRangeKind2["Imports"] = "imports";
3184 FoldingRangeKind2["Region"] = "region";
3185 })(FoldingRangeKind || (FoldingRangeKind = {}));
3187 (function(FoldingRange2) {
3188 function create(startLine, endLine, startCharacter, endCharacter, kind) {
3193 if (Is.defined(startCharacter)) {
3194 result.startCharacter = startCharacter;
3196 if (Is.defined(endCharacter)) {
3197 result.endCharacter = endCharacter;
3199 if (Is.defined(kind)) {
3204 FoldingRange2.create = create;
3205 function is(value) {
3206 var candidate = value;
3207 return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
3209 FoldingRange2.is = is;
3210 })(FoldingRange || (FoldingRange = {}));
3211 var DiagnosticRelatedInformation;
3212 (function(DiagnosticRelatedInformation2) {
3213 function create(location, message) {
3219 DiagnosticRelatedInformation2.create = create;
3220 function is(value) {
3221 var candidate = value;
3222 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
3224 DiagnosticRelatedInformation2.is = is;
3225 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
3226 var DiagnosticSeverity;
3227 (function(DiagnosticSeverity2) {
3228 DiagnosticSeverity2.Error = 1;
3229 DiagnosticSeverity2.Warning = 2;
3230 DiagnosticSeverity2.Information = 3;
3231 DiagnosticSeverity2.Hint = 4;
3232 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
3234 (function(DiagnosticTag2) {
3235 DiagnosticTag2.Unnecessary = 1;
3236 DiagnosticTag2.Deprecated = 2;
3237 })(DiagnosticTag || (DiagnosticTag = {}));
3238 var CodeDescription;
3239 (function(CodeDescription2) {
3240 function is(value) {
3241 var candidate = value;
3242 return candidate !== void 0 && candidate !== null && Is.string(candidate.href);
3244 CodeDescription2.is = is;
3245 })(CodeDescription || (CodeDescription = {}));
3247 (function(Diagnostic2) {
3248 function create(range, message, severity, code, source, relatedInformation) {
3249 var result = {range, message};
3250 if (Is.defined(severity)) {
3251 result.severity = severity;
3253 if (Is.defined(code)) {
3256 if (Is.defined(source)) {
3257 result.source = source;
3259 if (Is.defined(relatedInformation)) {
3260 result.relatedInformation = relatedInformation;
3264 Diagnostic2.create = create;
3265 function is(value) {
3267 var candidate = value;
3268 return Is.defined(candidate) && Range3.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
3270 Diagnostic2.is = is;
3271 })(Diagnostic || (Diagnostic = {}));
3273 (function(Command2) {
3274 function create(title, command) {
3276 for (var _i = 2; _i < arguments.length; _i++) {
3277 args[_i - 2] = arguments[_i];
3279 var result = {title, command};
3280 if (Is.defined(args) && args.length > 0) {
3281 result.arguments = args;
3285 Command2.create = create;
3286 function is(value) {
3287 var candidate = value;
3288 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
3291 })(Command || (Command = {}));
3293 (function(TextEdit2) {
3294 function replace(range, newText) {
3295 return {range, newText};
3297 TextEdit2.replace = replace;
3298 function insert(position, newText) {
3299 return {range: {start: position, end: position}, newText};
3301 TextEdit2.insert = insert;
3302 function del(range) {
3303 return {range, newText: ""};
3305 TextEdit2.del = del;
3306 function is(value) {
3307 var candidate = value;
3308 return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range3.is(candidate.range);
3311 })(TextEdit || (TextEdit = {}));
3312 var ChangeAnnotation;
3313 (function(ChangeAnnotation2) {
3314 function create(label, needsConfirmation, description) {
3315 var result = {label};
3316 if (needsConfirmation !== void 0) {
3317 result.needsConfirmation = needsConfirmation;
3319 if (description !== void 0) {
3320 result.description = description;
3324 ChangeAnnotation2.create = create;
3325 function is(value) {
3326 var candidate = value;
3327 return candidate !== void 0 && Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
3329 ChangeAnnotation2.is = is;
3330 })(ChangeAnnotation || (ChangeAnnotation = {}));
3331 var ChangeAnnotationIdentifier;
3332 (function(ChangeAnnotationIdentifier2) {
3333 function is(value) {
3334 var candidate = value;
3335 return typeof candidate === "string";
3337 ChangeAnnotationIdentifier2.is = is;
3338 })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
3339 var AnnotatedTextEdit;
3340 (function(AnnotatedTextEdit2) {
3341 function replace(range, newText, annotation) {
3342 return {range, newText, annotationId: annotation};
3344 AnnotatedTextEdit2.replace = replace;
3345 function insert(position, newText, annotation) {
3346 return {range: {start: position, end: position}, newText, annotationId: annotation};
3348 AnnotatedTextEdit2.insert = insert;
3349 function del(range, annotation) {
3350 return {range, newText: "", annotationId: annotation};
3352 AnnotatedTextEdit2.del = del;
3353 function is(value) {
3354 var candidate = value;
3355 return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
3357 AnnotatedTextEdit2.is = is;
3358 })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
3359 var TextDocumentEdit;
3360 (function(TextDocumentEdit2) {
3361 function create(textDocument, edits) {
3362 return {textDocument, edits};
3364 TextDocumentEdit2.create = create;
3365 function is(value) {
3366 var candidate = value;
3367 return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
3369 TextDocumentEdit2.is = is;
3370 })(TextDocumentEdit || (TextDocumentEdit = {}));
3372 (function(CreateFile2) {
3373 function create(uri, options, annotation) {
3378 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3379 result.options = options;
3381 if (annotation !== void 0) {
3382 result.annotationId = annotation;
3386 CreateFile2.create = create;
3387 function is(value) {
3388 var candidate = value;
3389 return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3391 CreateFile2.is = is;
3392 })(CreateFile || (CreateFile = {}));
3394 (function(RenameFile2) {
3395 function create(oldUri, newUri, options, annotation) {
3401 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3402 result.options = options;
3404 if (annotation !== void 0) {
3405 result.annotationId = annotation;
3409 RenameFile2.create = create;
3410 function is(value) {
3411 var candidate = value;
3412 return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3414 RenameFile2.is = is;
3415 })(RenameFile || (RenameFile = {}));
3417 (function(DeleteFile2) {
3418 function create(uri, options, annotation) {
3423 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
3424 result.options = options;
3426 if (annotation !== void 0) {
3427 result.annotationId = annotation;
3431 DeleteFile2.create = create;
3432 function is(value) {
3433 var candidate = value;
3434 return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3436 DeleteFile2.is = is;
3437 })(DeleteFile || (DeleteFile = {}));
3439 (function(WorkspaceEdit2) {
3440 function is(value) {
3441 var candidate = value;
3442 return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) {
3443 if (Is.string(change.kind)) {
3444 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
3446 return TextDocumentEdit.is(change);
3450 WorkspaceEdit2.is = is;
3451 })(WorkspaceEdit || (WorkspaceEdit = {}));
3452 var TextEditChangeImpl = function() {
3453 function TextEditChangeImpl2(edits, changeAnnotations) {
3455 this.changeAnnotations = changeAnnotations;
3457 TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) {
3460 if (annotation === void 0) {
3461 edit = TextEdit.insert(position, newText);
3462 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3464 edit = AnnotatedTextEdit.insert(position, newText, annotation);
3466 this.assertChangeAnnotations(this.changeAnnotations);
3467 id = this.changeAnnotations.manage(annotation);
3468 edit = AnnotatedTextEdit.insert(position, newText, id);
3470 this.edits.push(edit);
3471 if (id !== void 0) {
3475 TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) {
3478 if (annotation === void 0) {
3479 edit = TextEdit.replace(range, newText);
3480 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3482 edit = AnnotatedTextEdit.replace(range, newText, annotation);
3484 this.assertChangeAnnotations(this.changeAnnotations);
3485 id = this.changeAnnotations.manage(annotation);
3486 edit = AnnotatedTextEdit.replace(range, newText, id);
3488 this.edits.push(edit);
3489 if (id !== void 0) {
3493 TextEditChangeImpl2.prototype.delete = function(range, annotation) {
3496 if (annotation === void 0) {
3497 edit = TextEdit.del(range);
3498 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3500 edit = AnnotatedTextEdit.del(range, annotation);
3502 this.assertChangeAnnotations(this.changeAnnotations);
3503 id = this.changeAnnotations.manage(annotation);
3504 edit = AnnotatedTextEdit.del(range, id);
3506 this.edits.push(edit);
3507 if (id !== void 0) {
3511 TextEditChangeImpl2.prototype.add = function(edit) {
3512 this.edits.push(edit);
3514 TextEditChangeImpl2.prototype.all = function() {
3517 TextEditChangeImpl2.prototype.clear = function() {
3518 this.edits.splice(0, this.edits.length);
3520 TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) {
3521 if (value === void 0) {
3522 throw new Error("Text edit change is not configured to manage change annotations.");
3525 return TextEditChangeImpl2;
3527 var ChangeAnnotations = function() {
3528 function ChangeAnnotations2(annotations) {
3529 this._annotations = annotations === void 0 ? Object.create(null) : annotations;
3533 ChangeAnnotations2.prototype.all = function() {
3534 return this._annotations;
3536 Object.defineProperty(ChangeAnnotations2.prototype, "size", {
3543 ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) {
3545 if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
3546 id = idOrAnnotation;
3549 annotation = idOrAnnotation;
3551 if (this._annotations[id] !== void 0) {
3552 throw new Error("Id " + id + " is already in use.");
3554 if (annotation === void 0) {
3555 throw new Error("No annotation provided for id " + id);
3557 this._annotations[id] = annotation;
3561 ChangeAnnotations2.prototype.nextId = function() {
3563 return this._counter.toString();
3565 return ChangeAnnotations2;
3567 var WorkspaceChange = function() {
3568 function WorkspaceChange2(workspaceEdit) {
3570 this._textEditChanges = Object.create(null);
3571 if (workspaceEdit !== void 0) {
3572 this._workspaceEdit = workspaceEdit;
3573 if (workspaceEdit.documentChanges) {
3574 this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
3575 workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3576 workspaceEdit.documentChanges.forEach(function(change) {
3577 if (TextDocumentEdit.is(change)) {
3578 var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
3579 _this._textEditChanges[change.textDocument.uri] = textEditChange;
3582 } else if (workspaceEdit.changes) {
3583 Object.keys(workspaceEdit.changes).forEach(function(key) {
3584 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
3585 _this._textEditChanges[key] = textEditChange;
3589 this._workspaceEdit = {};
3592 Object.defineProperty(WorkspaceChange2.prototype, "edit", {
3594 this.initDocumentChanges();
3595 if (this._changeAnnotations !== void 0) {
3596 if (this._changeAnnotations.size === 0) {
3597 this._workspaceEdit.changeAnnotations = void 0;
3599 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3602 return this._workspaceEdit;
3607 WorkspaceChange2.prototype.getTextEditChange = function(key) {
3608 if (OptionalVersionedTextDocumentIdentifier.is(key)) {
3609 this.initDocumentChanges();
3610 if (this._workspaceEdit.documentChanges === void 0) {
3611 throw new Error("Workspace edit is not configured for document changes.");
3613 var textDocument = {uri: key.uri, version: key.version};
3614 var result = this._textEditChanges[textDocument.uri];
3617 var textDocumentEdit = {
3621 this._workspaceEdit.documentChanges.push(textDocumentEdit);
3622 result = new TextEditChangeImpl(edits, this._changeAnnotations);
3623 this._textEditChanges[textDocument.uri] = result;
3628 if (this._workspaceEdit.changes === void 0) {
3629 throw new Error("Workspace edit is not configured for normal text edit changes.");
3631 var result = this._textEditChanges[key];
3634 this._workspaceEdit.changes[key] = edits;
3635 result = new TextEditChangeImpl(edits);
3636 this._textEditChanges[key] = result;
3641 WorkspaceChange2.prototype.initDocumentChanges = function() {
3642 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
3643 this._changeAnnotations = new ChangeAnnotations();
3644 this._workspaceEdit.documentChanges = [];
3645 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3648 WorkspaceChange2.prototype.initChanges = function() {
3649 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
3650 this._workspaceEdit.changes = Object.create(null);
3653 WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) {
3654 this.initDocumentChanges();
3655 if (this._workspaceEdit.documentChanges === void 0) {
3656 throw new Error("Workspace edit is not configured for document changes.");
3659 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3660 annotation = optionsOrAnnotation;
3662 options = optionsOrAnnotation;
3666 if (annotation === void 0) {
3667 operation = CreateFile.create(uri, options);
3669 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3670 operation = CreateFile.create(uri, options, id);
3672 this._workspaceEdit.documentChanges.push(operation);
3673 if (id !== void 0) {
3677 WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) {
3678 this.initDocumentChanges();
3679 if (this._workspaceEdit.documentChanges === void 0) {
3680 throw new Error("Workspace edit is not configured for document changes.");
3683 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3684 annotation = optionsOrAnnotation;
3686 options = optionsOrAnnotation;
3690 if (annotation === void 0) {
3691 operation = RenameFile.create(oldUri, newUri, options);
3693 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3694 operation = RenameFile.create(oldUri, newUri, options, id);
3696 this._workspaceEdit.documentChanges.push(operation);
3697 if (id !== void 0) {
3701 WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) {
3702 this.initDocumentChanges();
3703 if (this._workspaceEdit.documentChanges === void 0) {
3704 throw new Error("Workspace edit is not configured for document changes.");
3707 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3708 annotation = optionsOrAnnotation;
3710 options = optionsOrAnnotation;
3714 if (annotation === void 0) {
3715 operation = DeleteFile.create(uri, options);
3717 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3718 operation = DeleteFile.create(uri, options, id);
3720 this._workspaceEdit.documentChanges.push(operation);
3721 if (id !== void 0) {
3725 return WorkspaceChange2;
3727 var TextDocumentIdentifier2;
3728 (function(TextDocumentIdentifier3) {
3729 function create(uri) {
3732 TextDocumentIdentifier3.create = create;
3733 function is(value) {
3734 var candidate = value;
3735 return Is.defined(candidate) && Is.string(candidate.uri);
3737 TextDocumentIdentifier3.is = is;
3738 })(TextDocumentIdentifier2 || (TextDocumentIdentifier2 = {}));
3739 var VersionedTextDocumentIdentifier2;
3740 (function(VersionedTextDocumentIdentifier3) {
3741 function create(uri, version) {
3742 return {uri, version};
3744 VersionedTextDocumentIdentifier3.create = create;
3745 function is(value) {
3746 var candidate = value;
3747 return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
3749 VersionedTextDocumentIdentifier3.is = is;
3750 })(VersionedTextDocumentIdentifier2 || (VersionedTextDocumentIdentifier2 = {}));
3751 var OptionalVersionedTextDocumentIdentifier;
3752 (function(OptionalVersionedTextDocumentIdentifier2) {
3753 function create(uri, version) {
3754 return {uri, version};
3756 OptionalVersionedTextDocumentIdentifier2.create = create;
3757 function is(value) {
3758 var candidate = value;
3759 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
3761 OptionalVersionedTextDocumentIdentifier2.is = is;
3762 })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
3763 var TextDocumentItem;
3764 (function(TextDocumentItem2) {
3765 function create(uri, languageId, version, text) {
3766 return {uri, languageId, version, text};
3768 TextDocumentItem2.create = create;
3769 function is(value) {
3770 var candidate = value;
3771 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
3773 TextDocumentItem2.is = is;
3774 })(TextDocumentItem || (TextDocumentItem = {}));
3776 (function(MarkupKind2) {
3777 MarkupKind2.PlainText = "plaintext";
3778 MarkupKind2.Markdown = "markdown";
3779 })(MarkupKind || (MarkupKind = {}));
3780 (function(MarkupKind2) {
3781 function is(value) {
3782 var candidate = value;
3783 return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown;
3785 MarkupKind2.is = is;
3786 })(MarkupKind || (MarkupKind = {}));
3788 (function(MarkupContent2) {
3789 function is(value) {
3790 var candidate = value;
3791 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
3793 MarkupContent2.is = is;
3794 })(MarkupContent || (MarkupContent = {}));
3795 var CompletionItemKind;
3796 (function(CompletionItemKind2) {
3797 CompletionItemKind2.Text = 1;
3798 CompletionItemKind2.Method = 2;
3799 CompletionItemKind2.Function = 3;
3800 CompletionItemKind2.Constructor = 4;
3801 CompletionItemKind2.Field = 5;
3802 CompletionItemKind2.Variable = 6;
3803 CompletionItemKind2.Class = 7;
3804 CompletionItemKind2.Interface = 8;
3805 CompletionItemKind2.Module = 9;
3806 CompletionItemKind2.Property = 10;
3807 CompletionItemKind2.Unit = 11;
3808 CompletionItemKind2.Value = 12;
3809 CompletionItemKind2.Enum = 13;
3810 CompletionItemKind2.Keyword = 14;
3811 CompletionItemKind2.Snippet = 15;
3812 CompletionItemKind2.Color = 16;
3813 CompletionItemKind2.File = 17;
3814 CompletionItemKind2.Reference = 18;
3815 CompletionItemKind2.Folder = 19;
3816 CompletionItemKind2.EnumMember = 20;
3817 CompletionItemKind2.Constant = 21;
3818 CompletionItemKind2.Struct = 22;
3819 CompletionItemKind2.Event = 23;
3820 CompletionItemKind2.Operator = 24;
3821 CompletionItemKind2.TypeParameter = 25;
3822 })(CompletionItemKind || (CompletionItemKind = {}));
3823 var InsertTextFormat;
3824 (function(InsertTextFormat2) {
3825 InsertTextFormat2.PlainText = 1;
3826 InsertTextFormat2.Snippet = 2;
3827 })(InsertTextFormat || (InsertTextFormat = {}));
3828 var CompletionItemTag;
3829 (function(CompletionItemTag2) {
3830 CompletionItemTag2.Deprecated = 1;
3831 })(CompletionItemTag || (CompletionItemTag = {}));
3832 var InsertReplaceEdit;
3833 (function(InsertReplaceEdit2) {
3834 function create(newText, insert, replace) {
3835 return {newText, insert, replace};
3837 InsertReplaceEdit2.create = create;
3838 function is(value) {
3839 var candidate = value;
3840 return candidate && Is.string(candidate.newText) && Range3.is(candidate.insert) && Range3.is(candidate.replace);
3842 InsertReplaceEdit2.is = is;
3843 })(InsertReplaceEdit || (InsertReplaceEdit = {}));
3845 (function(InsertTextMode2) {
3846 InsertTextMode2.asIs = 1;
3847 InsertTextMode2.adjustIndentation = 2;
3848 })(InsertTextMode || (InsertTextMode = {}));
3850 (function(CompletionItem2) {
3851 function create(label) {
3854 CompletionItem2.create = create;
3855 })(CompletionItem || (CompletionItem = {}));
3857 (function(CompletionList2) {
3858 function create(items, isIncomplete) {
3859 return {items: items ? items : [], isIncomplete: !!isIncomplete};
3861 CompletionList2.create = create;
3862 })(CompletionList || (CompletionList = {}));
3864 (function(MarkedString2) {
3865 function fromPlainText(plainText) {
3866 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
3868 MarkedString2.fromPlainText = fromPlainText;
3869 function is(value) {
3870 var candidate = value;
3871 return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
3873 MarkedString2.is = is;
3874 })(MarkedString || (MarkedString = {}));
3877 function is(value) {
3878 var candidate = value;
3879 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range3.is(value.range));
3882 })(Hover || (Hover = {}));
3883 var ParameterInformation;
3884 (function(ParameterInformation2) {
3885 function create(label, documentation) {
3886 return documentation ? {label, documentation} : {label};
3888 ParameterInformation2.create = create;
3889 })(ParameterInformation || (ParameterInformation = {}));
3890 var SignatureInformation;
3891 (function(SignatureInformation2) {
3892 function create(label, documentation) {
3893 var parameters = [];
3894 for (var _i = 2; _i < arguments.length; _i++) {
3895 parameters[_i - 2] = arguments[_i];
3897 var result = {label};
3898 if (Is.defined(documentation)) {
3899 result.documentation = documentation;
3901 if (Is.defined(parameters)) {
3902 result.parameters = parameters;
3904 result.parameters = [];
3908 SignatureInformation2.create = create;
3909 })(SignatureInformation || (SignatureInformation = {}));
3910 var DocumentHighlightKind;
3911 (function(DocumentHighlightKind2) {
3912 DocumentHighlightKind2.Text = 1;
3913 DocumentHighlightKind2.Read = 2;
3914 DocumentHighlightKind2.Write = 3;
3915 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
3916 var DocumentHighlight;
3917 (function(DocumentHighlight2) {
3918 function create(range, kind) {
3919 var result = {range};
3920 if (Is.number(kind)) {
3925 DocumentHighlight2.create = create;
3926 })(DocumentHighlight || (DocumentHighlight = {}));
3928 (function(SymbolKind2) {
3929 SymbolKind2.File = 1;
3930 SymbolKind2.Module = 2;
3931 SymbolKind2.Namespace = 3;
3932 SymbolKind2.Package = 4;
3933 SymbolKind2.Class = 5;
3934 SymbolKind2.Method = 6;
3935 SymbolKind2.Property = 7;
3936 SymbolKind2.Field = 8;
3937 SymbolKind2.Constructor = 9;
3938 SymbolKind2.Enum = 10;
3939 SymbolKind2.Interface = 11;
3940 SymbolKind2.Function = 12;
3941 SymbolKind2.Variable = 13;
3942 SymbolKind2.Constant = 14;
3943 SymbolKind2.String = 15;
3944 SymbolKind2.Number = 16;
3945 SymbolKind2.Boolean = 17;
3946 SymbolKind2.Array = 18;
3947 SymbolKind2.Object = 19;
3948 SymbolKind2.Key = 20;
3949 SymbolKind2.Null = 21;
3950 SymbolKind2.EnumMember = 22;
3951 SymbolKind2.Struct = 23;
3952 SymbolKind2.Event = 24;
3953 SymbolKind2.Operator = 25;
3954 SymbolKind2.TypeParameter = 26;
3955 })(SymbolKind || (SymbolKind = {}));
3957 (function(SymbolTag2) {
3958 SymbolTag2.Deprecated = 1;
3959 })(SymbolTag || (SymbolTag = {}));
3960 var SymbolInformation;
3961 (function(SymbolInformation2) {
3962 function create(name, kind, range, uri, containerName) {
3966 location: {uri, range}
3968 if (containerName) {
3969 result.containerName = containerName;
3973 SymbolInformation2.create = create;
3974 })(SymbolInformation || (SymbolInformation = {}));
3976 (function(DocumentSymbol2) {
3977 function create(name, detail, kind, range, selectionRange, children) {
3985 if (children !== void 0) {
3986 result.children = children;
3990 DocumentSymbol2.create = create;
3991 function is(value) {
3992 var candidate = value;
3993 return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range3.is(candidate.range) && Range3.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
3995 DocumentSymbol2.is = is;
3996 })(DocumentSymbol || (DocumentSymbol = {}));
3998 (function(CodeActionKind2) {
3999 CodeActionKind2.Empty = "";
4000 CodeActionKind2.QuickFix = "quickfix";
4001 CodeActionKind2.Refactor = "refactor";
4002 CodeActionKind2.RefactorExtract = "refactor.extract";
4003 CodeActionKind2.RefactorInline = "refactor.inline";
4004 CodeActionKind2.RefactorRewrite = "refactor.rewrite";
4005 CodeActionKind2.Source = "source";
4006 CodeActionKind2.SourceOrganizeImports = "source.organizeImports";
4007 CodeActionKind2.SourceFixAll = "source.fixAll";
4008 })(CodeActionKind || (CodeActionKind = {}));
4009 var CodeActionContext;
4010 (function(CodeActionContext2) {
4011 function create(diagnostics, only) {
4012 var result = {diagnostics};
4013 if (only !== void 0 && only !== null) {
4018 CodeActionContext2.create = create;
4019 function is(value) {
4020 var candidate = value;
4021 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
4023 CodeActionContext2.is = is;
4024 })(CodeActionContext || (CodeActionContext = {}));
4026 (function(CodeAction2) {
4027 function create(title, kindOrCommandOrEdit, kind) {
4028 var result = {title};
4029 var checkKind = true;
4030 if (typeof kindOrCommandOrEdit === "string") {
4032 result.kind = kindOrCommandOrEdit;
4033 } else if (Command.is(kindOrCommandOrEdit)) {
4034 result.command = kindOrCommandOrEdit;
4036 result.edit = kindOrCommandOrEdit;
4038 if (checkKind && kind !== void 0) {
4043 CodeAction2.create = create;
4044 function is(value) {
4045 var candidate = value;
4046 return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
4048 CodeAction2.is = is;
4049 })(CodeAction || (CodeAction = {}));
4051 (function(CodeLens2) {
4052 function create(range, data) {
4053 var result = {range};
4054 if (Is.defined(data)) {
4059 CodeLens2.create = create;
4060 function is(value) {
4061 var candidate = value;
4062 return Is.defined(candidate) && Range3.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
4065 })(CodeLens || (CodeLens = {}));
4066 var FormattingOptions;
4067 (function(FormattingOptions2) {
4068 function create(tabSize, insertSpaces) {
4069 return {tabSize, insertSpaces};
4071 FormattingOptions2.create = create;
4072 function is(value) {
4073 var candidate = value;
4074 return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
4076 FormattingOptions2.is = is;
4077 })(FormattingOptions || (FormattingOptions = {}));
4079 (function(DocumentLink2) {
4080 function create(range, target, data) {
4081 return {range, target, data};
4083 DocumentLink2.create = create;
4084 function is(value) {
4085 var candidate = value;
4086 return Is.defined(candidate) && Range3.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
4088 DocumentLink2.is = is;
4089 })(DocumentLink || (DocumentLink = {}));
4091 (function(SelectionRange2) {
4092 function create(range, parent) {
4093 return {range, parent};
4095 SelectionRange2.create = create;
4096 function is(value) {
4097 var candidate = value;
4098 return candidate !== void 0 && Range3.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
4100 SelectionRange2.is = is;
4101 })(SelectionRange || (SelectionRange = {}));
4102 var EOL = ["\n", "\r\n", "\r"];
4104 (function(TextDocument2) {
4105 function create(uri, languageId, version, content) {
4106 return new FullTextDocument(uri, languageId, version, content);
4108 TextDocument2.create = create;
4109 function is(value) {
4110 var candidate = value;
4111 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
4113 TextDocument2.is = is;
4114 function applyEdits(document2, edits) {
4115 var text = document2.getText();
4116 var sortedEdits = mergeSort(edits, function(a, b) {
4117 var diff = a.range.start.line - b.range.start.line;
4119 return a.range.start.character - b.range.start.character;
4123 var lastModifiedOffset = text.length;
4124 for (var i = sortedEdits.length - 1; i >= 0; i--) {
4125 var e = sortedEdits[i];
4126 var startOffset = document2.offsetAt(e.range.start);
4127 var endOffset = document2.offsetAt(e.range.end);
4128 if (endOffset <= lastModifiedOffset) {
4129 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
4131 throw new Error("Overlapping edit");
4133 lastModifiedOffset = startOffset;
4137 TextDocument2.applyEdits = applyEdits;
4138 function mergeSort(data, compare) {
4139 if (data.length <= 1) {
4142 var p = data.length / 2 | 0;
4143 var left = data.slice(0, p);
4144 var right = data.slice(p);
4145 mergeSort(left, compare);
4146 mergeSort(right, compare);
4150 while (leftIdx < left.length && rightIdx < right.length) {
4151 var ret2 = compare(left[leftIdx], right[rightIdx]);
4153 data[i++] = left[leftIdx++];
4155 data[i++] = right[rightIdx++];
4158 while (leftIdx < left.length) {
4159 data[i++] = left[leftIdx++];
4161 while (rightIdx < right.length) {
4162 data[i++] = right[rightIdx++];
4166 })(TextDocument || (TextDocument = {}));
4167 var FullTextDocument = function() {
4168 function FullTextDocument2(uri, languageId, version, content) {
4170 this._languageId = languageId;
4171 this._version = version;
4172 this._content = content;
4173 this._lineOffsets = void 0;
4175 Object.defineProperty(FullTextDocument2.prototype, "uri", {
4182 Object.defineProperty(FullTextDocument2.prototype, "languageId", {
4184 return this._languageId;
4189 Object.defineProperty(FullTextDocument2.prototype, "version", {
4191 return this._version;
4196 FullTextDocument2.prototype.getText = function(range) {
4198 var start = this.offsetAt(range.start);
4199 var end = this.offsetAt(range.end);
4200 return this._content.substring(start, end);
4202 return this._content;
4204 FullTextDocument2.prototype.update = function(event, version) {
4205 this._content = event.text;
4206 this._version = version;
4207 this._lineOffsets = void 0;
4209 FullTextDocument2.prototype.getLineOffsets = function() {
4210 if (this._lineOffsets === void 0) {
4211 var lineOffsets = [];
4212 var text = this._content;
4213 var isLineStart = true;
4214 for (var i = 0; i < text.length; i++) {
4216 lineOffsets.push(i);
4217 isLineStart = false;
4219 var ch = text.charAt(i);
4220 isLineStart = ch === "\r" || ch === "\n";
4221 if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") {
4225 if (isLineStart && text.length > 0) {
4226 lineOffsets.push(text.length);
4228 this._lineOffsets = lineOffsets;
4230 return this._lineOffsets;
4232 FullTextDocument2.prototype.positionAt = function(offset) {
4233 offset = Math.max(Math.min(offset, this._content.length), 0);
4234 var lineOffsets = this.getLineOffsets();
4235 var low = 0, high = lineOffsets.length;
4237 return Position.create(0, offset);
4239 while (low < high) {
4240 var mid = Math.floor((low + high) / 2);
4241 if (lineOffsets[mid] > offset) {
4248 return Position.create(line, offset - lineOffsets[line]);
4250 FullTextDocument2.prototype.offsetAt = function(position) {
4251 var lineOffsets = this.getLineOffsets();
4252 if (position.line >= lineOffsets.length) {
4253 return this._content.length;
4254 } else if (position.line < 0) {
4257 var lineOffset = lineOffsets[position.line];
4258 var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
4259 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
4261 Object.defineProperty(FullTextDocument2.prototype, "lineCount", {
4263 return this.getLineOffsets().length;
4268 return FullTextDocument2;
4272 var toString = Object.prototype.toString;
4273 function defined(value) {
4274 return typeof value !== "undefined";
4276 Is2.defined = defined;
4277 function undefined2(value) {
4278 return typeof value === "undefined";
4280 Is2.undefined = undefined2;
4281 function boolean(value) {
4282 return value === true || value === false;
4284 Is2.boolean = boolean;
4285 function string(value) {
4286 return toString.call(value) === "[object String]";
4288 Is2.string = string;
4289 function number(value) {
4290 return toString.call(value) === "[object Number]";
4292 Is2.number = number;
4293 function numberRange(value, min, max) {
4294 return toString.call(value) === "[object Number]" && min <= value && value <= max;
4296 Is2.numberRange = numberRange;
4297 function integer2(value) {
4298 return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647;
4300 Is2.integer = integer2;
4301 function uinteger2(value) {
4302 return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647;
4304 Is2.uinteger = uinteger2;
4305 function func(value) {
4306 return toString.call(value) === "[object Function]";
4309 function objectLiteral(value) {
4310 return value !== null && typeof value === "object";
4312 Is2.objectLiteral = objectLiteral;
4313 function typedArray(value, check) {
4314 return Array.isArray(value) && value.every(check);
4316 Is2.typedArray = typedArray;
4317 })(Is || (Is = {}));
4320 // node_modules/vscode-languageserver-protocol/lib/common/messages.js
4321 var require_messages2 = __commonJS((exports2) => {
4323 Object.defineProperty(exports2, "__esModule", {value: true});
4324 exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = void 0;
4325 var vscode_jsonrpc_1 = require_main();
4326 var RegistrationType = class {
4327 constructor(method) {
4328 this.method = method;
4331 exports2.RegistrationType = RegistrationType;
4332 var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 {
4333 constructor(method) {
4337 exports2.ProtocolRequestType0 = ProtocolRequestType0;
4338 var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType {
4339 constructor(method) {
4340 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
4343 exports2.ProtocolRequestType = ProtocolRequestType;
4344 var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 {
4345 constructor(method) {
4349 exports2.ProtocolNotificationType0 = ProtocolNotificationType0;
4350 var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType {
4351 constructor(method) {
4352 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
4355 exports2.ProtocolNotificationType = ProtocolNotificationType;
4358 // node_modules/vscode-languageserver-protocol/lib/common/utils/is.js
4359 var require_is2 = __commonJS((exports2) => {
4361 Object.defineProperty(exports2, "__esModule", {value: true});
4362 exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
4363 function boolean(value) {
4364 return value === true || value === false;
4366 exports2.boolean = boolean;
4367 function string(value) {
4368 return typeof value === "string" || value instanceof String;
4370 exports2.string = string;
4371 function number(value) {
4372 return typeof value === "number" || value instanceof Number;
4374 exports2.number = number;
4375 function error(value) {
4376 return value instanceof Error;
4378 exports2.error = error;
4379 function func(value) {
4380 return typeof value === "function";
4382 exports2.func = func;
4383 function array(value) {
4384 return Array.isArray(value);
4386 exports2.array = array;
4387 function stringArray(value) {
4388 return array(value) && value.every((elem) => string(elem));
4390 exports2.stringArray = stringArray;
4391 function typedArray(value, check) {
4392 return Array.isArray(value) && value.every(check);
4394 exports2.typedArray = typedArray;
4395 function objectLiteral(value) {
4396 return value !== null && typeof value === "object";
4398 exports2.objectLiteral = objectLiteral;
4401 // node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js
4402 var require_protocol_implementation = __commonJS((exports2) => {
4404 Object.defineProperty(exports2, "__esModule", {value: true});
4405 exports2.ImplementationRequest = void 0;
4406 var messages_1 = require_messages2();
4407 var ImplementationRequest;
4408 (function(ImplementationRequest2) {
4409 ImplementationRequest2.method = "textDocument/implementation";
4410 ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method);
4411 })(ImplementationRequest = exports2.ImplementationRequest || (exports2.ImplementationRequest = {}));
4414 // node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js
4415 var require_protocol_typeDefinition = __commonJS((exports2) => {
4417 Object.defineProperty(exports2, "__esModule", {value: true});
4418 exports2.TypeDefinitionRequest = void 0;
4419 var messages_1 = require_messages2();
4420 var TypeDefinitionRequest;
4421 (function(TypeDefinitionRequest2) {
4422 TypeDefinitionRequest2.method = "textDocument/typeDefinition";
4423 TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method);
4424 })(TypeDefinitionRequest = exports2.TypeDefinitionRequest || (exports2.TypeDefinitionRequest = {}));
4427 // node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js
4428 var require_protocol_workspaceFolders = __commonJS((exports2) => {
4430 Object.defineProperty(exports2, "__esModule", {value: true});
4431 exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = void 0;
4432 var messages_1 = require_messages2();
4433 var WorkspaceFoldersRequest;
4434 (function(WorkspaceFoldersRequest2) {
4435 WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0("workspace/workspaceFolders");
4436 })(WorkspaceFoldersRequest = exports2.WorkspaceFoldersRequest || (exports2.WorkspaceFoldersRequest = {}));
4437 var DidChangeWorkspaceFoldersNotification;
4438 (function(DidChangeWorkspaceFoldersNotification2) {
4439 DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWorkspaceFolders");
4440 })(DidChangeWorkspaceFoldersNotification = exports2.DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = {}));
4443 // node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js
4444 var require_protocol_configuration = __commonJS((exports2) => {
4446 Object.defineProperty(exports2, "__esModule", {value: true});
4447 exports2.ConfigurationRequest = void 0;
4448 var messages_1 = require_messages2();
4449 var ConfigurationRequest;
4450 (function(ConfigurationRequest2) {
4451 ConfigurationRequest2.type = new messages_1.ProtocolRequestType("workspace/configuration");
4452 })(ConfigurationRequest = exports2.ConfigurationRequest || (exports2.ConfigurationRequest = {}));
4455 // node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js
4456 var require_protocol_colorProvider = __commonJS((exports2) => {
4458 Object.defineProperty(exports2, "__esModule", {value: true});
4459 exports2.ColorPresentationRequest = exports2.DocumentColorRequest = void 0;
4460 var messages_1 = require_messages2();
4461 var DocumentColorRequest;
4462 (function(DocumentColorRequest2) {
4463 DocumentColorRequest2.method = "textDocument/documentColor";
4464 DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method);
4465 })(DocumentColorRequest = exports2.DocumentColorRequest || (exports2.DocumentColorRequest = {}));
4466 var ColorPresentationRequest;
4467 (function(ColorPresentationRequest2) {
4468 ColorPresentationRequest2.type = new messages_1.ProtocolRequestType("textDocument/colorPresentation");
4469 })(ColorPresentationRequest = exports2.ColorPresentationRequest || (exports2.ColorPresentationRequest = {}));
4472 // node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js
4473 var require_protocol_foldingRange = __commonJS((exports2) => {
4475 Object.defineProperty(exports2, "__esModule", {value: true});
4476 exports2.FoldingRangeRequest = exports2.FoldingRangeKind = void 0;
4477 var messages_1 = require_messages2();
4478 var FoldingRangeKind;
4479 (function(FoldingRangeKind2) {
4480 FoldingRangeKind2["Comment"] = "comment";
4481 FoldingRangeKind2["Imports"] = "imports";
4482 FoldingRangeKind2["Region"] = "region";
4483 })(FoldingRangeKind = exports2.FoldingRangeKind || (exports2.FoldingRangeKind = {}));
4484 var FoldingRangeRequest;
4485 (function(FoldingRangeRequest2) {
4486 FoldingRangeRequest2.method = "textDocument/foldingRange";
4487 FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method);
4488 })(FoldingRangeRequest = exports2.FoldingRangeRequest || (exports2.FoldingRangeRequest = {}));
4491 // node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js
4492 var require_protocol_declaration = __commonJS((exports2) => {
4494 Object.defineProperty(exports2, "__esModule", {value: true});
4495 exports2.DeclarationRequest = void 0;
4496 var messages_1 = require_messages2();
4497 var DeclarationRequest;
4498 (function(DeclarationRequest2) {
4499 DeclarationRequest2.method = "textDocument/declaration";
4500 DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method);
4501 })(DeclarationRequest = exports2.DeclarationRequest || (exports2.DeclarationRequest = {}));
4504 // node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js
4505 var require_protocol_selectionRange = __commonJS((exports2) => {
4507 Object.defineProperty(exports2, "__esModule", {value: true});
4508 exports2.SelectionRangeRequest = void 0;
4509 var messages_1 = require_messages2();
4510 var SelectionRangeRequest;
4511 (function(SelectionRangeRequest2) {
4512 SelectionRangeRequest2.method = "textDocument/selectionRange";
4513 SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method);
4514 })(SelectionRangeRequest = exports2.SelectionRangeRequest || (exports2.SelectionRangeRequest = {}));
4517 // node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js
4518 var require_protocol_progress = __commonJS((exports2) => {
4520 Object.defineProperty(exports2, "__esModule", {value: true});
4521 exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = void 0;
4522 var vscode_jsonrpc_1 = require_main();
4523 var messages_1 = require_messages2();
4524 var WorkDoneProgress;
4525 (function(WorkDoneProgress2) {
4526 WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType();
4527 function is(value) {
4528 return value === WorkDoneProgress2.type;
4530 WorkDoneProgress2.is = is;
4531 })(WorkDoneProgress = exports2.WorkDoneProgress || (exports2.WorkDoneProgress = {}));
4532 var WorkDoneProgressCreateRequest;
4533 (function(WorkDoneProgressCreateRequest2) {
4534 WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType("window/workDoneProgress/create");
4535 })(WorkDoneProgressCreateRequest = exports2.WorkDoneProgressCreateRequest || (exports2.WorkDoneProgressCreateRequest = {}));
4536 var WorkDoneProgressCancelNotification;
4537 (function(WorkDoneProgressCancelNotification2) {
4538 WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType("window/workDoneProgress/cancel");
4539 })(WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCancelNotification || (exports2.WorkDoneProgressCancelNotification = {}));
4542 // node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js
4543 var require_protocol_callHierarchy = __commonJS((exports2) => {
4545 Object.defineProperty(exports2, "__esModule", {value: true});
4546 exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.CallHierarchyPrepareRequest = void 0;
4547 var messages_1 = require_messages2();
4548 var CallHierarchyPrepareRequest;
4549 (function(CallHierarchyPrepareRequest2) {
4550 CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy";
4551 CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method);
4552 })(CallHierarchyPrepareRequest = exports2.CallHierarchyPrepareRequest || (exports2.CallHierarchyPrepareRequest = {}));
4553 var CallHierarchyIncomingCallsRequest;
4554 (function(CallHierarchyIncomingCallsRequest2) {
4555 CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls";
4556 CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method);
4557 })(CallHierarchyIncomingCallsRequest = exports2.CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = {}));
4558 var CallHierarchyOutgoingCallsRequest;
4559 (function(CallHierarchyOutgoingCallsRequest2) {
4560 CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls";
4561 CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method);
4562 })(CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = {}));
4565 // node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js
4566 var require_protocol_semanticTokens = __commonJS((exports2) => {
4568 Object.defineProperty(exports2, "__esModule", {value: true});
4569 exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = void 0;
4570 var messages_1 = require_messages2();
4571 var SemanticTokenTypes;
4572 (function(SemanticTokenTypes2) {
4573 SemanticTokenTypes2["namespace"] = "namespace";
4574 SemanticTokenTypes2["type"] = "type";
4575 SemanticTokenTypes2["class"] = "class";
4576 SemanticTokenTypes2["enum"] = "enum";
4577 SemanticTokenTypes2["interface"] = "interface";
4578 SemanticTokenTypes2["struct"] = "struct";
4579 SemanticTokenTypes2["typeParameter"] = "typeParameter";
4580 SemanticTokenTypes2["parameter"] = "parameter";
4581 SemanticTokenTypes2["variable"] = "variable";
4582 SemanticTokenTypes2["property"] = "property";
4583 SemanticTokenTypes2["enumMember"] = "enumMember";
4584 SemanticTokenTypes2["event"] = "event";
4585 SemanticTokenTypes2["function"] = "function";
4586 SemanticTokenTypes2["method"] = "method";
4587 SemanticTokenTypes2["macro"] = "macro";
4588 SemanticTokenTypes2["keyword"] = "keyword";
4589 SemanticTokenTypes2["modifier"] = "modifier";
4590 SemanticTokenTypes2["comment"] = "comment";
4591 SemanticTokenTypes2["string"] = "string";
4592 SemanticTokenTypes2["number"] = "number";
4593 SemanticTokenTypes2["regexp"] = "regexp";
4594 SemanticTokenTypes2["operator"] = "operator";
4595 })(SemanticTokenTypes = exports2.SemanticTokenTypes || (exports2.SemanticTokenTypes = {}));
4596 var SemanticTokenModifiers;
4597 (function(SemanticTokenModifiers2) {
4598 SemanticTokenModifiers2["declaration"] = "declaration";
4599 SemanticTokenModifiers2["definition"] = "definition";
4600 SemanticTokenModifiers2["readonly"] = "readonly";
4601 SemanticTokenModifiers2["static"] = "static";
4602 SemanticTokenModifiers2["deprecated"] = "deprecated";
4603 SemanticTokenModifiers2["abstract"] = "abstract";
4604 SemanticTokenModifiers2["async"] = "async";
4605 SemanticTokenModifiers2["modification"] = "modification";
4606 SemanticTokenModifiers2["documentation"] = "documentation";
4607 SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary";
4608 })(SemanticTokenModifiers = exports2.SemanticTokenModifiers || (exports2.SemanticTokenModifiers = {}));
4610 (function(SemanticTokens2) {
4611 function is(value) {
4612 const candidate = value;
4613 return candidate !== void 0 && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number");
4615 SemanticTokens2.is = is;
4616 })(SemanticTokens = exports2.SemanticTokens || (exports2.SemanticTokens = {}));
4618 (function(TokenFormat2) {
4619 TokenFormat2.Relative = "relative";
4620 })(TokenFormat = exports2.TokenFormat || (exports2.TokenFormat = {}));
4621 var SemanticTokensRegistrationType;
4622 (function(SemanticTokensRegistrationType2) {
4623 SemanticTokensRegistrationType2.method = "textDocument/semanticTokens";
4624 SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method);
4625 })(SemanticTokensRegistrationType = exports2.SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = {}));
4626 var SemanticTokensRequest;
4627 (function(SemanticTokensRequest2) {
4628 SemanticTokensRequest2.method = "textDocument/semanticTokens/full";
4629 SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method);
4630 })(SemanticTokensRequest = exports2.SemanticTokensRequest || (exports2.SemanticTokensRequest = {}));
4631 var SemanticTokensDeltaRequest;
4632 (function(SemanticTokensDeltaRequest2) {
4633 SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta";
4634 SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method);
4635 })(SemanticTokensDeltaRequest = exports2.SemanticTokensDeltaRequest || (exports2.SemanticTokensDeltaRequest = {}));
4636 var SemanticTokensRangeRequest;
4637 (function(SemanticTokensRangeRequest2) {
4638 SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range";
4639 SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method);
4640 })(SemanticTokensRangeRequest = exports2.SemanticTokensRangeRequest || (exports2.SemanticTokensRangeRequest = {}));
4641 var SemanticTokensRefreshRequest;
4642 (function(SemanticTokensRefreshRequest2) {
4643 SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`;
4644 SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method);
4645 })(SemanticTokensRefreshRequest = exports2.SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = {}));
4648 // node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js
4649 var require_protocol_showDocument = __commonJS((exports2) => {
4651 Object.defineProperty(exports2, "__esModule", {value: true});
4652 exports2.ShowDocumentRequest = void 0;
4653 var messages_1 = require_messages2();
4654 var ShowDocumentRequest;
4655 (function(ShowDocumentRequest2) {
4656 ShowDocumentRequest2.method = "window/showDocument";
4657 ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method);
4658 })(ShowDocumentRequest = exports2.ShowDocumentRequest || (exports2.ShowDocumentRequest = {}));
4661 // node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js
4662 var require_protocol_linkedEditingRange = __commonJS((exports2) => {
4664 Object.defineProperty(exports2, "__esModule", {value: true});
4665 exports2.LinkedEditingRangeRequest = void 0;
4666 var messages_1 = require_messages2();
4667 var LinkedEditingRangeRequest;
4668 (function(LinkedEditingRangeRequest2) {
4669 LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange";
4670 LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method);
4671 })(LinkedEditingRangeRequest = exports2.LinkedEditingRangeRequest || (exports2.LinkedEditingRangeRequest = {}));
4674 // node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js
4675 var require_protocol_fileOperations = __commonJS((exports2) => {
4677 Object.defineProperty(exports2, "__esModule", {value: true});
4678 exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0;
4679 var messages_1 = require_messages2();
4680 var FileOperationPatternKind;
4681 (function(FileOperationPatternKind2) {
4682 FileOperationPatternKind2.file = "file";
4683 FileOperationPatternKind2.folder = "folder";
4684 })(FileOperationPatternKind = exports2.FileOperationPatternKind || (exports2.FileOperationPatternKind = {}));
4685 var WillCreateFilesRequest;
4686 (function(WillCreateFilesRequest2) {
4687 WillCreateFilesRequest2.method = "workspace/willCreateFiles";
4688 WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method);
4689 })(WillCreateFilesRequest = exports2.WillCreateFilesRequest || (exports2.WillCreateFilesRequest = {}));
4690 var DidCreateFilesNotification;
4691 (function(DidCreateFilesNotification2) {
4692 DidCreateFilesNotification2.method = "workspace/didCreateFiles";
4693 DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method);
4694 })(DidCreateFilesNotification = exports2.DidCreateFilesNotification || (exports2.DidCreateFilesNotification = {}));
4695 var WillRenameFilesRequest;
4696 (function(WillRenameFilesRequest2) {
4697 WillRenameFilesRequest2.method = "workspace/willRenameFiles";
4698 WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method);
4699 })(WillRenameFilesRequest = exports2.WillRenameFilesRequest || (exports2.WillRenameFilesRequest = {}));
4700 var DidRenameFilesNotification;
4701 (function(DidRenameFilesNotification2) {
4702 DidRenameFilesNotification2.method = "workspace/didRenameFiles";
4703 DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method);
4704 })(DidRenameFilesNotification = exports2.DidRenameFilesNotification || (exports2.DidRenameFilesNotification = {}));
4705 var DidDeleteFilesNotification;
4706 (function(DidDeleteFilesNotification2) {
4707 DidDeleteFilesNotification2.method = "workspace/didDeleteFiles";
4708 DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method);
4709 })(DidDeleteFilesNotification = exports2.DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = {}));
4710 var WillDeleteFilesRequest;
4711 (function(WillDeleteFilesRequest2) {
4712 WillDeleteFilesRequest2.method = "workspace/willDeleteFiles";
4713 WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method);
4714 })(WillDeleteFilesRequest = exports2.WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = {}));
4717 // node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js
4718 var require_protocol_moniker = __commonJS((exports2) => {
4720 Object.defineProperty(exports2, "__esModule", {value: true});
4721 exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = void 0;
4722 var messages_1 = require_messages2();
4723 var UniquenessLevel;
4724 (function(UniquenessLevel2) {
4725 UniquenessLevel2["document"] = "document";
4726 UniquenessLevel2["project"] = "project";
4727 UniquenessLevel2["group"] = "group";
4728 UniquenessLevel2["scheme"] = "scheme";
4729 UniquenessLevel2["global"] = "global";
4730 })(UniquenessLevel = exports2.UniquenessLevel || (exports2.UniquenessLevel = {}));
4732 (function(MonikerKind2) {
4733 MonikerKind2["import"] = "import";
4734 MonikerKind2["export"] = "export";
4735 MonikerKind2["local"] = "local";
4736 })(MonikerKind = exports2.MonikerKind || (exports2.MonikerKind = {}));
4738 (function(MonikerRequest2) {
4739 MonikerRequest2.method = "textDocument/moniker";
4740 MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method);
4741 })(MonikerRequest = exports2.MonikerRequest || (exports2.MonikerRequest = {}));
4744 // node_modules/vscode-languageserver-protocol/lib/common/protocol.js
4745 var require_protocol = __commonJS((exports2) => {
4747 Object.defineProperty(exports2, "__esModule", {value: true});
4748 exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeError = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.DocumentFilter = void 0;
4749 exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = void 0;
4750 var Is = require_is2();
4751 var messages_1 = require_messages2();
4752 var protocol_implementation_1 = require_protocol_implementation();
4753 Object.defineProperty(exports2, "ImplementationRequest", {enumerable: true, get: function() {
4754 return protocol_implementation_1.ImplementationRequest;
4756 var protocol_typeDefinition_1 = require_protocol_typeDefinition();
4757 Object.defineProperty(exports2, "TypeDefinitionRequest", {enumerable: true, get: function() {
4758 return protocol_typeDefinition_1.TypeDefinitionRequest;
4760 var protocol_workspaceFolders_1 = require_protocol_workspaceFolders();
4761 Object.defineProperty(exports2, "WorkspaceFoldersRequest", {enumerable: true, get: function() {
4762 return protocol_workspaceFolders_1.WorkspaceFoldersRequest;
4764 Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", {enumerable: true, get: function() {
4765 return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
4767 var protocol_configuration_1 = require_protocol_configuration();
4768 Object.defineProperty(exports2, "ConfigurationRequest", {enumerable: true, get: function() {
4769 return protocol_configuration_1.ConfigurationRequest;
4771 var protocol_colorProvider_1 = require_protocol_colorProvider();
4772 Object.defineProperty(exports2, "DocumentColorRequest", {enumerable: true, get: function() {
4773 return protocol_colorProvider_1.DocumentColorRequest;
4775 Object.defineProperty(exports2, "ColorPresentationRequest", {enumerable: true, get: function() {
4776 return protocol_colorProvider_1.ColorPresentationRequest;
4778 var protocol_foldingRange_1 = require_protocol_foldingRange();
4779 Object.defineProperty(exports2, "FoldingRangeRequest", {enumerable: true, get: function() {
4780 return protocol_foldingRange_1.FoldingRangeRequest;
4782 var protocol_declaration_1 = require_protocol_declaration();
4783 Object.defineProperty(exports2, "DeclarationRequest", {enumerable: true, get: function() {
4784 return protocol_declaration_1.DeclarationRequest;
4786 var protocol_selectionRange_1 = require_protocol_selectionRange();
4787 Object.defineProperty(exports2, "SelectionRangeRequest", {enumerable: true, get: function() {
4788 return protocol_selectionRange_1.SelectionRangeRequest;
4790 var protocol_progress_1 = require_protocol_progress();
4791 Object.defineProperty(exports2, "WorkDoneProgress", {enumerable: true, get: function() {
4792 return protocol_progress_1.WorkDoneProgress;
4794 Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", {enumerable: true, get: function() {
4795 return protocol_progress_1.WorkDoneProgressCreateRequest;
4797 Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", {enumerable: true, get: function() {
4798 return protocol_progress_1.WorkDoneProgressCancelNotification;
4800 var protocol_callHierarchy_1 = require_protocol_callHierarchy();
4801 Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", {enumerable: true, get: function() {
4802 return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest;
4804 Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", {enumerable: true, get: function() {
4805 return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest;
4807 Object.defineProperty(exports2, "CallHierarchyPrepareRequest", {enumerable: true, get: function() {
4808 return protocol_callHierarchy_1.CallHierarchyPrepareRequest;
4810 var protocol_semanticTokens_1 = require_protocol_semanticTokens();
4811 Object.defineProperty(exports2, "SemanticTokenTypes", {enumerable: true, get: function() {
4812 return protocol_semanticTokens_1.SemanticTokenTypes;
4814 Object.defineProperty(exports2, "SemanticTokenModifiers", {enumerable: true, get: function() {
4815 return protocol_semanticTokens_1.SemanticTokenModifiers;
4817 Object.defineProperty(exports2, "SemanticTokens", {enumerable: true, get: function() {
4818 return protocol_semanticTokens_1.SemanticTokens;
4820 Object.defineProperty(exports2, "TokenFormat", {enumerable: true, get: function() {
4821 return protocol_semanticTokens_1.TokenFormat;
4823 Object.defineProperty(exports2, "SemanticTokensRequest", {enumerable: true, get: function() {
4824 return protocol_semanticTokens_1.SemanticTokensRequest;
4826 Object.defineProperty(exports2, "SemanticTokensDeltaRequest", {enumerable: true, get: function() {
4827 return protocol_semanticTokens_1.SemanticTokensDeltaRequest;
4829 Object.defineProperty(exports2, "SemanticTokensRangeRequest", {enumerable: true, get: function() {
4830 return protocol_semanticTokens_1.SemanticTokensRangeRequest;
4832 Object.defineProperty(exports2, "SemanticTokensRefreshRequest", {enumerable: true, get: function() {
4833 return protocol_semanticTokens_1.SemanticTokensRefreshRequest;
4835 Object.defineProperty(exports2, "SemanticTokensRegistrationType", {enumerable: true, get: function() {
4836 return protocol_semanticTokens_1.SemanticTokensRegistrationType;
4838 var protocol_showDocument_1 = require_protocol_showDocument();
4839 Object.defineProperty(exports2, "ShowDocumentRequest", {enumerable: true, get: function() {
4840 return protocol_showDocument_1.ShowDocumentRequest;
4842 var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange();
4843 Object.defineProperty(exports2, "LinkedEditingRangeRequest", {enumerable: true, get: function() {
4844 return protocol_linkedEditingRange_1.LinkedEditingRangeRequest;
4846 var protocol_fileOperations_1 = require_protocol_fileOperations();
4847 Object.defineProperty(exports2, "FileOperationPatternKind", {enumerable: true, get: function() {
4848 return protocol_fileOperations_1.FileOperationPatternKind;
4850 Object.defineProperty(exports2, "DidCreateFilesNotification", {enumerable: true, get: function() {
4851 return protocol_fileOperations_1.DidCreateFilesNotification;
4853 Object.defineProperty(exports2, "WillCreateFilesRequest", {enumerable: true, get: function() {
4854 return protocol_fileOperations_1.WillCreateFilesRequest;
4856 Object.defineProperty(exports2, "DidRenameFilesNotification", {enumerable: true, get: function() {
4857 return protocol_fileOperations_1.DidRenameFilesNotification;
4859 Object.defineProperty(exports2, "WillRenameFilesRequest", {enumerable: true, get: function() {
4860 return protocol_fileOperations_1.WillRenameFilesRequest;
4862 Object.defineProperty(exports2, "DidDeleteFilesNotification", {enumerable: true, get: function() {
4863 return protocol_fileOperations_1.DidDeleteFilesNotification;
4865 Object.defineProperty(exports2, "WillDeleteFilesRequest", {enumerable: true, get: function() {
4866 return protocol_fileOperations_1.WillDeleteFilesRequest;
4868 var protocol_moniker_1 = require_protocol_moniker();
4869 Object.defineProperty(exports2, "UniquenessLevel", {enumerable: true, get: function() {
4870 return protocol_moniker_1.UniquenessLevel;
4872 Object.defineProperty(exports2, "MonikerKind", {enumerable: true, get: function() {
4873 return protocol_moniker_1.MonikerKind;
4875 Object.defineProperty(exports2, "MonikerRequest", {enumerable: true, get: function() {
4876 return protocol_moniker_1.MonikerRequest;
4879 (function(DocumentFilter2) {
4880 function is(value) {
4881 const candidate = value;
4882 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
4884 DocumentFilter2.is = is;
4885 })(DocumentFilter = exports2.DocumentFilter || (exports2.DocumentFilter = {}));
4886 var DocumentSelector;
4887 (function(DocumentSelector2) {
4888 function is(value) {
4889 if (!Array.isArray(value)) {
4892 for (let elem of value) {
4893 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
4899 DocumentSelector2.is = is;
4900 })(DocumentSelector = exports2.DocumentSelector || (exports2.DocumentSelector = {}));
4901 var RegistrationRequest;
4902 (function(RegistrationRequest2) {
4903 RegistrationRequest2.type = new messages_1.ProtocolRequestType("client/registerCapability");
4904 })(RegistrationRequest = exports2.RegistrationRequest || (exports2.RegistrationRequest = {}));
4905 var UnregistrationRequest;
4906 (function(UnregistrationRequest2) {
4907 UnregistrationRequest2.type = new messages_1.ProtocolRequestType("client/unregisterCapability");
4908 })(UnregistrationRequest = exports2.UnregistrationRequest || (exports2.UnregistrationRequest = {}));
4909 var ResourceOperationKind;
4910 (function(ResourceOperationKind2) {
4911 ResourceOperationKind2.Create = "create";
4912 ResourceOperationKind2.Rename = "rename";
4913 ResourceOperationKind2.Delete = "delete";
4914 })(ResourceOperationKind = exports2.ResourceOperationKind || (exports2.ResourceOperationKind = {}));
4915 var FailureHandlingKind;
4916 (function(FailureHandlingKind2) {
4917 FailureHandlingKind2.Abort = "abort";
4918 FailureHandlingKind2.Transactional = "transactional";
4919 FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional";
4920 FailureHandlingKind2.Undo = "undo";
4921 })(FailureHandlingKind = exports2.FailureHandlingKind || (exports2.FailureHandlingKind = {}));
4922 var StaticRegistrationOptions;
4923 (function(StaticRegistrationOptions2) {
4924 function hasId(value) {
4925 const candidate = value;
4926 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
4928 StaticRegistrationOptions2.hasId = hasId;
4929 })(StaticRegistrationOptions = exports2.StaticRegistrationOptions || (exports2.StaticRegistrationOptions = {}));
4930 var TextDocumentRegistrationOptions;
4931 (function(TextDocumentRegistrationOptions2) {
4932 function is(value) {
4933 const candidate = value;
4934 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
4936 TextDocumentRegistrationOptions2.is = is;
4937 })(TextDocumentRegistrationOptions = exports2.TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = {}));
4938 var WorkDoneProgressOptions;
4939 (function(WorkDoneProgressOptions2) {
4940 function is(value) {
4941 const candidate = value;
4942 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is.boolean(candidate.workDoneProgress));
4944 WorkDoneProgressOptions2.is = is;
4945 function hasWorkDoneProgress(value) {
4946 const candidate = value;
4947 return candidate && Is.boolean(candidate.workDoneProgress);
4949 WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress;
4950 })(WorkDoneProgressOptions = exports2.WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = {}));
4951 var InitializeRequest;
4952 (function(InitializeRequest2) {
4953 InitializeRequest2.type = new messages_1.ProtocolRequestType("initialize");
4954 })(InitializeRequest = exports2.InitializeRequest || (exports2.InitializeRequest = {}));
4955 var InitializeError;
4956 (function(InitializeError2) {
4957 InitializeError2.unknownProtocolVersion = 1;
4958 })(InitializeError = exports2.InitializeError || (exports2.InitializeError = {}));
4959 var InitializedNotification;
4960 (function(InitializedNotification2) {
4961 InitializedNotification2.type = new messages_1.ProtocolNotificationType("initialized");
4962 })(InitializedNotification = exports2.InitializedNotification || (exports2.InitializedNotification = {}));
4963 var ShutdownRequest;
4964 (function(ShutdownRequest2) {
4965 ShutdownRequest2.type = new messages_1.ProtocolRequestType0("shutdown");
4966 })(ShutdownRequest = exports2.ShutdownRequest || (exports2.ShutdownRequest = {}));
4967 var ExitNotification;
4968 (function(ExitNotification2) {
4969 ExitNotification2.type = new messages_1.ProtocolNotificationType0("exit");
4970 })(ExitNotification = exports2.ExitNotification || (exports2.ExitNotification = {}));
4971 var DidChangeConfigurationNotification;
4972 (function(DidChangeConfigurationNotification2) {
4973 DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeConfiguration");
4974 })(DidChangeConfigurationNotification = exports2.DidChangeConfigurationNotification || (exports2.DidChangeConfigurationNotification = {}));
4976 (function(MessageType2) {
4977 MessageType2.Error = 1;
4978 MessageType2.Warning = 2;
4979 MessageType2.Info = 3;
4980 MessageType2.Log = 4;
4981 })(MessageType = exports2.MessageType || (exports2.MessageType = {}));
4982 var ShowMessageNotification;
4983 (function(ShowMessageNotification2) {
4984 ShowMessageNotification2.type = new messages_1.ProtocolNotificationType("window/showMessage");
4985 })(ShowMessageNotification = exports2.ShowMessageNotification || (exports2.ShowMessageNotification = {}));
4986 var ShowMessageRequest;
4987 (function(ShowMessageRequest2) {
4988 ShowMessageRequest2.type = new messages_1.ProtocolRequestType("window/showMessageRequest");
4989 })(ShowMessageRequest = exports2.ShowMessageRequest || (exports2.ShowMessageRequest = {}));
4990 var LogMessageNotification;
4991 (function(LogMessageNotification2) {
4992 LogMessageNotification2.type = new messages_1.ProtocolNotificationType("window/logMessage");
4993 })(LogMessageNotification = exports2.LogMessageNotification || (exports2.LogMessageNotification = {}));
4994 var TelemetryEventNotification;
4995 (function(TelemetryEventNotification2) {
4996 TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType("telemetry/event");
4997 })(TelemetryEventNotification = exports2.TelemetryEventNotification || (exports2.TelemetryEventNotification = {}));
4998 var TextDocumentSyncKind;
4999 (function(TextDocumentSyncKind2) {
5000 TextDocumentSyncKind2.None = 0;
5001 TextDocumentSyncKind2.Full = 1;
5002 TextDocumentSyncKind2.Incremental = 2;
5003 })(TextDocumentSyncKind = exports2.TextDocumentSyncKind || (exports2.TextDocumentSyncKind = {}));
5004 var DidOpenTextDocumentNotification;
5005 (function(DidOpenTextDocumentNotification2) {
5006 DidOpenTextDocumentNotification2.method = "textDocument/didOpen";
5007 DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method);
5008 })(DidOpenTextDocumentNotification = exports2.DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = {}));
5009 var TextDocumentContentChangeEvent;
5010 (function(TextDocumentContentChangeEvent2) {
5011 function isIncremental(event) {
5012 let candidate = event;
5013 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
5015 TextDocumentContentChangeEvent2.isIncremental = isIncremental;
5016 function isFull(event) {
5017 let candidate = event;
5018 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
5020 TextDocumentContentChangeEvent2.isFull = isFull;
5021 })(TextDocumentContentChangeEvent = exports2.TextDocumentContentChangeEvent || (exports2.TextDocumentContentChangeEvent = {}));
5022 var DidChangeTextDocumentNotification;
5023 (function(DidChangeTextDocumentNotification2) {
5024 DidChangeTextDocumentNotification2.method = "textDocument/didChange";
5025 DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method);
5026 })(DidChangeTextDocumentNotification = exports2.DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = {}));
5027 var DidCloseTextDocumentNotification;
5028 (function(DidCloseTextDocumentNotification2) {
5029 DidCloseTextDocumentNotification2.method = "textDocument/didClose";
5030 DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method);
5031 })(DidCloseTextDocumentNotification = exports2.DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = {}));
5032 var DidSaveTextDocumentNotification;
5033 (function(DidSaveTextDocumentNotification2) {
5034 DidSaveTextDocumentNotification2.method = "textDocument/didSave";
5035 DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method);
5036 })(DidSaveTextDocumentNotification = exports2.DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = {}));
5037 var TextDocumentSaveReason;
5038 (function(TextDocumentSaveReason2) {
5039 TextDocumentSaveReason2.Manual = 1;
5040 TextDocumentSaveReason2.AfterDelay = 2;
5041 TextDocumentSaveReason2.FocusOut = 3;
5042 })(TextDocumentSaveReason = exports2.TextDocumentSaveReason || (exports2.TextDocumentSaveReason = {}));
5043 var WillSaveTextDocumentNotification;
5044 (function(WillSaveTextDocumentNotification2) {
5045 WillSaveTextDocumentNotification2.method = "textDocument/willSave";
5046 WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method);
5047 })(WillSaveTextDocumentNotification = exports2.WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = {}));
5048 var WillSaveTextDocumentWaitUntilRequest;
5049 (function(WillSaveTextDocumentWaitUntilRequest2) {
5050 WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil";
5051 WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method);
5052 })(WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = {}));
5053 var DidChangeWatchedFilesNotification;
5054 (function(DidChangeWatchedFilesNotification2) {
5055 DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWatchedFiles");
5056 })(DidChangeWatchedFilesNotification = exports2.DidChangeWatchedFilesNotification || (exports2.DidChangeWatchedFilesNotification = {}));
5058 (function(FileChangeType2) {
5059 FileChangeType2.Created = 1;
5060 FileChangeType2.Changed = 2;
5061 FileChangeType2.Deleted = 3;
5062 })(FileChangeType = exports2.FileChangeType || (exports2.FileChangeType = {}));
5064 (function(WatchKind2) {
5065 WatchKind2.Create = 1;
5066 WatchKind2.Change = 2;
5067 WatchKind2.Delete = 4;
5068 })(WatchKind = exports2.WatchKind || (exports2.WatchKind = {}));
5069 var PublishDiagnosticsNotification;
5070 (function(PublishDiagnosticsNotification2) {
5071 PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType("textDocument/publishDiagnostics");
5072 })(PublishDiagnosticsNotification = exports2.PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = {}));
5073 var CompletionTriggerKind;
5074 (function(CompletionTriggerKind2) {
5075 CompletionTriggerKind2.Invoked = 1;
5076 CompletionTriggerKind2.TriggerCharacter = 2;
5077 CompletionTriggerKind2.TriggerForIncompleteCompletions = 3;
5078 })(CompletionTriggerKind = exports2.CompletionTriggerKind || (exports2.CompletionTriggerKind = {}));
5079 var CompletionRequest;
5080 (function(CompletionRequest2) {
5081 CompletionRequest2.method = "textDocument/completion";
5082 CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method);
5083 })(CompletionRequest = exports2.CompletionRequest || (exports2.CompletionRequest = {}));
5084 var CompletionResolveRequest;
5085 (function(CompletionResolveRequest2) {
5086 CompletionResolveRequest2.method = "completionItem/resolve";
5087 CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method);
5088 })(CompletionResolveRequest = exports2.CompletionResolveRequest || (exports2.CompletionResolveRequest = {}));
5090 (function(HoverRequest2) {
5091 HoverRequest2.method = "textDocument/hover";
5092 HoverRequest2.type = new messages_1.ProtocolRequestType(HoverRequest2.method);
5093 })(HoverRequest = exports2.HoverRequest || (exports2.HoverRequest = {}));
5094 var SignatureHelpTriggerKind;
5095 (function(SignatureHelpTriggerKind2) {
5096 SignatureHelpTriggerKind2.Invoked = 1;
5097 SignatureHelpTriggerKind2.TriggerCharacter = 2;
5098 SignatureHelpTriggerKind2.ContentChange = 3;
5099 })(SignatureHelpTriggerKind = exports2.SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = {}));
5100 var SignatureHelpRequest;
5101 (function(SignatureHelpRequest2) {
5102 SignatureHelpRequest2.method = "textDocument/signatureHelp";
5103 SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method);
5104 })(SignatureHelpRequest = exports2.SignatureHelpRequest || (exports2.SignatureHelpRequest = {}));
5105 var DefinitionRequest;
5106 (function(DefinitionRequest2) {
5107 DefinitionRequest2.method = "textDocument/definition";
5108 DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method);
5109 })(DefinitionRequest = exports2.DefinitionRequest || (exports2.DefinitionRequest = {}));
5110 var ReferencesRequest;
5111 (function(ReferencesRequest2) {
5112 ReferencesRequest2.method = "textDocument/references";
5113 ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method);
5114 })(ReferencesRequest = exports2.ReferencesRequest || (exports2.ReferencesRequest = {}));
5115 var DocumentHighlightRequest;
5116 (function(DocumentHighlightRequest2) {
5117 DocumentHighlightRequest2.method = "textDocument/documentHighlight";
5118 DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method);
5119 })(DocumentHighlightRequest = exports2.DocumentHighlightRequest || (exports2.DocumentHighlightRequest = {}));
5120 var DocumentSymbolRequest;
5121 (function(DocumentSymbolRequest2) {
5122 DocumentSymbolRequest2.method = "textDocument/documentSymbol";
5123 DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method);
5124 })(DocumentSymbolRequest = exports2.DocumentSymbolRequest || (exports2.DocumentSymbolRequest = {}));
5125 var CodeActionRequest;
5126 (function(CodeActionRequest2) {
5127 CodeActionRequest2.method = "textDocument/codeAction";
5128 CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method);
5129 })(CodeActionRequest = exports2.CodeActionRequest || (exports2.CodeActionRequest = {}));
5130 var CodeActionResolveRequest;
5131 (function(CodeActionResolveRequest2) {
5132 CodeActionResolveRequest2.method = "codeAction/resolve";
5133 CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method);
5134 })(CodeActionResolveRequest = exports2.CodeActionResolveRequest || (exports2.CodeActionResolveRequest = {}));
5135 var WorkspaceSymbolRequest;
5136 (function(WorkspaceSymbolRequest2) {
5137 WorkspaceSymbolRequest2.method = "workspace/symbol";
5138 WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method);
5139 })(WorkspaceSymbolRequest = exports2.WorkspaceSymbolRequest || (exports2.WorkspaceSymbolRequest = {}));
5140 var CodeLensRequest;
5141 (function(CodeLensRequest2) {
5142 CodeLensRequest2.method = "textDocument/codeLens";
5143 CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method);
5144 })(CodeLensRequest = exports2.CodeLensRequest || (exports2.CodeLensRequest = {}));
5145 var CodeLensResolveRequest;
5146 (function(CodeLensResolveRequest2) {
5147 CodeLensResolveRequest2.method = "codeLens/resolve";
5148 CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method);
5149 })(CodeLensResolveRequest = exports2.CodeLensResolveRequest || (exports2.CodeLensResolveRequest = {}));
5150 var CodeLensRefreshRequest;
5151 (function(CodeLensRefreshRequest2) {
5152 CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`;
5153 CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method);
5154 })(CodeLensRefreshRequest = exports2.CodeLensRefreshRequest || (exports2.CodeLensRefreshRequest = {}));
5155 var DocumentLinkRequest;
5156 (function(DocumentLinkRequest2) {
5157 DocumentLinkRequest2.method = "textDocument/documentLink";
5158 DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method);
5159 })(DocumentLinkRequest = exports2.DocumentLinkRequest || (exports2.DocumentLinkRequest = {}));
5160 var DocumentLinkResolveRequest;
5161 (function(DocumentLinkResolveRequest2) {
5162 DocumentLinkResolveRequest2.method = "documentLink/resolve";
5163 DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method);
5164 })(DocumentLinkResolveRequest = exports2.DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = {}));
5165 var DocumentFormattingRequest;
5166 (function(DocumentFormattingRequest2) {
5167 DocumentFormattingRequest2.method = "textDocument/formatting";
5168 DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method);
5169 })(DocumentFormattingRequest = exports2.DocumentFormattingRequest || (exports2.DocumentFormattingRequest = {}));
5170 var DocumentRangeFormattingRequest;
5171 (function(DocumentRangeFormattingRequest2) {
5172 DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting";
5173 DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method);
5174 })(DocumentRangeFormattingRequest = exports2.DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = {}));
5175 var DocumentOnTypeFormattingRequest;
5176 (function(DocumentOnTypeFormattingRequest2) {
5177 DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting";
5178 DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method);
5179 })(DocumentOnTypeFormattingRequest = exports2.DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = {}));
5180 var PrepareSupportDefaultBehavior;
5181 (function(PrepareSupportDefaultBehavior2) {
5182 PrepareSupportDefaultBehavior2.Identifier = 1;
5183 })(PrepareSupportDefaultBehavior = exports2.PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = {}));
5185 (function(RenameRequest2) {
5186 RenameRequest2.method = "textDocument/rename";
5187 RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method);
5188 })(RenameRequest = exports2.RenameRequest || (exports2.RenameRequest = {}));
5189 var PrepareRenameRequest;
5190 (function(PrepareRenameRequest2) {
5191 PrepareRenameRequest2.method = "textDocument/prepareRename";
5192 PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method);
5193 })(PrepareRenameRequest = exports2.PrepareRenameRequest || (exports2.PrepareRenameRequest = {}));
5194 var ExecuteCommandRequest;
5195 (function(ExecuteCommandRequest2) {
5196 ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType("workspace/executeCommand");
5197 })(ExecuteCommandRequest = exports2.ExecuteCommandRequest || (exports2.ExecuteCommandRequest = {}));
5198 var ApplyWorkspaceEditRequest;
5199 (function(ApplyWorkspaceEditRequest2) {
5200 ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit");
5201 })(ApplyWorkspaceEditRequest = exports2.ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = {}));
5204 // node_modules/vscode-languageserver-protocol/lib/common/connection.js
5205 var require_connection2 = __commonJS((exports2) => {
5207 Object.defineProperty(exports2, "__esModule", {value: true});
5208 exports2.createProtocolConnection = void 0;
5209 var vscode_jsonrpc_1 = require_main();
5210 function createProtocolConnection(input, output, logger, options) {
5211 if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {
5212 options = {connectionStrategy: options};
5214 return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options);
5216 exports2.createProtocolConnection = createProtocolConnection;
5219 // node_modules/vscode-languageserver-protocol/lib/common/api.js
5220 var require_api2 = __commonJS((exports2) => {
5222 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
5225 Object.defineProperty(o, k2, {enumerable: true, get: function() {
5228 } : function(o, m, k, k2) {
5233 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
5235 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
5236 __createBinding(exports3, m, p);
5238 Object.defineProperty(exports2, "__esModule", {value: true});
5239 exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0;
5240 __exportStar2(require_main(), exports2);
5241 __exportStar2(require_main2(), exports2);
5242 __exportStar2(require_messages2(), exports2);
5243 __exportStar2(require_protocol(), exports2);
5244 var connection_1 = require_connection2();
5245 Object.defineProperty(exports2, "createProtocolConnection", {enumerable: true, get: function() {
5246 return connection_1.createProtocolConnection;
5249 (function(LSPErrorCodes2) {
5250 LSPErrorCodes2.lspReservedErrorRangeStart = -32899;
5251 LSPErrorCodes2.ContentModified = -32801;
5252 LSPErrorCodes2.RequestCancelled = -32800;
5253 LSPErrorCodes2.lspReservedErrorRangeEnd = -32800;
5254 })(LSPErrorCodes = exports2.LSPErrorCodes || (exports2.LSPErrorCodes = {}));
5257 // node_modules/vscode-languageserver-protocol/lib/node/main.js
5258 var require_main3 = __commonJS((exports2) => {
5260 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
5263 Object.defineProperty(o, k2, {enumerable: true, get: function() {
5266 } : function(o, m, k, k2) {
5271 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
5273 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
5274 __createBinding(exports3, m, p);
5276 Object.defineProperty(exports2, "__esModule", {value: true});
5277 exports2.createProtocolConnection = void 0;
5278 var node_1 = require_node();
5279 __exportStar2(require_node(), exports2);
5280 __exportStar2(require_api2(), exports2);
5281 function createProtocolConnection(input, output, logger, options) {
5282 return node_1.createMessageConnection(input, output, logger, options);
5284 exports2.createProtocolConnection = createProtocolConnection;
5287 // node_modules/abort-controller/dist/abort-controller.mjs
5288 var require_abort_controller = __commonJS((exports2) => {
5289 __markAsModule(exports2);
5290 __export(exports2, {
5291 AbortController: () => AbortController,
5292 AbortSignal: () => AbortSignal,
5293 default: () => abort_controller_default
5295 var AbortSignal = class extends EventTarget {
5298 throw new TypeError("AbortSignal cannot be constructed directly");
5301 const aborted = abortedFlags.get(this);
5302 if (typeof aborted !== "boolean") {
5303 throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
5308 defineEventAttribute(AbortSignal.prototype, "abort");
5309 function createAbortSignal() {
5310 const signal = Object.create(AbortSignal.prototype);
5311 EventTarget.call(signal);
5312 abortedFlags.set(signal, false);
5315 function abortSignal(signal) {
5316 if (abortedFlags.get(signal) !== false) {
5319 abortedFlags.set(signal, true);
5320 signal.dispatchEvent({type: "abort"});
5322 var abortedFlags = new WeakMap();
5323 Object.defineProperties(AbortSignal.prototype, {
5324 aborted: {enumerable: true}
5326 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
5327 Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
5329 value: "AbortSignal"
5332 var AbortController = class {
5334 signals.set(this, createAbortSignal());
5337 return getSignal(this);
5340 abortSignal(getSignal(this));
5343 var signals = new WeakMap();
5344 function getSignal(controller) {
5345 const signal = signals.get(controller);
5346 if (signal == null) {
5347 throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
5351 Object.defineProperties(AbortController.prototype, {
5352 signal: {enumerable: true},
5353 abort: {enumerable: true}
5355 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
5356 Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
5358 value: "AbortController"
5361 var abort_controller_default = AbortController;
5364 // node_modules/node-fetch/lib/index.mjs
5365 var require_lib = __commonJS((exports2) => {
5366 __markAsModule(exports2);
5367 __export(exports2, {
5368 FetchError: () => FetchError,
5369 Headers: () => Headers,
5370 Request: () => Request,
5371 Response: () => Response,
5372 default: () => lib_default
5374 var import_stream = __toModule(require("stream"));
5375 var import_http = __toModule(require("http"));
5376 var import_url = __toModule(require("url"));
5377 var import_https = __toModule(require("https"));
5378 var import_zlib = __toModule(require("zlib"));
5379 var Readable = import_stream.default.Readable;
5380 var BUFFER = Symbol("buffer");
5381 var TYPE = Symbol("type");
5385 const blobParts = arguments[0];
5386 const options = arguments[1];
5390 const a = blobParts;
5391 const length = Number(a.length);
5392 for (let i = 0; i < length; i++) {
5393 const element = a[i];
5395 if (element instanceof Buffer) {
5397 } else if (ArrayBuffer.isView(element)) {
5398 buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
5399 } else if (element instanceof ArrayBuffer) {
5400 buffer = Buffer.from(element);
5401 } else if (element instanceof Blob) {
5402 buffer = element[BUFFER];
5404 buffer = Buffer.from(typeof element === "string" ? element : String(element));
5406 size += buffer.length;
5407 buffers.push(buffer);
5410 this[BUFFER] = Buffer.concat(buffers);
5411 let type = options && options.type !== void 0 && String(options.type).toLowerCase();
5412 if (type && !/[^\u0020-\u007E]/.test(type)) {
5417 return this[BUFFER].length;
5423 return Promise.resolve(this[BUFFER].toString());
5426 const buf = this[BUFFER];
5427 const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
5428 return Promise.resolve(ab);
5431 const readable = new Readable();
5432 readable._read = function() {
5434 readable.push(this[BUFFER]);
5435 readable.push(null);
5439 return "[object Blob]";
5442 const size = this.size;
5443 const start = arguments[0];
5444 const end = arguments[1];
5445 let relativeStart, relativeEnd;
5446 if (start === void 0) {
5448 } else if (start < 0) {
5449 relativeStart = Math.max(size + start, 0);
5451 relativeStart = Math.min(start, size);
5453 if (end === void 0) {
5455 } else if (end < 0) {
5456 relativeEnd = Math.max(size + end, 0);
5458 relativeEnd = Math.min(end, size);
5460 const span = Math.max(relativeEnd - relativeStart, 0);
5461 const buffer = this[BUFFER];
5462 const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
5463 const blob = new Blob([], {type: arguments[2]});
5464 blob[BUFFER] = slicedBuffer;
5468 Object.defineProperties(Blob.prototype, {
5469 size: {enumerable: true},
5470 type: {enumerable: true},
5471 slice: {enumerable: true}
5473 Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
5479 function FetchError(message, type, systemError) {
5480 Error.call(this, message);
5481 this.message = message;
5484 this.code = this.errno = systemError.code;
5486 Error.captureStackTrace(this, this.constructor);
5488 FetchError.prototype = Object.create(Error.prototype);
5489 FetchError.prototype.constructor = FetchError;
5490 FetchError.prototype.name = "FetchError";
5493 convert = require("encoding").convert;
5496 var INTERNALS = Symbol("Body internals");
5497 var PassThrough = import_stream.default.PassThrough;
5498 function Body(body) {
5500 var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size;
5501 let size = _ref$size === void 0 ? 0 : _ref$size;
5502 var _ref$timeout = _ref.timeout;
5503 let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout;
5506 } else if (isURLSearchParams(body)) {
5507 body = Buffer.from(body.toString());
5508 } else if (isBlob(body))
5510 else if (Buffer.isBuffer(body))
5512 else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
5513 body = Buffer.from(body);
5514 } else if (ArrayBuffer.isView(body)) {
5515 body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
5516 } else if (body instanceof import_stream.default)
5519 body = Buffer.from(String(body));
5527 this.timeout = timeout;
5528 if (body instanceof import_stream.default) {
5529 body.on("error", function(err) {
5530 const error = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err);
5531 _this[INTERNALS].error = error;
5537 return this[INTERNALS].body;
5540 return this[INTERNALS].disturbed;
5543 return consumeBody.call(this).then(function(buf) {
5544 return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
5548 let ct = this.headers && this.headers.get("content-type") || "";
5549 return consumeBody.call(this).then(function(buf) {
5550 return Object.assign(new Blob([], {
5551 type: ct.toLowerCase()
5559 return consumeBody.call(this).then(function(buffer) {
5561 return JSON.parse(buffer.toString());
5563 return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, "invalid-json"));
5568 return consumeBody.call(this).then(function(buffer) {
5569 return buffer.toString();
5573 return consumeBody.call(this);
5577 return consumeBody.call(this).then(function(buffer) {
5578 return convertBody(buffer, _this3.headers);
5582 Object.defineProperties(Body.prototype, {
5583 body: {enumerable: true},
5584 bodyUsed: {enumerable: true},
5585 arrayBuffer: {enumerable: true},
5586 blob: {enumerable: true},
5587 json: {enumerable: true},
5588 text: {enumerable: true}
5590 Body.mixIn = function(proto) {
5591 for (const name of Object.getOwnPropertyNames(Body.prototype)) {
5592 if (!(name in proto)) {
5593 const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
5594 Object.defineProperty(proto, name, desc);
5598 function consumeBody() {
5600 if (this[INTERNALS].disturbed) {
5601 return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
5603 this[INTERNALS].disturbed = true;
5604 if (this[INTERNALS].error) {
5605 return Body.Promise.reject(this[INTERNALS].error);
5607 let body = this.body;
5608 if (body === null) {
5609 return Body.Promise.resolve(Buffer.alloc(0));
5612 body = body.stream();
5614 if (Buffer.isBuffer(body)) {
5615 return Body.Promise.resolve(body);
5617 if (!(body instanceof import_stream.default)) {
5618 return Body.Promise.resolve(Buffer.alloc(0));
5623 return new Body.Promise(function(resolve, reject) {
5625 if (_this4.timeout) {
5626 resTimeout = setTimeout(function() {
5628 reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, "body-timeout"));
5631 body.on("error", function(err) {
5632 if (err.name === "AbortError") {
5636 reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, "system", err));
5639 body.on("data", function(chunk) {
5640 if (abort || chunk === null) {
5643 if (_this4.size && accumBytes + chunk.length > _this4.size) {
5645 reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, "max-size"));
5648 accumBytes += chunk.length;
5651 body.on("end", function() {
5655 clearTimeout(resTimeout);
5657 resolve(Buffer.concat(accum, accumBytes));
5659 reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
5664 function convertBody(buffer, headers) {
5665 if (typeof convert !== "function") {
5666 throw new Error("The package `encoding` must be installed to use the textConverted() function");
5668 const ct = headers.get("content-type");
5669 let charset = "utf-8";
5672 res = /charset=([^;]*)/i.exec(ct);
5674 str = buffer.slice(0, 1024).toString();
5676 res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
5679 res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
5681 res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
5687 res = /charset=(.*)/i.exec(res.pop());
5691 res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
5694 charset = res.pop();
5695 if (charset === "gb2312" || charset === "gbk") {
5696 charset = "gb18030";
5699 return convert(buffer, "UTF-8", charset).toString();
5701 function isURLSearchParams(obj) {
5702 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") {
5705 return obj.constructor.name === "URLSearchParams" || Object.prototype.toString.call(obj) === "[object URLSearchParams]" || typeof obj.sort === "function";
5707 function isBlob(obj) {
5708 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]);
5710 function clone(instance) {
5712 let body = instance.body;
5713 if (instance.bodyUsed) {
5714 throw new Error("cannot clone body after it is used");
5716 if (body instanceof import_stream.default && typeof body.getBoundary !== "function") {
5717 p1 = new PassThrough();
5718 p2 = new PassThrough();
5721 instance[INTERNALS].body = p1;
5726 function extractContentType(body) {
5727 if (body === null) {
5729 } else if (typeof body === "string") {
5730 return "text/plain;charset=UTF-8";
5731 } else if (isURLSearchParams(body)) {
5732 return "application/x-www-form-urlencoded;charset=UTF-8";
5733 } else if (isBlob(body)) {
5734 return body.type || null;
5735 } else if (Buffer.isBuffer(body)) {
5737 } else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
5739 } else if (ArrayBuffer.isView(body)) {
5741 } else if (typeof body.getBoundary === "function") {
5742 return `multipart/form-data;boundary=${body.getBoundary()}`;
5743 } else if (body instanceof import_stream.default) {
5746 return "text/plain;charset=UTF-8";
5749 function getTotalBytes(instance) {
5750 const body = instance.body;
5751 if (body === null) {
5753 } else if (isBlob(body)) {
5755 } else if (Buffer.isBuffer(body)) {
5757 } else if (body && typeof body.getLengthSync === "function") {
5758 if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || body.hasKnownLength && body.hasKnownLength()) {
5759 return body.getLengthSync();
5766 function writeToStream(dest, instance) {
5767 const body = instance.body;
5768 if (body === null) {
5770 } else if (isBlob(body)) {
5771 body.stream().pipe(dest);
5772 } else if (Buffer.isBuffer(body)) {
5779 Body.Promise = global.Promise;
5780 var invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
5781 var invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
5782 function validateName(name) {
5784 if (invalidTokenRegex.test(name) || name === "") {
5785 throw new TypeError(`${name} is not a legal HTTP header name`);
5788 function validateValue(value) {
5790 if (invalidHeaderCharRegex.test(value)) {
5791 throw new TypeError(`${value} is not a legal HTTP header value`);
5794 function find(map, name) {
5795 name = name.toLowerCase();
5796 for (const key in map) {
5797 if (key.toLowerCase() === name) {
5803 var MAP = Symbol("map");
5804 var Headers = class {
5806 let init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
5807 this[MAP] = Object.create(null);
5808 if (init instanceof Headers) {
5809 const rawHeaders = init.raw();
5810 const headerNames = Object.keys(rawHeaders);
5811 for (const headerName of headerNames) {
5812 for (const value of rawHeaders[headerName]) {
5813 this.append(headerName, value);
5820 else if (typeof init === "object") {
5821 const method = init[Symbol.iterator];
5822 if (method != null) {
5823 if (typeof method !== "function") {
5824 throw new TypeError("Header pairs must be iterable");
5827 for (const pair of init) {
5828 if (typeof pair !== "object" || typeof pair[Symbol.iterator] !== "function") {
5829 throw new TypeError("Each header pair must be iterable");
5831 pairs.push(Array.from(pair));
5833 for (const pair of pairs) {
5834 if (pair.length !== 2) {
5835 throw new TypeError("Each header pair must be a name/value tuple");
5837 this.append(pair[0], pair[1]);
5840 for (const key of Object.keys(init)) {
5841 const value = init[key];
5842 this.append(key, value);
5846 throw new TypeError("Provided initializer must be an object");
5852 const key = find(this[MAP], name);
5853 if (key === void 0) {
5856 return this[MAP][key].join(", ");
5859 let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0;
5860 let pairs = getHeaders(this);
5862 while (i < pairs.length) {
5863 var _pairs$i = pairs[i];
5864 const name = _pairs$i[0], value = _pairs$i[1];
5865 callback.call(thisArg, value, name, this);
5866 pairs = getHeaders(this);
5874 validateValue(value);
5875 const key = find(this[MAP], name);
5876 this[MAP][key !== void 0 ? key : name] = [value];
5878 append(name, value) {
5882 validateValue(value);
5883 const key = find(this[MAP], name);
5884 if (key !== void 0) {
5885 this[MAP][key].push(value);
5887 this[MAP][name] = [value];
5893 return find(this[MAP], name) !== void 0;
5898 const key = find(this[MAP], name);
5899 if (key !== void 0) {
5900 delete this[MAP][key];
5907 return createHeadersIterator(this, "key");
5910 return createHeadersIterator(this, "value");
5912 [Symbol.iterator]() {
5913 return createHeadersIterator(this, "key+value");
5916 Headers.prototype.entries = Headers.prototype[Symbol.iterator];
5917 Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
5923 Object.defineProperties(Headers.prototype, {
5924 get: {enumerable: true},
5925 forEach: {enumerable: true},
5926 set: {enumerable: true},
5927 append: {enumerable: true},
5928 has: {enumerable: true},
5929 delete: {enumerable: true},
5930 keys: {enumerable: true},
5931 values: {enumerable: true},
5932 entries: {enumerable: true}
5934 function getHeaders(headers) {
5935 let kind = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "key+value";
5936 const keys = Object.keys(headers[MAP]).sort();
5937 return keys.map(kind === "key" ? function(k) {
5938 return k.toLowerCase();
5939 } : kind === "value" ? function(k) {
5940 return headers[MAP][k].join(", ");
5942 return [k.toLowerCase(), headers[MAP][k].join(", ")];
5945 var INTERNAL = Symbol("internal");
5946 function createHeadersIterator(target, kind) {
5947 const iterator = Object.create(HeadersIteratorPrototype);
5948 iterator[INTERNAL] = {
5955 var HeadersIteratorPrototype = Object.setPrototypeOf({
5957 if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
5958 throw new TypeError("Value of `this` is not a HeadersIterator");
5960 var _INTERNAL = this[INTERNAL];
5961 const target = _INTERNAL.target, kind = _INTERNAL.kind, index = _INTERNAL.index;
5962 const values = getHeaders(target, kind);
5963 const len = values.length;
5970 this[INTERNAL].index = index + 1;
5972 value: values[index],
5976 }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
5977 Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
5978 value: "HeadersIterator",
5983 function exportNodeCompatibleHeaders(headers) {
5984 const obj = Object.assign({__proto__: null}, headers[MAP]);
5985 const hostHeaderKey = find(headers[MAP], "Host");
5986 if (hostHeaderKey !== void 0) {
5987 obj[hostHeaderKey] = obj[hostHeaderKey][0];
5991 function createHeadersLenient(obj) {
5992 const headers = new Headers();
5993 for (const name of Object.keys(obj)) {
5994 if (invalidTokenRegex.test(name)) {
5997 if (Array.isArray(obj[name])) {
5998 for (const val of obj[name]) {
5999 if (invalidHeaderCharRegex.test(val)) {
6002 if (headers[MAP][name] === void 0) {
6003 headers[MAP][name] = [val];
6005 headers[MAP][name].push(val);
6008 } else if (!invalidHeaderCharRegex.test(obj[name])) {
6009 headers[MAP][name] = [obj[name]];
6014 var INTERNALS$1 = Symbol("Response internals");
6015 var STATUS_CODES = import_http.default.STATUS_CODES;
6016 var Response = class {
6018 let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
6019 let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
6020 Body.call(this, body, opts);
6021 const status = opts.status || 200;
6022 const headers = new Headers(opts.headers);
6023 if (body != null && !headers.has("Content-Type")) {
6024 const contentType = extractContentType(body);
6026 headers.append("Content-Type", contentType);
6029 this[INTERNALS$1] = {
6032 statusText: opts.statusText || STATUS_CODES[status],
6034 counter: opts.counter
6038 return this[INTERNALS$1].url || "";
6041 return this[INTERNALS$1].status;
6044 return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
6047 return this[INTERNALS$1].counter > 0;
6050 return this[INTERNALS$1].statusText;
6053 return this[INTERNALS$1].headers;
6056 return new Response(clone(this), {
6058 status: this.status,
6059 statusText: this.statusText,
6060 headers: this.headers,
6062 redirected: this.redirected
6066 Body.mixIn(Response.prototype);
6067 Object.defineProperties(Response.prototype, {
6068 url: {enumerable: true},
6069 status: {enumerable: true},
6070 ok: {enumerable: true},
6071 redirected: {enumerable: true},
6072 statusText: {enumerable: true},
6073 headers: {enumerable: true},
6074 clone: {enumerable: true}
6076 Object.defineProperty(Response.prototype, Symbol.toStringTag, {
6082 var INTERNALS$2 = Symbol("Request internals");
6083 var parse_url = import_url.default.parse;
6084 var format_url = import_url.default.format;
6085 var streamDestructionSupported = "destroy" in import_stream.default.Readable.prototype;
6086 function isRequest(input) {
6087 return typeof input === "object" && typeof input[INTERNALS$2] === "object";
6089 function isAbortSignal(signal) {
6090 const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal);
6091 return !!(proto && proto.constructor.name === "AbortSignal");
6093 var Request = class {
6094 constructor(input) {
6095 let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
6097 if (!isRequest(input)) {
6098 if (input && input.href) {
6099 parsedURL = parse_url(input.href);
6101 parsedURL = parse_url(`${input}`);
6105 parsedURL = parse_url(input.url);
6107 let method = init.method || input.method || "GET";
6108 method = method.toUpperCase();
6109 if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
6110 throw new TypeError("Request with GET/HEAD method cannot have body");
6112 let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
6113 Body.call(this, inputBody, {
6114 timeout: init.timeout || input.timeout || 0,
6115 size: init.size || input.size || 0
6117 const headers = new Headers(init.headers || input.headers || {});
6118 if (inputBody != null && !headers.has("Content-Type")) {
6119 const contentType = extractContentType(inputBody);
6121 headers.append("Content-Type", contentType);
6124 let signal = isRequest(input) ? input.signal : null;
6125 if ("signal" in init)
6126 signal = init.signal;
6127 if (signal != null && !isAbortSignal(signal)) {
6128 throw new TypeError("Expected signal to be an instanceof AbortSignal");
6130 this[INTERNALS$2] = {
6132 redirect: init.redirect || input.redirect || "follow",
6137 this.follow = init.follow !== void 0 ? init.follow : input.follow !== void 0 ? input.follow : 20;
6138 this.compress = init.compress !== void 0 ? init.compress : input.compress !== void 0 ? input.compress : true;
6139 this.counter = init.counter || input.counter || 0;
6140 this.agent = init.agent || input.agent;
6143 return this[INTERNALS$2].method;
6146 return format_url(this[INTERNALS$2].parsedURL);
6149 return this[INTERNALS$2].headers;
6152 return this[INTERNALS$2].redirect;
6155 return this[INTERNALS$2].signal;
6158 return new Request(this);
6161 Body.mixIn(Request.prototype);
6162 Object.defineProperty(Request.prototype, Symbol.toStringTag, {
6168 Object.defineProperties(Request.prototype, {
6169 method: {enumerable: true},
6170 url: {enumerable: true},
6171 headers: {enumerable: true},
6172 redirect: {enumerable: true},
6173 clone: {enumerable: true},
6174 signal: {enumerable: true}
6176 function getNodeRequestOptions(request) {
6177 const parsedURL = request[INTERNALS$2].parsedURL;
6178 const headers = new Headers(request[INTERNALS$2].headers);
6179 if (!headers.has("Accept")) {
6180 headers.set("Accept", "*/*");
6182 if (!parsedURL.protocol || !parsedURL.hostname) {
6183 throw new TypeError("Only absolute URLs are supported");
6185 if (!/^https?:$/.test(parsedURL.protocol)) {
6186 throw new TypeError("Only HTTP(S) protocols are supported");
6188 if (request.signal && request.body instanceof import_stream.default.Readable && !streamDestructionSupported) {
6189 throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");
6191 let contentLengthValue = null;
6192 if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
6193 contentLengthValue = "0";
6195 if (request.body != null) {
6196 const totalBytes = getTotalBytes(request);
6197 if (typeof totalBytes === "number") {
6198 contentLengthValue = String(totalBytes);
6201 if (contentLengthValue) {
6202 headers.set("Content-Length", contentLengthValue);
6204 if (!headers.has("User-Agent")) {
6205 headers.set("User-Agent", "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)");
6207 if (request.compress && !headers.has("Accept-Encoding")) {
6208 headers.set("Accept-Encoding", "gzip,deflate");
6210 let agent = request.agent;
6211 if (typeof agent === "function") {
6212 agent = agent(parsedURL);
6214 if (!headers.has("Connection") && !agent) {
6215 headers.set("Connection", "close");
6217 return Object.assign({}, parsedURL, {
6218 method: request.method,
6219 headers: exportNodeCompatibleHeaders(headers),
6223 function AbortError(message) {
6224 Error.call(this, message);
6225 this.type = "aborted";
6226 this.message = message;
6227 Error.captureStackTrace(this, this.constructor);
6229 AbortError.prototype = Object.create(Error.prototype);
6230 AbortError.prototype.constructor = AbortError;
6231 AbortError.prototype.name = "AbortError";
6232 var PassThrough$1 = import_stream.default.PassThrough;
6233 var resolve_url = import_url.default.resolve;
6234 function fetch(url, opts) {
6235 if (!fetch.Promise) {
6236 throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
6238 Body.Promise = fetch.Promise;
6239 return new fetch.Promise(function(resolve, reject) {
6240 const request = new Request(url, opts);
6241 const options = getNodeRequestOptions(request);
6242 const send = (options.protocol === "https:" ? import_https.default : import_http.default).request;
6243 const signal = request.signal;
6244 let response = null;
6245 const abort = function abort2() {
6246 let error = new AbortError("The user aborted a request.");
6248 if (request.body && request.body instanceof import_stream.default.Readable) {
6249 request.body.destroy(error);
6251 if (!response || !response.body)
6253 response.body.emit("error", error);
6255 if (signal && signal.aborted) {
6259 const abortAndFinalize = function abortAndFinalize2() {
6263 const req = send(options);
6266 signal.addEventListener("abort", abortAndFinalize);
6268 function finalize() {
6271 signal.removeEventListener("abort", abortAndFinalize);
6272 clearTimeout(reqTimeout);
6274 if (request.timeout) {
6275 req.once("socket", function(socket) {
6276 reqTimeout = setTimeout(function() {
6277 reject(new FetchError(`network timeout at: ${request.url}`, "request-timeout"));
6279 }, request.timeout);
6282 req.on("error", function(err) {
6283 reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
6286 req.on("response", function(res) {
6287 clearTimeout(reqTimeout);
6288 const headers = createHeadersLenient(res.headers);
6289 if (fetch.isRedirect(res.statusCode)) {
6290 const location = headers.get("Location");
6291 const locationURL = location === null ? null : resolve_url(request.url, location);
6292 switch (request.redirect) {
6294 reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
6298 if (locationURL !== null) {
6300 headers.set("Location", locationURL);
6307 if (locationURL === null) {
6310 if (request.counter >= request.follow) {
6311 reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
6315 const requestOpts = {
6316 headers: new Headers(request.headers),
6317 follow: request.follow,
6318 counter: request.counter + 1,
6319 agent: request.agent,
6320 compress: request.compress,
6321 method: request.method,
6323 signal: request.signal,
6324 timeout: request.timeout,
6327 if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
6328 reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
6332 if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === "POST") {
6333 requestOpts.method = "GET";
6334 requestOpts.body = void 0;
6335 requestOpts.headers.delete("content-length");
6337 resolve(fetch(new Request(locationURL, requestOpts)));
6342 res.once("end", function() {
6344 signal.removeEventListener("abort", abortAndFinalize);
6346 let body = res.pipe(new PassThrough$1());
6347 const response_options = {
6349 status: res.statusCode,
6350 statusText: res.statusMessage,
6353 timeout: request.timeout,
6354 counter: request.counter
6356 const codings = headers.get("Content-Encoding");
6357 if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
6358 response = new Response(body, response_options);
6362 const zlibOptions = {
6363 flush: import_zlib.default.Z_SYNC_FLUSH,
6364 finishFlush: import_zlib.default.Z_SYNC_FLUSH
6366 if (codings == "gzip" || codings == "x-gzip") {
6367 body = body.pipe(import_zlib.default.createGunzip(zlibOptions));
6368 response = new Response(body, response_options);
6372 if (codings == "deflate" || codings == "x-deflate") {
6373 const raw = res.pipe(new PassThrough$1());
6374 raw.once("data", function(chunk) {
6375 if ((chunk[0] & 15) === 8) {
6376 body = body.pipe(import_zlib.default.createInflate());
6378 body = body.pipe(import_zlib.default.createInflateRaw());
6380 response = new Response(body, response_options);
6385 if (codings == "br" && typeof import_zlib.default.createBrotliDecompress === "function") {
6386 body = body.pipe(import_zlib.default.createBrotliDecompress());
6387 response = new Response(body, response_options);
6391 response = new Response(body, response_options);
6394 writeToStream(req, request);
6397 fetch.isRedirect = function(code) {
6398 return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
6400 fetch.Promise = global.Promise;
6401 var lib_default = fetch;
6404 // node_modules/picomatch/lib/constants.js
6405 var require_constants = __commonJS((exports2, module2) => {
6407 var path = require("path");
6408 var WIN_SLASH = "\\\\/";
6409 var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
6410 var DOT_LITERAL = "\\.";
6411 var PLUS_LITERAL = "\\+";
6412 var QMARK_LITERAL = "\\?";
6413 var SLASH_LITERAL = "\\/";
6414 var ONE_CHAR = "(?=.)";
6416 var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
6417 var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
6418 var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
6419 var NO_DOT = `(?!${DOT_LITERAL})`;
6420 var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
6421 var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
6422 var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
6423 var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
6424 var STAR = `${QMARK}*?`;
6442 var WINDOWS_CHARS = {
6444 SLASH_LITERAL: `[${WIN_SLASH}]`,
6445 QMARK: WIN_NO_SLASH,
6446 STAR: `${WIN_NO_SLASH}*?`,
6447 DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
6448 NO_DOT: `(?!${DOT_LITERAL})`,
6449 NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
6450 NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
6451 NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
6452 QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
6453 START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
6454 END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
6456 var POSIX_REGEX_SOURCE = {
6459 ascii: "\\x00-\\x7F",
6461 cntrl: "\\x00-\\x1F\\x7F",
6463 graph: "\\x21-\\x7E",
6465 print: "\\x20-\\x7E ",
6466 punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
6467 space: " \\t\\r\\n\\v\\f",
6473 MAX_LENGTH: 1024 * 64,
6475 REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
6476 REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
6477 REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
6478 REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
6479 REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
6480 REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
6488 CHAR_UPPERCASE_A: 65,
6489 CHAR_LOWERCASE_A: 97,
6490 CHAR_UPPERCASE_Z: 90,
6491 CHAR_LOWERCASE_Z: 122,
6492 CHAR_LEFT_PARENTHESES: 40,
6493 CHAR_RIGHT_PARENTHESES: 41,
6497 CHAR_BACKWARD_SLASH: 92,
6498 CHAR_CARRIAGE_RETURN: 13,
6499 CHAR_CIRCUMFLEX_ACCENT: 94,
6503 CHAR_DOUBLE_QUOTE: 34,
6505 CHAR_EXCLAMATION_MARK: 33,
6507 CHAR_FORWARD_SLASH: 47,
6508 CHAR_GRAVE_ACCENT: 96,
6510 CHAR_HYPHEN_MINUS: 45,
6511 CHAR_LEFT_ANGLE_BRACKET: 60,
6512 CHAR_LEFT_CURLY_BRACE: 123,
6513 CHAR_LEFT_SQUARE_BRACKET: 91,
6515 CHAR_NO_BREAK_SPACE: 160,
6518 CHAR_QUESTION_MARK: 63,
6519 CHAR_RIGHT_ANGLE_BRACKET: 62,
6520 CHAR_RIGHT_CURLY_BRACE: 125,
6521 CHAR_RIGHT_SQUARE_BRACKET: 93,
6523 CHAR_SINGLE_QUOTE: 39,
6526 CHAR_UNDERSCORE: 95,
6527 CHAR_VERTICAL_LINE: 124,
6528 CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
6530 extglobChars(chars) {
6532 "!": {type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})`},
6533 "?": {type: "qmark", open: "(?:", close: ")?"},
6534 "+": {type: "plus", open: "(?:", close: ")+"},
6535 "*": {type: "star", open: "(?:", close: ")*"},
6536 "@": {type: "at", open: "(?:", close: ")"}
6540 return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
6545 // node_modules/picomatch/lib/utils.js
6546 var require_utils = __commonJS((exports2) => {
6548 var path = require("path");
6549 var win32 = process.platform === "win32";
6552 REGEX_REMOVE_BACKSLASH,
6553 REGEX_SPECIAL_CHARS,
6554 REGEX_SPECIAL_CHARS_GLOBAL
6555 } = require_constants();
6556 exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
6557 exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
6558 exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
6559 exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
6560 exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
6561 exports2.removeBackslashes = (str) => {
6562 return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
6563 return match === "\\" ? "" : match;
6566 exports2.supportsLookbehinds = () => {
6567 const segs = process.version.slice(1).split(".").map(Number);
6568 if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
6573 exports2.isWindows = (options) => {
6574 if (options && typeof options.windows === "boolean") {
6575 return options.windows;
6577 return win32 === true || path.sep === "\\";
6579 exports2.escapeLast = (input, char, lastIdx) => {
6580 const idx = input.lastIndexOf(char, lastIdx);
6583 if (input[idx - 1] === "\\")
6584 return exports2.escapeLast(input, char, idx - 1);
6585 return `${input.slice(0, idx)}\\${input.slice(idx)}`;
6587 exports2.removePrefix = (input, state = {}) => {
6589 if (output.startsWith("./")) {
6590 output = output.slice(2);
6591 state.prefix = "./";
6595 exports2.wrapOutput = (input, state = {}, options = {}) => {
6596 const prepend = options.contains ? "" : "^";
6597 const append = options.contains ? "" : "$";
6598 let output = `${prepend}(?:${input})${append}`;
6599 if (state.negated === true) {
6600 output = `(?:^(?!${output}).*$)`;
6606 // node_modules/picomatch/lib/scan.js
6607 var require_scan = __commonJS((exports2, module2) => {
6609 var utils = require_utils();
6613 CHAR_BACKWARD_SLASH,
6616 CHAR_EXCLAMATION_MARK,
6618 CHAR_LEFT_CURLY_BRACE,
6619 CHAR_LEFT_PARENTHESES,
6620 CHAR_LEFT_SQUARE_BRACKET,
6623 CHAR_RIGHT_CURLY_BRACE,
6624 CHAR_RIGHT_PARENTHESES,
6625 CHAR_RIGHT_SQUARE_BRACKET
6626 } = require_constants();
6627 var isPathSeparator = (code) => {
6628 return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
6630 var depth = (token) => {
6631 if (token.isPrefix !== true) {
6632 token.depth = token.isGlobstar ? Infinity : 1;
6635 var scan = (input, options) => {
6636 const opts = options || {};
6637 const length = input.length - 1;
6638 const scanToEnd = opts.parts === true || opts.scanToEnd === true;
6646 let isBrace = false;
6647 let isBracket = false;
6649 let isExtglob = false;
6650 let isGlobstar = false;
6651 let braceEscaped = false;
6652 let backslashes = false;
6653 let negated = false;
6654 let finished = false;
6658 let token = {value: "", depth: 0, isGlob: false};
6659 const eos = () => index >= length;
6660 const peek = () => str.charCodeAt(index + 1);
6661 const advance = () => {
6663 return str.charCodeAt(++index);
6665 while (index < length) {
6668 if (code === CHAR_BACKWARD_SLASH) {
6669 backslashes = token.backslashes = true;
6671 if (code === CHAR_LEFT_CURLY_BRACE) {
6672 braceEscaped = true;
6676 if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
6678 while (eos() !== true && (code = advance())) {
6679 if (code === CHAR_BACKWARD_SLASH) {
6680 backslashes = token.backslashes = true;
6684 if (code === CHAR_LEFT_CURLY_BRACE) {
6688 if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
6689 isBrace = token.isBrace = true;
6690 isGlob = token.isGlob = true;
6692 if (scanToEnd === true) {
6697 if (braceEscaped !== true && code === CHAR_COMMA) {
6698 isBrace = token.isBrace = true;
6699 isGlob = token.isGlob = true;
6701 if (scanToEnd === true) {
6706 if (code === CHAR_RIGHT_CURLY_BRACE) {
6709 braceEscaped = false;
6710 isBrace = token.isBrace = true;
6716 if (scanToEnd === true) {
6721 if (code === CHAR_FORWARD_SLASH) {
6722 slashes.push(index);
6724 token = {value: "", depth: 0, isGlob: false};
6725 if (finished === true)
6727 if (prev === CHAR_DOT && index === start + 1) {
6731 lastIndex = index + 1;
6734 if (opts.noext !== true) {
6735 const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
6736 if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
6737 isGlob = token.isGlob = true;
6738 isExtglob = token.isExtglob = true;
6740 if (scanToEnd === true) {
6741 while (eos() !== true && (code = advance())) {
6742 if (code === CHAR_BACKWARD_SLASH) {
6743 backslashes = token.backslashes = true;
6747 if (code === CHAR_RIGHT_PARENTHESES) {
6748 isGlob = token.isGlob = true;
6758 if (code === CHAR_ASTERISK) {
6759 if (prev === CHAR_ASTERISK)
6760 isGlobstar = token.isGlobstar = true;
6761 isGlob = token.isGlob = true;
6763 if (scanToEnd === true) {
6768 if (code === CHAR_QUESTION_MARK) {
6769 isGlob = token.isGlob = true;
6771 if (scanToEnd === true) {
6776 if (code === CHAR_LEFT_SQUARE_BRACKET) {
6777 while (eos() !== true && (next = advance())) {
6778 if (next === CHAR_BACKWARD_SLASH) {
6779 backslashes = token.backslashes = true;
6783 if (next === CHAR_RIGHT_SQUARE_BRACKET) {
6784 isBracket = token.isBracket = true;
6785 isGlob = token.isGlob = true;
6787 if (scanToEnd === true) {
6794 if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
6795 negated = token.negated = true;
6799 if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
6800 isGlob = token.isGlob = true;
6801 if (scanToEnd === true) {
6802 while (eos() !== true && (code = advance())) {
6803 if (code === CHAR_LEFT_PARENTHESES) {
6804 backslashes = token.backslashes = true;
6808 if (code === CHAR_RIGHT_PARENTHESES) {
6817 if (isGlob === true) {
6819 if (scanToEnd === true) {
6825 if (opts.noext === true) {
6833 prefix = str.slice(0, start);
6834 str = str.slice(start);
6837 if (base && isGlob === true && lastIndex > 0) {
6838 base = str.slice(0, lastIndex);
6839 glob = str.slice(lastIndex);
6840 } else if (isGlob === true) {
6846 if (base && base !== "" && base !== "/" && base !== str) {
6847 if (isPathSeparator(base.charCodeAt(base.length - 1))) {
6848 base = base.slice(0, -1);
6851 if (opts.unescape === true) {
6853 glob = utils.removeBackslashes(glob);
6854 if (base && backslashes === true) {
6855 base = utils.removeBackslashes(base);
6871 if (opts.tokens === true) {
6873 if (!isPathSeparator(code)) {
6876 state.tokens = tokens;
6878 if (opts.parts === true || opts.tokens === true) {
6880 for (let idx = 0; idx < slashes.length; idx++) {
6881 const n = prevIndex ? prevIndex + 1 : start;
6882 const i = slashes[idx];
6883 const value = input.slice(n, i);
6885 if (idx === 0 && start !== 0) {
6886 tokens[idx].isPrefix = true;
6887 tokens[idx].value = prefix;
6889 tokens[idx].value = value;
6892 state.maxDepth += tokens[idx].depth;
6894 if (idx !== 0 || value !== "") {
6899 if (prevIndex && prevIndex + 1 < input.length) {
6900 const value = input.slice(prevIndex + 1);
6903 tokens[tokens.length - 1].value = value;
6904 depth(tokens[tokens.length - 1]);
6905 state.maxDepth += tokens[tokens.length - 1].depth;
6908 state.slashes = slashes;
6909 state.parts = parts;
6913 module2.exports = scan;
6916 // node_modules/picomatch/lib/parse.js
6917 var require_parse = __commonJS((exports2, module2) => {
6919 var constants = require_constants();
6920 var utils = require_utils();
6924 REGEX_NON_SPECIAL_CHARS,
6925 REGEX_SPECIAL_CHARS_BACKREF,
6928 var expandRange = (args, options) => {
6929 if (typeof options.expandRange === "function") {
6930 return options.expandRange(...args, options);
6933 const value = `[${args.join("-")}]`;
6937 return args.map((v) => utils.escapeRegex(v)).join("..");
6941 var syntaxError = (type, char) => {
6942 return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
6944 var parse = (input, options) => {
6945 if (typeof input !== "string") {
6946 throw new TypeError("Expected a string");
6948 input = REPLACEMENTS[input] || input;
6949 const opts = {...options};
6950 const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
6951 let len = input.length;
6953 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
6955 const bos = {type: "bos", value: "", output: opts.prepend || ""};
6956 const tokens = [bos];
6957 const capture = opts.capture ? "" : "?:";
6958 const win32 = utils.isWindows(options);
6959 const PLATFORM_CHARS = constants.globChars(win32);
6960 const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
6975 const globstar = (opts2) => {
6976 return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
6978 const nodot = opts.dot ? "" : NO_DOT;
6979 const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
6980 let star = opts.bash === true ? globstar(opts) : STAR;
6984 if (typeof opts.noext === "boolean") {
6985 opts.noextglob = opts.noext;
6991 dot: opts.dot === true,
7004 input = utils.removePrefix(input, state);
7006 const extglobs = [];
7011 const eos = () => state.index === len - 1;
7012 const peek = state.peek = (n = 1) => input[state.index + n];
7013 const advance = state.advance = () => input[++state.index];
7014 const remaining = () => input.slice(state.index + 1);
7015 const consume = (value2 = "", num = 0) => {
7016 state.consumed += value2;
7019 const append = (token) => {
7020 state.output += token.output != null ? token.output : token.value;
7021 consume(token.value);
7023 const negate = () => {
7025 while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
7030 if (count % 2 === 0) {
7033 state.negated = true;
7037 const increment = (type) => {
7041 const decrement = (type) => {
7045 const push = (tok) => {
7046 if (prev.type === "globstar") {
7047 const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
7048 const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
7049 if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
7050 state.output = state.output.slice(0, -prev.output.length);
7054 state.output += prev.output;
7057 if (extglobs.length && tok.type !== "paren" && !EXTGLOB_CHARS[tok.value]) {
7058 extglobs[extglobs.length - 1].inner += tok.value;
7060 if (tok.value || tok.output)
7062 if (prev && prev.type === "text" && tok.type === "text") {
7063 prev.value += tok.value;
7064 prev.output = (prev.output || "") + tok.value;
7071 const extglobOpen = (type, value2) => {
7072 const token = {...EXTGLOB_CHARS[value2], conditions: 1, inner: ""};
7074 token.parens = state.parens;
7075 token.output = state.output;
7076 const output = (opts.capture ? "(" : "") + token.open;
7077 increment("parens");
7078 push({type, value: value2, output: state.output ? "" : ONE_CHAR});
7079 push({type: "paren", extglob: true, value: advance(), output});
7080 extglobs.push(token);
7082 const extglobClose = (token) => {
7083 let output = token.close + (opts.capture ? ")" : "");
7084 if (token.type === "negate") {
7085 let extglobStar = star;
7086 if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
7087 extglobStar = globstar(opts);
7089 if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
7090 output = token.close = `)$))${extglobStar}`;
7092 if (token.prev.type === "bos" && eos()) {
7093 state.negatedExtglob = true;
7096 push({type: "paren", extglob: true, value, output});
7097 decrement("parens");
7099 if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
7100 let backslashes = false;
7101 let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
7102 if (first === "\\") {
7106 if (first === "?") {
7108 return esc + first + (rest ? QMARK.repeat(rest.length) : "");
7111 return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
7113 return QMARK.repeat(chars.length);
7115 if (first === ".") {
7116 return DOT_LITERAL.repeat(chars.length);
7118 if (first === "*") {
7120 return esc + first + (rest ? star : "");
7124 return esc ? m : `\\${m}`;
7126 if (backslashes === true) {
7127 if (opts.unescape === true) {
7128 output = output.replace(/\\/g, "");
7130 output = output.replace(/\\+/g, (m) => {
7131 return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
7135 if (output === input && opts.contains === true) {
7136 state.output = input;
7139 state.output = utils.wrapOutput(output, state, options);
7144 if (value === "\0") {
7147 if (value === "\\") {
7148 const next = peek();
7149 if (next === "/" && opts.bash !== true) {
7152 if (next === "." || next === ";") {
7157 push({type: "text", value});
7160 const match = /^\\+/.exec(remaining());
7162 if (match && match[0].length > 2) {
7163 slashes = match[0].length;
7164 state.index += slashes;
7165 if (slashes % 2 !== 0) {
7169 if (opts.unescape === true) {
7170 value = advance() || "";
7172 value += advance() || "";
7174 if (state.brackets === 0) {
7175 push({type: "text", value});
7179 if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
7180 if (opts.posix !== false && value === ":") {
7181 const inner = prev.value.slice(1);
7182 if (inner.includes("[")) {
7184 if (inner.includes(":")) {
7185 const idx = prev.value.lastIndexOf("[");
7186 const pre = prev.value.slice(0, idx);
7187 const rest2 = prev.value.slice(idx + 2);
7188 const posix = POSIX_REGEX_SOURCE[rest2];
7190 prev.value = pre + posix;
7191 state.backtrack = true;
7193 if (!bos.output && tokens.indexOf(prev) === 1) {
7194 bos.output = ONE_CHAR;
7201 if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
7202 value = `\\${value}`;
7204 if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
7205 value = `\\${value}`;
7207 if (opts.posix === true && value === "!" && prev.value === "[") {
7210 prev.value += value;
7214 if (state.quotes === 1 && value !== '"') {
7215 value = utils.escapeRegex(value);
7216 prev.value += value;
7220 if (value === '"') {
7221 state.quotes = state.quotes === 1 ? 0 : 1;
7222 if (opts.keepQuotes === true) {
7223 push({type: "text", value});
7227 if (value === "(") {
7228 increment("parens");
7229 push({type: "paren", value});
7232 if (value === ")") {
7233 if (state.parens === 0 && opts.strictBrackets === true) {
7234 throw new SyntaxError(syntaxError("opening", "("));
7236 const extglob = extglobs[extglobs.length - 1];
7237 if (extglob && state.parens === extglob.parens + 1) {
7238 extglobClose(extglobs.pop());
7241 push({type: "paren", value, output: state.parens ? ")" : "\\)"});
7242 decrement("parens");
7245 if (value === "[") {
7246 if (opts.nobracket === true || !remaining().includes("]")) {
7247 if (opts.nobracket !== true && opts.strictBrackets === true) {
7248 throw new SyntaxError(syntaxError("closing", "]"));
7250 value = `\\${value}`;
7252 increment("brackets");
7254 push({type: "bracket", value});
7257 if (value === "]") {
7258 if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
7259 push({type: "text", value, output: `\\${value}`});
7262 if (state.brackets === 0) {
7263 if (opts.strictBrackets === true) {
7264 throw new SyntaxError(syntaxError("opening", "["));
7266 push({type: "text", value, output: `\\${value}`});
7269 decrement("brackets");
7270 const prevValue = prev.value.slice(1);
7271 if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
7272 value = `/${value}`;
7274 prev.value += value;
7276 if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
7279 const escaped = utils.escapeRegex(prev.value);
7280 state.output = state.output.slice(0, -prev.value.length);
7281 if (opts.literalBrackets === true) {
7282 state.output += escaped;
7283 prev.value = escaped;
7286 prev.value = `(${capture}${escaped}|${prev.value})`;
7287 state.output += prev.value;
7290 if (value === "{" && opts.nobrace !== true) {
7291 increment("braces");
7296 outputIndex: state.output.length,
7297 tokensIndex: state.tokens.length
7303 if (value === "}") {
7304 const brace = braces[braces.length - 1];
7305 if (opts.nobrace === true || !brace) {
7306 push({type: "text", value, output: value});
7310 if (brace.dots === true) {
7311 const arr = tokens.slice();
7313 for (let i = arr.length - 1; i >= 0; i--) {
7315 if (arr[i].type === "brace") {
7318 if (arr[i].type !== "dots") {
7319 range.unshift(arr[i].value);
7322 output = expandRange(range, opts);
7323 state.backtrack = true;
7325 if (brace.comma !== true && brace.dots !== true) {
7326 const out = state.output.slice(0, brace.outputIndex);
7327 const toks = state.tokens.slice(brace.tokensIndex);
7328 brace.value = brace.output = "\\{";
7329 value = output = "\\}";
7331 for (const t of toks) {
7332 state.output += t.output || t.value;
7335 push({type: "brace", value, output});
7336 decrement("braces");
7340 if (value === "|") {
7341 if (extglobs.length > 0) {
7342 extglobs[extglobs.length - 1].conditions++;
7344 push({type: "text", value});
7347 if (value === ",") {
7349 const brace = braces[braces.length - 1];
7350 if (brace && stack[stack.length - 1] === "braces") {
7354 push({type: "comma", value, output});
7357 if (value === "/") {
7358 if (prev.type === "dot" && state.index === state.start + 1) {
7359 state.start = state.index + 1;
7360 state.consumed = "";
7366 push({type: "slash", value, output: SLASH_LITERAL});
7369 if (value === ".") {
7370 if (state.braces > 0 && prev.type === "dot") {
7371 if (prev.value === ".")
7372 prev.output = DOT_LITERAL;
7373 const brace = braces[braces.length - 1];
7375 prev.output += value;
7376 prev.value += value;
7380 if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
7381 push({type: "text", value, output: DOT_LITERAL});
7384 push({type: "dot", value, output: DOT_LITERAL});
7387 if (value === "?") {
7388 const isGroup = prev && prev.value === "(";
7389 if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7390 extglobOpen("qmark", value);
7393 if (prev && prev.type === "paren") {
7394 const next = peek();
7396 if (next === "<" && !utils.supportsLookbehinds()) {
7397 throw new Error("Node.js v10 or higher is required for regex lookbehinds");
7399 if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
7400 output = `\\${value}`;
7402 push({type: "text", value, output});
7405 if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
7406 push({type: "qmark", value, output: QMARK_NO_DOT});
7409 push({type: "qmark", value, output: QMARK});
7412 if (value === "!") {
7413 if (opts.noextglob !== true && peek() === "(") {
7414 if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
7415 extglobOpen("negate", value);
7419 if (opts.nonegate !== true && state.index === 0) {
7424 if (value === "+") {
7425 if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7426 extglobOpen("plus", value);
7429 if (prev && prev.value === "(" || opts.regex === false) {
7430 push({type: "plus", value, output: PLUS_LITERAL});
7433 if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
7434 push({type: "plus", value});
7437 push({type: "plus", value: PLUS_LITERAL});
7440 if (value === "@") {
7441 if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7442 push({type: "at", extglob: true, value, output: ""});
7445 push({type: "text", value});
7448 if (value !== "*") {
7449 if (value === "$" || value === "^") {
7450 value = `\\${value}`;
7452 const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
7455 state.index += match[0].length;
7457 push({type: "text", value});
7460 if (prev && (prev.type === "globstar" || prev.star === true)) {
7463 prev.value += value;
7465 state.backtrack = true;
7466 state.globstar = true;
7470 let rest = remaining();
7471 if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
7472 extglobOpen("star", value);
7475 if (prev.type === "star") {
7476 if (opts.noglobstar === true) {
7480 const prior = prev.prev;
7481 const before = prior.prev;
7482 const isStart = prior.type === "slash" || prior.type === "bos";
7483 const afterStar = before && (before.type === "star" || before.type === "globstar");
7484 if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
7485 push({type: "star", value, output: ""});
7488 const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
7489 const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
7490 if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
7491 push({type: "star", value, output: ""});
7494 while (rest.slice(0, 3) === "/**") {
7495 const after = input[state.index + 4];
7496 if (after && after !== "/") {
7499 rest = rest.slice(3);
7502 if (prior.type === "bos" && eos()) {
7503 prev.type = "globstar";
7504 prev.value += value;
7505 prev.output = globstar(opts);
7506 state.output = prev.output;
7507 state.globstar = true;
7511 if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
7512 state.output = state.output.slice(0, -(prior.output + prev.output).length);
7513 prior.output = `(?:${prior.output}`;
7514 prev.type = "globstar";
7515 prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
7516 prev.value += value;
7517 state.globstar = true;
7518 state.output += prior.output + prev.output;
7522 if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
7523 const end = rest[1] !== void 0 ? "|$" : "";
7524 state.output = state.output.slice(0, -(prior.output + prev.output).length);
7525 prior.output = `(?:${prior.output}`;
7526 prev.type = "globstar";
7527 prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
7528 prev.value += value;
7529 state.output += prior.output + prev.output;
7530 state.globstar = true;
7531 consume(value + advance());
7532 push({type: "slash", value: "/", output: ""});
7535 if (prior.type === "bos" && rest[0] === "/") {
7536 prev.type = "globstar";
7537 prev.value += value;
7538 prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
7539 state.output = prev.output;
7540 state.globstar = true;
7541 consume(value + advance());
7542 push({type: "slash", value: "/", output: ""});
7545 state.output = state.output.slice(0, -prev.output.length);
7546 prev.type = "globstar";
7547 prev.output = globstar(opts);
7548 prev.value += value;
7549 state.output += prev.output;
7550 state.globstar = true;
7554 const token = {type: "star", value, output: star};
7555 if (opts.bash === true) {
7556 token.output = ".*?";
7557 if (prev.type === "bos" || prev.type === "slash") {
7558 token.output = nodot + token.output;
7563 if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
7564 token.output = value;
7568 if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
7569 if (prev.type === "dot") {
7570 state.output += NO_DOT_SLASH;
7571 prev.output += NO_DOT_SLASH;
7572 } else if (opts.dot === true) {
7573 state.output += NO_DOTS_SLASH;
7574 prev.output += NO_DOTS_SLASH;
7576 state.output += nodot;
7577 prev.output += nodot;
7579 if (peek() !== "*") {
7580 state.output += ONE_CHAR;
7581 prev.output += ONE_CHAR;
7586 while (state.brackets > 0) {
7587 if (opts.strictBrackets === true)
7588 throw new SyntaxError(syntaxError("closing", "]"));
7589 state.output = utils.escapeLast(state.output, "[");
7590 decrement("brackets");
7592 while (state.parens > 0) {
7593 if (opts.strictBrackets === true)
7594 throw new SyntaxError(syntaxError("closing", ")"));
7595 state.output = utils.escapeLast(state.output, "(");
7596 decrement("parens");
7598 while (state.braces > 0) {
7599 if (opts.strictBrackets === true)
7600 throw new SyntaxError(syntaxError("closing", "}"));
7601 state.output = utils.escapeLast(state.output, "{");
7602 decrement("braces");
7604 if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
7605 push({type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?`});
7607 if (state.backtrack === true) {
7609 for (const token of state.tokens) {
7610 state.output += token.output != null ? token.output : token.value;
7612 state.output += token.suffix;
7618 parse.fastpaths = (input, options) => {
7619 const opts = {...options};
7620 const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
7621 const len = input.length;
7623 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
7625 input = REPLACEMENTS[input] || input;
7626 const win32 = utils.isWindows(options);
7637 } = constants.globChars(win32);
7638 const nodot = opts.dot ? NO_DOTS : NO_DOT;
7639 const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
7640 const capture = opts.capture ? "" : "?:";
7641 const state = {negated: false, prefix: ""};
7642 let star = opts.bash === true ? ".*?" : STAR;
7646 const globstar = (opts2) => {
7647 if (opts2.noglobstar === true)
7649 return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
7651 const create = (str) => {
7654 return `${nodot}${ONE_CHAR}${star}`;
7656 return `${DOT_LITERAL}${ONE_CHAR}${star}`;
7658 return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
7660 return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
7662 return nodot + globstar(opts);
7664 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
7666 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
7668 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
7670 const match = /^(.*?)\.(\w+)$/.exec(str);
7673 const source2 = create(match[1]);
7676 return source2 + DOT_LITERAL + match[2];
7680 const output = utils.removePrefix(input, state);
7681 let source = create(output);
7682 if (source && opts.strictSlashes !== true) {
7683 source += `${SLASH_LITERAL}?`;
7687 module2.exports = parse;
7690 // node_modules/picomatch/lib/picomatch.js
7691 var require_picomatch = __commonJS((exports2, module2) => {
7693 var path = require("path");
7694 var scan = require_scan();
7695 var parse = require_parse();
7696 var utils = require_utils();
7697 var constants = require_constants();
7698 var isObject3 = (val) => val && typeof val === "object" && !Array.isArray(val);
7699 var picomatch = (glob, options, returnState = false) => {
7700 if (Array.isArray(glob)) {
7701 const fns = glob.map((input) => picomatch(input, options, returnState));
7702 const arrayMatcher = (str) => {
7703 for (const isMatch of fns) {
7704 const state2 = isMatch(str);
7710 return arrayMatcher;
7712 const isState = isObject3(glob) && glob.tokens && glob.input;
7713 if (glob === "" || typeof glob !== "string" && !isState) {
7714 throw new TypeError("Expected pattern to be a non-empty string");
7716 const opts = options || {};
7717 const posix = utils.isWindows(options);
7718 const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
7719 const state = regex.state;
7721 let isIgnored = () => false;
7723 const ignoreOpts = {...options, ignore: null, onMatch: null, onResult: null};
7724 isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
7726 const matcher = (input, returnObject = false) => {
7727 const {isMatch, match, output} = picomatch.test(input, regex, options, {glob, posix});
7728 const result = {glob, state, regex, posix, input, output, match, isMatch};
7729 if (typeof opts.onResult === "function") {
7730 opts.onResult(result);
7732 if (isMatch === false) {
7733 result.isMatch = false;
7734 return returnObject ? result : false;
7736 if (isIgnored(input)) {
7737 if (typeof opts.onIgnore === "function") {
7738 opts.onIgnore(result);
7740 result.isMatch = false;
7741 return returnObject ? result : false;
7743 if (typeof opts.onMatch === "function") {
7744 opts.onMatch(result);
7746 return returnObject ? result : true;
7749 matcher.state = state;
7753 picomatch.test = (input, regex, options, {glob, posix} = {}) => {
7754 if (typeof input !== "string") {
7755 throw new TypeError("Expected input to be a string");
7758 return {isMatch: false, output: ""};
7760 const opts = options || {};
7761 const format = opts.format || (posix ? utils.toPosixSlashes : null);
7762 let match = input === glob;
7763 let output = match && format ? format(input) : input;
7764 if (match === false) {
7765 output = format ? format(input) : input;
7766 match = output === glob;
7768 if (match === false || opts.capture === true) {
7769 if (opts.matchBase === true || opts.basename === true) {
7770 match = picomatch.matchBase(input, regex, options, posix);
7772 match = regex.exec(output);
7775 return {isMatch: Boolean(match), match, output};
7777 picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
7778 const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
7779 return regex.test(path.basename(input));
7781 picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
7782 picomatch.parse = (pattern, options) => {
7783 if (Array.isArray(pattern))
7784 return pattern.map((p) => picomatch.parse(p, options));
7785 return parse(pattern, {...options, fastpaths: false});
7787 picomatch.scan = (input, options) => scan(input, options);
7788 picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => {
7789 if (returnOutput === true) {
7790 return parsed.output;
7792 const opts = options || {};
7793 const prepend = opts.contains ? "" : "^";
7794 const append = opts.contains ? "" : "$";
7795 let source = `${prepend}(?:${parsed.output})${append}`;
7796 if (parsed && parsed.negated === true) {
7797 source = `^(?!${source}).*$`;
7799 const regex = picomatch.toRegex(source, options);
7800 if (returnState === true) {
7801 regex.state = parsed;
7805 picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => {
7806 if (!input || typeof input !== "string") {
7807 throw new TypeError("Expected a non-empty string");
7809 const opts = options || {};
7810 let parsed = {negated: false, fastpaths: true};
7813 if (input.startsWith("./")) {
7814 input = input.slice(2);
7815 prefix = parsed.prefix = "./";
7817 if (opts.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
7818 output = parse.fastpaths(input, options);
7820 if (output === void 0) {
7821 parsed = parse(input, options);
7822 parsed.prefix = prefix + (parsed.prefix || "");
7824 parsed.output = output;
7826 return picomatch.compileRe(parsed, options, returnOutput, returnState);
7828 picomatch.toRegex = (source, options) => {
7830 const opts = options || {};
7831 return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
7833 if (options && options.debug === true)
7838 picomatch.constants = constants;
7839 module2.exports = picomatch;
7842 // node_modules/picomatch/index.js
7843 var require_picomatch2 = __commonJS((exports2, module2) => {
7845 module2.exports = require_picomatch();
7848 // node_modules/readdirp/index.js
7849 var require_readdirp = __commonJS((exports2, module2) => {
7851 var fs = require("fs");
7852 var {Readable} = require("stream");
7853 var sysPath = require("path");
7854 var {promisify} = require("util");
7855 var picomatch = require_picomatch2();
7856 var readdir = promisify(fs.readdir);
7857 var stat = promisify(fs.stat);
7858 var lstat = promisify(fs.lstat);
7859 var realpath = promisify(fs.realpath);
7861 var NORMAL_FLOW_ERRORS = new Set(["ENOENT", "EPERM", "EACCES", "ELOOP"]);
7862 var FILE_TYPE = "files";
7863 var DIR_TYPE = "directories";
7864 var FILE_DIR_TYPE = "files_directories";
7865 var EVERYTHING_TYPE = "all";
7866 var ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
7867 var isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);
7868 var normalizeFilter = (filter) => {
7869 if (filter === void 0)
7871 if (typeof filter === "function")
7873 if (typeof filter === "string") {
7874 const glob = picomatch(filter.trim());
7875 return (entry) => glob(entry.basename);
7877 if (Array.isArray(filter)) {
7878 const positive = [];
7879 const negative = [];
7880 for (const item of filter) {
7881 const trimmed = item.trim();
7882 if (trimmed.charAt(0) === BANG) {
7883 negative.push(picomatch(trimmed.slice(1)));
7885 positive.push(picomatch(trimmed));
7888 if (negative.length > 0) {
7889 if (positive.length > 0) {
7890 return (entry) => positive.some((f) => f(entry.basename)) && !negative.some((f) => f(entry.basename));
7892 return (entry) => !negative.some((f) => f(entry.basename));
7894 return (entry) => positive.some((f) => f(entry.basename));
7897 var ReaddirpStream = class extends Readable {
7898 static get defaultOptions() {
7901 fileFilter: (path) => true,
7902 directoryFilter: (path) => true,
7909 constructor(options = {}) {
7913 highWaterMark: options.highWaterMark || 4096
7915 const opts = {...ReaddirpStream.defaultOptions, ...options};
7916 const {root, type} = opts;
7917 this._fileFilter = normalizeFilter(opts.fileFilter);
7918 this._directoryFilter = normalizeFilter(opts.directoryFilter);
7919 const statMethod = opts.lstat ? lstat : stat;
7920 if (process.platform === "win32" && stat.length === 3) {
7921 this._stat = (path) => statMethod(path, {bigint: true});
7923 this._stat = statMethod;
7925 this._maxDepth = opts.depth;
7926 this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
7927 this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
7928 this._wantsEverything = type === EVERYTHING_TYPE;
7929 this._root = sysPath.resolve(root);
7930 this._isDirent = "Dirent" in fs && !opts.alwaysStat;
7931 this._statsProp = this._isDirent ? "dirent" : "stats";
7932 this._rdOptions = {encoding: "utf8", withFileTypes: this._isDirent};
7933 this.parents = [this._exploreDir(root, 1)];
7934 this.reading = false;
7935 this.parent = void 0;
7937 async _read(batch) {
7940 this.reading = true;
7942 while (!this.destroyed && batch > 0) {
7943 const {path, depth, files = []} = this.parent || {};
7944 if (files.length > 0) {
7945 const slice = files.splice(0, batch).map((dirent) => this._formatEntry(dirent, path));
7946 for (const entry of await Promise.all(slice)) {
7949 const entryType = await this._getEntryType(entry);
7950 if (entryType === "directory" && this._directoryFilter(entry)) {
7951 if (depth <= this._maxDepth) {
7952 this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
7954 if (this._wantsDir) {
7958 } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
7959 if (this._wantsFile) {
7966 const parent = this.parents.pop();
7971 this.parent = await parent;
7977 this.destroy(error);
7979 this.reading = false;
7982 async _exploreDir(path, depth) {
7985 files = await readdir(path, this._rdOptions);
7987 this._onError(error);
7989 return {files, depth, path};
7991 async _formatEntry(dirent, path) {
7994 const basename2 = this._isDirent ? dirent.name : dirent;
7995 const fullPath = sysPath.resolve(sysPath.join(path, basename2));
7996 entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename: basename2};
7997 entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
8004 if (isNormalFlowError(err) && !this.destroyed) {
8005 this.emit("warn", err);
8010 async _getEntryType(entry) {
8011 const stats = entry && entry[this._statsProp];
8015 if (stats.isFile()) {
8018 if (stats.isDirectory()) {
8021 if (stats && stats.isSymbolicLink()) {
8023 const entryRealPath = await realpath(entry.fullPath);
8024 const entryRealPathStats = await lstat(entryRealPath);
8025 if (entryRealPathStats.isFile()) {
8028 if (entryRealPathStats.isDirectory()) {
8032 this._onError(error);
8036 _includeAsFile(entry) {
8037 const stats = entry && entry[this._statsProp];
8038 return stats && this._wantsEverything && !stats.isDirectory();
8041 var readdirp = (root, options = {}) => {
8042 let type = options.entryType || options.type;
8043 if (type === "both")
8044 type = FILE_DIR_TYPE;
8046 options.type = type;
8048 throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
8049 } else if (typeof root !== "string") {
8050 throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
8051 } else if (type && !ALL_TYPES.includes(type)) {
8052 throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
8054 options.root = root;
8055 return new ReaddirpStream(options);
8057 var readdirpPromise = (root, options = {}) => {
8058 return new Promise((resolve, reject) => {
8060 readdirp(root, options).on("data", (entry) => files.push(entry)).on("end", () => resolve(files)).on("error", (error) => reject(error));
8063 readdirp.promise = readdirpPromise;
8064 readdirp.ReaddirpStream = ReaddirpStream;
8065 readdirp.default = readdirp;
8066 module2.exports = readdirp;
8069 // node_modules/fs.realpath/old.js
8070 var require_old = __commonJS((exports2) => {
8071 var pathModule = require("path");
8072 var isWindows = process.platform === "win32";
8073 var fs = require("fs");
8074 var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
8075 function rethrow() {
8078 var backtrace = new Error();
8079 callback = debugCallback;
8081 callback = missingCallback;
8083 function debugCallback(err) {
8085 backtrace.message = err.message;
8087 missingCallback(err);
8090 function missingCallback(err) {
8092 if (process.throwDeprecation)
8094 else if (!process.noDeprecation) {
8095 var msg = "fs: missing callback " + (err.stack || err.message);
8096 if (process.traceDeprecation)
8104 function maybeCallback(cb) {
8105 return typeof cb === "function" ? cb : rethrow();
8107 var normalize = pathModule.normalize;
8109 nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
8111 nextPartRe = /(.*?)(?:[\/]+|$)/g;
8115 splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
8117 splitRootRe = /^[\/]*/;
8120 exports2.realpathSync = function realpathSync(p, cache) {
8121 p = pathModule.resolve(p);
8122 if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
8125 var original = p, seenLinks = {}, knownHard = {};
8132 var m = splitRootRe.exec(p);
8137 if (isWindows && !knownHard[base]) {
8139 knownHard[base] = true;
8142 while (pos < p.length) {
8143 nextPartRe.lastIndex = pos;
8144 var result = nextPartRe.exec(p);
8146 current += result[0];
8147 base = previous + result[1];
8148 pos = nextPartRe.lastIndex;
8149 if (knownHard[base] || cache && cache[base] === base) {
8153 if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
8154 resolvedLink = cache[base];
8156 var stat = fs.lstatSync(base);
8157 if (!stat.isSymbolicLink()) {
8158 knownHard[base] = true;
8163 var linkTarget = null;
8165 var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
8166 if (seenLinks.hasOwnProperty(id)) {
8167 linkTarget = seenLinks[id];
8170 if (linkTarget === null) {
8172 linkTarget = fs.readlinkSync(base);
8174 resolvedLink = pathModule.resolve(previous, linkTarget);
8176 cache[base] = resolvedLink;
8178 seenLinks[id] = linkTarget;
8180 p = pathModule.resolve(resolvedLink, p.slice(pos));
8184 cache[original] = p;
8187 exports2.realpath = function realpath(p, cache, cb) {
8188 if (typeof cb !== "function") {
8189 cb = maybeCallback(cache);
8192 p = pathModule.resolve(p);
8193 if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
8194 return process.nextTick(cb.bind(null, null, cache[p]));
8196 var original = p, seenLinks = {}, knownHard = {};
8203 var m = splitRootRe.exec(p);
8208 if (isWindows && !knownHard[base]) {
8209 fs.lstat(base, function(err) {
8212 knownHard[base] = true;
8216 process.nextTick(LOOP);
8220 if (pos >= p.length) {
8222 cache[original] = p;
8225 nextPartRe.lastIndex = pos;
8226 var result = nextPartRe.exec(p);
8228 current += result[0];
8229 base = previous + result[1];
8230 pos = nextPartRe.lastIndex;
8231 if (knownHard[base] || cache && cache[base] === base) {
8232 return process.nextTick(LOOP);
8234 if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
8235 return gotResolvedLink(cache[base]);
8237 return fs.lstat(base, gotStat);
8239 function gotStat(err, stat) {
8242 if (!stat.isSymbolicLink()) {
8243 knownHard[base] = true;
8246 return process.nextTick(LOOP);
8249 var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
8250 if (seenLinks.hasOwnProperty(id)) {
8251 return gotTarget(null, seenLinks[id], base);
8254 fs.stat(base, function(err2) {
8257 fs.readlink(base, function(err3, target) {
8259 seenLinks[id] = target;
8260 gotTarget(err3, target);
8264 function gotTarget(err, target, base2) {
8267 var resolvedLink = pathModule.resolve(previous, target);
8269 cache[base2] = resolvedLink;
8270 gotResolvedLink(resolvedLink);
8272 function gotResolvedLink(resolvedLink) {
8273 p = pathModule.resolve(resolvedLink, p.slice(pos));
8279 // node_modules/fs.realpath/index.js
8280 var require_fs = __commonJS((exports2, module2) => {
8281 module2.exports = realpath;
8282 realpath.realpath = realpath;
8283 realpath.sync = realpathSync;
8284 realpath.realpathSync = realpathSync;
8285 realpath.monkeypatch = monkeypatch;
8286 realpath.unmonkeypatch = unmonkeypatch;
8287 var fs = require("fs");
8288 var origRealpath = fs.realpath;
8289 var origRealpathSync = fs.realpathSync;
8290 var version = process.version;
8291 var ok = /^v[0-5]\./.test(version);
8292 var old = require_old();
8293 function newError(er) {
8294 return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
8296 function realpath(p, cache, cb) {
8298 return origRealpath(p, cache, cb);
8300 if (typeof cache === "function") {
8304 origRealpath(p, cache, function(er, result) {
8306 old.realpath(p, cache, cb);
8312 function realpathSync(p, cache) {
8314 return origRealpathSync(p, cache);
8317 return origRealpathSync(p, cache);
8320 return old.realpathSync(p, cache);
8326 function monkeypatch() {
8327 fs.realpath = realpath;
8328 fs.realpathSync = realpathSync;
8330 function unmonkeypatch() {
8331 fs.realpath = origRealpath;
8332 fs.realpathSync = origRealpathSync;
8336 // node_modules/concat-map/index.js
8337 var require_concat_map = __commonJS((exports2, module2) => {
8338 module2.exports = function(xs, fn) {
8340 for (var i = 0; i < xs.length; i++) {
8341 var x = fn(xs[i], i);
8343 res.push.apply(res, x);
8349 var isArray = Array.isArray || function(xs) {
8350 return Object.prototype.toString.call(xs) === "[object Array]";
8354 // node_modules/balanced-match/index.js
8355 var require_balanced_match = __commonJS((exports2, module2) => {
8357 module2.exports = balanced;
8358 function balanced(a, b, str) {
8359 if (a instanceof RegExp)
8360 a = maybeMatch(a, str);
8361 if (b instanceof RegExp)
8362 b = maybeMatch(b, str);
8363 var r = range(a, b, str);
8367 pre: str.slice(0, r[0]),
8368 body: str.slice(r[0] + a.length, r[1]),
8369 post: str.slice(r[1] + b.length)
8372 function maybeMatch(reg, str) {
8373 var m = str.match(reg);
8374 return m ? m[0] : null;
8376 balanced.range = range;
8377 function range(a, b, str) {
8378 var begs, beg, left, right, result;
8379 var ai = str.indexOf(a);
8380 var bi = str.indexOf(b, ai + 1);
8382 if (ai >= 0 && bi > 0) {
8385 while (i >= 0 && !result) {
8388 ai = str.indexOf(a, i + 1);
8389 } else if (begs.length == 1) {
8390 result = [begs.pop(), bi];
8397 bi = str.indexOf(b, i + 1);
8399 i = ai < bi && ai >= 0 ? ai : bi;
8402 result = [left, right];
8409 // node_modules/brace-expansion/index.js
8410 var require_brace_expansion = __commonJS((exports2, module2) => {
8411 var concatMap = require_concat_map();
8412 var balanced = require_balanced_match();
8413 module2.exports = expandTop;
8414 var escSlash = "\0SLASH" + Math.random() + "\0";
8415 var escOpen = "\0OPEN" + Math.random() + "\0";
8416 var escClose = "\0CLOSE" + Math.random() + "\0";
8417 var escComma = "\0COMMA" + Math.random() + "\0";
8418 var escPeriod = "\0PERIOD" + Math.random() + "\0";
8419 function numeric(str) {
8420 return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
8422 function escapeBraces(str) {
8423 return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
8425 function unescapeBraces(str) {
8426 return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
8428 function parseCommaParts(str) {
8432 var m = balanced("{", "}", str);
8434 return str.split(",");
8438 var p = pre.split(",");
8439 p[p.length - 1] += "{" + body + "}";
8440 var postParts = parseCommaParts(post);
8442 p[p.length - 1] += postParts.shift();
8443 p.push.apply(p, postParts);
8445 parts.push.apply(parts, p);
8448 function expandTop(str) {
8451 if (str.substr(0, 2) === "{}") {
8452 str = "\\{\\}" + str.substr(2);
8454 return expand(escapeBraces(str), true).map(unescapeBraces);
8456 function embrace(str) {
8457 return "{" + str + "}";
8459 function isPadded(el) {
8460 return /^-?0\d/.test(el);
8462 function lte(i, y) {
8465 function gte(i, y) {
8468 function expand(str, isTop) {
8469 var expansions = [];
8470 var m = balanced("{", "}", str);
8471 if (!m || /\$$/.test(m.pre))
8473 var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
8474 var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
8475 var isSequence = isNumericSequence || isAlphaSequence;
8476 var isOptions = m.body.indexOf(",") >= 0;
8477 if (!isSequence && !isOptions) {
8478 if (m.post.match(/,.*\}/)) {
8479 str = m.pre + "{" + m.body + escClose + m.post;
8486 n = m.body.split(/\.\./);
8488 n = parseCommaParts(m.body);
8489 if (n.length === 1) {
8490 n = expand(n[0], false).map(embrace);
8491 if (n.length === 1) {
8492 var post = m.post.length ? expand(m.post, false) : [""];
8493 return post.map(function(p) {
8494 return m.pre + n[0] + p;
8500 var post = m.post.length ? expand(m.post, false) : [""];
8503 var x = numeric(n[0]);
8504 var y = numeric(n[1]);
8505 var width = Math.max(n[0].length, n[1].length);
8506 var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
8508 var reverse = y < x;
8513 var pad = n.some(isPadded);
8515 for (var i = x; test(i, y); i += incr) {
8517 if (isAlphaSequence) {
8518 c = String.fromCharCode(i);
8524 var need = width - c.length;
8526 var z = new Array(need + 1).join("0");
8528 c = "-" + z + c.slice(1);
8537 N = concatMap(n, function(el) {
8538 return expand(el, false);
8541 for (var j = 0; j < N.length; j++) {
8542 for (var k = 0; k < post.length; k++) {
8543 var expansion = pre + N[j] + post[k];
8544 if (!isTop || isSequence || expansion)
8545 expansions.push(expansion);
8552 // node_modules/minimatch/minimatch.js
8553 var require_minimatch = __commonJS((exports2, module2) => {
8554 module2.exports = minimatch;
8555 minimatch.Minimatch = Minimatch;
8556 var path = {sep: "/"};
8558 path = require("path");
8561 var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
8562 var expand = require_brace_expansion();
8564 "!": {open: "(?:(?!(?:", close: "))[^/]*?)"},
8565 "?": {open: "(?:", close: ")?"},
8566 "+": {open: "(?:", close: ")+"},
8567 "*": {open: "(?:", close: ")*"},
8568 "@": {open: "(?:", close: ")"}
8571 var star = qmark + "*?";
8572 var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
8573 var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
8574 var reSpecials = charSet("().*{}+?[]^$\\!");
8575 function charSet(s) {
8576 return s.split("").reduce(function(set, c) {
8581 var slashSplit = /\/+/;
8582 minimatch.filter = filter;
8583 function filter(pattern, options) {
8584 options = options || {};
8585 return function(p, i, list) {
8586 return minimatch(p, pattern, options);
8589 function ext(a, b) {
8593 Object.keys(b).forEach(function(k) {
8596 Object.keys(a).forEach(function(k) {
8601 minimatch.defaults = function(def) {
8602 if (!def || !Object.keys(def).length)
8604 var orig = minimatch;
8605 var m = function minimatch2(p, pattern, options) {
8606 return orig.minimatch(p, pattern, ext(def, options));
8608 m.Minimatch = function Minimatch2(pattern, options) {
8609 return new orig.Minimatch(pattern, ext(def, options));
8613 Minimatch.defaults = function(def) {
8614 if (!def || !Object.keys(def).length)
8616 return minimatch.defaults(def).Minimatch;
8618 function minimatch(p, pattern, options) {
8619 if (typeof pattern !== "string") {
8620 throw new TypeError("glob pattern string required");
8624 if (!options.nocomment && pattern.charAt(0) === "#") {
8627 if (pattern.trim() === "")
8629 return new Minimatch(pattern, options).match(p);
8631 function Minimatch(pattern, options) {
8632 if (!(this instanceof Minimatch)) {
8633 return new Minimatch(pattern, options);
8635 if (typeof pattern !== "string") {
8636 throw new TypeError("glob pattern string required");
8640 pattern = pattern.trim();
8641 if (path.sep !== "/") {
8642 pattern = pattern.split(path.sep).join("/");
8644 this.options = options;
8646 this.pattern = pattern;
8648 this.negate = false;
8649 this.comment = false;
8653 Minimatch.prototype.debug = function() {
8655 Minimatch.prototype.make = make;
8659 var pattern = this.pattern;
8660 var options = this.options;
8661 if (!options.nocomment && pattern.charAt(0) === "#") {
8662 this.comment = true;
8670 var set = this.globSet = this.braceExpand();
8672 this.debug = console.error;
8673 this.debug(this.pattern, set);
8674 set = this.globParts = set.map(function(s) {
8675 return s.split(slashSplit);
8677 this.debug(this.pattern, set);
8678 set = set.map(function(s, si, set2) {
8679 return s.map(this.parse, this);
8681 this.debug(this.pattern, set);
8682 set = set.filter(function(s) {
8683 return s.indexOf(false) === -1;
8685 this.debug(this.pattern, set);
8688 Minimatch.prototype.parseNegate = parseNegate;
8689 function parseNegate() {
8690 var pattern = this.pattern;
8692 var options = this.options;
8693 var negateOffset = 0;
8694 if (options.nonegate)
8696 for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
8701 this.pattern = pattern.substr(negateOffset);
8702 this.negate = negate;
8704 minimatch.braceExpand = function(pattern, options) {
8705 return braceExpand(pattern, options);
8707 Minimatch.prototype.braceExpand = braceExpand;
8708 function braceExpand(pattern, options) {
8710 if (this instanceof Minimatch) {
8711 options = this.options;
8716 pattern = typeof pattern === "undefined" ? this.pattern : pattern;
8717 if (typeof pattern === "undefined") {
8718 throw new TypeError("undefined pattern");
8720 if (options.nobrace || !pattern.match(/\{.*\}/)) {
8723 return expand(pattern);
8725 Minimatch.prototype.parse = parse;
8727 function parse(pattern, isSub) {
8728 if (pattern.length > 1024 * 64) {
8729 throw new TypeError("pattern is too long");
8731 var options = this.options;
8732 if (!options.noglobstar && pattern === "**")
8737 var hasMagic = !!options.nocase;
8738 var escaping = false;
8739 var patternListStack = [];
8740 var negativeLists = [];
8742 var inClass = false;
8743 var reClassStart = -1;
8744 var classStart = -1;
8745 var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
8747 function clearStateChar() {
8749 switch (stateChar) {
8759 re += "\\" + stateChar;
8762 self2.debug("clearStateChar %j %j", stateChar, re);
8766 for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
8767 this.debug("%s %s %s %j", pattern, i, re, c);
8768 if (escaping && reSpecials[c]) {
8785 this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
8787 this.debug(" in class");
8788 if (c === "!" && i === classStart + 1)
8793 self2.debug("call clearStateChar %j", stateChar);
8808 patternListStack.push({
8812 open: plTypes[stateChar].open,
8813 close: plTypes[stateChar].close
8815 re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
8816 this.debug("plType %j %j", stateChar, re);
8820 if (inClass || !patternListStack.length) {
8826 var pl = patternListStack.pop();
8828 if (pl.type === "!") {
8829 negativeLists.push(pl);
8831 pl.reEnd = re.length;
8834 if (inClass || !patternListStack.length || escaping) {
8850 reClassStart = re.length;
8854 if (i === classStart + 1 || !inClass) {
8860 var cs = pattern.substring(classStart + 1, i);
8862 RegExp("[" + cs + "]");
8864 var sp = this.parse(cs, SUBPARSE);
8865 re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
8866 hasMagic = hasMagic || sp[1];
8879 } else if (reSpecials[c] && !(c === "^" && inClass)) {
8886 cs = pattern.substr(classStart + 1);
8887 sp = this.parse(cs, SUBPARSE);
8888 re = re.substr(0, reClassStart) + "\\[" + sp[0];
8889 hasMagic = hasMagic || sp[1];
8891 for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
8892 var tail = re.slice(pl.reStart + pl.open.length);
8893 this.debug("setting tail", re, pl);
8894 tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
8898 return $1 + $1 + $2 + "|";
8900 this.debug("tail=%j\n %s", tail, tail, pl, re);
8901 var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
8903 re = re.slice(0, pl.reStart) + t + "\\(" + tail;
8909 var addPatternStart = false;
8910 switch (re.charAt(0)) {
8914 addPatternStart = true;
8916 for (var n = negativeLists.length - 1; n > -1; n--) {
8917 var nl = negativeLists[n];
8918 var nlBefore = re.slice(0, nl.reStart);
8919 var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
8920 var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
8921 var nlAfter = re.slice(nl.reEnd);
8923 var openParensBefore = nlBefore.split("(").length - 1;
8924 var cleanAfter = nlAfter;
8925 for (i = 0; i < openParensBefore; i++) {
8926 cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
8928 nlAfter = cleanAfter;
8930 if (nlAfter === "" && isSub !== SUBPARSE) {
8933 var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
8936 if (re !== "" && hasMagic) {
8939 if (addPatternStart) {
8940 re = patternStart + re;
8942 if (isSub === SUBPARSE) {
8943 return [re, hasMagic];
8946 return globUnescape(pattern);
8948 var flags = options.nocase ? "i" : "";
8950 var regExp = new RegExp("^" + re + "$", flags);
8952 return new RegExp("$.");
8954 regExp._glob = pattern;
8958 minimatch.makeRe = function(pattern, options) {
8959 return new Minimatch(pattern, options || {}).makeRe();
8961 Minimatch.prototype.makeRe = makeRe;
8963 if (this.regexp || this.regexp === false)
8967 this.regexp = false;
8970 var options = this.options;
8971 var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
8972 var flags = options.nocase ? "i" : "";
8973 var re = set.map(function(pattern) {
8974 return pattern.map(function(p) {
8975 return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
8978 re = "^(?:" + re + ")$";
8980 re = "^(?!" + re + ").*$";
8982 this.regexp = new RegExp(re, flags);
8984 this.regexp = false;
8988 minimatch.match = function(list, pattern, options) {
8989 options = options || {};
8990 var mm = new Minimatch(pattern, options);
8991 list = list.filter(function(f) {
8994 if (mm.options.nonull && !list.length) {
8999 Minimatch.prototype.match = match;
9000 function match(f, partial) {
9001 this.debug("match", f, this.pattern);
9006 if (f === "/" && partial)
9008 var options = this.options;
9009 if (path.sep !== "/") {
9010 f = f.split(path.sep).join("/");
9012 f = f.split(slashSplit);
9013 this.debug(this.pattern, "split", f);
9015 this.debug(this.pattern, "set", set);
9018 for (i = f.length - 1; i >= 0; i--) {
9023 for (i = 0; i < set.length; i++) {
9024 var pattern = set[i];
9026 if (options.matchBase && pattern.length === 1) {
9029 var hit = this.matchOne(file, pattern, partial);
9031 if (options.flipNegate)
9033 return !this.negate;
9036 if (options.flipNegate)
9040 Minimatch.prototype.matchOne = function(file, pattern, partial) {
9041 var options = this.options;
9042 this.debug("matchOne", {this: this, file, pattern});
9043 this.debug("matchOne", file.length, pattern.length);
9044 for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
9045 this.debug("matchOne loop");
9046 var p = pattern[pi];
9048 this.debug(pattern, p, f);
9051 if (p === GLOBSTAR) {
9052 this.debug("GLOBSTAR", [pattern, p, f]);
9056 this.debug("** at the end");
9057 for (; fi < fl; fi++) {
9058 if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
9064 var swallowee = file[fr];
9065 this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
9066 if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
9067 this.debug("globstar found match!", fr, fl, swallowee);
9070 if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
9071 this.debug("dot detected!", file, fr, pattern, pr);
9074 this.debug("globstar swallow a segment, and continue");
9079 this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
9086 if (typeof p === "string") {
9087 if (options.nocase) {
9088 hit = f.toLowerCase() === p.toLowerCase();
9092 this.debug("string match", p, f, hit);
9095 this.debug("pattern match", p, f, hit);
9100 if (fi === fl && pi === pl) {
9102 } else if (fi === fl) {
9104 } else if (pi === pl) {
9105 var emptyFileEnd = fi === fl - 1 && file[fi] === "";
9106 return emptyFileEnd;
9108 throw new Error("wtf?");
9110 function globUnescape(s) {
9111 return s.replace(/\\(.)/g, "$1");
9113 function regExpEscape(s) {
9114 return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
9118 // node_modules/inherits/inherits_browser.js
9119 var require_inherits_browser = __commonJS((exports2, module2) => {
9120 if (typeof Object.create === "function") {
9121 module2.exports = function inherits2(ctor, superCtor) {
9123 ctor.super_ = superCtor;
9124 ctor.prototype = Object.create(superCtor.prototype, {
9135 module2.exports = function inherits2(ctor, superCtor) {
9137 ctor.super_ = superCtor;
9138 var TempCtor = function() {
9140 TempCtor.prototype = superCtor.prototype;
9141 ctor.prototype = new TempCtor();
9142 ctor.prototype.constructor = ctor;
9148 // node_modules/inherits/inherits.js
9149 var require_inherits = __commonJS((exports2, module2) => {
9151 util = require("util");
9152 if (typeof util.inherits !== "function")
9154 module2.exports = util.inherits;
9156 module2.exports = require_inherits_browser();
9161 // node_modules/path-is-absolute/index.js
9162 var require_path_is_absolute = __commonJS((exports2, module2) => {
9164 function posix(path) {
9165 return path.charAt(0) === "/";
9167 function win32(path) {
9168 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
9169 var result = splitDeviceRe.exec(path);
9170 var device = result[1] || "";
9171 var isUnc = Boolean(device && device.charAt(1) !== ":");
9172 return Boolean(result[2] || isUnc);
9174 module2.exports = process.platform === "win32" ? win32 : posix;
9175 module2.exports.posix = posix;
9176 module2.exports.win32 = win32;
9179 // node_modules/glob/common.js
9180 var require_common = __commonJS((exports2) => {
9181 exports2.alphasort = alphasort;
9182 exports2.alphasorti = alphasorti;
9183 exports2.setopts = setopts;
9184 exports2.ownProp = ownProp;
9185 exports2.makeAbs = makeAbs;
9186 exports2.finish = finish;
9187 exports2.mark = mark;
9188 exports2.isIgnored = isIgnored;
9189 exports2.childrenIgnored = childrenIgnored;
9190 function ownProp(obj, field) {
9191 return Object.prototype.hasOwnProperty.call(obj, field);
9193 var path = require("path");
9194 var minimatch = require_minimatch();
9195 var isAbsolute = require_path_is_absolute();
9196 var Minimatch = minimatch.Minimatch;
9197 function alphasorti(a, b) {
9198 return a.toLowerCase().localeCompare(b.toLowerCase());
9200 function alphasort(a, b) {
9201 return a.localeCompare(b);
9203 function setupIgnores(self2, options) {
9204 self2.ignore = options.ignore || [];
9205 if (!Array.isArray(self2.ignore))
9206 self2.ignore = [self2.ignore];
9207 if (self2.ignore.length) {
9208 self2.ignore = self2.ignore.map(ignoreMap);
9211 function ignoreMap(pattern) {
9212 var gmatcher = null;
9213 if (pattern.slice(-3) === "/**") {
9214 var gpattern = pattern.replace(/(\/\*\*)+$/, "");
9215 gmatcher = new Minimatch(gpattern, {dot: true});
9218 matcher: new Minimatch(pattern, {dot: true}),
9222 function setopts(self2, pattern, options) {
9225 if (options.matchBase && pattern.indexOf("/") === -1) {
9226 if (options.noglobstar) {
9227 throw new Error("base matching requires globstar");
9229 pattern = "**/" + pattern;
9231 self2.silent = !!options.silent;
9232 self2.pattern = pattern;
9233 self2.strict = options.strict !== false;
9234 self2.realpath = !!options.realpath;
9235 self2.realpathCache = options.realpathCache || Object.create(null);
9236 self2.follow = !!options.follow;
9237 self2.dot = !!options.dot;
9238 self2.mark = !!options.mark;
9239 self2.nodir = !!options.nodir;
9242 self2.sync = !!options.sync;
9243 self2.nounique = !!options.nounique;
9244 self2.nonull = !!options.nonull;
9245 self2.nosort = !!options.nosort;
9246 self2.nocase = !!options.nocase;
9247 self2.stat = !!options.stat;
9248 self2.noprocess = !!options.noprocess;
9249 self2.absolute = !!options.absolute;
9250 self2.maxLength = options.maxLength || Infinity;
9251 self2.cache = options.cache || Object.create(null);
9252 self2.statCache = options.statCache || Object.create(null);
9253 self2.symlinks = options.symlinks || Object.create(null);
9254 setupIgnores(self2, options);
9255 self2.changedCwd = false;
9256 var cwd = process.cwd();
9257 if (!ownProp(options, "cwd"))
9260 self2.cwd = path.resolve(options.cwd);
9261 self2.changedCwd = self2.cwd !== cwd;
9263 self2.root = options.root || path.resolve(self2.cwd, "/");
9264 self2.root = path.resolve(self2.root);
9265 if (process.platform === "win32")
9266 self2.root = self2.root.replace(/\\/g, "/");
9267 self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
9268 if (process.platform === "win32")
9269 self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
9270 self2.nomount = !!options.nomount;
9271 options.nonegate = true;
9272 options.nocomment = true;
9273 self2.minimatch = new Minimatch(pattern, options);
9274 self2.options = self2.minimatch.options;
9276 function finish(self2) {
9277 var nou = self2.nounique;
9278 var all = nou ? [] : Object.create(null);
9279 for (var i = 0, l = self2.matches.length; i < l; i++) {
9280 var matches = self2.matches[i];
9281 if (!matches || Object.keys(matches).length === 0) {
9283 var literal = self2.minimatch.globSet[i];
9287 all[literal] = true;
9290 var m = Object.keys(matches);
9292 all.push.apply(all, m);
9294 m.forEach(function(m2) {
9300 all = Object.keys(all);
9302 all = all.sort(self2.nocase ? alphasorti : alphasort);
9304 for (var i = 0; i < all.length; i++) {
9305 all[i] = self2._mark(all[i]);
9308 all = all.filter(function(e) {
9309 var notDir = !/\/$/.test(e);
9310 var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
9312 notDir = c !== "DIR" && !Array.isArray(c);
9317 if (self2.ignore.length)
9318 all = all.filter(function(m2) {
9319 return !isIgnored(self2, m2);
9323 function mark(self2, p) {
9324 var abs = makeAbs(self2, p);
9325 var c = self2.cache[abs];
9328 var isDir = c === "DIR" || Array.isArray(c);
9329 var slash = p.slice(-1) === "/";
9330 if (isDir && !slash)
9332 else if (!isDir && slash)
9335 var mabs = makeAbs(self2, m);
9336 self2.statCache[mabs] = self2.statCache[abs];
9337 self2.cache[mabs] = self2.cache[abs];
9342 function makeAbs(self2, f) {
9344 if (f.charAt(0) === "/") {
9345 abs = path.join(self2.root, f);
9346 } else if (isAbsolute(f) || f === "") {
9348 } else if (self2.changedCwd) {
9349 abs = path.resolve(self2.cwd, f);
9351 abs = path.resolve(f);
9353 if (process.platform === "win32")
9354 abs = abs.replace(/\\/g, "/");
9357 function isIgnored(self2, path2) {
9358 if (!self2.ignore.length)
9360 return self2.ignore.some(function(item) {
9361 return item.matcher.match(path2) || !!(item.gmatcher && item.gmatcher.match(path2));
9364 function childrenIgnored(self2, path2) {
9365 if (!self2.ignore.length)
9367 return self2.ignore.some(function(item) {
9368 return !!(item.gmatcher && item.gmatcher.match(path2));
9373 // node_modules/glob/sync.js
9374 var require_sync = __commonJS((exports2, module2) => {
9375 module2.exports = globSync;
9376 globSync.GlobSync = GlobSync;
9377 var fs = require("fs");
9378 var rp = require_fs();
9379 var minimatch = require_minimatch();
9380 var Minimatch = minimatch.Minimatch;
9381 var Glob = require_glob().Glob;
9382 var util = require("util");
9383 var path = require("path");
9384 var assert = require("assert");
9385 var isAbsolute = require_path_is_absolute();
9386 var common2 = require_common();
9387 var alphasort = common2.alphasort;
9388 var alphasorti = common2.alphasorti;
9389 var setopts = common2.setopts;
9390 var ownProp = common2.ownProp;
9391 var childrenIgnored = common2.childrenIgnored;
9392 var isIgnored = common2.isIgnored;
9393 function globSync(pattern, options) {
9394 if (typeof options === "function" || arguments.length === 3)
9395 throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
9396 return new GlobSync(pattern, options).found;
9398 function GlobSync(pattern, options) {
9400 throw new Error("must provide pattern");
9401 if (typeof options === "function" || arguments.length === 3)
9402 throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
9403 if (!(this instanceof GlobSync))
9404 return new GlobSync(pattern, options);
9405 setopts(this, pattern, options);
9408 var n = this.minimatch.set.length;
9409 this.matches = new Array(n);
9410 for (var i = 0; i < n; i++) {
9411 this._process(this.minimatch.set[i], i, false);
9415 GlobSync.prototype._finish = function() {
9416 assert(this instanceof GlobSync);
9417 if (this.realpath) {
9419 this.matches.forEach(function(matchset, index) {
9420 var set = self2.matches[index] = Object.create(null);
9421 for (var p in matchset) {
9423 p = self2._makeAbs(p);
9424 var real = rp.realpathSync(p, self2.realpathCache);
9427 if (er.syscall === "stat")
9428 set[self2._makeAbs(p)] = true;
9435 common2.finish(this);
9437 GlobSync.prototype._process = function(pattern, index, inGlobStar) {
9438 assert(this instanceof GlobSync);
9440 while (typeof pattern[n] === "string") {
9445 case pattern.length:
9446 this._processSimple(pattern.join("/"), index);
9452 prefix = pattern.slice(0, n).join("/");
9455 var remain = pattern.slice(n);
9457 if (prefix === null)
9459 else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
9460 if (!prefix || !isAbsolute(prefix))
9461 prefix = "/" + prefix;
9465 var abs = this._makeAbs(read);
9466 if (childrenIgnored(this, read))
9468 var isGlobStar = remain[0] === minimatch.GLOBSTAR;
9470 this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
9472 this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
9474 GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) {
9475 var entries = this._readdir(abs, inGlobStar);
9479 var negate = !!this.minimatch.negate;
9480 var rawGlob = pn._glob;
9481 var dotOk = this.dot || rawGlob.charAt(0) === ".";
9482 var matchedEntries = [];
9483 for (var i = 0; i < entries.length; i++) {
9485 if (e.charAt(0) !== "." || dotOk) {
9487 if (negate && !prefix) {
9493 matchedEntries.push(e);
9496 var len = matchedEntries.length;
9499 if (remain.length === 1 && !this.mark && !this.stat) {
9500 if (!this.matches[index])
9501 this.matches[index] = Object.create(null);
9502 for (var i = 0; i < len; i++) {
9503 var e = matchedEntries[i];
9505 if (prefix.slice(-1) !== "/")
9506 e = prefix + "/" + e;
9510 if (e.charAt(0) === "/" && !this.nomount) {
9511 e = path.join(this.root, e);
9513 this._emitMatch(index, e);
9518 for (var i = 0; i < len; i++) {
9519 var e = matchedEntries[i];
9522 newPattern = [prefix, e];
9525 this._process(newPattern.concat(remain), index, inGlobStar);
9528 GlobSync.prototype._emitMatch = function(index, e) {
9529 if (isIgnored(this, e))
9531 var abs = this._makeAbs(e);
9534 if (this.absolute) {
9537 if (this.matches[index][e])
9540 var c = this.cache[abs];
9541 if (c === "DIR" || Array.isArray(c))
9544 this.matches[index][e] = true;
9548 GlobSync.prototype._readdirInGlobStar = function(abs) {
9550 return this._readdir(abs, false);
9555 lstat = fs.lstatSync(abs);
9557 if (er.code === "ENOENT") {
9561 var isSym = lstat && lstat.isSymbolicLink();
9562 this.symlinks[abs] = isSym;
9563 if (!isSym && lstat && !lstat.isDirectory())
9564 this.cache[abs] = "FILE";
9566 entries = this._readdir(abs, false);
9569 GlobSync.prototype._readdir = function(abs, inGlobStar) {
9571 if (inGlobStar && !ownProp(this.symlinks, abs))
9572 return this._readdirInGlobStar(abs);
9573 if (ownProp(this.cache, abs)) {
9574 var c = this.cache[abs];
9575 if (!c || c === "FILE")
9577 if (Array.isArray(c))
9581 return this._readdirEntries(abs, fs.readdirSync(abs));
9583 this._readdirError(abs, er);
9587 GlobSync.prototype._readdirEntries = function(abs, entries) {
9588 if (!this.mark && !this.stat) {
9589 for (var i = 0; i < entries.length; i++) {
9595 this.cache[e] = true;
9598 this.cache[abs] = entries;
9601 GlobSync.prototype._readdirError = function(f, er) {
9605 var abs = this._makeAbs(f);
9606 this.cache[abs] = "FILE";
9607 if (abs === this.cwdAbs) {
9608 var error = new Error(er.code + " invalid cwd " + this.cwd);
9609 error.path = this.cwd;
9610 error.code = er.code;
9616 case "ENAMETOOLONG":
9618 this.cache[this._makeAbs(f)] = false;
9621 this.cache[this._makeAbs(f)] = false;
9625 console.error("glob error", er);
9629 GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) {
9630 var entries = this._readdir(abs, inGlobStar);
9633 var remainWithoutGlobStar = remain.slice(1);
9634 var gspref = prefix ? [prefix] : [];
9635 var noGlobStar = gspref.concat(remainWithoutGlobStar);
9636 this._process(noGlobStar, index, false);
9637 var len = entries.length;
9638 var isSym = this.symlinks[abs];
9639 if (isSym && inGlobStar)
9641 for (var i = 0; i < len; i++) {
9643 if (e.charAt(0) === "." && !this.dot)
9645 var instead = gspref.concat(entries[i], remainWithoutGlobStar);
9646 this._process(instead, index, true);
9647 var below = gspref.concat(entries[i], remain);
9648 this._process(below, index, true);
9651 GlobSync.prototype._processSimple = function(prefix, index) {
9652 var exists = this._stat(prefix);
9653 if (!this.matches[index])
9654 this.matches[index] = Object.create(null);
9657 if (prefix && isAbsolute(prefix) && !this.nomount) {
9658 var trail = /[\/\\]$/.test(prefix);
9659 if (prefix.charAt(0) === "/") {
9660 prefix = path.join(this.root, prefix);
9662 prefix = path.resolve(this.root, prefix);
9667 if (process.platform === "win32")
9668 prefix = prefix.replace(/\\/g, "/");
9669 this._emitMatch(index, prefix);
9671 GlobSync.prototype._stat = function(f) {
9672 var abs = this._makeAbs(f);
9673 var needDir = f.slice(-1) === "/";
9674 if (f.length > this.maxLength)
9676 if (!this.stat && ownProp(this.cache, abs)) {
9677 var c = this.cache[abs];
9678 if (Array.isArray(c))
9680 if (!needDir || c === "DIR")
9682 if (needDir && c === "FILE")
9686 var stat = this.statCache[abs];
9690 lstat = fs.lstatSync(abs);
9692 if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
9693 this.statCache[abs] = false;
9697 if (lstat && lstat.isSymbolicLink()) {
9699 stat = fs.statSync(abs);
9707 this.statCache[abs] = stat;
9710 c = stat.isDirectory() ? "DIR" : "FILE";
9711 this.cache[abs] = this.cache[abs] || c;
9712 if (needDir && c === "FILE")
9716 GlobSync.prototype._mark = function(p) {
9717 return common2.mark(this, p);
9719 GlobSync.prototype._makeAbs = function(f) {
9720 return common2.makeAbs(this, f);
9724 // node_modules/wrappy/wrappy.js
9725 var require_wrappy = __commonJS((exports2, module2) => {
9726 module2.exports = wrappy;
9727 function wrappy(fn, cb) {
9729 return wrappy(fn)(cb);
9730 if (typeof fn !== "function")
9731 throw new TypeError("need wrapper function");
9732 Object.keys(fn).forEach(function(k) {
9736 function wrapper() {
9737 var args = new Array(arguments.length);
9738 for (var i = 0; i < args.length; i++) {
9739 args[i] = arguments[i];
9741 var ret2 = fn.apply(this, args);
9742 var cb2 = args[args.length - 1];
9743 if (typeof ret2 === "function" && ret2 !== cb2) {
9744 Object.keys(cb2).forEach(function(k) {
9753 // node_modules/once/once.js
9754 var require_once = __commonJS((exports2, module2) => {
9755 var wrappy = require_wrappy();
9756 module2.exports = wrappy(once);
9757 module2.exports.strict = wrappy(onceStrict);
9758 once.proto = once(function() {
9759 Object.defineProperty(Function.prototype, "once", {
9765 Object.defineProperty(Function.prototype, "onceStrict", {
9767 return onceStrict(this);
9773 var f = function() {
9777 return f.value = fn.apply(this, arguments);
9782 function onceStrict(fn) {
9783 var f = function() {
9785 throw new Error(f.onceError);
9787 return f.value = fn.apply(this, arguments);
9789 var name = fn.name || "Function wrapped with `once`";
9790 f.onceError = name + " shouldn't be called more than once";
9796 // node_modules/inflight/inflight.js
9797 var require_inflight = __commonJS((exports2, module2) => {
9798 var wrappy = require_wrappy();
9799 var reqs = Object.create(null);
9800 var once = require_once();
9801 module2.exports = wrappy(inflight);
9802 function inflight(key, cb) {
9808 return makeres(key);
9811 function makeres(key) {
9812 return once(function RES() {
9813 var cbs = reqs[key];
9814 var len = cbs.length;
9815 var args = slice(arguments);
9817 for (var i = 0; i < len; i++) {
9818 cbs[i].apply(null, args);
9821 if (cbs.length > len) {
9823 process.nextTick(function() {
9824 RES.apply(null, args);
9832 function slice(args) {
9833 var length = args.length;
9835 for (var i = 0; i < length; i++)
9841 // node_modules/glob/glob.js
9842 var require_glob = __commonJS((exports2, module2) => {
9843 module2.exports = glob;
9844 var fs = require("fs");
9845 var rp = require_fs();
9846 var minimatch = require_minimatch();
9847 var Minimatch = minimatch.Minimatch;
9848 var inherits2 = require_inherits();
9849 var EE = require("events").EventEmitter;
9850 var path = require("path");
9851 var assert = require("assert");
9852 var isAbsolute = require_path_is_absolute();
9853 var globSync = require_sync();
9854 var common2 = require_common();
9855 var alphasort = common2.alphasort;
9856 var alphasorti = common2.alphasorti;
9857 var setopts = common2.setopts;
9858 var ownProp = common2.ownProp;
9859 var inflight = require_inflight();
9860 var util = require("util");
9861 var childrenIgnored = common2.childrenIgnored;
9862 var isIgnored = common2.isIgnored;
9863 var once = require_once();
9864 function glob(pattern, options, cb) {
9865 if (typeof options === "function")
9866 cb = options, options = {};
9871 throw new TypeError("callback provided to sync glob");
9872 return globSync(pattern, options);
9874 return new Glob(pattern, options, cb);
9876 glob.sync = globSync;
9877 var GlobSync = glob.GlobSync = globSync.GlobSync;
9879 function extend(origin, add) {
9880 if (add === null || typeof add !== "object") {
9883 var keys = Object.keys(add);
9884 var i = keys.length;
9886 origin[keys[i]] = add[keys[i]];
9890 glob.hasMagic = function(pattern, options_) {
9891 var options = extend({}, options_);
9892 options.noprocess = true;
9893 var g = new Glob(pattern, options);
9894 var set = g.minimatch.set;
9899 for (var j = 0; j < set[0].length; j++) {
9900 if (typeof set[0][j] !== "string")
9906 inherits2(Glob, EE);
9907 function Glob(pattern, options, cb) {
9908 if (typeof options === "function") {
9912 if (options && options.sync) {
9914 throw new TypeError("callback provided to sync glob");
9915 return new GlobSync(pattern, options);
9917 if (!(this instanceof Glob))
9918 return new Glob(pattern, options, cb);
9919 setopts(this, pattern, options);
9920 this._didRealPath = false;
9921 var n = this.minimatch.set.length;
9922 this.matches = new Array(n);
9923 if (typeof cb === "function") {
9925 this.on("error", cb);
9926 this.on("end", function(matches) {
9931 this._processing = 0;
9932 this._emitQueue = [];
9933 this._processQueue = [];
9934 this.paused = false;
9940 for (var i = 0; i < n; i++) {
9941 this._process(this.minimatch.set[i], i, false, done);
9945 --self2._processing;
9946 if (self2._processing <= 0) {
9948 process.nextTick(function() {
9957 Glob.prototype._finish = function() {
9958 assert(this instanceof Glob);
9961 if (this.realpath && !this._didRealpath)
9962 return this._realpath();
9963 common2.finish(this);
9964 this.emit("end", this.found);
9966 Glob.prototype._realpath = function() {
9967 if (this._didRealpath)
9969 this._didRealpath = true;
9970 var n = this.matches.length;
9972 return this._finish();
9974 for (var i = 0; i < this.matches.length; i++)
9975 this._realpathSet(i, next);
9981 Glob.prototype._realpathSet = function(index, cb) {
9982 var matchset = this.matches[index];
9985 var found = Object.keys(matchset);
9987 var n = found.length;
9990 var set = this.matches[index] = Object.create(null);
9991 found.forEach(function(p, i) {
9992 p = self2._makeAbs(p);
9993 rp.realpath(p, self2.realpathCache, function(er, real) {
9996 else if (er.syscall === "stat")
9999 self2.emit("error", er);
10001 self2.matches[index] = set;
10007 Glob.prototype._mark = function(p) {
10008 return common2.mark(this, p);
10010 Glob.prototype._makeAbs = function(f) {
10011 return common2.makeAbs(this, f);
10013 Glob.prototype.abort = function() {
10014 this.aborted = true;
10015 this.emit("abort");
10017 Glob.prototype.pause = function() {
10018 if (!this.paused) {
10019 this.paused = true;
10020 this.emit("pause");
10023 Glob.prototype.resume = function() {
10025 this.emit("resume");
10026 this.paused = false;
10027 if (this._emitQueue.length) {
10028 var eq = this._emitQueue.slice(0);
10029 this._emitQueue.length = 0;
10030 for (var i = 0; i < eq.length; i++) {
10032 this._emitMatch(e[0], e[1]);
10035 if (this._processQueue.length) {
10036 var pq = this._processQueue.slice(0);
10037 this._processQueue.length = 0;
10038 for (var i = 0; i < pq.length; i++) {
10040 this._processing--;
10041 this._process(p[0], p[1], p[2], p[3]);
10046 Glob.prototype._process = function(pattern, index, inGlobStar, cb) {
10047 assert(this instanceof Glob);
10048 assert(typeof cb === "function");
10051 this._processing++;
10053 this._processQueue.push([pattern, index, inGlobStar, cb]);
10057 while (typeof pattern[n] === "string") {
10062 case pattern.length:
10063 this._processSimple(pattern.join("/"), index, cb);
10069 prefix = pattern.slice(0, n).join("/");
10072 var remain = pattern.slice(n);
10074 if (prefix === null)
10076 else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
10077 if (!prefix || !isAbsolute(prefix))
10078 prefix = "/" + prefix;
10082 var abs = this._makeAbs(read);
10083 if (childrenIgnored(this, read))
10085 var isGlobStar = remain[0] === minimatch.GLOBSTAR;
10087 this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
10089 this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
10091 Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
10093 this._readdir(abs, inGlobStar, function(er, entries) {
10094 return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
10097 Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
10100 var pn = remain[0];
10101 var negate = !!this.minimatch.negate;
10102 var rawGlob = pn._glob;
10103 var dotOk = this.dot || rawGlob.charAt(0) === ".";
10104 var matchedEntries = [];
10105 for (var i = 0; i < entries.length; i++) {
10106 var e = entries[i];
10107 if (e.charAt(0) !== "." || dotOk) {
10109 if (negate && !prefix) {
10115 matchedEntries.push(e);
10118 var len = matchedEntries.length;
10121 if (remain.length === 1 && !this.mark && !this.stat) {
10122 if (!this.matches[index])
10123 this.matches[index] = Object.create(null);
10124 for (var i = 0; i < len; i++) {
10125 var e = matchedEntries[i];
10127 if (prefix !== "/")
10128 e = prefix + "/" + e;
10132 if (e.charAt(0) === "/" && !this.nomount) {
10133 e = path.join(this.root, e);
10135 this._emitMatch(index, e);
10140 for (var i = 0; i < len; i++) {
10141 var e = matchedEntries[i];
10144 if (prefix !== "/")
10145 e = prefix + "/" + e;
10149 this._process([e].concat(remain), index, inGlobStar, cb);
10153 Glob.prototype._emitMatch = function(index, e) {
10156 if (isIgnored(this, e))
10159 this._emitQueue.push([index, e]);
10162 var abs = isAbsolute(e) ? e : this._makeAbs(e);
10167 if (this.matches[index][e])
10170 var c = this.cache[abs];
10171 if (c === "DIR" || Array.isArray(c))
10174 this.matches[index][e] = true;
10175 var st = this.statCache[abs];
10177 this.emit("stat", e, st);
10178 this.emit("match", e);
10180 Glob.prototype._readdirInGlobStar = function(abs, cb) {
10184 return this._readdir(abs, false, cb);
10185 var lstatkey = "lstat\0" + abs;
10187 var lstatcb = inflight(lstatkey, lstatcb_);
10189 fs.lstat(abs, lstatcb);
10190 function lstatcb_(er, lstat) {
10191 if (er && er.code === "ENOENT")
10193 var isSym = lstat && lstat.isSymbolicLink();
10194 self2.symlinks[abs] = isSym;
10195 if (!isSym && lstat && !lstat.isDirectory()) {
10196 self2.cache[abs] = "FILE";
10199 self2._readdir(abs, false, cb);
10202 Glob.prototype._readdir = function(abs, inGlobStar, cb) {
10205 cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
10208 if (inGlobStar && !ownProp(this.symlinks, abs))
10209 return this._readdirInGlobStar(abs, cb);
10210 if (ownProp(this.cache, abs)) {
10211 var c = this.cache[abs];
10212 if (!c || c === "FILE")
10214 if (Array.isArray(c))
10215 return cb(null, c);
10218 fs.readdir(abs, readdirCb(this, abs, cb));
10220 function readdirCb(self2, abs, cb) {
10221 return function(er, entries) {
10223 self2._readdirError(abs, er, cb);
10225 self2._readdirEntries(abs, entries, cb);
10228 Glob.prototype._readdirEntries = function(abs, entries, cb) {
10231 if (!this.mark && !this.stat) {
10232 for (var i = 0; i < entries.length; i++) {
10233 var e = entries[i];
10238 this.cache[e] = true;
10241 this.cache[abs] = entries;
10242 return cb(null, entries);
10244 Glob.prototype._readdirError = function(f, er, cb) {
10250 var abs = this._makeAbs(f);
10251 this.cache[abs] = "FILE";
10252 if (abs === this.cwdAbs) {
10253 var error = new Error(er.code + " invalid cwd " + this.cwd);
10254 error.path = this.cwd;
10255 error.code = er.code;
10256 this.emit("error", error);
10262 case "ENAMETOOLONG":
10264 this.cache[this._makeAbs(f)] = false;
10267 this.cache[this._makeAbs(f)] = false;
10269 this.emit("error", er);
10273 console.error("glob error", er);
10278 Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
10280 this._readdir(abs, inGlobStar, function(er, entries) {
10281 self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
10284 Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
10287 var remainWithoutGlobStar = remain.slice(1);
10288 var gspref = prefix ? [prefix] : [];
10289 var noGlobStar = gspref.concat(remainWithoutGlobStar);
10290 this._process(noGlobStar, index, false, cb);
10291 var isSym = this.symlinks[abs];
10292 var len = entries.length;
10293 if (isSym && inGlobStar)
10295 for (var i = 0; i < len; i++) {
10296 var e = entries[i];
10297 if (e.charAt(0) === "." && !this.dot)
10299 var instead = gspref.concat(entries[i], remainWithoutGlobStar);
10300 this._process(instead, index, true, cb);
10301 var below = gspref.concat(entries[i], remain);
10302 this._process(below, index, true, cb);
10306 Glob.prototype._processSimple = function(prefix, index, cb) {
10308 this._stat(prefix, function(er, exists) {
10309 self2._processSimple2(prefix, index, er, exists, cb);
10312 Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) {
10313 if (!this.matches[index])
10314 this.matches[index] = Object.create(null);
10317 if (prefix && isAbsolute(prefix) && !this.nomount) {
10318 var trail = /[\/\\]$/.test(prefix);
10319 if (prefix.charAt(0) === "/") {
10320 prefix = path.join(this.root, prefix);
10322 prefix = path.resolve(this.root, prefix);
10327 if (process.platform === "win32")
10328 prefix = prefix.replace(/\\/g, "/");
10329 this._emitMatch(index, prefix);
10332 Glob.prototype._stat = function(f, cb) {
10333 var abs = this._makeAbs(f);
10334 var needDir = f.slice(-1) === "/";
10335 if (f.length > this.maxLength)
10337 if (!this.stat && ownProp(this.cache, abs)) {
10338 var c = this.cache[abs];
10339 if (Array.isArray(c))
10341 if (!needDir || c === "DIR")
10342 return cb(null, c);
10343 if (needDir && c === "FILE")
10347 var stat = this.statCache[abs];
10348 if (stat !== void 0) {
10349 if (stat === false)
10350 return cb(null, stat);
10352 var type = stat.isDirectory() ? "DIR" : "FILE";
10353 if (needDir && type === "FILE")
10356 return cb(null, type, stat);
10360 var statcb = inflight("stat\0" + abs, lstatcb_);
10362 fs.lstat(abs, statcb);
10363 function lstatcb_(er, lstat) {
10364 if (lstat && lstat.isSymbolicLink()) {
10365 return fs.stat(abs, function(er2, stat2) {
10367 self2._stat2(f, abs, null, lstat, cb);
10369 self2._stat2(f, abs, er2, stat2, cb);
10372 self2._stat2(f, abs, er, lstat, cb);
10376 Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
10377 if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
10378 this.statCache[abs] = false;
10381 var needDir = f.slice(-1) === "/";
10382 this.statCache[abs] = stat;
10383 if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
10384 return cb(null, false, stat);
10387 c = stat.isDirectory() ? "DIR" : "FILE";
10388 this.cache[abs] = this.cache[abs] || c;
10389 if (needDir && c === "FILE")
10391 return cb(null, c, stat);
10395 // node_modules/rimraf/rimraf.js
10396 var require_rimraf = __commonJS((exports2, module2) => {
10397 var assert = require("assert");
10398 var path = require("path");
10399 var fs = require("fs");
10402 glob = require_glob();
10405 var defaultGlobOpts = {
10410 var isWindows = process.platform === "win32";
10411 var defaults = (options) => {
10420 methods.forEach((m) => {
10421 options[m] = options[m] || fs[m];
10423 options[m] = options[m] || fs[m];
10425 options.maxBusyTries = options.maxBusyTries || 3;
10426 options.emfileWait = options.emfileWait || 1e3;
10427 if (options.glob === false) {
10428 options.disableGlob = true;
10430 if (options.disableGlob !== true && glob === void 0) {
10431 throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");
10433 options.disableGlob = options.disableGlob || false;
10434 options.glob = options.glob || defaultGlobOpts;
10436 var rimraf = (p, options, cb) => {
10437 if (typeof options === "function") {
10441 assert(p, "rimraf: missing path");
10442 assert.equal(typeof p, "string", "rimraf: path should be a string");
10443 assert.equal(typeof cb, "function", "rimraf: callback function required");
10444 assert(options, "rimraf: invalid options argument provided");
10445 assert.equal(typeof options, "object", "rimraf: options should be object");
10448 let errState = null;
10450 const next = (er) => {
10451 errState = errState || er;
10455 const afterGlob = (er, results) => {
10458 n = results.length;
10461 results.forEach((p2) => {
10462 const CB = (er2) => {
10464 if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) {
10466 return setTimeout(() => rimraf_(p2, options, CB), busyTries * 100);
10468 if (er2.code === "EMFILE" && timeout < options.emfileWait) {
10469 return setTimeout(() => rimraf_(p2, options, CB), timeout++);
10471 if (er2.code === "ENOENT")
10477 rimraf_(p2, options, CB);
10480 if (options.disableGlob || !glob.hasMagic(p))
10481 return afterGlob(null, [p]);
10482 options.lstat(p, (er, stat) => {
10484 return afterGlob(null, [p]);
10485 glob(p, options.glob, afterGlob);
10488 var rimraf_ = (p, options, cb) => {
10491 assert(typeof cb === "function");
10492 options.lstat(p, (er, st) => {
10493 if (er && er.code === "ENOENT")
10495 if (er && er.code === "EPERM" && isWindows)
10496 fixWinEPERM(p, options, er, cb);
10497 if (st && st.isDirectory())
10498 return rmdir(p, options, er, cb);
10499 options.unlink(p, (er2) => {
10501 if (er2.code === "ENOENT")
10503 if (er2.code === "EPERM")
10504 return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
10505 if (er2.code === "EISDIR")
10506 return rmdir(p, options, er2, cb);
10512 var fixWinEPERM = (p, options, er, cb) => {
10515 assert(typeof cb === "function");
10516 options.chmod(p, 438, (er2) => {
10518 cb(er2.code === "ENOENT" ? null : er);
10520 options.stat(p, (er3, stats) => {
10522 cb(er3.code === "ENOENT" ? null : er);
10523 else if (stats.isDirectory())
10524 rmdir(p, options, er, cb);
10526 options.unlink(p, cb);
10530 var fixWinEPERMSync = (p, options, er) => {
10534 options.chmodSync(p, 438);
10536 if (er2.code === "ENOENT")
10543 stats = options.statSync(p);
10545 if (er3.code === "ENOENT")
10550 if (stats.isDirectory())
10551 rmdirSync(p, options, er);
10553 options.unlinkSync(p);
10555 var rmdir = (p, options, originalEr, cb) => {
10558 assert(typeof cb === "function");
10559 options.rmdir(p, (er) => {
10560 if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
10561 rmkids(p, options, cb);
10562 else if (er && er.code === "ENOTDIR")
10568 var rmkids = (p, options, cb) => {
10571 assert(typeof cb === "function");
10572 options.readdir(p, (er, files) => {
10575 let n = files.length;
10577 return options.rmdir(p, cb);
10579 files.forEach((f) => {
10580 rimraf(path.join(p, f), options, (er2) => {
10584 return cb(errState = er2);
10586 options.rmdir(p, cb);
10591 var rimrafSync = (p, options) => {
10592 options = options || {};
10594 assert(p, "rimraf: missing path");
10595 assert.equal(typeof p, "string", "rimraf: path should be a string");
10596 assert(options, "rimraf: missing options");
10597 assert.equal(typeof options, "object", "rimraf: options should be object");
10599 if (options.disableGlob || !glob.hasMagic(p)) {
10603 options.lstatSync(p);
10606 results = glob.sync(p, options.glob);
10609 if (!results.length)
10611 for (let i = 0; i < results.length; i++) {
10612 const p2 = results[i];
10615 st = options.lstatSync(p2);
10617 if (er.code === "ENOENT")
10619 if (er.code === "EPERM" && isWindows)
10620 fixWinEPERMSync(p2, options, er);
10623 if (st && st.isDirectory())
10624 rmdirSync(p2, options, null);
10626 options.unlinkSync(p2);
10628 if (er.code === "ENOENT")
10630 if (er.code === "EPERM")
10631 return isWindows ? fixWinEPERMSync(p2, options, er) : rmdirSync(p2, options, er);
10632 if (er.code !== "EISDIR")
10634 rmdirSync(p2, options, er);
10638 var rmdirSync = (p, options, originalEr) => {
10642 options.rmdirSync(p);
10644 if (er.code === "ENOENT")
10646 if (er.code === "ENOTDIR")
10648 if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
10649 rmkidsSync(p, options);
10652 var rmkidsSync = (p, options) => {
10655 options.readdirSync(p).forEach((f) => rimrafSync(path.join(p, f), options));
10656 const retries = isWindows ? 100 : 1;
10661 const ret2 = options.rmdirSync(p, options);
10665 if (++i < retries && threw)
10670 module2.exports = rimraf;
10671 rimraf.sync = rimrafSync;
10674 // node_modules/semver/internal/constants.js
10675 var require_constants2 = __commonJS((exports2, module2) => {
10676 var SEMVER_SPEC_VERSION = "2.0.0";
10677 var MAX_LENGTH = 256;
10678 var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
10679 var MAX_SAFE_COMPONENT_LENGTH = 16;
10680 module2.exports = {
10681 SEMVER_SPEC_VERSION,
10684 MAX_SAFE_COMPONENT_LENGTH
10688 // node_modules/semver/internal/debug.js
10689 var require_debug = __commonJS((exports2, module2) => {
10690 var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
10692 module2.exports = debug;
10695 // node_modules/semver/internal/re.js
10696 var require_re = __commonJS((exports2, module2) => {
10697 var {MAX_SAFE_COMPONENT_LENGTH} = require_constants2();
10698 var debug = require_debug();
10699 exports2 = module2.exports = {};
10700 var re = exports2.re = [];
10701 var src = exports2.src = [];
10702 var t = exports2.t = {};
10704 var createToken = (name, value, isGlobal) => {
10706 debug(index, value);
10708 src[index] = value;
10709 re[index] = new RegExp(value, isGlobal ? "g" : void 0);
10711 createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
10712 createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
10713 createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
10714 createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
10715 createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
10716 createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
10717 createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
10718 createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
10719 createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
10720 createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
10721 createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
10722 createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
10723 createToken("FULL", `^${src[t.FULLPLAIN]}$`);
10724 createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
10725 createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
10726 createToken("GTLT", "((?:<|>)?=?)");
10727 createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
10728 createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
10729 createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
10730 createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
10731 createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
10732 createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
10733 createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
10734 createToken("COERCERTL", src[t.COERCE], true);
10735 createToken("LONETILDE", "(?:~>?)");
10736 createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
10737 exports2.tildeTrimReplace = "$1~";
10738 createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
10739 createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
10740 createToken("LONECARET", "(?:\\^)");
10741 createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
10742 exports2.caretTrimReplace = "$1^";
10743 createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
10744 createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
10745 createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
10746 createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
10747 createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
10748 exports2.comparatorTrimReplace = "$1$2$3";
10749 createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
10750 createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
10751 createToken("STAR", "(<|>)?=?\\s*\\*");
10752 createToken("GTE0", "^\\s*>=\\s*0.0.0\\s*$");
10753 createToken("GTE0PRE", "^\\s*>=\\s*0.0.0-0\\s*$");
10756 // node_modules/semver/internal/parse-options.js
10757 var require_parse_options = __commonJS((exports2, module2) => {
10758 var opts = ["includePrerelease", "loose", "rtl"];
10759 var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {loose: true} : opts.filter((k) => options[k]).reduce((options2, k) => {
10760 options2[k] = true;
10763 module2.exports = parseOptions;
10766 // node_modules/semver/internal/identifiers.js
10767 var require_identifiers = __commonJS((exports2, module2) => {
10768 var numeric = /^[0-9]+$/;
10769 var compareIdentifiers = (a, b) => {
10770 const anum = numeric.test(a);
10771 const bnum = numeric.test(b);
10772 if (anum && bnum) {
10776 return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
10778 var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
10779 module2.exports = {
10780 compareIdentifiers,
10781 rcompareIdentifiers
10785 // node_modules/semver/classes/semver.js
10786 var require_semver = __commonJS((exports2, module2) => {
10787 var debug = require_debug();
10788 var {MAX_LENGTH, MAX_SAFE_INTEGER} = require_constants2();
10789 var {re, t} = require_re();
10790 var parseOptions = require_parse_options();
10791 var {compareIdentifiers} = require_identifiers();
10792 var SemVer = class {
10793 constructor(version, options) {
10794 options = parseOptions(options);
10795 if (version instanceof SemVer) {
10796 if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
10799 version = version.version;
10801 } else if (typeof version !== "string") {
10802 throw new TypeError(`Invalid Version: ${version}`);
10804 if (version.length > MAX_LENGTH) {
10805 throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
10807 debug("SemVer", version, options);
10808 this.options = options;
10809 this.loose = !!options.loose;
10810 this.includePrerelease = !!options.includePrerelease;
10811 const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
10813 throw new TypeError(`Invalid Version: ${version}`);
10815 this.raw = version;
10816 this.major = +m[1];
10817 this.minor = +m[2];
10818 this.patch = +m[3];
10819 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
10820 throw new TypeError("Invalid major version");
10822 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
10823 throw new TypeError("Invalid minor version");
10825 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
10826 throw new TypeError("Invalid patch version");
10829 this.prerelease = [];
10831 this.prerelease = m[4].split(".").map((id) => {
10832 if (/^[0-9]+$/.test(id)) {
10834 if (num >= 0 && num < MAX_SAFE_INTEGER) {
10841 this.build = m[5] ? m[5].split(".") : [];
10845 this.version = `${this.major}.${this.minor}.${this.patch}`;
10846 if (this.prerelease.length) {
10847 this.version += `-${this.prerelease.join(".")}`;
10849 return this.version;
10852 return this.version;
10855 debug("SemVer.compare", this.version, this.options, other);
10856 if (!(other instanceof SemVer)) {
10857 if (typeof other === "string" && other === this.version) {
10860 other = new SemVer(other, this.options);
10862 if (other.version === this.version) {
10865 return this.compareMain(other) || this.comparePre(other);
10867 compareMain(other) {
10868 if (!(other instanceof SemVer)) {
10869 other = new SemVer(other, this.options);
10871 return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
10873 comparePre(other) {
10874 if (!(other instanceof SemVer)) {
10875 other = new SemVer(other, this.options);
10877 if (this.prerelease.length && !other.prerelease.length) {
10879 } else if (!this.prerelease.length && other.prerelease.length) {
10881 } else if (!this.prerelease.length && !other.prerelease.length) {
10886 const a = this.prerelease[i];
10887 const b = other.prerelease[i];
10888 debug("prerelease compare", i, a, b);
10889 if (a === void 0 && b === void 0) {
10891 } else if (b === void 0) {
10893 } else if (a === void 0) {
10895 } else if (a === b) {
10898 return compareIdentifiers(a, b);
10902 compareBuild(other) {
10903 if (!(other instanceof SemVer)) {
10904 other = new SemVer(other, this.options);
10908 const a = this.build[i];
10909 const b = other.build[i];
10910 debug("prerelease compare", i, a, b);
10911 if (a === void 0 && b === void 0) {
10913 } else if (b === void 0) {
10915 } else if (a === void 0) {
10917 } else if (a === b) {
10920 return compareIdentifiers(a, b);
10924 inc(release, identifier) {
10927 this.prerelease.length = 0;
10931 this.inc("pre", identifier);
10934 this.prerelease.length = 0;
10937 this.inc("pre", identifier);
10940 this.prerelease.length = 0;
10941 this.inc("patch", identifier);
10942 this.inc("pre", identifier);
10945 if (this.prerelease.length === 0) {
10946 this.inc("patch", identifier);
10948 this.inc("pre", identifier);
10951 if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
10956 this.prerelease = [];
10959 if (this.patch !== 0 || this.prerelease.length === 0) {
10963 this.prerelease = [];
10966 if (this.prerelease.length === 0) {
10969 this.prerelease = [];
10972 if (this.prerelease.length === 0) {
10973 this.prerelease = [0];
10975 let i = this.prerelease.length;
10977 if (typeof this.prerelease[i] === "number") {
10978 this.prerelease[i]++;
10983 this.prerelease.push(0);
10987 if (this.prerelease[0] === identifier) {
10988 if (isNaN(this.prerelease[1])) {
10989 this.prerelease = [identifier, 0];
10992 this.prerelease = [identifier, 0];
10997 throw new Error(`invalid increment argument: ${release}`);
11000 this.raw = this.version;
11004 module2.exports = SemVer;
11007 // node_modules/semver/functions/parse.js
11008 var require_parse2 = __commonJS((exports2, module2) => {
11009 var {MAX_LENGTH} = require_constants2();
11010 var {re, t} = require_re();
11011 var SemVer = require_semver();
11012 var parseOptions = require_parse_options();
11013 var parse = (version, options) => {
11014 options = parseOptions(options);
11015 if (version instanceof SemVer) {
11018 if (typeof version !== "string") {
11021 if (version.length > MAX_LENGTH) {
11024 const r = options.loose ? re[t.LOOSE] : re[t.FULL];
11025 if (!r.test(version)) {
11029 return new SemVer(version, options);
11034 module2.exports = parse;
11037 // node_modules/semver/functions/valid.js
11038 var require_valid = __commonJS((exports2, module2) => {
11039 var parse = require_parse2();
11040 var valid = (version, options) => {
11041 const v = parse(version, options);
11042 return v ? v.version : null;
11044 module2.exports = valid;
11047 // node_modules/semver/functions/clean.js
11048 var require_clean = __commonJS((exports2, module2) => {
11049 var parse = require_parse2();
11050 var clean = (version, options) => {
11051 const s = parse(version.trim().replace(/^[=v]+/, ""), options);
11052 return s ? s.version : null;
11054 module2.exports = clean;
11057 // node_modules/semver/functions/inc.js
11058 var require_inc = __commonJS((exports2, module2) => {
11059 var SemVer = require_semver();
11060 var inc = (version, release, options, identifier) => {
11061 if (typeof options === "string") {
11062 identifier = options;
11066 return new SemVer(version, options).inc(release, identifier).version;
11071 module2.exports = inc;
11074 // node_modules/semver/functions/compare.js
11075 var require_compare = __commonJS((exports2, module2) => {
11076 var SemVer = require_semver();
11077 var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
11078 module2.exports = compare;
11081 // node_modules/semver/functions/eq.js
11082 var require_eq = __commonJS((exports2, module2) => {
11083 var compare = require_compare();
11084 var eq = (a, b, loose) => compare(a, b, loose) === 0;
11085 module2.exports = eq;
11088 // node_modules/semver/functions/diff.js
11089 var require_diff = __commonJS((exports2, module2) => {
11090 var parse = require_parse2();
11091 var eq = require_eq();
11092 var diff = (version1, version2) => {
11093 if (eq(version1, version2)) {
11096 const v1 = parse(version1);
11097 const v2 = parse(version2);
11098 const hasPre = v1.prerelease.length || v2.prerelease.length;
11099 const prefix = hasPre ? "pre" : "";
11100 const defaultResult = hasPre ? "prerelease" : "";
11101 for (const key in v1) {
11102 if (key === "major" || key === "minor" || key === "patch") {
11103 if (v1[key] !== v2[key]) {
11104 return prefix + key;
11108 return defaultResult;
11111 module2.exports = diff;
11114 // node_modules/semver/functions/major.js
11115 var require_major = __commonJS((exports2, module2) => {
11116 var SemVer = require_semver();
11117 var major = (a, loose) => new SemVer(a, loose).major;
11118 module2.exports = major;
11121 // node_modules/semver/functions/minor.js
11122 var require_minor = __commonJS((exports2, module2) => {
11123 var SemVer = require_semver();
11124 var minor = (a, loose) => new SemVer(a, loose).minor;
11125 module2.exports = minor;
11128 // node_modules/semver/functions/patch.js
11129 var require_patch = __commonJS((exports2, module2) => {
11130 var SemVer = require_semver();
11131 var patch = (a, loose) => new SemVer(a, loose).patch;
11132 module2.exports = patch;
11135 // node_modules/semver/functions/prerelease.js
11136 var require_prerelease = __commonJS((exports2, module2) => {
11137 var parse = require_parse2();
11138 var prerelease = (version, options) => {
11139 const parsed = parse(version, options);
11140 return parsed && parsed.prerelease.length ? parsed.prerelease : null;
11142 module2.exports = prerelease;
11145 // node_modules/semver/functions/rcompare.js
11146 var require_rcompare = __commonJS((exports2, module2) => {
11147 var compare = require_compare();
11148 var rcompare = (a, b, loose) => compare(b, a, loose);
11149 module2.exports = rcompare;
11152 // node_modules/semver/functions/compare-loose.js
11153 var require_compare_loose = __commonJS((exports2, module2) => {
11154 var compare = require_compare();
11155 var compareLoose = (a, b) => compare(a, b, true);
11156 module2.exports = compareLoose;
11159 // node_modules/semver/functions/compare-build.js
11160 var require_compare_build = __commonJS((exports2, module2) => {
11161 var SemVer = require_semver();
11162 var compareBuild = (a, b, loose) => {
11163 const versionA = new SemVer(a, loose);
11164 const versionB = new SemVer(b, loose);
11165 return versionA.compare(versionB) || versionA.compareBuild(versionB);
11167 module2.exports = compareBuild;
11170 // node_modules/semver/functions/sort.js
11171 var require_sort = __commonJS((exports2, module2) => {
11172 var compareBuild = require_compare_build();
11173 var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
11174 module2.exports = sort;
11177 // node_modules/semver/functions/rsort.js
11178 var require_rsort = __commonJS((exports2, module2) => {
11179 var compareBuild = require_compare_build();
11180 var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
11181 module2.exports = rsort;
11184 // node_modules/semver/functions/gt.js
11185 var require_gt = __commonJS((exports2, module2) => {
11186 var compare = require_compare();
11187 var gt = (a, b, loose) => compare(a, b, loose) > 0;
11188 module2.exports = gt;
11191 // node_modules/semver/functions/lt.js
11192 var require_lt = __commonJS((exports2, module2) => {
11193 var compare = require_compare();
11194 var lt = (a, b, loose) => compare(a, b, loose) < 0;
11195 module2.exports = lt;
11198 // node_modules/semver/functions/neq.js
11199 var require_neq = __commonJS((exports2, module2) => {
11200 var compare = require_compare();
11201 var neq = (a, b, loose) => compare(a, b, loose) !== 0;
11202 module2.exports = neq;
11205 // node_modules/semver/functions/gte.js
11206 var require_gte = __commonJS((exports2, module2) => {
11207 var compare = require_compare();
11208 var gte = (a, b, loose) => compare(a, b, loose) >= 0;
11209 module2.exports = gte;
11212 // node_modules/semver/functions/lte.js
11213 var require_lte = __commonJS((exports2, module2) => {
11214 var compare = require_compare();
11215 var lte = (a, b, loose) => compare(a, b, loose) <= 0;
11216 module2.exports = lte;
11219 // node_modules/semver/functions/cmp.js
11220 var require_cmp = __commonJS((exports2, module2) => {
11221 var eq = require_eq();
11222 var neq = require_neq();
11223 var gt = require_gt();
11224 var gte = require_gte();
11225 var lt = require_lt();
11226 var lte = require_lte();
11227 var cmp = (a, op, b, loose) => {
11230 if (typeof a === "object")
11232 if (typeof b === "object")
11236 if (typeof a === "object")
11238 if (typeof b === "object")
11244 return eq(a, b, loose);
11246 return neq(a, b, loose);
11248 return gt(a, b, loose);
11250 return gte(a, b, loose);
11252 return lt(a, b, loose);
11254 return lte(a, b, loose);
11256 throw new TypeError(`Invalid operator: ${op}`);
11259 module2.exports = cmp;
11262 // node_modules/semver/functions/coerce.js
11263 var require_coerce = __commonJS((exports2, module2) => {
11264 var SemVer = require_semver();
11265 var parse = require_parse2();
11266 var {re, t} = require_re();
11267 var coerce = (version, options) => {
11268 if (version instanceof SemVer) {
11271 if (typeof version === "number") {
11272 version = String(version);
11274 if (typeof version !== "string") {
11277 options = options || {};
11279 if (!options.rtl) {
11280 match = version.match(re[t.COERCE]);
11283 while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
11284 if (!match || next.index + next[0].length !== match.index + match[0].length) {
11287 re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
11289 re[t.COERCERTL].lastIndex = -1;
11291 if (match === null)
11293 return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
11295 module2.exports = coerce;
11298 // node_modules/yallist/iterator.js
11299 var require_iterator = __commonJS((exports2, module2) => {
11301 module2.exports = function(Yallist) {
11302 Yallist.prototype[Symbol.iterator] = function* () {
11303 for (let walker = this.head; walker; walker = walker.next) {
11304 yield walker.value;
11310 // node_modules/yallist/yallist.js
11311 var require_yallist = __commonJS((exports2, module2) => {
11313 module2.exports = Yallist;
11314 Yallist.Node = Node;
11315 Yallist.create = Yallist;
11316 function Yallist(list) {
11318 if (!(self2 instanceof Yallist)) {
11319 self2 = new Yallist();
11324 if (list && typeof list.forEach === "function") {
11325 list.forEach(function(item) {
11328 } else if (arguments.length > 0) {
11329 for (var i = 0, l = arguments.length; i < l; i++) {
11330 self2.push(arguments[i]);
11335 Yallist.prototype.removeNode = function(node) {
11336 if (node.list !== this) {
11337 throw new Error("removing node which does not belong to this list");
11339 var next = node.next;
11340 var prev = node.prev;
11347 if (node === this.head) {
11350 if (node === this.tail) {
11353 node.list.length--;
11359 Yallist.prototype.unshiftNode = function(node) {
11360 if (node === this.head) {
11364 node.list.removeNode(node);
11366 var head = this.head;
11378 Yallist.prototype.pushNode = function(node) {
11379 if (node === this.tail) {
11383 node.list.removeNode(node);
11385 var tail = this.tail;
11397 Yallist.prototype.push = function() {
11398 for (var i = 0, l = arguments.length; i < l; i++) {
11399 push(this, arguments[i]);
11401 return this.length;
11403 Yallist.prototype.unshift = function() {
11404 for (var i = 0, l = arguments.length; i < l; i++) {
11405 unshift(this, arguments[i]);
11407 return this.length;
11409 Yallist.prototype.pop = function() {
11413 var res = this.tail.value;
11414 this.tail = this.tail.prev;
11416 this.tail.next = null;
11423 Yallist.prototype.shift = function() {
11427 var res = this.head.value;
11428 this.head = this.head.next;
11430 this.head.prev = null;
11437 Yallist.prototype.forEach = function(fn, thisp) {
11438 thisp = thisp || this;
11439 for (var walker = this.head, i = 0; walker !== null; i++) {
11440 fn.call(thisp, walker.value, i, this);
11441 walker = walker.next;
11444 Yallist.prototype.forEachReverse = function(fn, thisp) {
11445 thisp = thisp || this;
11446 for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
11447 fn.call(thisp, walker.value, i, this);
11448 walker = walker.prev;
11451 Yallist.prototype.get = function(n) {
11452 for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
11453 walker = walker.next;
11455 if (i === n && walker !== null) {
11456 return walker.value;
11459 Yallist.prototype.getReverse = function(n) {
11460 for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
11461 walker = walker.prev;
11463 if (i === n && walker !== null) {
11464 return walker.value;
11467 Yallist.prototype.map = function(fn, thisp) {
11468 thisp = thisp || this;
11469 var res = new Yallist();
11470 for (var walker = this.head; walker !== null; ) {
11471 res.push(fn.call(thisp, walker.value, this));
11472 walker = walker.next;
11476 Yallist.prototype.mapReverse = function(fn, thisp) {
11477 thisp = thisp || this;
11478 var res = new Yallist();
11479 for (var walker = this.tail; walker !== null; ) {
11480 res.push(fn.call(thisp, walker.value, this));
11481 walker = walker.prev;
11485 Yallist.prototype.reduce = function(fn, initial) {
11487 var walker = this.head;
11488 if (arguments.length > 1) {
11490 } else if (this.head) {
11491 walker = this.head.next;
11492 acc = this.head.value;
11494 throw new TypeError("Reduce of empty list with no initial value");
11496 for (var i = 0; walker !== null; i++) {
11497 acc = fn(acc, walker.value, i);
11498 walker = walker.next;
11502 Yallist.prototype.reduceReverse = function(fn, initial) {
11504 var walker = this.tail;
11505 if (arguments.length > 1) {
11507 } else if (this.tail) {
11508 walker = this.tail.prev;
11509 acc = this.tail.value;
11511 throw new TypeError("Reduce of empty list with no initial value");
11513 for (var i = this.length - 1; walker !== null; i--) {
11514 acc = fn(acc, walker.value, i);
11515 walker = walker.prev;
11519 Yallist.prototype.toArray = function() {
11520 var arr = new Array(this.length);
11521 for (var i = 0, walker = this.head; walker !== null; i++) {
11522 arr[i] = walker.value;
11523 walker = walker.next;
11527 Yallist.prototype.toArrayReverse = function() {
11528 var arr = new Array(this.length);
11529 for (var i = 0, walker = this.tail; walker !== null; i++) {
11530 arr[i] = walker.value;
11531 walker = walker.prev;
11535 Yallist.prototype.slice = function(from, to) {
11536 to = to || this.length;
11542 from += this.length;
11544 var ret2 = new Yallist();
11545 if (to < from || to < 0) {
11551 if (to > this.length) {
11554 for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
11555 walker = walker.next;
11557 for (; walker !== null && i < to; i++, walker = walker.next) {
11558 ret2.push(walker.value);
11562 Yallist.prototype.sliceReverse = function(from, to) {
11563 to = to || this.length;
11569 from += this.length;
11571 var ret2 = new Yallist();
11572 if (to < from || to < 0) {
11578 if (to > this.length) {
11581 for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
11582 walker = walker.prev;
11584 for (; walker !== null && i > from; i--, walker = walker.prev) {
11585 ret2.push(walker.value);
11589 Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
11590 if (start > this.length) {
11591 start = this.length - 1;
11594 start = this.length + start;
11596 for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
11597 walker = walker.next;
11600 for (var i = 0; walker && i < deleteCount; i++) {
11601 ret2.push(walker.value);
11602 walker = this.removeNode(walker);
11604 if (walker === null) {
11605 walker = this.tail;
11607 if (walker !== this.head && walker !== this.tail) {
11608 walker = walker.prev;
11610 for (var i = 0; i < nodes.length; i++) {
11611 walker = insert(this, walker, nodes[i]);
11615 Yallist.prototype.reverse = function() {
11616 var head = this.head;
11617 var tail = this.tail;
11618 for (var walker = head; walker !== null; walker = walker.prev) {
11619 var p = walker.prev;
11620 walker.prev = walker.next;
11627 function insert(self2, node, value) {
11628 var inserted = node === self2.head ? new Node(value, null, node, self2) : new Node(value, node, node.next, self2);
11629 if (inserted.next === null) {
11630 self2.tail = inserted;
11632 if (inserted.prev === null) {
11633 self2.head = inserted;
11638 function push(self2, item) {
11639 self2.tail = new Node(item, self2.tail, null, self2);
11641 self2.head = self2.tail;
11645 function unshift(self2, item) {
11646 self2.head = new Node(item, null, self2.head, self2);
11648 self2.tail = self2.head;
11652 function Node(value, prev, next, list) {
11653 if (!(this instanceof Node)) {
11654 return new Node(value, prev, next, list);
11657 this.value = value;
11672 require_iterator()(Yallist);
11677 // node_modules/lru-cache/index.js
11678 var require_lru_cache = __commonJS((exports2, module2) => {
11680 var Yallist = require_yallist();
11681 var MAX = Symbol("max");
11682 var LENGTH = Symbol("length");
11683 var LENGTH_CALCULATOR = Symbol("lengthCalculator");
11684 var ALLOW_STALE = Symbol("allowStale");
11685 var MAX_AGE = Symbol("maxAge");
11686 var DISPOSE = Symbol("dispose");
11687 var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
11688 var LRU_LIST = Symbol("lruList");
11689 var CACHE = Symbol("cache");
11690 var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
11691 var naiveLength = () => 1;
11692 var LRUCache = class {
11693 constructor(options) {
11694 if (typeof options === "number")
11695 options = {max: options};
11698 if (options.max && (typeof options.max !== "number" || options.max < 0))
11699 throw new TypeError("max must be a non-negative number");
11700 const max = this[MAX] = options.max || Infinity;
11701 const lc = options.length || naiveLength;
11702 this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
11703 this[ALLOW_STALE] = options.stale || false;
11704 if (options.maxAge && typeof options.maxAge !== "number")
11705 throw new TypeError("maxAge must be a number");
11706 this[MAX_AGE] = options.maxAge || 0;
11707 this[DISPOSE] = options.dispose;
11708 this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
11709 this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
11713 if (typeof mL !== "number" || mL < 0)
11714 throw new TypeError("max must be a non-negative number");
11715 this[MAX] = mL || Infinity;
11721 set allowStale(allowStale) {
11722 this[ALLOW_STALE] = !!allowStale;
11725 return this[ALLOW_STALE];
11728 if (typeof mA !== "number")
11729 throw new TypeError("maxAge must be a non-negative number");
11730 this[MAX_AGE] = mA;
11734 return this[MAX_AGE];
11736 set lengthCalculator(lC) {
11737 if (typeof lC !== "function")
11739 if (lC !== this[LENGTH_CALCULATOR]) {
11740 this[LENGTH_CALCULATOR] = lC;
11742 this[LRU_LIST].forEach((hit) => {
11743 hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
11744 this[LENGTH] += hit.length;
11749 get lengthCalculator() {
11750 return this[LENGTH_CALCULATOR];
11753 return this[LENGTH];
11756 return this[LRU_LIST].length;
11758 rforEach(fn, thisp) {
11759 thisp = thisp || this;
11760 for (let walker = this[LRU_LIST].tail; walker !== null; ) {
11761 const prev = walker.prev;
11762 forEachStep(this, fn, walker, thisp);
11766 forEach(fn, thisp) {
11767 thisp = thisp || this;
11768 for (let walker = this[LRU_LIST].head; walker !== null; ) {
11769 const next = walker.next;
11770 forEachStep(this, fn, walker, thisp);
11775 return this[LRU_LIST].toArray().map((k) => k.key);
11778 return this[LRU_LIST].toArray().map((k) => k.value);
11781 if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
11782 this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
11784 this[CACHE] = new Map();
11785 this[LRU_LIST] = new Yallist();
11789 return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
11792 e: hit.now + (hit.maxAge || 0)
11793 }).toArray().filter((h) => h);
11796 return this[LRU_LIST];
11798 set(key, value, maxAge) {
11799 maxAge = maxAge || this[MAX_AGE];
11800 if (maxAge && typeof maxAge !== "number")
11801 throw new TypeError("maxAge must be a number");
11802 const now = maxAge ? Date.now() : 0;
11803 const len = this[LENGTH_CALCULATOR](value, key);
11804 if (this[CACHE].has(key)) {
11805 if (len > this[MAX]) {
11806 del(this, this[CACHE].get(key));
11809 const node = this[CACHE].get(key);
11810 const item = node.value;
11811 if (this[DISPOSE]) {
11812 if (!this[NO_DISPOSE_ON_SET])
11813 this[DISPOSE](key, item.value);
11816 item.maxAge = maxAge;
11817 item.value = value;
11818 this[LENGTH] += len - item.length;
11824 const hit = new Entry(key, value, len, now, maxAge);
11825 if (hit.length > this[MAX]) {
11827 this[DISPOSE](key, value);
11830 this[LENGTH] += hit.length;
11831 this[LRU_LIST].unshift(hit);
11832 this[CACHE].set(key, this[LRU_LIST].head);
11837 if (!this[CACHE].has(key))
11839 const hit = this[CACHE].get(key).value;
11840 return !isStale(this, hit);
11843 return get(this, key, true);
11846 return get(this, key, false);
11849 const node = this[LRU_LIST].tail;
11856 del(this, this[CACHE].get(key));
11860 const now = Date.now();
11861 for (let l = arr.length - 1; l >= 0; l--) {
11862 const hit = arr[l];
11863 const expiresAt = hit.e || 0;
11864 if (expiresAt === 0)
11865 this.set(hit.k, hit.v);
11867 const maxAge = expiresAt - now;
11869 this.set(hit.k, hit.v, maxAge);
11875 this[CACHE].forEach((value, key) => get(this, key, false));
11878 var get = (self2, key, doUse) => {
11879 const node = self2[CACHE].get(key);
11881 const hit = node.value;
11882 if (isStale(self2, hit)) {
11884 if (!self2[ALLOW_STALE])
11888 if (self2[UPDATE_AGE_ON_GET])
11889 node.value.now = Date.now();
11890 self2[LRU_LIST].unshiftNode(node);
11896 var isStale = (self2, hit) => {
11897 if (!hit || !hit.maxAge && !self2[MAX_AGE])
11899 const diff = Date.now() - hit.now;
11900 return hit.maxAge ? diff > hit.maxAge : self2[MAX_AGE] && diff > self2[MAX_AGE];
11902 var trim = (self2) => {
11903 if (self2[LENGTH] > self2[MAX]) {
11904 for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
11905 const prev = walker.prev;
11906 del(self2, walker);
11911 var del = (self2, node) => {
11913 const hit = node.value;
11914 if (self2[DISPOSE])
11915 self2[DISPOSE](hit.key, hit.value);
11916 self2[LENGTH] -= hit.length;
11917 self2[CACHE].delete(hit.key);
11918 self2[LRU_LIST].removeNode(node);
11921 var Entry = class {
11922 constructor(key, value, length, now, maxAge) {
11924 this.value = value;
11925 this.length = length;
11927 this.maxAge = maxAge || 0;
11930 var forEachStep = (self2, fn, node, thisp) => {
11931 let hit = node.value;
11932 if (isStale(self2, hit)) {
11934 if (!self2[ALLOW_STALE])
11938 fn.call(thisp, hit.value, hit.key, self2);
11940 module2.exports = LRUCache;
11943 // node_modules/semver/classes/range.js
11944 var require_range = __commonJS((exports2, module2) => {
11945 var Range3 = class {
11946 constructor(range, options) {
11947 options = parseOptions(options);
11948 if (range instanceof Range3) {
11949 if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
11952 return new Range3(range.raw, options);
11955 if (range instanceof Comparator) {
11956 this.raw = range.value;
11957 this.set = [[range]];
11961 this.options = options;
11962 this.loose = !!options.loose;
11963 this.includePrerelease = !!options.includePrerelease;
11965 this.set = range.split(/\s*\|\|\s*/).map((range2) => this.parseRange(range2.trim())).filter((c) => c.length);
11966 if (!this.set.length) {
11967 throw new TypeError(`Invalid SemVer Range: ${range}`);
11969 if (this.set.length > 1) {
11970 const first = this.set[0];
11971 this.set = this.set.filter((c) => !isNullSet(c[0]));
11972 if (this.set.length === 0)
11973 this.set = [first];
11974 else if (this.set.length > 1) {
11975 for (const c of this.set) {
11976 if (c.length === 1 && isAny(c[0])) {
11986 this.range = this.set.map((comps) => {
11987 return comps.join(" ").trim();
11988 }).join("||").trim();
11994 parseRange(range) {
11995 range = range.trim();
11996 const memoOpts = Object.keys(this.options).join(",");
11997 const memoKey = `parseRange:${memoOpts}:${range}`;
11998 const cached = cache.get(memoKey);
12001 const loose = this.options.loose;
12002 const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
12003 range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
12004 debug("hyphen replace", range);
12005 range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
12006 debug("comparator trim", range, re[t.COMPARATORTRIM]);
12007 range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
12008 range = range.replace(re[t.CARETTRIM], caretTrimReplace);
12009 range = range.split(/\s+/).join(" ");
12010 const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
12011 const rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options));
12012 const l = rangeList.length;
12013 const rangeMap = new Map();
12014 for (const comp of rangeList) {
12015 if (isNullSet(comp))
12017 rangeMap.set(comp.value, comp);
12019 if (rangeMap.size > 1 && rangeMap.has(""))
12020 rangeMap.delete("");
12021 const result = [...rangeMap.values()];
12022 cache.set(memoKey, result);
12025 intersects(range, options) {
12026 if (!(range instanceof Range3)) {
12027 throw new TypeError("a Range is required");
12029 return this.set.some((thisComparators) => {
12030 return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
12031 return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
12032 return rangeComparators.every((rangeComparator) => {
12033 return thisComparator.intersects(rangeComparator, options);
12043 if (typeof version === "string") {
12045 version = new SemVer(version, this.options);
12050 for (let i = 0; i < this.set.length; i++) {
12051 if (testSet(this.set[i], version, this.options)) {
12058 module2.exports = Range3;
12059 var LRU = require_lru_cache();
12060 var cache = new LRU({max: 1e3});
12061 var parseOptions = require_parse_options();
12062 var Comparator = require_comparator();
12063 var debug = require_debug();
12064 var SemVer = require_semver();
12068 comparatorTrimReplace,
12072 var isNullSet = (c) => c.value === "<0.0.0-0";
12073 var isAny = (c) => c.value === "";
12074 var isSatisfiable = (comparators, options) => {
12076 const remainingComparators = comparators.slice();
12077 let testComparator = remainingComparators.pop();
12078 while (result && remainingComparators.length) {
12079 result = remainingComparators.every((otherComparator) => {
12080 return testComparator.intersects(otherComparator, options);
12082 testComparator = remainingComparators.pop();
12086 var parseComparator = (comp, options) => {
12087 debug("comp", comp, options);
12088 comp = replaceCarets(comp, options);
12089 debug("caret", comp);
12090 comp = replaceTildes(comp, options);
12091 debug("tildes", comp);
12092 comp = replaceXRanges(comp, options);
12093 debug("xrange", comp);
12094 comp = replaceStars(comp, options);
12095 debug("stars", comp);
12098 var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
12099 var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
12100 return replaceTilde(comp2, options);
12102 var replaceTilde = (comp, options) => {
12103 const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
12104 return comp.replace(r, (_, M, m, p, pr) => {
12105 debug("tilde", comp, _, M, m, p, pr);
12109 } else if (isX(m)) {
12110 ret2 = `>=${M}.0.0 <${+M + 1}.0.0-0`;
12111 } else if (isX(p)) {
12112 ret2 = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
12114 debug("replaceTilde pr", pr);
12115 ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
12117 ret2 = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
12119 debug("tilde return", ret2);
12123 var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
12124 return replaceCaret(comp2, options);
12126 var replaceCaret = (comp, options) => {
12127 debug("caret", comp, options);
12128 const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
12129 const z = options.includePrerelease ? "-0" : "";
12130 return comp.replace(r, (_, M, m, p, pr) => {
12131 debug("caret", comp, _, M, m, p, pr);
12135 } else if (isX(m)) {
12136 ret2 = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
12137 } else if (isX(p)) {
12139 ret2 = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
12141 ret2 = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
12144 debug("replaceCaret pr", pr);
12147 ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
12149 ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
12152 ret2 = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
12158 ret2 = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
12160 ret2 = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
12163 ret2 = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
12166 debug("caret return", ret2);
12170 var replaceXRanges = (comp, options) => {
12171 debug("replaceXRanges", comp, options);
12172 return comp.split(/\s+/).map((comp2) => {
12173 return replaceXRange(comp2, options);
12176 var replaceXRange = (comp, options) => {
12177 comp = comp.trim();
12178 const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
12179 return comp.replace(r, (ret2, gtlt, M, m, p, pr) => {
12180 debug("xRange", comp, ret2, gtlt, M, m, p, pr);
12182 const xm = xM || isX(m);
12183 const xp = xm || isX(p);
12185 if (gtlt === "=" && anyX) {
12188 pr = options.includePrerelease ? "-0" : "";
12190 if (gtlt === ">" || gtlt === "<") {
12195 } else if (gtlt && anyX) {
12200 if (gtlt === ">") {
12210 } else if (gtlt === "<=") {
12220 ret2 = `${gtlt + M}.${m}.${p}${pr}`;
12222 ret2 = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
12224 ret2 = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
12226 debug("xRange return", ret2);
12230 var replaceStars = (comp, options) => {
12231 debug("replaceStars", comp, options);
12232 return comp.trim().replace(re[t.STAR], "");
12234 var replaceGTE0 = (comp, options) => {
12235 debug("replaceGTE0", comp, options);
12236 return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
12238 var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
12241 } else if (isX(fm)) {
12242 from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
12243 } else if (isX(fp)) {
12244 from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
12246 from = `>=${from}`;
12248 from = `>=${from}${incPr ? "-0" : ""}`;
12252 } else if (isX(tm)) {
12253 to = `<${+tM + 1}.0.0-0`;
12254 } else if (isX(tp)) {
12255 to = `<${tM}.${+tm + 1}.0-0`;
12257 to = `<=${tM}.${tm}.${tp}-${tpr}`;
12258 } else if (incPr) {
12259 to = `<${tM}.${tm}.${+tp + 1}-0`;
12263 return `${from} ${to}`.trim();
12265 var testSet = (set, version, options) => {
12266 for (let i = 0; i < set.length; i++) {
12267 if (!set[i].test(version)) {
12271 if (version.prerelease.length && !options.includePrerelease) {
12272 for (let i = 0; i < set.length; i++) {
12273 debug(set[i].semver);
12274 if (set[i].semver === Comparator.ANY) {
12277 if (set[i].semver.prerelease.length > 0) {
12278 const allowed = set[i].semver;
12279 if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
12290 // node_modules/semver/classes/comparator.js
12291 var require_comparator = __commonJS((exports2, module2) => {
12292 var ANY = Symbol("SemVer ANY");
12293 var Comparator = class {
12297 constructor(comp, options) {
12298 options = parseOptions(options);
12299 if (comp instanceof Comparator) {
12300 if (comp.loose === !!options.loose) {
12306 debug("comparator", comp, options);
12307 this.options = options;
12308 this.loose = !!options.loose;
12310 if (this.semver === ANY) {
12313 this.value = this.operator + this.semver.version;
12315 debug("comp", this);
12318 const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
12319 const m = comp.match(r);
12321 throw new TypeError(`Invalid comparator: ${comp}`);
12323 this.operator = m[1] !== void 0 ? m[1] : "";
12324 if (this.operator === "=") {
12325 this.operator = "";
12330 this.semver = new SemVer(m[2], this.options.loose);
12337 debug("Comparator.test", version, this.options.loose);
12338 if (this.semver === ANY || version === ANY) {
12341 if (typeof version === "string") {
12343 version = new SemVer(version, this.options);
12348 return cmp(version, this.operator, this.semver, this.options);
12350 intersects(comp, options) {
12351 if (!(comp instanceof Comparator)) {
12352 throw new TypeError("a Comparator is required");
12354 if (!options || typeof options !== "object") {
12357 includePrerelease: false
12360 if (this.operator === "") {
12361 if (this.value === "") {
12364 return new Range3(comp.value, options).test(this.value);
12365 } else if (comp.operator === "") {
12366 if (comp.value === "") {
12369 return new Range3(this.value, options).test(comp.semver);
12371 const sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">");
12372 const sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<");
12373 const sameSemVer = this.semver.version === comp.semver.version;
12374 const differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<=");
12375 const oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<");
12376 const oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">");
12377 return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
12380 module2.exports = Comparator;
12381 var parseOptions = require_parse_options();
12382 var {re, t} = require_re();
12383 var cmp = require_cmp();
12384 var debug = require_debug();
12385 var SemVer = require_semver();
12386 var Range3 = require_range();
12389 // node_modules/semver/functions/satisfies.js
12390 var require_satisfies = __commonJS((exports2, module2) => {
12391 var Range3 = require_range();
12392 var satisfies = (version, range, options) => {
12394 range = new Range3(range, options);
12398 return range.test(version);
12400 module2.exports = satisfies;
12403 // node_modules/semver/ranges/to-comparators.js
12404 var require_to_comparators = __commonJS((exports2, module2) => {
12405 var Range3 = require_range();
12406 var toComparators = (range, options) => new Range3(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
12407 module2.exports = toComparators;
12410 // node_modules/semver/ranges/max-satisfying.js
12411 var require_max_satisfying = __commonJS((exports2, module2) => {
12412 var SemVer = require_semver();
12413 var Range3 = require_range();
12414 var maxSatisfying = (versions, range, options) => {
12417 let rangeObj = null;
12419 rangeObj = new Range3(range, options);
12423 versions.forEach((v) => {
12424 if (rangeObj.test(v)) {
12425 if (!max || maxSV.compare(v) === -1) {
12427 maxSV = new SemVer(max, options);
12433 module2.exports = maxSatisfying;
12436 // node_modules/semver/ranges/min-satisfying.js
12437 var require_min_satisfying = __commonJS((exports2, module2) => {
12438 var SemVer = require_semver();
12439 var Range3 = require_range();
12440 var minSatisfying = (versions, range, options) => {
12443 let rangeObj = null;
12445 rangeObj = new Range3(range, options);
12449 versions.forEach((v) => {
12450 if (rangeObj.test(v)) {
12451 if (!min || minSV.compare(v) === 1) {
12453 minSV = new SemVer(min, options);
12459 module2.exports = minSatisfying;
12462 // node_modules/semver/ranges/min-version.js
12463 var require_min_version = __commonJS((exports2, module2) => {
12464 var SemVer = require_semver();
12465 var Range3 = require_range();
12466 var gt = require_gt();
12467 var minVersion = (range, loose) => {
12468 range = new Range3(range, loose);
12469 let minver = new SemVer("0.0.0");
12470 if (range.test(minver)) {
12473 minver = new SemVer("0.0.0-0");
12474 if (range.test(minver)) {
12478 for (let i = 0; i < range.set.length; ++i) {
12479 const comparators = range.set[i];
12481 comparators.forEach((comparator) => {
12482 const compver = new SemVer(comparator.semver.version);
12483 switch (comparator.operator) {
12485 if (compver.prerelease.length === 0) {
12488 compver.prerelease.push(0);
12490 compver.raw = compver.format();
12493 if (!setMin || gt(compver, setMin)) {
12501 throw new Error(`Unexpected operation: ${comparator.operator}`);
12504 if (setMin && (!minver || gt(minver, setMin)))
12507 if (minver && range.test(minver)) {
12512 module2.exports = minVersion;
12515 // node_modules/semver/ranges/valid.js
12516 var require_valid2 = __commonJS((exports2, module2) => {
12517 var Range3 = require_range();
12518 var validRange = (range, options) => {
12520 return new Range3(range, options).range || "*";
12525 module2.exports = validRange;
12528 // node_modules/semver/ranges/outside.js
12529 var require_outside = __commonJS((exports2, module2) => {
12530 var SemVer = require_semver();
12531 var Comparator = require_comparator();
12532 var {ANY} = Comparator;
12533 var Range3 = require_range();
12534 var satisfies = require_satisfies();
12535 var gt = require_gt();
12536 var lt = require_lt();
12537 var lte = require_lte();
12538 var gte = require_gte();
12539 var outside = (version, range, hilo, options) => {
12540 version = new SemVer(version, options);
12541 range = new Range3(range, options);
12542 let gtfn, ltefn, ltfn, comp, ecomp;
12559 throw new TypeError('Must provide a hilo val of "<" or ">"');
12561 if (satisfies(version, range, options)) {
12564 for (let i = 0; i < range.set.length; ++i) {
12565 const comparators = range.set[i];
12568 comparators.forEach((comparator) => {
12569 if (comparator.semver === ANY) {
12570 comparator = new Comparator(">=0.0.0");
12572 high = high || comparator;
12573 low = low || comparator;
12574 if (gtfn(comparator.semver, high.semver, options)) {
12576 } else if (ltfn(comparator.semver, low.semver, options)) {
12580 if (high.operator === comp || high.operator === ecomp) {
12583 if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
12585 } else if (low.operator === ecomp && ltfn(version, low.semver)) {
12591 module2.exports = outside;
12594 // node_modules/semver/ranges/gtr.js
12595 var require_gtr = __commonJS((exports2, module2) => {
12596 var outside = require_outside();
12597 var gtr = (version, range, options) => outside(version, range, ">", options);
12598 module2.exports = gtr;
12601 // node_modules/semver/ranges/ltr.js
12602 var require_ltr = __commonJS((exports2, module2) => {
12603 var outside = require_outside();
12604 var ltr = (version, range, options) => outside(version, range, "<", options);
12605 module2.exports = ltr;
12608 // node_modules/semver/ranges/intersects.js
12609 var require_intersects = __commonJS((exports2, module2) => {
12610 var Range3 = require_range();
12611 var intersects = (r1, r2, options) => {
12612 r1 = new Range3(r1, options);
12613 r2 = new Range3(r2, options);
12614 return r1.intersects(r2);
12616 module2.exports = intersects;
12619 // node_modules/semver/ranges/simplify.js
12620 var require_simplify = __commonJS((exports2, module2) => {
12621 var satisfies = require_satisfies();
12622 var compare = require_compare();
12623 module2.exports = (versions, range, options) => {
12627 const v = versions.sort((a, b) => compare(a, b, options));
12628 for (const version of v) {
12629 const included = satisfies(version, range, options);
12636 set.push([min, prev]);
12643 set.push([min, null]);
12645 for (const [min2, max] of set) {
12648 else if (!max && min2 === v[0])
12651 ranges.push(`>=${min2}`);
12652 else if (min2 === v[0])
12653 ranges.push(`<=${max}`);
12655 ranges.push(`${min2} - ${max}`);
12657 const simplified = ranges.join(" || ");
12658 const original = typeof range.raw === "string" ? range.raw : String(range);
12659 return simplified.length < original.length ? simplified : range;
12663 // node_modules/semver/ranges/subset.js
12664 var require_subset = __commonJS((exports2, module2) => {
12665 var Range3 = require_range();
12666 var {ANY} = require_comparator();
12667 var satisfies = require_satisfies();
12668 var compare = require_compare();
12669 var subset = (sub, dom, options) => {
12672 sub = new Range3(sub, options);
12673 dom = new Range3(dom, options);
12674 let sawNonNull = false;
12676 for (const simpleSub of sub.set) {
12677 for (const simpleDom of dom.set) {
12678 const isSub = simpleSubset(simpleSub, simpleDom, options);
12679 sawNonNull = sawNonNull || isSub !== null;
12688 var simpleSubset = (sub, dom, options) => {
12691 if (sub.length === 1 && sub[0].semver === ANY)
12692 return dom.length === 1 && dom[0].semver === ANY;
12693 const eqSet = new Set();
12695 for (const c of sub) {
12696 if (c.operator === ">" || c.operator === ">=")
12697 gt = higherGT(gt, c, options);
12698 else if (c.operator === "<" || c.operator === "<=")
12699 lt = lowerLT(lt, c, options);
12701 eqSet.add(c.semver);
12703 if (eqSet.size > 1)
12707 gtltComp = compare(gt.semver, lt.semver, options);
12710 else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
12713 for (const eq of eqSet) {
12714 if (gt && !satisfies(eq, String(gt), options))
12716 if (lt && !satisfies(eq, String(lt), options))
12718 for (const c of dom) {
12719 if (!satisfies(eq, String(c), options))
12725 let hasDomLT, hasDomGT;
12726 for (const c of dom) {
12727 hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
12728 hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
12730 if (c.operator === ">" || c.operator === ">=") {
12731 higher = higherGT(gt, c, options);
12732 if (higher === c && higher !== gt)
12734 } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options))
12738 if (c.operator === "<" || c.operator === "<=") {
12739 lower = lowerLT(lt, c, options);
12740 if (lower === c && lower !== lt)
12742 } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options))
12745 if (!c.operator && (lt || gt) && gtltComp !== 0)
12748 if (gt && hasDomLT && !lt && gtltComp !== 0)
12750 if (lt && hasDomGT && !gt && gtltComp !== 0)
12754 var higherGT = (a, b, options) => {
12757 const comp = compare(a.semver, b.semver, options);
12758 return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
12760 var lowerLT = (a, b, options) => {
12763 const comp = compare(a.semver, b.semver, options);
12764 return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
12766 module2.exports = subset;
12769 // node_modules/semver/index.js
12770 var require_semver2 = __commonJS((exports2, module2) => {
12771 var internalRe = require_re();
12772 module2.exports = {
12774 src: internalRe.src,
12775 tokens: internalRe.t,
12776 SEMVER_SPEC_VERSION: require_constants2().SEMVER_SPEC_VERSION,
12777 SemVer: require_semver(),
12778 compareIdentifiers: require_identifiers().compareIdentifiers,
12779 rcompareIdentifiers: require_identifiers().rcompareIdentifiers,
12780 parse: require_parse2(),
12781 valid: require_valid(),
12782 clean: require_clean(),
12783 inc: require_inc(),
12784 diff: require_diff(),
12785 major: require_major(),
12786 minor: require_minor(),
12787 patch: require_patch(),
12788 prerelease: require_prerelease(),
12789 compare: require_compare(),
12790 rcompare: require_rcompare(),
12791 compareLoose: require_compare_loose(),
12792 compareBuild: require_compare_build(),
12793 sort: require_sort(),
12794 rsort: require_rsort(),
12798 neq: require_neq(),
12799 gte: require_gte(),
12800 lte: require_lte(),
12801 cmp: require_cmp(),
12802 coerce: require_coerce(),
12803 Comparator: require_comparator(),
12804 Range: require_range(),
12805 satisfies: require_satisfies(),
12806 toComparators: require_to_comparators(),
12807 maxSatisfying: require_max_satisfying(),
12808 minSatisfying: require_min_satisfying(),
12809 minVersion: require_min_version(),
12810 validRange: require_valid2(),
12811 outside: require_outside(),
12812 gtr: require_gtr(),
12813 ltr: require_ltr(),
12814 intersects: require_intersects(),
12815 simplifyRange: require_simplify(),
12816 subset: require_subset()
12820 // node_modules/listenercount/index.js
12821 var require_listenercount = __commonJS((exports2, module2) => {
12823 var listenerCount = require("events").listenerCount;
12824 listenerCount = listenerCount || function(ee, event) {
12825 var listeners = ee && ee._events && ee._events[event];
12826 if (Array.isArray(listeners)) {
12827 return listeners.length;
12828 } else if (typeof listeners === "function") {
12834 module2.exports = listenerCount;
12837 // node_modules/buffer-indexof-polyfill/index.js
12838 var require_buffer_indexof_polyfill = __commonJS(() => {
12840 if (!Buffer.prototype.indexOf) {
12841 Buffer.prototype.indexOf = function(value, offset) {
12842 offset = offset || 0;
12843 if (typeof value === "string" || value instanceof String) {
12844 value = new Buffer(value);
12845 } else if (typeof value === "number" || value instanceof Number) {
12846 value = new Buffer([value]);
12848 var len = value.length;
12849 for (var i = offset; i <= this.length - len; i++) {
12850 var mismatch = false;
12851 for (var j = 0; j < len; j++) {
12852 if (this[i + j] != value[j]) {
12864 function bufferLastIndexOf(value, offset) {
12865 if (typeof value === "string" || value instanceof String) {
12866 value = new Buffer(value);
12867 } else if (typeof value === "number" || value instanceof Number) {
12868 value = new Buffer([value]);
12870 var len = value.length;
12871 offset = offset || this.length - len;
12872 for (var i = offset; i >= 0; i--) {
12873 var mismatch = false;
12874 for (var j = 0; j < len; j++) {
12875 if (this[i + j] != value[j]) {
12886 if (Buffer.prototype.lastIndexOf) {
12887 if (new Buffer("ABC").lastIndexOf("ABC") === -1)
12888 Buffer.prototype.lastIndexOf = bufferLastIndexOf;
12890 Buffer.prototype.lastIndexOf = bufferLastIndexOf;
12894 // node_modules/setimmediate/setImmediate.js
12895 var require_setImmediate = __commonJS((exports2) => {
12896 (function(global2, undefined2) {
12898 if (global2.setImmediate) {
12901 var nextHandle = 1;
12902 var tasksByHandle = {};
12903 var currentlyRunningATask = false;
12904 var doc = global2.document;
12905 var registerImmediate;
12906 function setImmediate2(callback) {
12907 if (typeof callback !== "function") {
12908 callback = new Function("" + callback);
12910 var args = new Array(arguments.length - 1);
12911 for (var i = 0; i < args.length; i++) {
12912 args[i] = arguments[i + 1];
12914 var task = {callback, args};
12915 tasksByHandle[nextHandle] = task;
12916 registerImmediate(nextHandle);
12917 return nextHandle++;
12919 function clearImmediate2(handle) {
12920 delete tasksByHandle[handle];
12922 function run(task) {
12923 var callback = task.callback;
12924 var args = task.args;
12925 switch (args.length) {
12933 callback(args[0], args[1]);
12936 callback(args[0], args[1], args[2]);
12939 callback.apply(undefined2, args);
12943 function runIfPresent(handle) {
12944 if (currentlyRunningATask) {
12945 setTimeout(runIfPresent, 0, handle);
12947 var task = tasksByHandle[handle];
12949 currentlyRunningATask = true;
12953 clearImmediate2(handle);
12954 currentlyRunningATask = false;
12959 function installNextTickImplementation() {
12960 registerImmediate = function(handle) {
12961 process.nextTick(function() {
12962 runIfPresent(handle);
12966 function canUsePostMessage() {
12967 if (global2.postMessage && !global2.importScripts) {
12968 var postMessageIsAsynchronous = true;
12969 var oldOnMessage = global2.onmessage;
12970 global2.onmessage = function() {
12971 postMessageIsAsynchronous = false;
12973 global2.postMessage("", "*");
12974 global2.onmessage = oldOnMessage;
12975 return postMessageIsAsynchronous;
12978 function installPostMessageImplementation() {
12979 var messagePrefix = "setImmediate$" + Math.random() + "$";
12980 var onGlobalMessage = function(event) {
12981 if (event.source === global2 && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
12982 runIfPresent(+event.data.slice(messagePrefix.length));
12985 if (global2.addEventListener) {
12986 global2.addEventListener("message", onGlobalMessage, false);
12988 global2.attachEvent("onmessage", onGlobalMessage);
12990 registerImmediate = function(handle) {
12991 global2.postMessage(messagePrefix + handle, "*");
12994 function installMessageChannelImplementation() {
12995 var channel = new MessageChannel();
12996 channel.port1.onmessage = function(event) {
12997 var handle = event.data;
12998 runIfPresent(handle);
13000 registerImmediate = function(handle) {
13001 channel.port2.postMessage(handle);
13004 function installReadyStateChangeImplementation() {
13005 var html = doc.documentElement;
13006 registerImmediate = function(handle) {
13007 var script = doc.createElement("script");
13008 script.onreadystatechange = function() {
13009 runIfPresent(handle);
13010 script.onreadystatechange = null;
13011 html.removeChild(script);
13014 html.appendChild(script);
13017 function installSetTimeoutImplementation() {
13018 registerImmediate = function(handle) {
13019 setTimeout(runIfPresent, 0, handle);
13022 var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global2);
13023 attachTo = attachTo && attachTo.setTimeout ? attachTo : global2;
13024 if ({}.toString.call(global2.process) === "[object process]") {
13025 installNextTickImplementation();
13026 } else if (canUsePostMessage()) {
13027 installPostMessageImplementation();
13028 } else if (global2.MessageChannel) {
13029 installMessageChannelImplementation();
13030 } else if (doc && "onreadystatechange" in doc.createElement("script")) {
13031 installReadyStateChangeImplementation();
13033 installSetTimeoutImplementation();
13035 attachTo.setImmediate = setImmediate2;
13036 attachTo.clearImmediate = clearImmediate2;
13037 })(typeof self === "undefined" ? typeof global === "undefined" ? exports2 : global : self);
13040 // node_modules/traverse/index.js
13041 var require_traverse = __commonJS((exports2, module2) => {
13042 module2.exports = Traverse;
13043 function Traverse(obj) {
13044 if (!(this instanceof Traverse))
13045 return new Traverse(obj);
13048 Traverse.prototype.get = function(ps) {
13049 var node = this.value;
13050 for (var i = 0; i < ps.length; i++) {
13052 if (!Object.hasOwnProperty.call(node, key)) {
13060 Traverse.prototype.set = function(ps, value) {
13061 var node = this.value;
13062 for (var i = 0; i < ps.length - 1; i++) {
13064 if (!Object.hasOwnProperty.call(node, key))
13068 node[ps[i]] = value;
13071 Traverse.prototype.map = function(cb) {
13072 return walk(this.value, cb, true);
13074 Traverse.prototype.forEach = function(cb) {
13075 this.value = walk(this.value, cb, false);
13078 Traverse.prototype.reduce = function(cb, init) {
13079 var skip = arguments.length === 1;
13080 var acc = skip ? this.value : init;
13081 this.forEach(function(x) {
13082 if (!this.isRoot || !skip) {
13083 acc = cb.call(this, acc, x);
13088 Traverse.prototype.deepEqual = function(obj) {
13089 if (arguments.length !== 1) {
13090 throw new Error("deepEqual requires exactly one object to compare against");
13094 this.forEach(function(y) {
13095 var notEqual = function() {
13099 if (!this.isRoot) {
13100 if (typeof node !== "object")
13102 node = node[this.key];
13105 this.post(function() {
13108 var toS = function(o) {
13109 return Object.prototype.toString.call(o);
13111 if (this.circular) {
13112 if (Traverse(obj).get(this.circular.path) !== x)
13114 } else if (typeof x !== typeof y) {
13116 } else if (x === null || y === null || x === void 0 || y === void 0) {
13119 } else if (x.__proto__ !== y.__proto__) {
13121 } else if (x === y) {
13122 } else if (typeof x === "function") {
13123 if (x instanceof RegExp) {
13124 if (x.toString() != y.toString())
13126 } else if (x !== y)
13128 } else if (typeof x === "object") {
13129 if (toS(y) === "[object Arguments]" || toS(x) === "[object Arguments]") {
13130 if (toS(x) !== toS(y)) {
13133 } else if (x instanceof Date || y instanceof Date) {
13134 if (!(x instanceof Date) || !(y instanceof Date) || x.getTime() !== y.getTime()) {
13138 var kx = Object.keys(x);
13139 var ky = Object.keys(y);
13140 if (kx.length !== ky.length)
13142 for (var i = 0; i < kx.length; i++) {
13144 if (!Object.hasOwnProperty.call(y, k)) {
13153 Traverse.prototype.paths = function() {
13155 this.forEach(function(x) {
13156 acc.push(this.path);
13160 Traverse.prototype.nodes = function() {
13162 this.forEach(function(x) {
13163 acc.push(this.node);
13167 Traverse.prototype.clone = function() {
13168 var parents = [], nodes = [];
13169 return function clone(src) {
13170 for (var i = 0; i < parents.length; i++) {
13171 if (parents[i] === src) {
13175 if (typeof src === "object" && src !== null) {
13176 var dst = copy(src);
13179 Object.keys(src).forEach(function(key) {
13180 dst[key] = clone(src[key]);
13190 function walk(root, cb, immutable) {
13194 return function walker(node_) {
13195 var node = immutable ? copy(node_) : node_;
13196 var modifiers = {};
13200 path: [].concat(path),
13201 parent: parents.slice(-1)[0],
13202 key: path.slice(-1)[0],
13203 isRoot: path.length === 0,
13204 level: path.length,
13206 update: function(x) {
13207 if (!state.isRoot) {
13208 state.parent.node[state.key] = x;
13212 delete: function() {
13213 delete state.parent.node[state.key];
13215 remove: function() {
13216 if (Array.isArray(state.parent.node)) {
13217 state.parent.node.splice(state.key, 1);
13219 delete state.parent.node[state.key];
13222 before: function(f) {
13223 modifiers.before = f;
13225 after: function(f) {
13226 modifiers.after = f;
13231 post: function(f) {
13232 modifiers.post = f;
13240 if (typeof node === "object" && node !== null) {
13241 state.isLeaf = Object.keys(node).length == 0;
13242 for (var i = 0; i < parents.length; i++) {
13243 if (parents[i].node_ === node_) {
13244 state.circular = parents[i];
13249 state.isLeaf = true;
13251 state.notLeaf = !state.isLeaf;
13252 state.notRoot = !state.isRoot;
13253 var ret2 = cb.call(state, state.node);
13254 if (ret2 !== void 0 && state.update)
13255 state.update(ret2);
13256 if (modifiers.before)
13257 modifiers.before.call(state, state.node);
13258 if (typeof state.node == "object" && state.node !== null && !state.circular) {
13259 parents.push(state);
13260 var keys = Object.keys(state.node);
13261 keys.forEach(function(key, i2) {
13264 modifiers.pre.call(state, state.node[key], key);
13265 var child = walker(state.node[key]);
13266 if (immutable && Object.hasOwnProperty.call(state.node, key)) {
13267 state.node[key] = child.node;
13269 child.isLast = i2 == keys.length - 1;
13270 child.isFirst = i2 == 0;
13271 if (modifiers.post)
13272 modifiers.post.call(state, child);
13277 if (modifiers.after)
13278 modifiers.after.call(state, state.node);
13282 Object.keys(Traverse.prototype).forEach(function(key) {
13283 Traverse[key] = function(obj) {
13284 var args = [].slice.call(arguments, 1);
13285 var t = Traverse(obj);
13286 return t[key].apply(t, args);
13289 function copy(src) {
13290 if (typeof src === "object" && src !== null) {
13292 if (Array.isArray(src)) {
13294 } else if (src instanceof Date) {
13295 dst = new Date(src);
13296 } else if (src instanceof Boolean) {
13297 dst = new Boolean(src);
13298 } else if (src instanceof Number) {
13299 dst = new Number(src);
13300 } else if (src instanceof String) {
13301 dst = new String(src);
13303 dst = Object.create(Object.getPrototypeOf(src));
13305 Object.keys(src).forEach(function(key) {
13306 dst[key] = src[key];
13314 // node_modules/chainsaw/index.js
13315 var require_chainsaw = __commonJS((exports2, module2) => {
13316 var Traverse = require_traverse();
13317 var EventEmitter = require("events").EventEmitter;
13318 module2.exports = Chainsaw;
13319 function Chainsaw(builder) {
13320 var saw = Chainsaw.saw(builder, {});
13321 var r = builder.call(saw.handlers, saw);
13325 return saw.chain();
13327 Chainsaw.light = function ChainsawLight(builder) {
13328 var saw = Chainsaw.saw(builder, {});
13329 var r = builder.call(saw.handlers, saw);
13332 return saw.chain();
13334 Chainsaw.saw = function(builder, handlers) {
13335 var saw = new EventEmitter();
13336 saw.handlers = handlers;
13338 saw.chain = function() {
13339 var ch = Traverse(saw.handlers).map(function(node) {
13342 var ps = this.path;
13343 if (typeof node === "function") {
13344 this.update(function() {
13347 args: [].slice.call(arguments)
13353 process.nextTick(function() {
13359 saw.pop = function() {
13360 return saw.actions.shift();
13362 saw.next = function() {
13363 var action = saw.pop();
13366 } else if (!action.trap) {
13367 var node = saw.handlers;
13368 action.path.forEach(function(key) {
13371 node.apply(saw.handlers, action.args);
13374 saw.nest = function(cb) {
13375 var args = [].slice.call(arguments, 1);
13376 var autonext = true;
13377 if (typeof cb === "boolean") {
13381 var s = Chainsaw.saw(builder, {});
13382 var r = builder.call(s.handlers, s);
13385 if (typeof saw.step !== "undefined") {
13388 cb.apply(s.chain(), args);
13389 if (autonext !== false)
13390 s.on("end", saw.next);
13392 saw.record = function() {
13393 upgradeChainsaw(saw);
13395 ["trap", "down", "jump"].forEach(function(method) {
13396 saw[method] = function() {
13397 throw new Error("To use the trap, down and jump features, please call record() first to start recording actions.");
13402 function upgradeChainsaw(saw) {
13404 saw.pop = function() {
13405 return saw.actions[saw.step++];
13407 saw.trap = function(name, cb) {
13408 var ps = Array.isArray(name) ? name : [name];
13416 saw.down = function(name) {
13417 var ps = (Array.isArray(name) ? name : [name]).join("/");
13418 var i = saw.actions.slice(saw.step).map(function(x) {
13419 if (x.trap && x.step <= saw.step)
13421 return x.path.join("/") == ps;
13426 saw.step = saw.actions.length;
13427 var act = saw.actions[saw.step - 1];
13428 if (act && act.trap) {
13429 saw.step = act.step;
13434 saw.jump = function(step) {
13441 // node_modules/buffers/index.js
13442 var require_buffers = __commonJS((exports2, module2) => {
13443 module2.exports = Buffers;
13444 function Buffers(bufs) {
13445 if (!(this instanceof Buffers))
13446 return new Buffers(bufs);
13447 this.buffers = bufs || [];
13448 this.length = this.buffers.reduce(function(size, buf) {
13449 return size + buf.length;
13452 Buffers.prototype.push = function() {
13453 for (var i = 0; i < arguments.length; i++) {
13454 if (!Buffer.isBuffer(arguments[i])) {
13455 throw new TypeError("Tried to push a non-buffer");
13458 for (var i = 0; i < arguments.length; i++) {
13459 var buf = arguments[i];
13460 this.buffers.push(buf);
13461 this.length += buf.length;
13463 return this.length;
13465 Buffers.prototype.unshift = function() {
13466 for (var i = 0; i < arguments.length; i++) {
13467 if (!Buffer.isBuffer(arguments[i])) {
13468 throw new TypeError("Tried to unshift a non-buffer");
13471 for (var i = 0; i < arguments.length; i++) {
13472 var buf = arguments[i];
13473 this.buffers.unshift(buf);
13474 this.length += buf.length;
13476 return this.length;
13478 Buffers.prototype.copy = function(dst, dStart, start, end) {
13479 return this.slice(start, end).copy(dst, dStart, 0, end - start);
13481 Buffers.prototype.splice = function(i, howMany) {
13482 var buffers = this.buffers;
13483 var index = i >= 0 ? i : this.length - i;
13484 var reps = [].slice.call(arguments, 2);
13485 if (howMany === void 0) {
13486 howMany = this.length - index;
13487 } else if (howMany > this.length - index) {
13488 howMany = this.length - index;
13490 for (var i = 0; i < reps.length; i++) {
13491 this.length += reps[i].length;
13493 var removed = new Buffers();
13495 var startBytes = 0;
13496 for (var ii = 0; ii < buffers.length && startBytes + buffers[ii].length < index; ii++) {
13497 startBytes += buffers[ii].length;
13499 if (index - startBytes > 0) {
13500 var start = index - startBytes;
13501 if (start + howMany < buffers[ii].length) {
13502 removed.push(buffers[ii].slice(start, start + howMany));
13503 var orig = buffers[ii];
13504 var buf0 = new Buffer(start);
13505 for (var i = 0; i < start; i++) {
13508 var buf1 = new Buffer(orig.length - start - howMany);
13509 for (var i = start + howMany; i < orig.length; i++) {
13510 buf1[i - howMany - start] = orig[i];
13512 if (reps.length > 0) {
13513 var reps_ = reps.slice();
13514 reps_.unshift(buf0);
13516 buffers.splice.apply(buffers, [ii, 1].concat(reps_));
13517 ii += reps_.length;
13520 buffers.splice(ii, 1, buf0, buf1);
13524 removed.push(buffers[ii].slice(start));
13525 buffers[ii] = buffers[ii].slice(0, start);
13529 if (reps.length > 0) {
13530 buffers.splice.apply(buffers, [ii, 0].concat(reps));
13533 while (removed.length < howMany) {
13534 var buf = buffers[ii];
13535 var len = buf.length;
13536 var take = Math.min(len, howMany - removed.length);
13537 if (take === len) {
13539 buffers.splice(ii, 1);
13541 removed.push(buf.slice(0, take));
13542 buffers[ii] = buffers[ii].slice(take);
13545 this.length -= removed.length;
13548 Buffers.prototype.slice = function(i, j) {
13549 var buffers = this.buffers;
13554 if (j > this.length)
13556 var startBytes = 0;
13557 for (var si = 0; si < buffers.length && startBytes + buffers[si].length <= i; si++) {
13558 startBytes += buffers[si].length;
13560 var target = new Buffer(j - i);
13562 for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
13563 var len = buffers[ii].length;
13564 var start = ti === 0 ? i - startBytes : 0;
13565 var end = ti + len >= j - i ? Math.min(start + (j - i) - ti, len) : len;
13566 buffers[ii].copy(target, ti, start, end);
13571 Buffers.prototype.pos = function(i) {
13572 if (i < 0 || i >= this.length)
13573 throw new Error("oob");
13574 var l = i, bi = 0, bu = null;
13576 bu = this.buffers[bi];
13577 if (l < bu.length) {
13578 return {buf: bi, offset: l};
13585 Buffers.prototype.get = function get(i) {
13586 var pos = this.pos(i);
13587 return this.buffers[pos.buf].get(pos.offset);
13589 Buffers.prototype.set = function set(i, b) {
13590 var pos = this.pos(i);
13591 return this.buffers[pos.buf].set(pos.offset, b);
13593 Buffers.prototype.indexOf = function(needle, offset) {
13594 if (typeof needle === "string") {
13595 needle = new Buffer(needle);
13596 } else if (needle instanceof Buffer) {
13598 throw new Error("Invalid type for a search string");
13600 if (!needle.length) {
13603 if (!this.length) {
13606 var i = 0, j = 0, match = 0, mstart, pos = 0;
13608 var p = this.pos(offset);
13614 while (j >= this.buffers[i].length) {
13617 if (i >= this.buffers.length) {
13621 var char = this.buffers[i][j];
13622 if (char == needle[match]) {
13631 if (match == needle.length) {
13634 } else if (match != 0) {
13644 Buffers.prototype.toBuffer = function() {
13645 return this.slice();
13647 Buffers.prototype.toString = function(encoding, start, end) {
13648 return this.slice(start, end).toString(encoding);
13652 // node_modules/binary/lib/vars.js
13653 var require_vars = __commonJS((exports2, module2) => {
13654 module2.exports = function(store) {
13655 function getset(name, value) {
13656 var node = vars.store;
13657 var keys = name.split(".");
13658 keys.slice(0, -1).forEach(function(k) {
13659 if (node[k] === void 0)
13663 var key = keys[keys.length - 1];
13664 if (arguments.length == 1) {
13667 return node[key] = value;
13671 get: function(name) {
13672 return getset(name);
13674 set: function(name, value) {
13675 return getset(name, value);
13683 // node_modules/binary/index.js
13684 var require_binary = __commonJS((exports2, module2) => {
13685 var Chainsaw = require_chainsaw();
13686 var EventEmitter = require("events").EventEmitter;
13687 var Buffers = require_buffers();
13688 var Vars = require_vars();
13689 var Stream = require("stream").Stream;
13690 exports2 = module2.exports = function(bufOrEm, eventName) {
13691 if (Buffer.isBuffer(bufOrEm)) {
13692 return exports2.parse(bufOrEm);
13694 var s = exports2.stream();
13695 if (bufOrEm && bufOrEm.pipe) {
13697 } else if (bufOrEm) {
13698 bufOrEm.on(eventName || "data", function(buf) {
13701 bufOrEm.on("end", function() {
13707 exports2.stream = function(input) {
13709 return exports2.apply(null, arguments);
13710 var pending = null;
13711 function getBytes(bytes, cb, skip) {
13715 cb: function(buf) {
13723 function dispatch() {
13729 if (typeof pending === "function") {
13732 var bytes = offset + pending.bytes;
13733 if (buffers.length >= bytes) {
13735 if (offset == null) {
13736 buf = buffers.splice(0, bytes);
13737 if (!pending.skip) {
13741 if (!pending.skip) {
13742 buf = buffers.slice(offset, bytes);
13746 if (pending.skip) {
13754 function builder(saw) {
13759 var self2 = words(function(bytes, cb) {
13760 return function(name) {
13761 getBytes(bytes, function(buf) {
13762 vars.set(name, cb(buf));
13767 self2.tap = function(cb) {
13768 saw.nest(cb, vars.store);
13770 self2.into = function(key, cb) {
13771 if (!vars.get(key))
13774 vars = Vars(parent.get(key));
13775 saw.nest(function() {
13776 cb.apply(this, arguments);
13777 this.tap(function() {
13782 self2.flush = function() {
13786 self2.loop = function(cb) {
13788 saw.nest(false, function loop() {
13789 this.vars = vars.store;
13790 cb.call(this, function() {
13794 this.tap(function() {
13802 self2.buffer = function(name, bytes) {
13803 if (typeof bytes === "string") {
13804 bytes = vars.get(bytes);
13806 getBytes(bytes, function(buf) {
13807 vars.set(name, buf);
13811 self2.skip = function(bytes) {
13812 if (typeof bytes === "string") {
13813 bytes = vars.get(bytes);
13815 getBytes(bytes, function() {
13819 self2.scan = function find(name, search) {
13820 if (typeof search === "string") {
13821 search = new Buffer(search);
13822 } else if (!Buffer.isBuffer(search)) {
13823 throw new Error("search must be a Buffer or a string");
13826 pending = function() {
13827 var pos = buffers.indexOf(search, offset + taken);
13828 var i = pos - offset - taken;
13831 if (offset != null) {
13832 vars.set(name, buffers.slice(offset, offset + taken + i));
13833 offset += taken + i + search.length;
13835 vars.set(name, buffers.slice(0, taken + i));
13836 buffers.splice(0, taken + i + search.length);
13841 i = Math.max(buffers.length - search.length - offset - taken, 0);
13847 self2.peek = function(cb) {
13849 saw.nest(function() {
13850 cb.call(this, vars.store);
13851 this.tap(function() {
13859 var stream = Chainsaw.light(builder);
13860 stream.writable = true;
13861 var buffers = Buffers();
13862 stream.write = function(buf) {
13867 var done = false, caughtEnd = false;
13868 stream.end = function() {
13871 stream.pipe = Stream.prototype.pipe;
13872 Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function(name) {
13873 stream[name] = EventEmitter.prototype[name];
13877 exports2.parse = function parse(buffer) {
13878 var self2 = words(function(bytes, cb) {
13879 return function(name) {
13880 if (offset + bytes <= buffer.length) {
13881 var buf = buffer.slice(offset, offset + bytes);
13883 vars.set(name, cb(buf));
13885 vars.set(name, null);
13892 self2.vars = vars.store;
13893 self2.tap = function(cb) {
13894 cb.call(self2, vars.store);
13897 self2.into = function(key, cb) {
13898 if (!vars.get(key)) {
13902 vars = Vars(parent.get(key));
13903 cb.call(self2, vars.store);
13907 self2.loop = function(cb) {
13909 var ender = function() {
13912 while (end === false) {
13913 cb.call(self2, ender, vars.store);
13917 self2.buffer = function(name, size) {
13918 if (typeof size === "string") {
13919 size = vars.get(size);
13921 var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
13923 vars.set(name, buf);
13926 self2.skip = function(bytes) {
13927 if (typeof bytes === "string") {
13928 bytes = vars.get(bytes);
13933 self2.scan = function(name, search) {
13934 if (typeof search === "string") {
13935 search = new Buffer(search);
13936 } else if (!Buffer.isBuffer(search)) {
13937 throw new Error("search must be a Buffer or a string");
13939 vars.set(name, null);
13940 for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
13941 for (var j = 0; j < search.length && buffer[offset + i + j] === search[j]; j++)
13943 if (j === search.length)
13946 vars.set(name, buffer.slice(offset, offset + i));
13947 offset += i + search.length;
13950 self2.peek = function(cb) {
13952 cb.call(self2, vars.store);
13956 self2.flush = function() {
13960 self2.eof = function() {
13961 return offset >= buffer.length;
13965 function decodeLEu(bytes) {
13967 for (var i = 0; i < bytes.length; i++) {
13968 acc += Math.pow(256, i) * bytes[i];
13972 function decodeBEu(bytes) {
13974 for (var i = 0; i < bytes.length; i++) {
13975 acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
13979 function decodeBEs(bytes) {
13980 var val = decodeBEu(bytes);
13981 if ((bytes[0] & 128) == 128) {
13982 val -= Math.pow(256, bytes.length);
13986 function decodeLEs(bytes) {
13987 var val = decodeLEu(bytes);
13988 if ((bytes[bytes.length - 1] & 128) == 128) {
13989 val -= Math.pow(256, bytes.length);
13993 function words(decode) {
13995 [1, 2, 4, 8].forEach(function(bytes) {
13996 var bits = bytes * 8;
13997 self2["word" + bits + "le"] = self2["word" + bits + "lu"] = decode(bytes, decodeLEu);
13998 self2["word" + bits + "ls"] = decode(bytes, decodeLEs);
13999 self2["word" + bits + "be"] = self2["word" + bits + "bu"] = decode(bytes, decodeBEu);
14000 self2["word" + bits + "bs"] = decode(bytes, decodeBEs);
14002 self2.word8 = self2.word8u = self2.word8be;
14003 self2.word8s = self2.word8bs;
14008 // node_modules/bluebird/js/release/es5.js
14009 var require_es5 = __commonJS((exports2, module2) => {
14010 var isES5 = function() {
14012 return this === void 0;
14015 module2.exports = {
14016 freeze: Object.freeze,
14017 defineProperty: Object.defineProperty,
14018 getDescriptor: Object.getOwnPropertyDescriptor,
14020 names: Object.getOwnPropertyNames,
14021 getPrototypeOf: Object.getPrototypeOf,
14022 isArray: Array.isArray,
14024 propertyIsWritable: function(obj, prop) {
14025 var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
14026 return !!(!descriptor || descriptor.writable || descriptor.set);
14030 has = {}.hasOwnProperty;
14032 proto = {}.constructor.prototype;
14033 ObjectKeys = function(o) {
14035 for (var key in o) {
14036 if (has.call(o, key)) {
14042 ObjectGetDescriptor = function(o, key) {
14043 return {value: o[key]};
14045 ObjectDefineProperty = function(o, key, desc) {
14046 o[key] = desc.value;
14049 ObjectFreeze = function(obj) {
14052 ObjectGetPrototypeOf = function(obj) {
14054 return Object(obj).constructor.prototype;
14059 ArrayIsArray = function(obj) {
14061 return str.call(obj) === "[object Array]";
14066 module2.exports = {
14067 isArray: ArrayIsArray,
14070 defineProperty: ObjectDefineProperty,
14071 getDescriptor: ObjectGetDescriptor,
14072 freeze: ObjectFreeze,
14073 getPrototypeOf: ObjectGetPrototypeOf,
14075 propertyIsWritable: function() {
14084 var ObjectGetDescriptor;
14085 var ObjectDefineProperty;
14087 var ObjectGetPrototypeOf;
14091 // node_modules/bluebird/js/release/util.js
14092 var require_util = __commonJS((exports, module) => {
14094 var es5 = require_es5();
14095 var canEvaluate = typeof navigator == "undefined";
14096 var errorObj = {e: {}};
14097 var tryCatchTarget;
14098 var globalObject = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : exports !== void 0 ? exports : null;
14099 function tryCatcher() {
14101 var target = tryCatchTarget;
14102 tryCatchTarget = null;
14103 return target.apply(this, arguments);
14109 function tryCatch(fn) {
14110 tryCatchTarget = fn;
14113 var inherits = function(Child, Parent) {
14114 var hasProp = {}.hasOwnProperty;
14116 this.constructor = Child;
14117 this.constructor$ = Parent;
14118 for (var propertyName in Parent.prototype) {
14119 if (hasProp.call(Parent.prototype, propertyName) && propertyName.charAt(propertyName.length - 1) !== "$") {
14120 this[propertyName + "$"] = Parent.prototype[propertyName];
14124 T.prototype = Parent.prototype;
14125 Child.prototype = new T();
14126 return Child.prototype;
14128 function isPrimitive(val) {
14129 return val == null || val === true || val === false || typeof val === "string" || typeof val === "number";
14131 function isObject(value) {
14132 return typeof value === "function" || typeof value === "object" && value !== null;
14134 function maybeWrapAsError(maybeError) {
14135 if (!isPrimitive(maybeError))
14137 return new Error(safeToString(maybeError));
14139 function withAppended(target, appendee) {
14140 var len = target.length;
14141 var ret2 = new Array(len + 1);
14143 for (i = 0; i < len; ++i) {
14144 ret2[i] = target[i];
14146 ret2[i] = appendee;
14149 function getDataPropertyOrDefault(obj, key, defaultValue) {
14151 var desc = Object.getOwnPropertyDescriptor(obj, key);
14152 if (desc != null) {
14153 return desc.get == null && desc.set == null ? desc.value : defaultValue;
14156 return {}.hasOwnProperty.call(obj, key) ? obj[key] : void 0;
14159 function notEnumerableProp(obj, name, value) {
14160 if (isPrimitive(obj))
14164 configurable: true,
14168 es5.defineProperty(obj, name, descriptor);
14171 function thrower(r) {
14174 var inheritedDataKeys = function() {
14175 var excludedPrototypes = [
14180 var isExcludedProto = function(val) {
14181 for (var i = 0; i < excludedPrototypes.length; ++i) {
14182 if (excludedPrototypes[i] === val) {
14189 var getKeys = Object.getOwnPropertyNames;
14190 return function(obj) {
14192 var visitedKeys = Object.create(null);
14193 while (obj != null && !isExcludedProto(obj)) {
14196 keys = getKeys(obj);
14200 for (var i = 0; i < keys.length; ++i) {
14202 if (visitedKeys[key])
14204 visitedKeys[key] = true;
14205 var desc = Object.getOwnPropertyDescriptor(obj, key);
14206 if (desc != null && desc.get == null && desc.set == null) {
14210 obj = es5.getPrototypeOf(obj);
14215 var hasProp = {}.hasOwnProperty;
14216 return function(obj) {
14217 if (isExcludedProto(obj))
14221 for (var key in obj) {
14222 if (hasProp.call(obj, key)) {
14225 for (var i = 0; i < excludedPrototypes.length; ++i) {
14226 if (hasProp.call(excludedPrototypes[i], key)) {
14227 continue enumeration;
14237 var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
14238 function isClass(fn) {
14240 if (typeof fn === "function") {
14241 var keys = es5.names(fn.prototype);
14242 var hasMethods = es5.isES5 && keys.length > 1;
14243 var hasMethodsOtherThanConstructor = keys.length > 0 && !(keys.length === 1 && keys[0] === "constructor");
14244 var hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
14245 if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) {
14254 function toFastProperties(obj) {
14255 function FakeConstructor() {
14257 FakeConstructor.prototype = obj;
14260 new FakeConstructor();
14264 var rident = /^[a-z$_][a-z$_0-9]*$/i;
14265 function isIdentifier(str) {
14266 return rident.test(str);
14268 function filledRange(count, prefix, suffix) {
14269 var ret2 = new Array(count);
14270 for (var i = 0; i < count; ++i) {
14271 ret2[i] = prefix + i + suffix;
14275 function safeToString(obj) {
14279 return "[no string representation]";
14282 function isError(obj) {
14283 return obj !== null && typeof obj === "object" && typeof obj.message === "string" && typeof obj.name === "string";
14285 function markAsOriginatingFromRejection(e) {
14287 notEnumerableProp(e, "isOperational", true);
14291 function originatesFromRejection(e) {
14294 return e instanceof Error["__BluebirdErrorTypes__"].OperationalError || e["isOperational"] === true;
14296 function canAttachTrace(obj) {
14297 return isError(obj) && es5.propertyIsWritable(obj, "stack");
14299 var ensureErrorObject = function() {
14300 if (!("stack" in new Error())) {
14301 return function(value) {
14302 if (canAttachTrace(value))
14305 throw new Error(safeToString(value));
14311 return function(value) {
14312 if (canAttachTrace(value))
14314 return new Error(safeToString(value));
14318 function classString(obj) {
14319 return {}.toString.call(obj);
14321 function copyDescriptors(from, to, filter) {
14322 var keys = es5.names(from);
14323 for (var i = 0; i < keys.length; ++i) {
14327 es5.defineProperty(to, key, es5.getDescriptor(from, key));
14333 var asArray = function(v) {
14334 if (es5.isArray(v)) {
14339 if (typeof Symbol !== "undefined" && Symbol.iterator) {
14340 ArrayFrom = typeof Array.from === "function" ? function(v) {
14341 return Array.from(v);
14344 var it = v[Symbol.iterator]();
14346 while (!(itResult = it.next()).done) {
14347 ret2.push(itResult.value);
14351 asArray = function(v) {
14352 if (es5.isArray(v)) {
14354 } else if (v != null && typeof v[Symbol.iterator] === "function") {
14355 return ArrayFrom(v);
14361 var isNode = typeof process !== "undefined" && classString(process).toLowerCase() === "[object process]";
14362 var hasEnvVariables = typeof process !== "undefined" && typeof process.env !== "undefined";
14363 function env(key) {
14364 return hasEnvVariables ? process.env[key] : void 0;
14366 function getNativePromise() {
14367 if (typeof Promise === "function") {
14369 var promise = new Promise(function() {
14371 if ({}.toString.call(promise) === "[object Promise]") {
14378 function domainBind(self2, cb) {
14379 return self2.bind(cb);
14385 getDataPropertyOrDefault,
14387 isArray: es5.isArray,
14401 toString: safeToString,
14404 originatesFromRejection,
14405 markAsOriginatingFromRejection,
14408 hasDevTools: typeof chrome !== "undefined" && chrome && typeof chrome.loadTimes === "function",
14412 global: globalObject,
14416 ret.isRecentNode = ret.isNode && function() {
14417 var version = process.versions.node.split(".").map(Number);
14418 return version[0] === 0 && version[1] > 10 || version[0] > 0;
14421 ret.toFastProperties(process);
14425 ret.lastLineError = e;
14427 module.exports = ret;
14430 // node_modules/bluebird/js/release/schedule.js
14431 var require_schedule = __commonJS((exports2, module2) => {
14433 var util = require_util();
14435 var noAsyncScheduler = function() {
14436 throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n");
14438 var NativePromise = util.getNativePromise();
14439 if (util.isNode && typeof MutationObserver === "undefined") {
14440 GlobalSetImmediate = global.setImmediate;
14441 ProcessNextTick = process.nextTick;
14442 schedule = util.isRecentNode ? function(fn) {
14443 GlobalSetImmediate.call(global, fn);
14445 ProcessNextTick.call(process, fn);
14447 } else if (typeof NativePromise === "function" && typeof NativePromise.resolve === "function") {
14448 nativePromise = NativePromise.resolve();
14449 schedule = function(fn) {
14450 nativePromise.then(fn);
14452 } else if (typeof MutationObserver !== "undefined" && !(typeof window !== "undefined" && window.navigator && (window.navigator.standalone || window.cordova))) {
14453 schedule = function() {
14454 var div = document.createElement("div");
14455 var opts = {attributes: true};
14456 var toggleScheduled = false;
14457 var div2 = document.createElement("div");
14458 var o2 = new MutationObserver(function() {
14459 div.classList.toggle("foo");
14460 toggleScheduled = false;
14462 o2.observe(div2, opts);
14463 var scheduleToggle = function() {
14464 if (toggleScheduled)
14466 toggleScheduled = true;
14467 div2.classList.toggle("foo");
14469 return function schedule2(fn) {
14470 var o = new MutationObserver(function() {
14474 o.observe(div, opts);
14478 } else if (typeof setImmediate !== "undefined") {
14479 schedule = function(fn) {
14482 } else if (typeof setTimeout !== "undefined") {
14483 schedule = function(fn) {
14487 schedule = noAsyncScheduler;
14489 var GlobalSetImmediate;
14490 var ProcessNextTick;
14492 module2.exports = schedule;
14495 // node_modules/bluebird/js/release/queue.js
14496 var require_queue = __commonJS((exports2, module2) => {
14498 function arrayMove(src, srcIndex, dst, dstIndex, len) {
14499 for (var j = 0; j < len; ++j) {
14500 dst[j + dstIndex] = src[j + srcIndex];
14501 src[j + srcIndex] = void 0;
14504 function Queue(capacity) {
14505 this._capacity = capacity;
14509 Queue.prototype._willBeOverCapacity = function(size) {
14510 return this._capacity < size;
14512 Queue.prototype._pushOne = function(arg) {
14513 var length = this.length();
14514 this._checkCapacity(length + 1);
14515 var i = this._front + length & this._capacity - 1;
14517 this._length = length + 1;
14519 Queue.prototype.push = function(fn, receiver, arg) {
14520 var length = this.length() + 3;
14521 if (this._willBeOverCapacity(length)) {
14523 this._pushOne(receiver);
14524 this._pushOne(arg);
14527 var j = this._front + length - 3;
14528 this._checkCapacity(length);
14529 var wrapMask = this._capacity - 1;
14530 this[j + 0 & wrapMask] = fn;
14531 this[j + 1 & wrapMask] = receiver;
14532 this[j + 2 & wrapMask] = arg;
14533 this._length = length;
14535 Queue.prototype.shift = function() {
14536 var front = this._front, ret2 = this[front];
14537 this[front] = void 0;
14538 this._front = front + 1 & this._capacity - 1;
14542 Queue.prototype.length = function() {
14543 return this._length;
14545 Queue.prototype._checkCapacity = function(size) {
14546 if (this._capacity < size) {
14547 this._resizeTo(this._capacity << 1);
14550 Queue.prototype._resizeTo = function(capacity) {
14551 var oldCapacity = this._capacity;
14552 this._capacity = capacity;
14553 var front = this._front;
14554 var length = this._length;
14555 var moveItemsCount = front + length & oldCapacity - 1;
14556 arrayMove(this, 0, this, oldCapacity, moveItemsCount);
14558 module2.exports = Queue;
14561 // node_modules/bluebird/js/release/async.js
14562 var require_async = __commonJS((exports2, module2) => {
14564 var firstLineError;
14568 firstLineError = e;
14570 var schedule = require_schedule();
14571 var Queue = require_queue();
14572 var util = require_util();
14574 this._customScheduler = false;
14575 this._isTickUsed = false;
14576 this._lateQueue = new Queue(16);
14577 this._normalQueue = new Queue(16);
14578 this._haveDrainedQueues = false;
14579 this._trampolineEnabled = true;
14581 this.drainQueues = function() {
14582 self2._drainQueues();
14584 this._schedule = schedule;
14586 Async.prototype.setScheduler = function(fn) {
14587 var prev = this._schedule;
14588 this._schedule = fn;
14589 this._customScheduler = true;
14592 Async.prototype.hasCustomScheduler = function() {
14593 return this._customScheduler;
14595 Async.prototype.enableTrampoline = function() {
14596 this._trampolineEnabled = true;
14598 Async.prototype.disableTrampolineIfNecessary = function() {
14599 if (util.hasDevTools) {
14600 this._trampolineEnabled = false;
14603 Async.prototype.haveItemsQueued = function() {
14604 return this._isTickUsed || this._haveDrainedQueues;
14606 Async.prototype.fatalError = function(e, isNode2) {
14608 process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) + "\n");
14611 this.throwLater(e);
14614 Async.prototype.throwLater = function(fn, arg) {
14615 if (arguments.length === 1) {
14621 if (typeof setTimeout !== "undefined") {
14622 setTimeout(function() {
14627 this._schedule(function() {
14631 throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n");
14634 function AsyncInvokeLater(fn, receiver, arg) {
14635 this._lateQueue.push(fn, receiver, arg);
14638 function AsyncInvoke(fn, receiver, arg) {
14639 this._normalQueue.push(fn, receiver, arg);
14642 function AsyncSettlePromises(promise) {
14643 this._normalQueue._pushOne(promise);
14646 if (!util.hasDevTools) {
14647 Async.prototype.invokeLater = AsyncInvokeLater;
14648 Async.prototype.invoke = AsyncInvoke;
14649 Async.prototype.settlePromises = AsyncSettlePromises;
14651 Async.prototype.invokeLater = function(fn, receiver, arg) {
14652 if (this._trampolineEnabled) {
14653 AsyncInvokeLater.call(this, fn, receiver, arg);
14655 this._schedule(function() {
14656 setTimeout(function() {
14657 fn.call(receiver, arg);
14662 Async.prototype.invoke = function(fn, receiver, arg) {
14663 if (this._trampolineEnabled) {
14664 AsyncInvoke.call(this, fn, receiver, arg);
14666 this._schedule(function() {
14667 fn.call(receiver, arg);
14671 Async.prototype.settlePromises = function(promise) {
14672 if (this._trampolineEnabled) {
14673 AsyncSettlePromises.call(this, promise);
14675 this._schedule(function() {
14676 promise._settlePromises();
14681 Async.prototype._drainQueue = function(queue) {
14682 while (queue.length() > 0) {
14683 var fn = queue.shift();
14684 if (typeof fn !== "function") {
14685 fn._settlePromises();
14688 var receiver = queue.shift();
14689 var arg = queue.shift();
14690 fn.call(receiver, arg);
14693 Async.prototype._drainQueues = function() {
14694 this._drainQueue(this._normalQueue);
14696 this._haveDrainedQueues = true;
14697 this._drainQueue(this._lateQueue);
14699 Async.prototype._queueTick = function() {
14700 if (!this._isTickUsed) {
14701 this._isTickUsed = true;
14702 this._schedule(this.drainQueues);
14705 Async.prototype._reset = function() {
14706 this._isTickUsed = false;
14708 module2.exports = Async;
14709 module2.exports.firstLineError = firstLineError;
14712 // node_modules/bluebird/js/release/errors.js
14713 var require_errors = __commonJS((exports2, module2) => {
14715 var es52 = require_es5();
14716 var Objectfreeze = es52.freeze;
14717 var util = require_util();
14718 var inherits2 = util.inherits;
14719 var notEnumerableProp2 = util.notEnumerableProp;
14720 function subError(nameProperty, defaultMessage) {
14721 function SubError(message) {
14722 if (!(this instanceof SubError))
14723 return new SubError(message);
14724 notEnumerableProp2(this, "message", typeof message === "string" ? message : defaultMessage);
14725 notEnumerableProp2(this, "name", nameProperty);
14726 if (Error.captureStackTrace) {
14727 Error.captureStackTrace(this, this.constructor);
14732 inherits2(SubError, Error);
14737 var Warning = subError("Warning", "warning");
14738 var CancellationError = subError("CancellationError", "cancellation error");
14739 var TimeoutError = subError("TimeoutError", "timeout error");
14740 var AggregateError = subError("AggregateError", "aggregate error");
14742 _TypeError = TypeError;
14743 _RangeError = RangeError;
14745 _TypeError = subError("TypeError", "type error");
14746 _RangeError = subError("RangeError", "range error");
14748 var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");
14749 for (var i = 0; i < methods.length; ++i) {
14750 if (typeof Array.prototype[methods[i]] === "function") {
14751 AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
14754 es52.defineProperty(AggregateError.prototype, "length", {
14756 configurable: false,
14760 AggregateError.prototype["isOperational"] = true;
14762 AggregateError.prototype.toString = function() {
14763 var indent = Array(level * 4 + 1).join(" ");
14764 var ret2 = "\n" + indent + "AggregateError of:\n";
14766 indent = Array(level * 4 + 1).join(" ");
14767 for (var i2 = 0; i2 < this.length; ++i2) {
14768 var str = this[i2] === this ? "[Circular AggregateError]" : this[i2] + "";
14769 var lines = str.split("\n");
14770 for (var j = 0; j < lines.length; ++j) {
14771 lines[j] = indent + lines[j];
14773 str = lines.join("\n");
14774 ret2 += str + "\n";
14779 function OperationalError(message) {
14780 if (!(this instanceof OperationalError))
14781 return new OperationalError(message);
14782 notEnumerableProp2(this, "name", "OperationalError");
14783 notEnumerableProp2(this, "message", message);
14784 this.cause = message;
14785 this["isOperational"] = true;
14786 if (message instanceof Error) {
14787 notEnumerableProp2(this, "message", message.message);
14788 notEnumerableProp2(this, "stack", message.stack);
14789 } else if (Error.captureStackTrace) {
14790 Error.captureStackTrace(this, this.constructor);
14793 inherits2(OperationalError, Error);
14794 var errorTypes = Error["__BluebirdErrorTypes__"];
14796 errorTypes = Objectfreeze({
14800 RejectionError: OperationalError,
14803 es52.defineProperty(Error, "__BluebirdErrorTypes__", {
14807 configurable: false
14810 module2.exports = {
14812 TypeError: _TypeError,
14813 RangeError: _RangeError,
14814 CancellationError: errorTypes.CancellationError,
14815 OperationalError: errorTypes.OperationalError,
14816 TimeoutError: errorTypes.TimeoutError,
14817 AggregateError: errorTypes.AggregateError,
14822 // node_modules/bluebird/js/release/thenables.js
14823 var require_thenables = __commonJS((exports2, module2) => {
14825 module2.exports = function(Promise2, INTERNAL) {
14826 var util = require_util();
14827 var errorObj2 = util.errorObj;
14828 var isObject3 = util.isObject;
14829 function tryConvertToPromise(obj, context) {
14830 if (isObject3(obj)) {
14831 if (obj instanceof Promise2)
14833 var then = getThen(obj);
14834 if (then === errorObj2) {
14836 context._pushContext();
14837 var ret2 = Promise2.reject(then.e);
14839 context._popContext();
14841 } else if (typeof then === "function") {
14842 if (isAnyBluebirdPromise(obj)) {
14843 var ret2 = new Promise2(INTERNAL);
14844 obj._then(ret2._fulfill, ret2._reject, void 0, ret2, null);
14847 return doThenable(obj, then, context);
14852 function doGetThen(obj) {
14855 function getThen(obj) {
14857 return doGetThen(obj);
14863 var hasProp = {}.hasOwnProperty;
14864 function isAnyBluebirdPromise(obj) {
14866 return hasProp.call(obj, "_promise0");
14871 function doThenable(x, then, context) {
14872 var promise = new Promise2(INTERNAL);
14873 var ret2 = promise;
14875 context._pushContext();
14876 promise._captureStackTrace();
14878 context._popContext();
14879 var synchronous = true;
14880 var result = util.tryCatch(then).call(x, resolve, reject);
14881 synchronous = false;
14882 if (promise && result === errorObj2) {
14883 promise._rejectCallback(result.e, true, true);
14886 function resolve(value) {
14889 promise._resolveCallback(value);
14892 function reject(reason) {
14895 promise._rejectCallback(reason, synchronous, true);
14900 return tryConvertToPromise;
14904 // node_modules/bluebird/js/release/promise_array.js
14905 var require_promise_array = __commonJS((exports2, module2) => {
14907 module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, apiRejection, Proxyable) {
14908 var util = require_util();
14909 var isArray = util.isArray;
14910 function toResolutionValue(val) {
14918 function PromiseArray(values) {
14919 var promise = this._promise = new Promise2(INTERNAL);
14920 if (values instanceof Promise2) {
14921 promise._propagateFrom(values, 3);
14923 promise._setOnCancel(this);
14924 this._values = values;
14926 this._totalResolved = 0;
14927 this._init(void 0, -2);
14929 util.inherits(PromiseArray, Proxyable);
14930 PromiseArray.prototype.length = function() {
14931 return this._length;
14933 PromiseArray.prototype.promise = function() {
14934 return this._promise;
14936 PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
14937 var values = tryConvertToPromise(this._values, this._promise);
14938 if (values instanceof Promise2) {
14939 values = values._target();
14940 var bitField = values._bitField;
14942 this._values = values;
14943 if ((bitField & 50397184) === 0) {
14944 this._promise._setAsyncGuaranteed();
14945 return values._then(init, this._reject, void 0, this, resolveValueIfEmpty);
14946 } else if ((bitField & 33554432) !== 0) {
14947 values = values._value();
14948 } else if ((bitField & 16777216) !== 0) {
14949 return this._reject(values._reason());
14951 return this._cancel();
14954 values = util.asArray(values);
14955 if (values === null) {
14956 var err = apiRejection("expecting an array or an iterable object but got " + util.classString(values)).reason();
14957 this._promise._rejectCallback(err, false);
14960 if (values.length === 0) {
14961 if (resolveValueIfEmpty === -5) {
14962 this._resolveEmptyArray();
14964 this._resolve(toResolutionValue(resolveValueIfEmpty));
14968 this._iterate(values);
14970 PromiseArray.prototype._iterate = function(values) {
14971 var len = this.getActualLength(values.length);
14972 this._length = len;
14973 this._values = this.shouldCopyValues() ? new Array(len) : this._values;
14974 var result = this._promise;
14975 var isResolved = false;
14976 var bitField = null;
14977 for (var i = 0; i < len; ++i) {
14978 var maybePromise = tryConvertToPromise(values[i], result);
14979 if (maybePromise instanceof Promise2) {
14980 maybePromise = maybePromise._target();
14981 bitField = maybePromise._bitField;
14986 if (bitField !== null) {
14987 maybePromise.suppressUnhandledRejections();
14989 } else if (bitField !== null) {
14990 if ((bitField & 50397184) === 0) {
14991 maybePromise._proxy(this, i);
14992 this._values[i] = maybePromise;
14993 } else if ((bitField & 33554432) !== 0) {
14994 isResolved = this._promiseFulfilled(maybePromise._value(), i);
14995 } else if ((bitField & 16777216) !== 0) {
14996 isResolved = this._promiseRejected(maybePromise._reason(), i);
14998 isResolved = this._promiseCancelled(i);
15001 isResolved = this._promiseFulfilled(maybePromise, i);
15005 result._setAsyncGuaranteed();
15007 PromiseArray.prototype._isResolved = function() {
15008 return this._values === null;
15010 PromiseArray.prototype._resolve = function(value) {
15011 this._values = null;
15012 this._promise._fulfill(value);
15014 PromiseArray.prototype._cancel = function() {
15015 if (this._isResolved() || !this._promise._isCancellable())
15017 this._values = null;
15018 this._promise._cancel();
15020 PromiseArray.prototype._reject = function(reason) {
15021 this._values = null;
15022 this._promise._rejectCallback(reason, false);
15024 PromiseArray.prototype._promiseFulfilled = function(value, index) {
15025 this._values[index] = value;
15026 var totalResolved = ++this._totalResolved;
15027 if (totalResolved >= this._length) {
15028 this._resolve(this._values);
15033 PromiseArray.prototype._promiseCancelled = function() {
15037 PromiseArray.prototype._promiseRejected = function(reason) {
15038 this._totalResolved++;
15039 this._reject(reason);
15042 PromiseArray.prototype._resultCancelled = function() {
15043 if (this._isResolved())
15045 var values = this._values;
15047 if (values instanceof Promise2) {
15050 for (var i = 0; i < values.length; ++i) {
15051 if (values[i] instanceof Promise2) {
15052 values[i].cancel();
15057 PromiseArray.prototype.shouldCopyValues = function() {
15060 PromiseArray.prototype.getActualLength = function(len) {
15063 return PromiseArray;
15067 // node_modules/bluebird/js/release/context.js
15068 var require_context = __commonJS((exports2, module2) => {
15070 module2.exports = function(Promise2) {
15071 var longStackTraces = false;
15072 var contextStack = [];
15073 Promise2.prototype._promiseCreated = function() {
15075 Promise2.prototype._pushContext = function() {
15077 Promise2.prototype._popContext = function() {
15080 Promise2._peekContext = Promise2.prototype._peekContext = function() {
15082 function Context() {
15083 this._trace = new Context.CapturedTrace(peekContext());
15085 Context.prototype._pushContext = function() {
15086 if (this._trace !== void 0) {
15087 this._trace._promiseCreated = null;
15088 contextStack.push(this._trace);
15091 Context.prototype._popContext = function() {
15092 if (this._trace !== void 0) {
15093 var trace = contextStack.pop();
15094 var ret2 = trace._promiseCreated;
15095 trace._promiseCreated = null;
15100 function createContext() {
15101 if (longStackTraces)
15102 return new Context();
15104 function peekContext() {
15105 var lastIndex = contextStack.length - 1;
15106 if (lastIndex >= 0) {
15107 return contextStack[lastIndex];
15111 Context.CapturedTrace = null;
15112 Context.create = createContext;
15113 Context.deactivateLongStackTraces = function() {
15115 Context.activateLongStackTraces = function() {
15116 var Promise_pushContext = Promise2.prototype._pushContext;
15117 var Promise_popContext = Promise2.prototype._popContext;
15118 var Promise_PeekContext = Promise2._peekContext;
15119 var Promise_peekContext = Promise2.prototype._peekContext;
15120 var Promise_promiseCreated = Promise2.prototype._promiseCreated;
15121 Context.deactivateLongStackTraces = function() {
15122 Promise2.prototype._pushContext = Promise_pushContext;
15123 Promise2.prototype._popContext = Promise_popContext;
15124 Promise2._peekContext = Promise_PeekContext;
15125 Promise2.prototype._peekContext = Promise_peekContext;
15126 Promise2.prototype._promiseCreated = Promise_promiseCreated;
15127 longStackTraces = false;
15129 longStackTraces = true;
15130 Promise2.prototype._pushContext = Context.prototype._pushContext;
15131 Promise2.prototype._popContext = Context.prototype._popContext;
15132 Promise2._peekContext = Promise2.prototype._peekContext = peekContext;
15133 Promise2.prototype._promiseCreated = function() {
15134 var ctx = this._peekContext();
15135 if (ctx && ctx._promiseCreated == null)
15136 ctx._promiseCreated = this;
15143 // node_modules/bluebird/js/release/debuggability.js
15144 var require_debuggability = __commonJS((exports2, module2) => {
15146 module2.exports = function(Promise2, Context) {
15147 var getDomain = Promise2._getDomain;
15148 var async = Promise2._async;
15149 var Warning = require_errors().Warning;
15150 var util = require_util();
15151 var canAttachTrace2 = util.canAttachTrace;
15152 var unhandledRejectionHandled;
15153 var possiblyUnhandledRejection;
15154 var bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
15155 var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
15156 var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
15157 var stackFramePattern = null;
15158 var formatStack = null;
15159 var indentStackFrames = false;
15161 var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && (util.env("BLUEBIRD_DEBUG") || util.env("NODE_ENV") === "development"));
15162 var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && (debugging || util.env("BLUEBIRD_WARNINGS")));
15163 var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
15164 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
15165 Promise2.prototype.suppressUnhandledRejections = function() {
15166 var target = this._target();
15167 target._bitField = target._bitField & ~1048576 | 524288;
15169 Promise2.prototype._ensurePossibleRejectionHandled = function() {
15170 if ((this._bitField & 524288) !== 0)
15172 this._setRejectionIsUnhandled();
15173 async.invokeLater(this._notifyUnhandledRejection, this, void 0);
15175 Promise2.prototype._notifyUnhandledRejectionIsHandled = function() {
15176 fireRejectionEvent("rejectionHandled", unhandledRejectionHandled, void 0, this);
15178 Promise2.prototype._setReturnedNonUndefined = function() {
15179 this._bitField = this._bitField | 268435456;
15181 Promise2.prototype._returnedNonUndefined = function() {
15182 return (this._bitField & 268435456) !== 0;
15184 Promise2.prototype._notifyUnhandledRejection = function() {
15185 if (this._isRejectionUnhandled()) {
15186 var reason = this._settledValue();
15187 this._setUnhandledRejectionIsNotified();
15188 fireRejectionEvent("unhandledRejection", possiblyUnhandledRejection, reason, this);
15191 Promise2.prototype._setUnhandledRejectionIsNotified = function() {
15192 this._bitField = this._bitField | 262144;
15194 Promise2.prototype._unsetUnhandledRejectionIsNotified = function() {
15195 this._bitField = this._bitField & ~262144;
15197 Promise2.prototype._isUnhandledRejectionNotified = function() {
15198 return (this._bitField & 262144) > 0;
15200 Promise2.prototype._setRejectionIsUnhandled = function() {
15201 this._bitField = this._bitField | 1048576;
15203 Promise2.prototype._unsetRejectionIsUnhandled = function() {
15204 this._bitField = this._bitField & ~1048576;
15205 if (this._isUnhandledRejectionNotified()) {
15206 this._unsetUnhandledRejectionIsNotified();
15207 this._notifyUnhandledRejectionIsHandled();
15210 Promise2.prototype._isRejectionUnhandled = function() {
15211 return (this._bitField & 1048576) > 0;
15213 Promise2.prototype._warn = function(message, shouldUseOwnTrace, promise) {
15214 return warn(message, shouldUseOwnTrace, promise || this);
15216 Promise2.onPossiblyUnhandledRejection = function(fn) {
15217 var domain = getDomain();
15218 possiblyUnhandledRejection = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0;
15220 Promise2.onUnhandledRejectionHandled = function(fn) {
15221 var domain = getDomain();
15222 unhandledRejectionHandled = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0;
15224 var disableLongStackTraces = function() {
15226 Promise2.longStackTraces = function() {
15227 if (async.haveItemsQueued() && !config.longStackTraces) {
15228 throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");
15230 if (!config.longStackTraces && longStackTracesIsSupported()) {
15231 var Promise_captureStackTrace = Promise2.prototype._captureStackTrace;
15232 var Promise_attachExtraTrace = Promise2.prototype._attachExtraTrace;
15233 config.longStackTraces = true;
15234 disableLongStackTraces = function() {
15235 if (async.haveItemsQueued() && !config.longStackTraces) {
15236 throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");
15238 Promise2.prototype._captureStackTrace = Promise_captureStackTrace;
15239 Promise2.prototype._attachExtraTrace = Promise_attachExtraTrace;
15240 Context.deactivateLongStackTraces();
15241 async.enableTrampoline();
15242 config.longStackTraces = false;
15244 Promise2.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
15245 Promise2.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
15246 Context.activateLongStackTraces();
15247 async.disableTrampolineIfNecessary();
15250 Promise2.hasLongStackTraces = function() {
15251 return config.longStackTraces && longStackTracesIsSupported();
15253 var fireDomEvent = function() {
15255 if (typeof CustomEvent === "function") {
15256 var event = new CustomEvent("CustomEvent");
15257 util.global.dispatchEvent(event);
15258 return function(name, event2) {
15259 var domEvent = new CustomEvent(name.toLowerCase(), {
15263 return !util.global.dispatchEvent(domEvent);
15265 } else if (typeof Event === "function") {
15266 var event = new Event("CustomEvent");
15267 util.global.dispatchEvent(event);
15268 return function(name, event2) {
15269 var domEvent = new Event(name.toLowerCase(), {
15272 domEvent.detail = event2;
15273 return !util.global.dispatchEvent(domEvent);
15276 var event = document.createEvent("CustomEvent");
15277 event.initCustomEvent("testingtheevent", false, true, {});
15278 util.global.dispatchEvent(event);
15279 return function(name, event2) {
15280 var domEvent = document.createEvent("CustomEvent");
15281 domEvent.initCustomEvent(name.toLowerCase(), false, true, event2);
15282 return !util.global.dispatchEvent(domEvent);
15287 return function() {
15291 var fireGlobalEvent = function() {
15293 return function() {
15294 return process.emit.apply(process, arguments);
15297 if (!util.global) {
15298 return function() {
15302 return function(name) {
15303 var methodName = "on" + name.toLowerCase();
15304 var method = util.global[methodName];
15307 method.apply(util.global, [].slice.call(arguments, 1));
15312 function generatePromiseLifecycleEventObject(name, promise) {
15315 var eventToObjectGenerator = {
15316 promiseCreated: generatePromiseLifecycleEventObject,
15317 promiseFulfilled: generatePromiseLifecycleEventObject,
15318 promiseRejected: generatePromiseLifecycleEventObject,
15319 promiseResolved: generatePromiseLifecycleEventObject,
15320 promiseCancelled: generatePromiseLifecycleEventObject,
15321 promiseChained: function(name, promise, child) {
15322 return {promise, child};
15324 warning: function(name, warning) {
15327 unhandledRejection: function(name, reason, promise) {
15328 return {reason, promise};
15330 rejectionHandled: generatePromiseLifecycleEventObject
15332 var activeFireEvent = function(name) {
15333 var globalEventFired = false;
15335 globalEventFired = fireGlobalEvent.apply(null, arguments);
15337 async.throwLater(e);
15338 globalEventFired = true;
15340 var domEventFired = false;
15342 domEventFired = fireDomEvent(name, eventToObjectGenerator[name].apply(null, arguments));
15344 async.throwLater(e);
15345 domEventFired = true;
15347 return domEventFired || globalEventFired;
15349 Promise2.config = function(opts) {
15350 opts = Object(opts);
15351 if ("longStackTraces" in opts) {
15352 if (opts.longStackTraces) {
15353 Promise2.longStackTraces();
15354 } else if (!opts.longStackTraces && Promise2.hasLongStackTraces()) {
15355 disableLongStackTraces();
15358 if ("warnings" in opts) {
15359 var warningsOption = opts.warnings;
15360 config.warnings = !!warningsOption;
15361 wForgottenReturn = config.warnings;
15362 if (util.isObject(warningsOption)) {
15363 if ("wForgottenReturn" in warningsOption) {
15364 wForgottenReturn = !!warningsOption.wForgottenReturn;
15368 if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
15369 if (async.haveItemsQueued()) {
15370 throw new Error("cannot enable cancellation after promises are in use");
15372 Promise2.prototype._clearCancellationData = cancellationClearCancellationData;
15373 Promise2.prototype._propagateFrom = cancellationPropagateFrom;
15374 Promise2.prototype._onCancel = cancellationOnCancel;
15375 Promise2.prototype._setOnCancel = cancellationSetOnCancel;
15376 Promise2.prototype._attachCancellationCallback = cancellationAttachCancellationCallback;
15377 Promise2.prototype._execute = cancellationExecute;
15378 propagateFromFunction = cancellationPropagateFrom;
15379 config.cancellation = true;
15381 if ("monitoring" in opts) {
15382 if (opts.monitoring && !config.monitoring) {
15383 config.monitoring = true;
15384 Promise2.prototype._fireEvent = activeFireEvent;
15385 } else if (!opts.monitoring && config.monitoring) {
15386 config.monitoring = false;
15387 Promise2.prototype._fireEvent = defaultFireEvent;
15392 function defaultFireEvent() {
15395 Promise2.prototype._fireEvent = defaultFireEvent;
15396 Promise2.prototype._execute = function(executor, resolve, reject) {
15398 executor(resolve, reject);
15403 Promise2.prototype._onCancel = function() {
15405 Promise2.prototype._setOnCancel = function(handler) {
15408 Promise2.prototype._attachCancellationCallback = function(onCancel) {
15411 Promise2.prototype._captureStackTrace = function() {
15413 Promise2.prototype._attachExtraTrace = function() {
15415 Promise2.prototype._clearCancellationData = function() {
15417 Promise2.prototype._propagateFrom = function(parent, flags) {
15421 function cancellationExecute(executor, resolve, reject) {
15422 var promise = this;
15424 executor(resolve, reject, function(onCancel) {
15425 if (typeof onCancel !== "function") {
15426 throw new TypeError("onCancel must be a function, got: " + util.toString(onCancel));
15428 promise._attachCancellationCallback(onCancel);
15434 function cancellationAttachCancellationCallback(onCancel) {
15435 if (!this._isCancellable())
15437 var previousOnCancel = this._onCancel();
15438 if (previousOnCancel !== void 0) {
15439 if (util.isArray(previousOnCancel)) {
15440 previousOnCancel.push(onCancel);
15442 this._setOnCancel([previousOnCancel, onCancel]);
15445 this._setOnCancel(onCancel);
15448 function cancellationOnCancel() {
15449 return this._onCancelField;
15451 function cancellationSetOnCancel(onCancel) {
15452 this._onCancelField = onCancel;
15454 function cancellationClearCancellationData() {
15455 this._cancellationParent = void 0;
15456 this._onCancelField = void 0;
15458 function cancellationPropagateFrom(parent, flags) {
15459 if ((flags & 1) !== 0) {
15460 this._cancellationParent = parent;
15461 var branchesRemainingToCancel = parent._branchesRemainingToCancel;
15462 if (branchesRemainingToCancel === void 0) {
15463 branchesRemainingToCancel = 0;
15465 parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
15467 if ((flags & 2) !== 0 && parent._isBound()) {
15468 this._setBoundTo(parent._boundTo);
15471 function bindingPropagateFrom(parent, flags) {
15472 if ((flags & 2) !== 0 && parent._isBound()) {
15473 this._setBoundTo(parent._boundTo);
15476 var propagateFromFunction = bindingPropagateFrom;
15477 function boundValueFunction() {
15478 var ret2 = this._boundTo;
15479 if (ret2 !== void 0) {
15480 if (ret2 instanceof Promise2) {
15481 if (ret2.isFulfilled()) {
15482 return ret2.value();
15490 function longStackTracesCaptureStackTrace() {
15491 this._trace = new CapturedTrace(this._peekContext());
15493 function longStackTracesAttachExtraTrace(error, ignoreSelf) {
15494 if (canAttachTrace2(error)) {
15495 var trace = this._trace;
15496 if (trace !== void 0) {
15498 trace = trace._parent;
15500 if (trace !== void 0) {
15501 trace.attachExtraTrace(error);
15502 } else if (!error.__stackCleaned__) {
15503 var parsed = parseStackAndMessage(error);
15504 util.notEnumerableProp(error, "stack", parsed.message + "\n" + parsed.stack.join("\n"));
15505 util.notEnumerableProp(error, "__stackCleaned__", true);
15509 function checkForgottenReturns(returnValue, promiseCreated, name, promise, parent) {
15510 if (returnValue === void 0 && promiseCreated !== null && wForgottenReturn) {
15511 if (parent !== void 0 && parent._returnedNonUndefined())
15513 if ((promise._bitField & 65535) === 0)
15517 var handlerLine = "";
15518 var creatorLine = "";
15519 if (promiseCreated._trace) {
15520 var traceLines = promiseCreated._trace.stack.split("\n");
15521 var stack = cleanStack(traceLines);
15522 for (var i = stack.length - 1; i >= 0; --i) {
15523 var line = stack[i];
15524 if (!nodeFramePattern.test(line)) {
15525 var lineMatches = line.match(parseLinePattern);
15527 handlerLine = "at " + lineMatches[1] + ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
15532 if (stack.length > 0) {
15533 var firstUserLine = stack[0];
15534 for (var i = 0; i < traceLines.length; ++i) {
15535 if (traceLines[i] === firstUserLine) {
15537 creatorLine = "\n" + traceLines[i - 1];
15544 var msg = "a promise was created in a " + name + "handler " + handlerLine + "but was not returned from it, see http://goo.gl/rRqMUw" + creatorLine;
15545 promise._warn(msg, true, promiseCreated);
15548 function deprecated(name, replacement) {
15549 var message = name + " is deprecated and will be removed in a future version.";
15551 message += " Use " + replacement + " instead.";
15552 return warn(message);
15554 function warn(message, shouldUseOwnTrace, promise) {
15555 if (!config.warnings)
15557 var warning = new Warning(message);
15559 if (shouldUseOwnTrace) {
15560 promise._attachExtraTrace(warning);
15561 } else if (config.longStackTraces && (ctx = Promise2._peekContext())) {
15562 ctx.attachExtraTrace(warning);
15564 var parsed = parseStackAndMessage(warning);
15565 warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
15567 if (!activeFireEvent("warning", warning)) {
15568 formatAndLogError(warning, "", true);
15571 function reconstructStack(message, stacks) {
15572 for (var i = 0; i < stacks.length - 1; ++i) {
15573 stacks[i].push("From previous event:");
15574 stacks[i] = stacks[i].join("\n");
15576 if (i < stacks.length) {
15577 stacks[i] = stacks[i].join("\n");
15579 return message + "\n" + stacks.join("\n");
15581 function removeDuplicateOrEmptyJumps(stacks) {
15582 for (var i = 0; i < stacks.length; ++i) {
15583 if (stacks[i].length === 0 || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) {
15584 stacks.splice(i, 1);
15589 function removeCommonRoots(stacks) {
15590 var current = stacks[0];
15591 for (var i = 1; i < stacks.length; ++i) {
15592 var prev = stacks[i];
15593 var currentLastIndex = current.length - 1;
15594 var currentLastLine = current[currentLastIndex];
15595 var commonRootMeetPoint = -1;
15596 for (var j = prev.length - 1; j >= 0; --j) {
15597 if (prev[j] === currentLastLine) {
15598 commonRootMeetPoint = j;
15602 for (var j = commonRootMeetPoint; j >= 0; --j) {
15603 var line = prev[j];
15604 if (current[currentLastIndex] === line) {
15606 currentLastIndex--;
15614 function cleanStack(stack) {
15616 for (var i = 0; i < stack.length; ++i) {
15617 var line = stack[i];
15618 var isTraceLine = line === " (No stack trace)" || stackFramePattern.test(line);
15619 var isInternalFrame = isTraceLine && shouldIgnore(line);
15620 if (isTraceLine && !isInternalFrame) {
15621 if (indentStackFrames && line.charAt(0) !== " ") {
15629 function stackFramesAsArray(error) {
15630 var stack = error.stack.replace(/\s+$/g, "").split("\n");
15631 for (var i = 0; i < stack.length; ++i) {
15632 var line = stack[i];
15633 if (line === " (No stack trace)" || stackFramePattern.test(line)) {
15637 if (i > 0 && error.name != "SyntaxError") {
15638 stack = stack.slice(i);
15642 function parseStackAndMessage(error) {
15643 var stack = error.stack;
15644 var message = error.toString();
15645 stack = typeof stack === "string" && stack.length > 0 ? stackFramesAsArray(error) : [" (No stack trace)"];
15648 stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
15651 function formatAndLogError(error, title, isSoft) {
15652 if (typeof console !== "undefined") {
15654 if (util.isObject(error)) {
15655 var stack = error.stack;
15656 message = title + formatStack(stack, error);
15658 message = title + String(error);
15660 if (typeof printWarning === "function") {
15661 printWarning(message, isSoft);
15662 } else if (typeof console.log === "function" || typeof console.log === "object") {
15663 console.log(message);
15667 function fireRejectionEvent(name, localHandler, reason, promise) {
15668 var localEventFired = false;
15670 if (typeof localHandler === "function") {
15671 localEventFired = true;
15672 if (name === "rejectionHandled") {
15673 localHandler(promise);
15675 localHandler(reason, promise);
15679 async.throwLater(e);
15681 if (name === "unhandledRejection") {
15682 if (!activeFireEvent(name, reason, promise) && !localEventFired) {
15683 formatAndLogError(reason, "Unhandled rejection ");
15686 activeFireEvent(name, promise);
15689 function formatNonError(obj) {
15691 if (typeof obj === "function") {
15692 str = "[function " + (obj.name || "anonymous") + "]";
15694 str = obj && typeof obj.toString === "function" ? obj.toString() : util.toString(obj);
15695 var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
15696 if (ruselessToString.test(str)) {
15698 var newStr = JSON.stringify(obj);
15703 if (str.length === 0) {
15704 str = "(empty array)";
15707 return "(<" + snip(str) + ">, no stack trace)";
15709 function snip(str) {
15711 if (str.length < maxChars) {
15714 return str.substr(0, maxChars - 3) + "...";
15716 function longStackTracesIsSupported() {
15717 return typeof captureStackTrace === "function";
15719 var shouldIgnore = function() {
15722 var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
15723 function parseLineInfo(line) {
15724 var matches = line.match(parseLineInfoRegex);
15727 fileName: matches[1],
15728 line: parseInt(matches[2], 10)
15732 function setBounds(firstLineError, lastLineError) {
15733 if (!longStackTracesIsSupported())
15735 var firstStackLines = firstLineError.stack.split("\n");
15736 var lastStackLines = lastLineError.stack.split("\n");
15737 var firstIndex = -1;
15738 var lastIndex = -1;
15741 for (var i = 0; i < firstStackLines.length; ++i) {
15742 var result = parseLineInfo(firstStackLines[i]);
15744 firstFileName = result.fileName;
15745 firstIndex = result.line;
15749 for (var i = 0; i < lastStackLines.length; ++i) {
15750 var result = parseLineInfo(lastStackLines[i]);
15752 lastFileName = result.fileName;
15753 lastIndex = result.line;
15757 if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex) {
15760 shouldIgnore = function(line) {
15761 if (bluebirdFramePattern.test(line))
15763 var info = parseLineInfo(line);
15765 if (info.fileName === firstFileName && (firstIndex <= info.line && info.line <= lastIndex)) {
15772 function CapturedTrace(parent) {
15773 this._parent = parent;
15774 this._promisesCreated = 0;
15775 var length = this._length = 1 + (parent === void 0 ? 0 : parent._length);
15776 captureStackTrace(this, CapturedTrace);
15780 util.inherits(CapturedTrace, Error);
15781 Context.CapturedTrace = CapturedTrace;
15782 CapturedTrace.prototype.uncycle = function() {
15783 var length = this._length;
15787 var stackToIndex = {};
15788 for (var i = 0, node = this; node !== void 0; ++i) {
15790 node = node._parent;
15792 length = this._length = i;
15793 for (var i = length - 1; i >= 0; --i) {
15794 var stack = nodes[i].stack;
15795 if (stackToIndex[stack] === void 0) {
15796 stackToIndex[stack] = i;
15799 for (var i = 0; i < length; ++i) {
15800 var currentStack = nodes[i].stack;
15801 var index = stackToIndex[currentStack];
15802 if (index !== void 0 && index !== i) {
15804 nodes[index - 1]._parent = void 0;
15805 nodes[index - 1]._length = 1;
15807 nodes[i]._parent = void 0;
15808 nodes[i]._length = 1;
15809 var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
15810 if (index < length - 1) {
15811 cycleEdgeNode._parent = nodes[index + 1];
15812 cycleEdgeNode._parent.uncycle();
15813 cycleEdgeNode._length = cycleEdgeNode._parent._length + 1;
15815 cycleEdgeNode._parent = void 0;
15816 cycleEdgeNode._length = 1;
15818 var currentChildLength = cycleEdgeNode._length + 1;
15819 for (var j = i - 2; j >= 0; --j) {
15820 nodes[j]._length = currentChildLength;
15821 currentChildLength++;
15827 CapturedTrace.prototype.attachExtraTrace = function(error) {
15828 if (error.__stackCleaned__)
15831 var parsed = parseStackAndMessage(error);
15832 var message = parsed.message;
15833 var stacks = [parsed.stack];
15835 while (trace !== void 0) {
15836 stacks.push(cleanStack(trace.stack.split("\n")));
15837 trace = trace._parent;
15839 removeCommonRoots(stacks);
15840 removeDuplicateOrEmptyJumps(stacks);
15841 util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
15842 util.notEnumerableProp(error, "__stackCleaned__", true);
15844 var captureStackTrace = function stackDetection() {
15845 var v8stackFramePattern = /^\s*at\s*/;
15846 var v8stackFormatter = function(stack, error) {
15847 if (typeof stack === "string")
15849 if (error.name !== void 0 && error.message !== void 0) {
15850 return error.toString();
15852 return formatNonError(error);
15854 if (typeof Error.stackTraceLimit === "number" && typeof Error.captureStackTrace === "function") {
15855 Error.stackTraceLimit += 6;
15856 stackFramePattern = v8stackFramePattern;
15857 formatStack = v8stackFormatter;
15858 var captureStackTrace2 = Error.captureStackTrace;
15859 shouldIgnore = function(line) {
15860 return bluebirdFramePattern.test(line);
15862 return function(receiver, ignoreUntil) {
15863 Error.stackTraceLimit += 6;
15864 captureStackTrace2(receiver, ignoreUntil);
15865 Error.stackTraceLimit -= 6;
15868 var err = new Error();
15869 if (typeof err.stack === "string" && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
15870 stackFramePattern = /@/;
15871 formatStack = v8stackFormatter;
15872 indentStackFrames = true;
15873 return function captureStackTrace3(o) {
15874 o.stack = new Error().stack;
15877 var hasStackAfterThrow;
15881 hasStackAfterThrow = "stack" in e;
15883 if (!("stack" in err) && hasStackAfterThrow && typeof Error.stackTraceLimit === "number") {
15884 stackFramePattern = v8stackFramePattern;
15885 formatStack = v8stackFormatter;
15886 return function captureStackTrace3(o) {
15887 Error.stackTraceLimit += 6;
15893 Error.stackTraceLimit -= 6;
15896 formatStack = function(stack, error) {
15897 if (typeof stack === "string")
15899 if ((typeof error === "object" || typeof error === "function") && error.name !== void 0 && error.message !== void 0) {
15900 return error.toString();
15902 return formatNonError(error);
15906 if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
15907 printWarning = function(message) {
15908 console.warn(message);
15910 if (util.isNode && process.stderr.isTTY) {
15911 printWarning = function(message, isSoft) {
15912 var color = isSoft ? "
\e[33m" : "
\e[31m";
15913 console.warn(color + message + "
\e[0m\n");
15915 } else if (!util.isNode && typeof new Error().stack === "string") {
15916 printWarning = function(message, isSoft) {
15917 console.warn("%c" + message, isSoft ? "color: darkorange" : "color: red");
15923 longStackTraces: false,
15924 cancellation: false,
15927 if (longStackTraces)
15928 Promise2.longStackTraces();
15930 longStackTraces: function() {
15931 return config.longStackTraces;
15933 warnings: function() {
15934 return config.warnings;
15936 cancellation: function() {
15937 return config.cancellation;
15939 monitoring: function() {
15940 return config.monitoring;
15942 propagateFromFunction: function() {
15943 return propagateFromFunction;
15945 boundValueFunction: function() {
15946 return boundValueFunction;
15948 checkForgottenReturns,
15959 // node_modules/bluebird/js/release/finally.js
15960 var require_finally = __commonJS((exports2, module2) => {
15962 module2.exports = function(Promise2, tryConvertToPromise) {
15963 var util = require_util();
15964 var CancellationError = Promise2.CancellationError;
15965 var errorObj2 = util.errorObj;
15966 function PassThroughHandlerContext(promise, type, handler) {
15967 this.promise = promise;
15969 this.handler = handler;
15970 this.called = false;
15971 this.cancelPromise = null;
15973 PassThroughHandlerContext.prototype.isFinallyHandler = function() {
15974 return this.type === 0;
15976 function FinallyHandlerCancelReaction(finallyHandler2) {
15977 this.finallyHandler = finallyHandler2;
15979 FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
15980 checkCancel(this.finallyHandler);
15982 function checkCancel(ctx, reason) {
15983 if (ctx.cancelPromise != null) {
15984 if (arguments.length > 1) {
15985 ctx.cancelPromise._reject(reason);
15987 ctx.cancelPromise._cancel();
15989 ctx.cancelPromise = null;
15994 function succeed() {
15995 return finallyHandler.call(this, this.promise._target()._settledValue());
15997 function fail(reason) {
15998 if (checkCancel(this, reason))
16000 errorObj2.e = reason;
16003 function finallyHandler(reasonOrValue) {
16004 var promise = this.promise;
16005 var handler = this.handler;
16006 if (!this.called) {
16007 this.called = true;
16008 var ret2 = this.isFinallyHandler() ? handler.call(promise._boundValue()) : handler.call(promise._boundValue(), reasonOrValue);
16009 if (ret2 !== void 0) {
16010 promise._setReturnedNonUndefined();
16011 var maybePromise = tryConvertToPromise(ret2, promise);
16012 if (maybePromise instanceof Promise2) {
16013 if (this.cancelPromise != null) {
16014 if (maybePromise._isCancelled()) {
16015 var reason = new CancellationError("late cancellation observer");
16016 promise._attachExtraTrace(reason);
16017 errorObj2.e = reason;
16019 } else if (maybePromise.isPending()) {
16020 maybePromise._attachCancellationCallback(new FinallyHandlerCancelReaction(this));
16023 return maybePromise._then(succeed, fail, void 0, this, void 0);
16027 if (promise.isRejected()) {
16029 errorObj2.e = reasonOrValue;
16033 return reasonOrValue;
16036 Promise2.prototype._passThrough = function(handler, type, success, fail2) {
16037 if (typeof handler !== "function")
16038 return this.then();
16039 return this._then(success, fail2, void 0, new PassThroughHandlerContext(this, type, handler), void 0);
16041 Promise2.prototype.lastly = Promise2.prototype["finally"] = function(handler) {
16042 return this._passThrough(handler, 0, finallyHandler, finallyHandler);
16044 Promise2.prototype.tap = function(handler) {
16045 return this._passThrough(handler, 1, finallyHandler);
16047 return PassThroughHandlerContext;
16051 // node_modules/bluebird/js/release/catch_filter.js
16052 var require_catch_filter = __commonJS((exports2, module2) => {
16054 module2.exports = function(NEXT_FILTER) {
16055 var util = require_util();
16056 var getKeys = require_es5().keys;
16057 var tryCatch2 = util.tryCatch;
16058 var errorObj2 = util.errorObj;
16059 function catchFilter(instances, cb, promise) {
16060 return function(e) {
16061 var boundTo = promise._boundValue();
16063 for (var i = 0; i < instances.length; ++i) {
16064 var item = instances[i];
16065 if (item === Error || item != null && item.prototype instanceof Error) {
16066 if (e instanceof item) {
16067 return tryCatch2(cb).call(boundTo, e);
16069 } else if (typeof item === "function") {
16070 var matchesPredicate = tryCatch2(item).call(boundTo, e);
16071 if (matchesPredicate === errorObj2) {
16072 return matchesPredicate;
16073 } else if (matchesPredicate) {
16074 return tryCatch2(cb).call(boundTo, e);
16076 } else if (util.isObject(e)) {
16077 var keys = getKeys(item);
16078 for (var j = 0; j < keys.length; ++j) {
16080 if (item[key] != e[key]) {
16081 continue predicateLoop;
16084 return tryCatch2(cb).call(boundTo, e);
16087 return NEXT_FILTER;
16090 return catchFilter;
16094 // node_modules/bluebird/js/release/nodeback.js
16095 var require_nodeback = __commonJS((exports2, module2) => {
16097 var util = require_util();
16098 var maybeWrapAsError2 = util.maybeWrapAsError;
16099 var errors = require_errors();
16100 var OperationalError = errors.OperationalError;
16101 var es52 = require_es5();
16102 function isUntypedError(obj) {
16103 return obj instanceof Error && es52.getPrototypeOf(obj) === Error.prototype;
16105 var rErrorKey = /^(?:name|message|stack|cause)$/;
16106 function wrapAsOperationalError(obj) {
16108 if (isUntypedError(obj)) {
16109 ret2 = new OperationalError(obj);
16110 ret2.name = obj.name;
16111 ret2.message = obj.message;
16112 ret2.stack = obj.stack;
16113 var keys = es52.keys(obj);
16114 for (var i = 0; i < keys.length; ++i) {
16116 if (!rErrorKey.test(key)) {
16117 ret2[key] = obj[key];
16122 util.markAsOriginatingFromRejection(obj);
16125 function nodebackForPromise(promise, multiArgs) {
16126 return function(err, value) {
16127 if (promise === null)
16130 var wrapped = wrapAsOperationalError(maybeWrapAsError2(err));
16131 promise._attachExtraTrace(wrapped);
16132 promise._reject(wrapped);
16133 } else if (!multiArgs) {
16134 promise._fulfill(value);
16136 var $_len = arguments.length;
16137 var args = new Array(Math.max($_len - 1, 0));
16138 for (var $_i = 1; $_i < $_len; ++$_i) {
16139 args[$_i - 1] = arguments[$_i];
16142 promise._fulfill(args);
16147 module2.exports = nodebackForPromise;
16150 // node_modules/bluebird/js/release/method.js
16151 var require_method = __commonJS((exports2, module2) => {
16153 module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, apiRejection, debug) {
16154 var util = require_util();
16155 var tryCatch2 = util.tryCatch;
16156 Promise2.method = function(fn) {
16157 if (typeof fn !== "function") {
16158 throw new Promise2.TypeError("expecting a function but got " + util.classString(fn));
16160 return function() {
16161 var ret2 = new Promise2(INTERNAL);
16162 ret2._captureStackTrace();
16163 ret2._pushContext();
16164 var value = tryCatch2(fn).apply(this, arguments);
16165 var promiseCreated = ret2._popContext();
16166 debug.checkForgottenReturns(value, promiseCreated, "Promise.method", ret2);
16167 ret2._resolveFromSyncValue(value);
16171 Promise2.attempt = Promise2["try"] = function(fn) {
16172 if (typeof fn !== "function") {
16173 return apiRejection("expecting a function but got " + util.classString(fn));
16175 var ret2 = new Promise2(INTERNAL);
16176 ret2._captureStackTrace();
16177 ret2._pushContext();
16179 if (arguments.length > 1) {
16180 debug.deprecated("calling Promise.try with more than 1 argument");
16181 var arg = arguments[1];
16182 var ctx = arguments[2];
16183 value = util.isArray(arg) ? tryCatch2(fn).apply(ctx, arg) : tryCatch2(fn).call(ctx, arg);
16185 value = tryCatch2(fn)();
16187 var promiseCreated = ret2._popContext();
16188 debug.checkForgottenReturns(value, promiseCreated, "Promise.try", ret2);
16189 ret2._resolveFromSyncValue(value);
16192 Promise2.prototype._resolveFromSyncValue = function(value) {
16193 if (value === util.errorObj) {
16194 this._rejectCallback(value.e, false);
16196 this._resolveCallback(value, true);
16202 // node_modules/bluebird/js/release/bind.js
16203 var require_bind = __commonJS((exports2, module2) => {
16205 module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, debug) {
16206 var calledBind = false;
16207 var rejectThis = function(_, e) {
16210 var targetRejected = function(e, context) {
16211 context.promiseRejectionQueued = true;
16212 context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
16214 var bindingResolved = function(thisArg, context) {
16215 if ((this._bitField & 50397184) === 0) {
16216 this._resolveCallback(context.target);
16219 var bindingRejected = function(e, context) {
16220 if (!context.promiseRejectionQueued)
16223 Promise2.prototype.bind = function(thisArg) {
16226 Promise2.prototype._propagateFrom = debug.propagateFromFunction();
16227 Promise2.prototype._boundValue = debug.boundValueFunction();
16229 var maybePromise = tryConvertToPromise(thisArg);
16230 var ret2 = new Promise2(INTERNAL);
16231 ret2._propagateFrom(this, 1);
16232 var target = this._target();
16233 ret2._setBoundTo(maybePromise);
16234 if (maybePromise instanceof Promise2) {
16236 promiseRejectionQueued: false,
16239 bindingPromise: maybePromise
16241 target._then(INTERNAL, targetRejected, void 0, ret2, context);
16242 maybePromise._then(bindingResolved, bindingRejected, void 0, ret2, context);
16243 ret2._setOnCancel(maybePromise);
16245 ret2._resolveCallback(target);
16249 Promise2.prototype._setBoundTo = function(obj) {
16250 if (obj !== void 0) {
16251 this._bitField = this._bitField | 2097152;
16252 this._boundTo = obj;
16254 this._bitField = this._bitField & ~2097152;
16257 Promise2.prototype._isBound = function() {
16258 return (this._bitField & 2097152) === 2097152;
16260 Promise2.bind = function(thisArg, value) {
16261 return Promise2.resolve(value).bind(thisArg);
16266 // node_modules/bluebird/js/release/cancel.js
16267 var require_cancel = __commonJS((exports2, module2) => {
16269 module2.exports = function(Promise2, PromiseArray, apiRejection, debug) {
16270 var util = require_util();
16271 var tryCatch2 = util.tryCatch;
16272 var errorObj2 = util.errorObj;
16273 var async = Promise2._async;
16274 Promise2.prototype["break"] = Promise2.prototype.cancel = function() {
16275 if (!debug.cancellation())
16276 return this._warn("cancellation is disabled");
16277 var promise = this;
16278 var child = promise;
16279 while (promise._isCancellable()) {
16280 if (!promise._cancelBy(child)) {
16281 if (child._isFollowing()) {
16282 child._followee().cancel();
16284 child._cancelBranched();
16288 var parent = promise._cancellationParent;
16289 if (parent == null || !parent._isCancellable()) {
16290 if (promise._isFollowing()) {
16291 promise._followee().cancel();
16293 promise._cancelBranched();
16297 if (promise._isFollowing())
16298 promise._followee().cancel();
16299 promise._setWillBeCancelled();
16305 Promise2.prototype._branchHasCancelled = function() {
16306 this._branchesRemainingToCancel--;
16308 Promise2.prototype._enoughBranchesHaveCancelled = function() {
16309 return this._branchesRemainingToCancel === void 0 || this._branchesRemainingToCancel <= 0;
16311 Promise2.prototype._cancelBy = function(canceller) {
16312 if (canceller === this) {
16313 this._branchesRemainingToCancel = 0;
16314 this._invokeOnCancel();
16317 this._branchHasCancelled();
16318 if (this._enoughBranchesHaveCancelled()) {
16319 this._invokeOnCancel();
16325 Promise2.prototype._cancelBranched = function() {
16326 if (this._enoughBranchesHaveCancelled()) {
16330 Promise2.prototype._cancel = function() {
16331 if (!this._isCancellable())
16333 this._setCancelled();
16334 async.invoke(this._cancelPromises, this, void 0);
16336 Promise2.prototype._cancelPromises = function() {
16337 if (this._length() > 0)
16338 this._settlePromises();
16340 Promise2.prototype._unsetOnCancel = function() {
16341 this._onCancelField = void 0;
16343 Promise2.prototype._isCancellable = function() {
16344 return this.isPending() && !this._isCancelled();
16346 Promise2.prototype.isCancellable = function() {
16347 return this.isPending() && !this.isCancelled();
16349 Promise2.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
16350 if (util.isArray(onCancelCallback)) {
16351 for (var i = 0; i < onCancelCallback.length; ++i) {
16352 this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
16354 } else if (onCancelCallback !== void 0) {
16355 if (typeof onCancelCallback === "function") {
16356 if (!internalOnly) {
16357 var e = tryCatch2(onCancelCallback).call(this._boundValue());
16358 if (e === errorObj2) {
16359 this._attachExtraTrace(e.e);
16360 async.throwLater(e.e);
16364 onCancelCallback._resultCancelled(this);
16368 Promise2.prototype._invokeOnCancel = function() {
16369 var onCancelCallback = this._onCancel();
16370 this._unsetOnCancel();
16371 async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
16373 Promise2.prototype._invokeInternalOnCancel = function() {
16374 if (this._isCancellable()) {
16375 this._doInvokeOnCancel(this._onCancel(), true);
16376 this._unsetOnCancel();
16379 Promise2.prototype._resultCancelled = function() {
16385 // node_modules/bluebird/js/release/direct_resolve.js
16386 var require_direct_resolve = __commonJS((exports2, module2) => {
16388 module2.exports = function(Promise2) {
16389 function returner() {
16392 function thrower2() {
16395 Promise2.prototype["return"] = Promise2.prototype.thenReturn = function(value) {
16396 if (value instanceof Promise2)
16397 value.suppressUnhandledRejections();
16398 return this._then(returner, void 0, void 0, {value}, void 0);
16400 Promise2.prototype["throw"] = Promise2.prototype.thenThrow = function(reason) {
16401 return this._then(thrower2, void 0, void 0, {reason}, void 0);
16403 Promise2.prototype.catchThrow = function(reason) {
16404 if (arguments.length <= 1) {
16405 return this._then(void 0, thrower2, void 0, {reason}, void 0);
16407 var _reason = arguments[1];
16408 var handler = function() {
16411 return this.caught(reason, handler);
16414 Promise2.prototype.catchReturn = function(value) {
16415 if (arguments.length <= 1) {
16416 if (value instanceof Promise2)
16417 value.suppressUnhandledRejections();
16418 return this._then(void 0, returner, void 0, {value}, void 0);
16420 var _value = arguments[1];
16421 if (_value instanceof Promise2)
16422 _value.suppressUnhandledRejections();
16423 var handler = function() {
16426 return this.caught(value, handler);
16432 // node_modules/bluebird/js/release/synchronous_inspection.js
16433 var require_synchronous_inspection = __commonJS((exports2, module2) => {
16435 module2.exports = function(Promise2) {
16436 function PromiseInspection(promise) {
16437 if (promise !== void 0) {
16438 promise = promise._target();
16439 this._bitField = promise._bitField;
16440 this._settledValueField = promise._isFateSealed() ? promise._settledValue() : void 0;
16442 this._bitField = 0;
16443 this._settledValueField = void 0;
16446 PromiseInspection.prototype._settledValue = function() {
16447 return this._settledValueField;
16449 var value = PromiseInspection.prototype.value = function() {
16450 if (!this.isFulfilled()) {
16451 throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");
16453 return this._settledValue();
16455 var reason = PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function() {
16456 if (!this.isRejected()) {
16457 throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");
16459 return this._settledValue();
16461 var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
16462 return (this._bitField & 33554432) !== 0;
16464 var isRejected = PromiseInspection.prototype.isRejected = function() {
16465 return (this._bitField & 16777216) !== 0;
16467 var isPending = PromiseInspection.prototype.isPending = function() {
16468 return (this._bitField & 50397184) === 0;
16470 var isResolved = PromiseInspection.prototype.isResolved = function() {
16471 return (this._bitField & 50331648) !== 0;
16473 PromiseInspection.prototype.isCancelled = function() {
16474 return (this._bitField & 8454144) !== 0;
16476 Promise2.prototype.__isCancelled = function() {
16477 return (this._bitField & 65536) === 65536;
16479 Promise2.prototype._isCancelled = function() {
16480 return this._target().__isCancelled();
16482 Promise2.prototype.isCancelled = function() {
16483 return (this._target()._bitField & 8454144) !== 0;
16485 Promise2.prototype.isPending = function() {
16486 return isPending.call(this._target());
16488 Promise2.prototype.isRejected = function() {
16489 return isRejected.call(this._target());
16491 Promise2.prototype.isFulfilled = function() {
16492 return isFulfilled.call(this._target());
16494 Promise2.prototype.isResolved = function() {
16495 return isResolved.call(this._target());
16497 Promise2.prototype.value = function() {
16498 return value.call(this._target());
16500 Promise2.prototype.reason = function() {
16501 var target = this._target();
16502 target._unsetRejectionIsUnhandled();
16503 return reason.call(target);
16505 Promise2.prototype._value = function() {
16506 return this._settledValue();
16508 Promise2.prototype._reason = function() {
16509 this._unsetRejectionIsUnhandled();
16510 return this._settledValue();
16512 Promise2.PromiseInspection = PromiseInspection;
16516 // node_modules/bluebird/js/release/join.js
16517 var require_join = __commonJS((exports2, module2) => {
16519 module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain) {
16520 var util = require_util();
16521 var canEvaluate2 = util.canEvaluate;
16522 var tryCatch2 = util.tryCatch;
16523 var errorObj2 = util.errorObj;
16526 if (canEvaluate2) {
16527 var thenCallback = function(i2) {
16528 return new Function("value", "holder", " \n 'use strict'; \n holder.pIndex = value; \n holder.checkFulfillment(this); \n ".replace(/Index/g, i2));
16530 var promiseSetter = function(i2) {
16531 return new Function("promise", "holder", " \n 'use strict'; \n holder.pIndex = promise; \n ".replace(/Index/g, i2));
16533 var generateHolderClass = function(total) {
16534 var props = new Array(total);
16535 for (var i2 = 0; i2 < props.length; ++i2) {
16536 props[i2] = "this.p" + (i2 + 1);
16538 var assignment = props.join(" = ") + " = null;";
16539 var cancellationCode = "var promise;\n" + props.map(function(prop) {
16540 return " \n promise = " + prop + "; \n if (promise instanceof Promise) { \n promise.cancel(); \n } \n ";
16542 var passedArguments = props.join(", ");
16543 var name = "Holder$" + total;
16544 var code = "return function(tryCatch, errorObj, Promise, async) { \n 'use strict'; \n function [TheName](fn) { \n [TheProperties] \n this.fn = fn; \n this.asyncNeeded = true; \n this.now = 0; \n } \n \n [TheName].prototype._callFunction = function(promise) { \n promise._pushContext(); \n var ret = tryCatch(this.fn)([ThePassedArguments]); \n promise._popContext(); \n if (ret === errorObj) { \n promise._rejectCallback(ret.e, false); \n } else { \n promise._resolveCallback(ret); \n } \n }; \n \n [TheName].prototype.checkFulfillment = function(promise) { \n var now = ++this.now; \n if (now === [TheTotal]) { \n if (this.asyncNeeded) { \n async.invoke(this._callFunction, this, promise); \n } else { \n this._callFunction(promise); \n } \n \n } \n }; \n \n [TheName].prototype._resultCancelled = function() { \n [CancellationCode] \n }; \n \n return [TheName]; \n }(tryCatch, errorObj, Promise, async); \n ";
16545 code = code.replace(/\[TheName\]/g, name).replace(/\[TheTotal\]/g, total).replace(/\[ThePassedArguments\]/g, passedArguments).replace(/\[TheProperties\]/g, assignment).replace(/\[CancellationCode\]/g, cancellationCode);
16546 return new Function("tryCatch", "errorObj", "Promise", "async", code)(tryCatch2, errorObj2, Promise2, async);
16548 var holderClasses = [];
16549 var thenCallbacks = [];
16550 var promiseSetters = [];
16551 for (var i = 0; i < 8; ++i) {
16552 holderClasses.push(generateHolderClass(i + 1));
16553 thenCallbacks.push(thenCallback(i + 1));
16554 promiseSetters.push(promiseSetter(i + 1));
16556 reject = function(reason) {
16557 this._reject(reason);
16561 Promise2.join = function() {
16562 var last = arguments.length - 1;
16564 if (last > 0 && typeof arguments[last] === "function") {
16565 fn = arguments[last];
16567 if (last <= 8 && canEvaluate2) {
16568 var ret2 = new Promise2(INTERNAL);
16569 ret2._captureStackTrace();
16570 var HolderClass = holderClasses[last - 1];
16571 var holder = new HolderClass(fn);
16572 var callbacks = thenCallbacks;
16573 for (var i2 = 0; i2 < last; ++i2) {
16574 var maybePromise = tryConvertToPromise(arguments[i2], ret2);
16575 if (maybePromise instanceof Promise2) {
16576 maybePromise = maybePromise._target();
16577 var bitField = maybePromise._bitField;
16579 if ((bitField & 50397184) === 0) {
16580 maybePromise._then(callbacks[i2], reject, void 0, ret2, holder);
16581 promiseSetters[i2](maybePromise, holder);
16582 holder.asyncNeeded = false;
16583 } else if ((bitField & 33554432) !== 0) {
16584 callbacks[i2].call(ret2, maybePromise._value(), holder);
16585 } else if ((bitField & 16777216) !== 0) {
16586 ret2._reject(maybePromise._reason());
16591 callbacks[i2].call(ret2, maybePromise, holder);
16594 if (!ret2._isFateSealed()) {
16595 if (holder.asyncNeeded) {
16596 var domain = getDomain();
16597 if (domain !== null) {
16598 holder.fn = util.domainBind(domain, holder.fn);
16601 ret2._setAsyncGuaranteed();
16602 ret2._setOnCancel(holder);
16608 var $_len = arguments.length;
16609 var args = new Array($_len);
16610 for (var $_i = 0; $_i < $_len; ++$_i) {
16611 args[$_i] = arguments[$_i];
16616 var ret2 = new PromiseArray(args).promise();
16617 return fn !== void 0 ? ret2.spread(fn) : ret2;
16622 // node_modules/bluebird/js/release/map.js
16623 var require_map = __commonJS((exports2, module2) => {
16625 module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug) {
16626 var getDomain = Promise2._getDomain;
16627 var util = require_util();
16628 var tryCatch2 = util.tryCatch;
16629 var errorObj2 = util.errorObj;
16630 var async = Promise2._async;
16631 function MappingPromiseArray(promises, fn, limit, _filter) {
16632 this.constructor$(promises);
16633 this._promise._captureStackTrace();
16634 var domain = getDomain();
16635 this._callback = domain === null ? fn : util.domainBind(domain, fn);
16636 this._preservedValues = _filter === INTERNAL ? new Array(this.length()) : null;
16637 this._limit = limit;
16638 this._inFlight = 0;
16640 async.invoke(this._asyncInit, this, void 0);
16642 util.inherits(MappingPromiseArray, PromiseArray);
16643 MappingPromiseArray.prototype._asyncInit = function() {
16644 this._init$(void 0, -2);
16646 MappingPromiseArray.prototype._init = function() {
16648 MappingPromiseArray.prototype._promiseFulfilled = function(value, index) {
16649 var values = this._values;
16650 var length = this.length();
16651 var preservedValues = this._preservedValues;
16652 var limit = this._limit;
16654 index = index * -1 - 1;
16655 values[index] = value;
16658 this._drainQueue();
16659 if (this._isResolved())
16663 if (limit >= 1 && this._inFlight >= limit) {
16664 values[index] = value;
16665 this._queue.push(index);
16668 if (preservedValues !== null)
16669 preservedValues[index] = value;
16670 var promise = this._promise;
16671 var callback = this._callback;
16672 var receiver = promise._boundValue();
16673 promise._pushContext();
16674 var ret2 = tryCatch2(callback).call(receiver, value, index, length);
16675 var promiseCreated = promise._popContext();
16676 debug.checkForgottenReturns(ret2, promiseCreated, preservedValues !== null ? "Promise.filter" : "Promise.map", promise);
16677 if (ret2 === errorObj2) {
16678 this._reject(ret2.e);
16681 var maybePromise = tryConvertToPromise(ret2, this._promise);
16682 if (maybePromise instanceof Promise2) {
16683 maybePromise = maybePromise._target();
16684 var bitField = maybePromise._bitField;
16686 if ((bitField & 50397184) === 0) {
16689 values[index] = maybePromise;
16690 maybePromise._proxy(this, (index + 1) * -1);
16692 } else if ((bitField & 33554432) !== 0) {
16693 ret2 = maybePromise._value();
16694 } else if ((bitField & 16777216) !== 0) {
16695 this._reject(maybePromise._reason());
16702 values[index] = ret2;
16704 var totalResolved = ++this._totalResolved;
16705 if (totalResolved >= length) {
16706 if (preservedValues !== null) {
16707 this._filter(values, preservedValues);
16709 this._resolve(values);
16715 MappingPromiseArray.prototype._drainQueue = function() {
16716 var queue = this._queue;
16717 var limit = this._limit;
16718 var values = this._values;
16719 while (queue.length > 0 && this._inFlight < limit) {
16720 if (this._isResolved())
16722 var index = queue.pop();
16723 this._promiseFulfilled(values[index], index);
16726 MappingPromiseArray.prototype._filter = function(booleans, values) {
16727 var len = values.length;
16728 var ret2 = new Array(len);
16730 for (var i = 0; i < len; ++i) {
16732 ret2[j++] = values[i];
16735 this._resolve(ret2);
16737 MappingPromiseArray.prototype.preservedValues = function() {
16738 return this._preservedValues;
16740 function map(promises, fn, options, _filter) {
16741 if (typeof fn !== "function") {
16742 return apiRejection("expecting a function but got " + util.classString(fn));
16745 if (options !== void 0) {
16746 if (typeof options === "object" && options !== null) {
16747 if (typeof options.concurrency !== "number") {
16748 return Promise2.reject(new TypeError("'concurrency' must be a number but it is " + util.classString(options.concurrency)));
16750 limit = options.concurrency;
16752 return Promise2.reject(new TypeError("options argument must be an object but it is " + util.classString(options)));
16755 limit = typeof limit === "number" && isFinite(limit) && limit >= 1 ? limit : 0;
16756 return new MappingPromiseArray(promises, fn, limit, _filter).promise();
16758 Promise2.prototype.map = function(fn, options) {
16759 return map(this, fn, options, null);
16761 Promise2.map = function(promises, fn, options, _filter) {
16762 return map(promises, fn, options, _filter);
16767 // node_modules/bluebird/js/release/call_get.js
16768 var require_call_get = __commonJS((exports2, module2) => {
16770 var cr = Object.create;
16772 callerCache = cr(null);
16773 getterCache = cr(null);
16774 callerCache[" size"] = getterCache[" size"] = 0;
16778 module2.exports = function(Promise2) {
16779 var util = require_util();
16780 var canEvaluate2 = util.canEvaluate;
16781 var isIdentifier2 = util.isIdentifier;
16782 var getMethodCaller;
16785 var makeMethodCaller = function(methodName) {
16786 return new Function("ensureMethod", " \n return function(obj) { \n 'use strict' \n var len = this.length; \n ensureMethod(obj, 'methodName'); \n switch(len) { \n case 1: return obj.methodName(this[0]); \n case 2: return obj.methodName(this[0], this[1]); \n case 3: return obj.methodName(this[0], this[1], this[2]); \n case 0: return obj.methodName(); \n default: \n return obj.methodName.apply(obj, this); \n } \n }; \n ".replace(/methodName/g, methodName))(ensureMethod);
16788 var makeGetter = function(propertyName) {
16789 return new Function("obj", " \n 'use strict'; \n return obj.propertyName; \n ".replace("propertyName", propertyName));
16791 var getCompiled = function(name, compiler, cache) {
16792 var ret2 = cache[name];
16793 if (typeof ret2 !== "function") {
16794 if (!isIdentifier2(name)) {
16797 ret2 = compiler(name);
16798 cache[name] = ret2;
16800 if (cache[" size"] > 512) {
16801 var keys = Object.keys(cache);
16802 for (var i = 0; i < 256; ++i)
16803 delete cache[keys[i]];
16804 cache[" size"] = keys.length - 256;
16809 getMethodCaller = function(name) {
16810 return getCompiled(name, makeMethodCaller, callerCache);
16812 getGetter = function(name) {
16813 return getCompiled(name, makeGetter, getterCache);
16816 function ensureMethod(obj, methodName) {
16819 fn = obj[methodName];
16820 if (typeof fn !== "function") {
16821 var message = "Object " + util.classString(obj) + " has no method '" + util.toString(methodName) + "'";
16822 throw new Promise2.TypeError(message);
16826 function caller(obj) {
16827 var methodName = this.pop();
16828 var fn = ensureMethod(obj, methodName);
16829 return fn.apply(obj, this);
16831 Promise2.prototype.call = function(methodName) {
16832 var $_len = arguments.length;
16833 var args = new Array(Math.max($_len - 1, 0));
16834 for (var $_i = 1; $_i < $_len; ++$_i) {
16835 args[$_i - 1] = arguments[$_i];
16839 if (canEvaluate2) {
16840 var maybeCaller = getMethodCaller(methodName);
16841 if (maybeCaller !== null) {
16842 return this._then(maybeCaller, void 0, void 0, args, void 0);
16846 args.push(methodName);
16847 return this._then(caller, void 0, void 0, args, void 0);
16849 function namedGetter(obj) {
16852 function indexedGetter(obj) {
16855 index = Math.max(0, index + obj.length);
16858 Promise2.prototype.get = function(propertyName) {
16859 var isIndex = typeof propertyName === "number";
16862 if (canEvaluate2) {
16863 var maybeGetter = getGetter(propertyName);
16864 getter = maybeGetter !== null ? maybeGetter : namedGetter;
16866 getter = namedGetter;
16869 getter = indexedGetter;
16871 return this._then(getter, void 0, void 0, propertyName, void 0);
16876 // node_modules/bluebird/js/release/using.js
16877 var require_using = __commonJS((exports2, module2) => {
16879 module2.exports = function(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug) {
16880 var util = require_util();
16881 var TypeError2 = require_errors().TypeError;
16882 var inherits2 = require_util().inherits;
16883 var errorObj2 = util.errorObj;
16884 var tryCatch2 = util.tryCatch;
16886 function thrower2(e) {
16887 setTimeout(function() {
16891 function castPreservingDisposable(thenable) {
16892 var maybePromise = tryConvertToPromise(thenable);
16893 if (maybePromise !== thenable && typeof thenable._isDisposable === "function" && typeof thenable._getDisposer === "function" && thenable._isDisposable()) {
16894 maybePromise._setDisposable(thenable._getDisposer());
16896 return maybePromise;
16898 function dispose(resources, inspection) {
16900 var len = resources.length;
16901 var ret2 = new Promise2(INTERNAL);
16902 function iterator() {
16904 return ret2._fulfill();
16905 var maybePromise = castPreservingDisposable(resources[i++]);
16906 if (maybePromise instanceof Promise2 && maybePromise._isDisposable()) {
16908 maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise);
16910 return thrower2(e);
16912 if (maybePromise instanceof Promise2) {
16913 return maybePromise._then(iterator, thrower2, null, null, null);
16921 function Disposer(data, promise, context) {
16923 this._promise = promise;
16924 this._context = context;
16926 Disposer.prototype.data = function() {
16929 Disposer.prototype.promise = function() {
16930 return this._promise;
16932 Disposer.prototype.resource = function() {
16933 if (this.promise().isFulfilled()) {
16934 return this.promise().value();
16938 Disposer.prototype.tryDispose = function(inspection) {
16939 var resource = this.resource();
16940 var context = this._context;
16941 if (context !== void 0)
16942 context._pushContext();
16943 var ret2 = resource !== NULL ? this.doDispose(resource, inspection) : null;
16944 if (context !== void 0)
16945 context._popContext();
16946 this._promise._unsetDisposable();
16950 Disposer.isDisposer = function(d) {
16951 return d != null && typeof d.resource === "function" && typeof d.tryDispose === "function";
16953 function FunctionDisposer(fn, promise, context) {
16954 this.constructor$(fn, promise, context);
16956 inherits2(FunctionDisposer, Disposer);
16957 FunctionDisposer.prototype.doDispose = function(resource, inspection) {
16958 var fn = this.data();
16959 return fn.call(resource, resource, inspection);
16961 function maybeUnwrapDisposer(value) {
16962 if (Disposer.isDisposer(value)) {
16963 this.resources[this.index]._setDisposable(value);
16964 return value.promise();
16968 function ResourceList(length) {
16969 this.length = length;
16970 this.promise = null;
16971 this[length - 1] = null;
16973 ResourceList.prototype._resultCancelled = function() {
16974 var len = this.length;
16975 for (var i = 0; i < len; ++i) {
16976 var item = this[i];
16977 if (item instanceof Promise2) {
16982 Promise2.using = function() {
16983 var len = arguments.length;
16985 return apiRejection("you must pass at least 2 arguments to Promise.using");
16986 var fn = arguments[len - 1];
16987 if (typeof fn !== "function") {
16988 return apiRejection("expecting a function but got " + util.classString(fn));
16991 var spreadArgs = true;
16992 if (len === 2 && Array.isArray(arguments[0])) {
16993 input = arguments[0];
16994 len = input.length;
16995 spreadArgs = false;
17000 var resources = new ResourceList(len);
17001 for (var i = 0; i < len; ++i) {
17002 var resource = input[i];
17003 if (Disposer.isDisposer(resource)) {
17004 var disposer = resource;
17005 resource = resource.promise();
17006 resource._setDisposable(disposer);
17008 var maybePromise = tryConvertToPromise(resource);
17009 if (maybePromise instanceof Promise2) {
17010 resource = maybePromise._then(maybeUnwrapDisposer, null, null, {
17016 resources[i] = resource;
17018 var reflectedResources = new Array(resources.length);
17019 for (var i = 0; i < reflectedResources.length; ++i) {
17020 reflectedResources[i] = Promise2.resolve(resources[i]).reflect();
17022 var resultPromise = Promise2.all(reflectedResources).then(function(inspections) {
17023 for (var i2 = 0; i2 < inspections.length; ++i2) {
17024 var inspection = inspections[i2];
17025 if (inspection.isRejected()) {
17026 errorObj2.e = inspection.error();
17028 } else if (!inspection.isFulfilled()) {
17029 resultPromise.cancel();
17032 inspections[i2] = inspection.value();
17034 promise._pushContext();
17035 fn = tryCatch2(fn);
17036 var ret2 = spreadArgs ? fn.apply(void 0, inspections) : fn(inspections);
17037 var promiseCreated = promise._popContext();
17038 debug.checkForgottenReturns(ret2, promiseCreated, "Promise.using", promise);
17041 var promise = resultPromise.lastly(function() {
17042 var inspection = new Promise2.PromiseInspection(resultPromise);
17043 return dispose(resources, inspection);
17045 resources.promise = promise;
17046 promise._setOnCancel(resources);
17049 Promise2.prototype._setDisposable = function(disposer) {
17050 this._bitField = this._bitField | 131072;
17051 this._disposer = disposer;
17053 Promise2.prototype._isDisposable = function() {
17054 return (this._bitField & 131072) > 0;
17056 Promise2.prototype._getDisposer = function() {
17057 return this._disposer;
17059 Promise2.prototype._unsetDisposable = function() {
17060 this._bitField = this._bitField & ~131072;
17061 this._disposer = void 0;
17063 Promise2.prototype.disposer = function(fn) {
17064 if (typeof fn === "function") {
17065 return new FunctionDisposer(fn, this, createContext());
17067 throw new TypeError2();
17072 // node_modules/bluebird/js/release/timers.js
17073 var require_timers = __commonJS((exports2, module2) => {
17075 module2.exports = function(Promise2, INTERNAL, debug) {
17076 var util = require_util();
17077 var TimeoutError = Promise2.TimeoutError;
17078 function HandleWrapper(handle) {
17079 this.handle = handle;
17081 HandleWrapper.prototype._resultCancelled = function() {
17082 clearTimeout(this.handle);
17084 var afterValue = function(value) {
17085 return delay(+this).thenReturn(value);
17087 var delay = Promise2.delay = function(ms, value) {
17090 if (value !== void 0) {
17091 ret2 = Promise2.resolve(value)._then(afterValue, null, null, ms, void 0);
17092 if (debug.cancellation() && value instanceof Promise2) {
17093 ret2._setOnCancel(value);
17096 ret2 = new Promise2(INTERNAL);
17097 handle = setTimeout(function() {
17100 if (debug.cancellation()) {
17101 ret2._setOnCancel(new HandleWrapper(handle));
17103 ret2._captureStackTrace();
17105 ret2._setAsyncGuaranteed();
17108 Promise2.prototype.delay = function(ms) {
17109 return delay(ms, this);
17111 var afterTimeout = function(promise, message, parent) {
17113 if (typeof message !== "string") {
17114 if (message instanceof Error) {
17117 err = new TimeoutError("operation timed out");
17120 err = new TimeoutError(message);
17122 util.markAsOriginatingFromRejection(err);
17123 promise._attachExtraTrace(err);
17124 promise._reject(err);
17125 if (parent != null) {
17129 function successClear(value) {
17130 clearTimeout(this.handle);
17133 function failureClear(reason) {
17134 clearTimeout(this.handle);
17137 Promise2.prototype.timeout = function(ms, message) {
17140 var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
17141 if (ret2.isPending()) {
17142 afterTimeout(ret2, message, parent);
17145 if (debug.cancellation()) {
17146 parent = this.then();
17147 ret2 = parent._then(successClear, failureClear, void 0, handleWrapper, void 0);
17148 ret2._setOnCancel(handleWrapper);
17150 ret2 = this._then(successClear, failureClear, void 0, handleWrapper, void 0);
17157 // node_modules/bluebird/js/release/generators.js
17158 var require_generators = __commonJS((exports2, module2) => {
17160 module2.exports = function(Promise2, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug) {
17161 var errors = require_errors();
17162 var TypeError2 = errors.TypeError;
17163 var util = require_util();
17164 var errorObj2 = util.errorObj;
17165 var tryCatch2 = util.tryCatch;
17166 var yieldHandlers = [];
17167 function promiseFromYieldHandler(value, yieldHandlers2, traceParent) {
17168 for (var i = 0; i < yieldHandlers2.length; ++i) {
17169 traceParent._pushContext();
17170 var result = tryCatch2(yieldHandlers2[i])(value);
17171 traceParent._popContext();
17172 if (result === errorObj2) {
17173 traceParent._pushContext();
17174 var ret2 = Promise2.reject(errorObj2.e);
17175 traceParent._popContext();
17178 var maybePromise = tryConvertToPromise(result, traceParent);
17179 if (maybePromise instanceof Promise2)
17180 return maybePromise;
17184 function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
17185 if (debug.cancellation()) {
17186 var internal = new Promise2(INTERNAL);
17187 var _finallyPromise = this._finallyPromise = new Promise2(INTERNAL);
17188 this._promise = internal.lastly(function() {
17189 return _finallyPromise;
17191 internal._captureStackTrace();
17192 internal._setOnCancel(this);
17194 var promise = this._promise = new Promise2(INTERNAL);
17195 promise._captureStackTrace();
17197 this._stack = stack;
17198 this._generatorFunction = generatorFunction;
17199 this._receiver = receiver;
17200 this._generator = void 0;
17201 this._yieldHandlers = typeof yieldHandler === "function" ? [yieldHandler].concat(yieldHandlers) : yieldHandlers;
17202 this._yieldedPromise = null;
17203 this._cancellationPhase = false;
17205 util.inherits(PromiseSpawn, Proxyable);
17206 PromiseSpawn.prototype._isResolved = function() {
17207 return this._promise === null;
17209 PromiseSpawn.prototype._cleanup = function() {
17210 this._promise = this._generator = null;
17211 if (debug.cancellation() && this._finallyPromise !== null) {
17212 this._finallyPromise._fulfill();
17213 this._finallyPromise = null;
17216 PromiseSpawn.prototype._promiseCancelled = function() {
17217 if (this._isResolved())
17219 var implementsReturn = typeof this._generator["return"] !== "undefined";
17221 if (!implementsReturn) {
17222 var reason = new Promise2.CancellationError("generator .return() sentinel");
17223 Promise2.coroutine.returnSentinel = reason;
17224 this._promise._attachExtraTrace(reason);
17225 this._promise._pushContext();
17226 result = tryCatch2(this._generator["throw"]).call(this._generator, reason);
17227 this._promise._popContext();
17229 this._promise._pushContext();
17230 result = tryCatch2(this._generator["return"]).call(this._generator, void 0);
17231 this._promise._popContext();
17233 this._cancellationPhase = true;
17234 this._yieldedPromise = null;
17235 this._continue(result);
17237 PromiseSpawn.prototype._promiseFulfilled = function(value) {
17238 this._yieldedPromise = null;
17239 this._promise._pushContext();
17240 var result = tryCatch2(this._generator.next).call(this._generator, value);
17241 this._promise._popContext();
17242 this._continue(result);
17244 PromiseSpawn.prototype._promiseRejected = function(reason) {
17245 this._yieldedPromise = null;
17246 this._promise._attachExtraTrace(reason);
17247 this._promise._pushContext();
17248 var result = tryCatch2(this._generator["throw"]).call(this._generator, reason);
17249 this._promise._popContext();
17250 this._continue(result);
17252 PromiseSpawn.prototype._resultCancelled = function() {
17253 if (this._yieldedPromise instanceof Promise2) {
17254 var promise = this._yieldedPromise;
17255 this._yieldedPromise = null;
17259 PromiseSpawn.prototype.promise = function() {
17260 return this._promise;
17262 PromiseSpawn.prototype._run = function() {
17263 this._generator = this._generatorFunction.call(this._receiver);
17264 this._receiver = this._generatorFunction = void 0;
17265 this._promiseFulfilled(void 0);
17267 PromiseSpawn.prototype._continue = function(result) {
17268 var promise = this._promise;
17269 if (result === errorObj2) {
17271 if (this._cancellationPhase) {
17272 return promise.cancel();
17274 return promise._rejectCallback(result.e, false);
17277 var value = result.value;
17278 if (result.done === true) {
17280 if (this._cancellationPhase) {
17281 return promise.cancel();
17283 return promise._resolveCallback(value);
17286 var maybePromise = tryConvertToPromise(value, this._promise);
17287 if (!(maybePromise instanceof Promise2)) {
17288 maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise);
17289 if (maybePromise === null) {
17290 this._promiseRejected(new TypeError2("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n")));
17294 maybePromise = maybePromise._target();
17295 var bitField = maybePromise._bitField;
17297 if ((bitField & 50397184) === 0) {
17298 this._yieldedPromise = maybePromise;
17299 maybePromise._proxy(this, null);
17300 } else if ((bitField & 33554432) !== 0) {
17301 Promise2._async.invoke(this._promiseFulfilled, this, maybePromise._value());
17302 } else if ((bitField & 16777216) !== 0) {
17303 Promise2._async.invoke(this._promiseRejected, this, maybePromise._reason());
17305 this._promiseCancelled();
17309 Promise2.coroutine = function(generatorFunction, options) {
17310 if (typeof generatorFunction !== "function") {
17311 throw new TypeError2("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");
17313 var yieldHandler = Object(options).yieldHandler;
17314 var PromiseSpawn$ = PromiseSpawn;
17315 var stack = new Error().stack;
17316 return function() {
17317 var generator = generatorFunction.apply(this, arguments);
17318 var spawn = new PromiseSpawn$(void 0, void 0, yieldHandler, stack);
17319 var ret2 = spawn.promise();
17320 spawn._generator = generator;
17321 spawn._promiseFulfilled(void 0);
17325 Promise2.coroutine.addYieldHandler = function(fn) {
17326 if (typeof fn !== "function") {
17327 throw new TypeError2("expecting a function but got " + util.classString(fn));
17329 yieldHandlers.push(fn);
17331 Promise2.spawn = function(generatorFunction) {
17332 debug.deprecated("Promise.spawn()", "Promise.coroutine()");
17333 if (typeof generatorFunction !== "function") {
17334 return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");
17336 var spawn = new PromiseSpawn(generatorFunction, this);
17337 var ret2 = spawn.promise();
17338 spawn._run(Promise2.spawn);
17344 // node_modules/bluebird/js/release/nodeify.js
17345 var require_nodeify = __commonJS((exports2, module2) => {
17347 module2.exports = function(Promise2) {
17348 var util = require_util();
17349 var async = Promise2._async;
17350 var tryCatch2 = util.tryCatch;
17351 var errorObj2 = util.errorObj;
17352 function spreadAdapter(val, nodeback) {
17353 var promise = this;
17354 if (!util.isArray(val))
17355 return successAdapter.call(promise, val, nodeback);
17356 var ret2 = tryCatch2(nodeback).apply(promise._boundValue(), [null].concat(val));
17357 if (ret2 === errorObj2) {
17358 async.throwLater(ret2.e);
17361 function successAdapter(val, nodeback) {
17362 var promise = this;
17363 var receiver = promise._boundValue();
17364 var ret2 = val === void 0 ? tryCatch2(nodeback).call(receiver, null) : tryCatch2(nodeback).call(receiver, null, val);
17365 if (ret2 === errorObj2) {
17366 async.throwLater(ret2.e);
17369 function errorAdapter(reason, nodeback) {
17370 var promise = this;
17372 var newReason = new Error(reason + "");
17373 newReason.cause = reason;
17374 reason = newReason;
17376 var ret2 = tryCatch2(nodeback).call(promise._boundValue(), reason);
17377 if (ret2 === errorObj2) {
17378 async.throwLater(ret2.e);
17381 Promise2.prototype.asCallback = Promise2.prototype.nodeify = function(nodeback, options) {
17382 if (typeof nodeback == "function") {
17383 var adapter = successAdapter;
17384 if (options !== void 0 && Object(options).spread) {
17385 adapter = spreadAdapter;
17387 this._then(adapter, errorAdapter, void 0, this, nodeback);
17394 // node_modules/bluebird/js/release/promisify.js
17395 var require_promisify = __commonJS((exports2, module2) => {
17397 module2.exports = function(Promise2, INTERNAL) {
17399 var util = require_util();
17400 var nodebackForPromise = require_nodeback();
17401 var withAppended2 = util.withAppended;
17402 var maybeWrapAsError2 = util.maybeWrapAsError;
17403 var canEvaluate2 = util.canEvaluate;
17404 var TypeError2 = require_errors().TypeError;
17405 var defaultSuffix = "Async";
17406 var defaultPromisified = {__isPromisified__: true};
17407 var noCopyProps = [
17415 "__isPromisified__"
17417 var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
17418 var defaultFilter = function(name) {
17419 return util.isIdentifier(name) && name.charAt(0) !== "_" && name !== "constructor";
17421 function propsFilter(key) {
17422 return !noCopyPropsPattern.test(key);
17424 function isPromisified(fn) {
17426 return fn.__isPromisified__ === true;
17431 function hasPromisified(obj, key, suffix) {
17432 var val = util.getDataPropertyOrDefault(obj, key + suffix, defaultPromisified);
17433 return val ? isPromisified(val) : false;
17435 function checkValid(ret2, suffix, suffixRegexp) {
17436 for (var i = 0; i < ret2.length; i += 2) {
17438 if (suffixRegexp.test(key)) {
17439 var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
17440 for (var j = 0; j < ret2.length; j += 2) {
17441 if (ret2[j] === keyWithoutAsyncSuffix) {
17442 throw new TypeError2("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s", suffix));
17448 function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
17449 var keys = util.inheritedDataKeys(obj);
17451 for (var i = 0; i < keys.length; ++i) {
17453 var value = obj[key];
17454 var passesDefaultFilter = filter === defaultFilter ? true : defaultFilter(key, value, obj);
17455 if (typeof value === "function" && !isPromisified(value) && !hasPromisified(obj, key, suffix) && filter(key, value, obj, passesDefaultFilter)) {
17456 ret2.push(key, value);
17459 checkValid(ret2, suffix, suffixRegexp);
17462 var escapeIdentRegex = function(str) {
17463 return str.replace(/([$])/, "\\$");
17465 var makeNodePromisifiedEval;
17467 var switchCaseArgumentOrder = function(likelyArgumentCount) {
17468 var ret2 = [likelyArgumentCount];
17469 var min = Math.max(0, likelyArgumentCount - 1 - 3);
17470 for (var i = likelyArgumentCount - 1; i >= min; --i) {
17473 for (var i = likelyArgumentCount + 1; i <= 3; ++i) {
17478 var argumentSequence = function(argumentCount) {
17479 return util.filledRange(argumentCount, "_arg", "");
17481 var parameterDeclaration = function(parameterCount2) {
17482 return util.filledRange(Math.max(parameterCount2, 3), "_arg", "");
17484 var parameterCount = function(fn) {
17485 if (typeof fn.length === "number") {
17486 return Math.max(Math.min(fn.length, 1023 + 1), 0);
17490 makeNodePromisifiedEval = function(callback, receiver, originalName, fn, _, multiArgs) {
17491 var newParameterCount = Math.max(0, parameterCount(fn) - 1);
17492 var argumentOrder = switchCaseArgumentOrder(newParameterCount);
17493 var shouldProxyThis = typeof callback === "string" || receiver === THIS;
17494 function generateCallForArgumentCount(count) {
17495 var args = argumentSequence(count).join(", ");
17496 var comma = count > 0 ? ", " : "";
17498 if (shouldProxyThis) {
17499 ret2 = "ret = callback.call(this, {{args}}, nodeback); break;\n";
17501 ret2 = receiver === void 0 ? "ret = callback({{args}}, nodeback); break;\n" : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
17503 return ret2.replace("{{args}}", args).replace(", ", comma);
17505 function generateArgumentSwitchCase() {
17507 for (var i = 0; i < argumentOrder.length; ++i) {
17508 ret2 += "case " + argumentOrder[i] + ":" + generateCallForArgumentCount(argumentOrder[i]);
17510 ret2 += " \n default: \n var args = new Array(len + 1); \n var i = 0; \n for (var i = 0; i < len; ++i) { \n args[i] = arguments[i]; \n } \n args[i] = nodeback; \n [CodeForCall] \n break; \n ".replace("[CodeForCall]", shouldProxyThis ? "ret = callback.apply(this, args);\n" : "ret = callback.apply(receiver, args);\n");
17513 var getFunctionCode = typeof callback === "string" ? "this != null ? this['" + callback + "'] : fn" : "fn";
17514 var body = "'use strict'; \n var ret = function (Parameters) { \n 'use strict'; \n var len = arguments.length; \n var promise = new Promise(INTERNAL); \n promise._captureStackTrace(); \n var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n var ret; \n var callback = tryCatch([GetFunctionCode]); \n switch(len) { \n [CodeForSwitchCase] \n } \n if (ret === errorObj) { \n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n } \n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n return promise; \n }; \n notEnumerableProp(ret, '__isPromisified__', true); \n return ret; \n ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()).replace("[GetFunctionCode]", getFunctionCode);
17515 body = body.replace("Parameters", parameterDeclaration(newParameterCount));
17516 return new Function("Promise", "fn", "receiver", "withAppended", "maybeWrapAsError", "nodebackForPromise", "tryCatch", "errorObj", "notEnumerableProp", "INTERNAL", body)(Promise2, fn, receiver, withAppended2, maybeWrapAsError2, nodebackForPromise, util.tryCatch, util.errorObj, util.notEnumerableProp, INTERNAL);
17519 function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
17520 var defaultThis = function() {
17523 var method = callback;
17524 if (typeof method === "string") {
17527 function promisified() {
17528 var _receiver = receiver;
17529 if (receiver === THIS)
17531 var promise = new Promise2(INTERNAL);
17532 promise._captureStackTrace();
17533 var cb = typeof method === "string" && this !== defaultThis ? this[method] : callback;
17534 var fn2 = nodebackForPromise(promise, multiArgs);
17536 cb.apply(_receiver, withAppended2(arguments, fn2));
17538 promise._rejectCallback(maybeWrapAsError2(e), true, true);
17540 if (!promise._isFateSealed())
17541 promise._setAsyncGuaranteed();
17544 util.notEnumerableProp(promisified, "__isPromisified__", true);
17545 return promisified;
17547 var makeNodePromisified = canEvaluate2 ? makeNodePromisifiedEval : makeNodePromisifiedClosure;
17548 function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
17549 var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
17550 var methods = promisifiableMethods(obj, suffix, suffixRegexp, filter);
17551 for (var i = 0, len = methods.length; i < len; i += 2) {
17552 var key = methods[i];
17553 var fn = methods[i + 1];
17554 var promisifiedKey = key + suffix;
17555 if (promisifier === makeNodePromisified) {
17556 obj[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
17558 var promisified = promisifier(fn, function() {
17559 return makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
17561 util.notEnumerableProp(promisified, "__isPromisified__", true);
17562 obj[promisifiedKey] = promisified;
17565 util.toFastProperties(obj);
17568 function promisify(callback, receiver, multiArgs) {
17569 return makeNodePromisified(callback, receiver, void 0, callback, null, multiArgs);
17571 Promise2.promisify = function(fn, options) {
17572 if (typeof fn !== "function") {
17573 throw new TypeError2("expecting a function but got " + util.classString(fn));
17575 if (isPromisified(fn)) {
17578 options = Object(options);
17579 var receiver = options.context === void 0 ? THIS : options.context;
17580 var multiArgs = !!options.multiArgs;
17581 var ret2 = promisify(fn, receiver, multiArgs);
17582 util.copyDescriptors(fn, ret2, propsFilter);
17585 Promise2.promisifyAll = function(target, options) {
17586 if (typeof target !== "function" && typeof target !== "object") {
17587 throw new TypeError2("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");
17589 options = Object(options);
17590 var multiArgs = !!options.multiArgs;
17591 var suffix = options.suffix;
17592 if (typeof suffix !== "string")
17593 suffix = defaultSuffix;
17594 var filter = options.filter;
17595 if (typeof filter !== "function")
17596 filter = defaultFilter;
17597 var promisifier = options.promisifier;
17598 if (typeof promisifier !== "function")
17599 promisifier = makeNodePromisified;
17600 if (!util.isIdentifier(suffix)) {
17601 throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");
17603 var keys = util.inheritedDataKeys(target);
17604 for (var i = 0; i < keys.length; ++i) {
17605 var value = target[keys[i]];
17606 if (keys[i] !== "constructor" && util.isClass(value)) {
17607 promisifyAll(value.prototype, suffix, filter, promisifier, multiArgs);
17608 promisifyAll(value, suffix, filter, promisifier, multiArgs);
17611 return promisifyAll(target, suffix, filter, promisifier, multiArgs);
17616 // node_modules/bluebird/js/release/props.js
17617 var require_props = __commonJS((exports2, module2) => {
17619 module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, apiRejection) {
17620 var util = require_util();
17621 var isObject3 = util.isObject;
17622 var es52 = require_es5();
17624 if (typeof Map === "function")
17626 var mapToEntries = function() {
17629 function extractEntry(value, key) {
17630 this[index] = value;
17631 this[index + size] = key;
17634 return function mapToEntries2(map) {
17637 var ret2 = new Array(map.size * 2);
17638 map.forEach(extractEntry, ret2);
17642 var entriesToMap = function(entries) {
17643 var ret2 = new Es6Map();
17644 var length = entries.length / 2 | 0;
17645 for (var i = 0; i < length; ++i) {
17646 var key = entries[length + i];
17647 var value = entries[i];
17648 ret2.set(key, value);
17652 function PropertiesPromiseArray(obj) {
17655 if (Es6Map !== void 0 && obj instanceof Es6Map) {
17656 entries = mapToEntries(obj);
17659 var keys = es52.keys(obj);
17660 var len = keys.length;
17661 entries = new Array(len * 2);
17662 for (var i = 0; i < len; ++i) {
17664 entries[i] = obj[key];
17665 entries[i + len] = key;
17668 this.constructor$(entries);
17669 this._isMap = isMap;
17670 this._init$(void 0, -3);
17672 util.inherits(PropertiesPromiseArray, PromiseArray);
17673 PropertiesPromiseArray.prototype._init = function() {
17675 PropertiesPromiseArray.prototype._promiseFulfilled = function(value, index) {
17676 this._values[index] = value;
17677 var totalResolved = ++this._totalResolved;
17678 if (totalResolved >= this._length) {
17681 val = entriesToMap(this._values);
17684 var keyOffset = this.length();
17685 for (var i = 0, len = this.length(); i < len; ++i) {
17686 val[this._values[i + keyOffset]] = this._values[i];
17689 this._resolve(val);
17694 PropertiesPromiseArray.prototype.shouldCopyValues = function() {
17697 PropertiesPromiseArray.prototype.getActualLength = function(len) {
17700 function props(promises) {
17702 var castValue = tryConvertToPromise(promises);
17703 if (!isObject3(castValue)) {
17704 return apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n");
17705 } else if (castValue instanceof Promise2) {
17706 ret2 = castValue._then(Promise2.props, void 0, void 0, void 0, void 0);
17708 ret2 = new PropertiesPromiseArray(castValue).promise();
17710 if (castValue instanceof Promise2) {
17711 ret2._propagateFrom(castValue, 2);
17715 Promise2.prototype.props = function() {
17716 return props(this);
17718 Promise2.props = function(promises) {
17719 return props(promises);
17724 // node_modules/bluebird/js/release/race.js
17725 var require_race = __commonJS((exports2, module2) => {
17727 module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, apiRejection) {
17728 var util = require_util();
17729 var raceLater = function(promise) {
17730 return promise.then(function(array) {
17731 return race(array, promise);
17734 function race(promises, parent) {
17735 var maybePromise = tryConvertToPromise(promises);
17736 if (maybePromise instanceof Promise2) {
17737 return raceLater(maybePromise);
17739 promises = util.asArray(promises);
17740 if (promises === null)
17741 return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
17743 var ret2 = new Promise2(INTERNAL);
17744 if (parent !== void 0) {
17745 ret2._propagateFrom(parent, 3);
17747 var fulfill = ret2._fulfill;
17748 var reject = ret2._reject;
17749 for (var i = 0, len = promises.length; i < len; ++i) {
17750 var val = promises[i];
17751 if (val === void 0 && !(i in promises)) {
17754 Promise2.cast(val)._then(fulfill, reject, void 0, ret2, null);
17758 Promise2.race = function(promises) {
17759 return race(promises, void 0);
17761 Promise2.prototype.race = function() {
17762 return race(this, void 0);
17767 // node_modules/bluebird/js/release/reduce.js
17768 var require_reduce = __commonJS((exports2, module2) => {
17770 module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug) {
17771 var getDomain = Promise2._getDomain;
17772 var util = require_util();
17773 var tryCatch2 = util.tryCatch;
17774 function ReductionPromiseArray(promises, fn, initialValue, _each) {
17775 this.constructor$(promises);
17776 var domain = getDomain();
17777 this._fn = domain === null ? fn : util.domainBind(domain, fn);
17778 if (initialValue !== void 0) {
17779 initialValue = Promise2.resolve(initialValue);
17780 initialValue._attachCancellationCallback(this);
17782 this._initialValue = initialValue;
17783 this._currentCancellable = null;
17784 if (_each === INTERNAL) {
17785 this._eachValues = Array(this._length);
17786 } else if (_each === 0) {
17787 this._eachValues = null;
17789 this._eachValues = void 0;
17791 this._promise._captureStackTrace();
17792 this._init$(void 0, -5);
17794 util.inherits(ReductionPromiseArray, PromiseArray);
17795 ReductionPromiseArray.prototype._gotAccum = function(accum) {
17796 if (this._eachValues !== void 0 && this._eachValues !== null && accum !== INTERNAL) {
17797 this._eachValues.push(accum);
17800 ReductionPromiseArray.prototype._eachComplete = function(value) {
17801 if (this._eachValues !== null) {
17802 this._eachValues.push(value);
17804 return this._eachValues;
17806 ReductionPromiseArray.prototype._init = function() {
17808 ReductionPromiseArray.prototype._resolveEmptyArray = function() {
17809 this._resolve(this._eachValues !== void 0 ? this._eachValues : this._initialValue);
17811 ReductionPromiseArray.prototype.shouldCopyValues = function() {
17814 ReductionPromiseArray.prototype._resolve = function(value) {
17815 this._promise._resolveCallback(value);
17816 this._values = null;
17818 ReductionPromiseArray.prototype._resultCancelled = function(sender) {
17819 if (sender === this._initialValue)
17820 return this._cancel();
17821 if (this._isResolved())
17823 this._resultCancelled$();
17824 if (this._currentCancellable instanceof Promise2) {
17825 this._currentCancellable.cancel();
17827 if (this._initialValue instanceof Promise2) {
17828 this._initialValue.cancel();
17831 ReductionPromiseArray.prototype._iterate = function(values) {
17832 this._values = values;
17835 var length = values.length;
17836 if (this._initialValue !== void 0) {
17837 value = this._initialValue;
17840 value = Promise2.resolve(values[0]);
17843 this._currentCancellable = value;
17844 if (!value.isRejected()) {
17845 for (; i < length; ++i) {
17853 value = value._then(gotAccum, void 0, void 0, ctx, void 0);
17856 if (this._eachValues !== void 0) {
17857 value = value._then(this._eachComplete, void 0, void 0, this, void 0);
17859 value._then(completed, completed, void 0, value, this);
17861 Promise2.prototype.reduce = function(fn, initialValue) {
17862 return reduce(this, fn, initialValue, null);
17864 Promise2.reduce = function(promises, fn, initialValue, _each) {
17865 return reduce(promises, fn, initialValue, _each);
17867 function completed(valueOrReason, array) {
17868 if (this.isFulfilled()) {
17869 array._resolve(valueOrReason);
17871 array._reject(valueOrReason);
17874 function reduce(promises, fn, initialValue, _each) {
17875 if (typeof fn !== "function") {
17876 return apiRejection("expecting a function but got " + util.classString(fn));
17878 var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
17879 return array.promise();
17881 function gotAccum(accum) {
17882 this.accum = accum;
17883 this.array._gotAccum(accum);
17884 var value = tryConvertToPromise(this.value, this.array._promise);
17885 if (value instanceof Promise2) {
17886 this.array._currentCancellable = value;
17887 return value._then(gotValue, void 0, void 0, this, void 0);
17889 return gotValue.call(this, value);
17892 function gotValue(value) {
17893 var array = this.array;
17894 var promise = array._promise;
17895 var fn = tryCatch2(array._fn);
17896 promise._pushContext();
17898 if (array._eachValues !== void 0) {
17899 ret2 = fn.call(promise._boundValue(), value, this.index, this.length);
17901 ret2 = fn.call(promise._boundValue(), this.accum, value, this.index, this.length);
17903 if (ret2 instanceof Promise2) {
17904 array._currentCancellable = ret2;
17906 var promiseCreated = promise._popContext();
17907 debug.checkForgottenReturns(ret2, promiseCreated, array._eachValues !== void 0 ? "Promise.each" : "Promise.reduce", promise);
17913 // node_modules/bluebird/js/release/settle.js
17914 var require_settle = __commonJS((exports2, module2) => {
17916 module2.exports = function(Promise2, PromiseArray, debug) {
17917 var PromiseInspection = Promise2.PromiseInspection;
17918 var util = require_util();
17919 function SettledPromiseArray(values) {
17920 this.constructor$(values);
17922 util.inherits(SettledPromiseArray, PromiseArray);
17923 SettledPromiseArray.prototype._promiseResolved = function(index, inspection) {
17924 this._values[index] = inspection;
17925 var totalResolved = ++this._totalResolved;
17926 if (totalResolved >= this._length) {
17927 this._resolve(this._values);
17932 SettledPromiseArray.prototype._promiseFulfilled = function(value, index) {
17933 var ret2 = new PromiseInspection();
17934 ret2._bitField = 33554432;
17935 ret2._settledValueField = value;
17936 return this._promiseResolved(index, ret2);
17938 SettledPromiseArray.prototype._promiseRejected = function(reason, index) {
17939 var ret2 = new PromiseInspection();
17940 ret2._bitField = 16777216;
17941 ret2._settledValueField = reason;
17942 return this._promiseResolved(index, ret2);
17944 Promise2.settle = function(promises) {
17945 debug.deprecated(".settle()", ".reflect()");
17946 return new SettledPromiseArray(promises).promise();
17948 Promise2.prototype.settle = function() {
17949 return Promise2.settle(this);
17954 // node_modules/bluebird/js/release/some.js
17955 var require_some = __commonJS((exports2, module2) => {
17957 module2.exports = function(Promise2, PromiseArray, apiRejection) {
17958 var util = require_util();
17959 var RangeError2 = require_errors().RangeError;
17960 var AggregateError = require_errors().AggregateError;
17961 var isArray = util.isArray;
17962 var CANCELLATION = {};
17963 function SomePromiseArray(values) {
17964 this.constructor$(values);
17966 this._unwrap = false;
17967 this._initialized = false;
17969 util.inherits(SomePromiseArray, PromiseArray);
17970 SomePromiseArray.prototype._init = function() {
17971 if (!this._initialized) {
17974 if (this._howMany === 0) {
17978 this._init$(void 0, -5);
17979 var isArrayResolved = isArray(this._values);
17980 if (!this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill()) {
17981 this._reject(this._getRangeError(this.length()));
17984 SomePromiseArray.prototype.init = function() {
17985 this._initialized = true;
17988 SomePromiseArray.prototype.setUnwrap = function() {
17989 this._unwrap = true;
17991 SomePromiseArray.prototype.howMany = function() {
17992 return this._howMany;
17994 SomePromiseArray.prototype.setHowMany = function(count) {
17995 this._howMany = count;
17997 SomePromiseArray.prototype._promiseFulfilled = function(value) {
17998 this._addFulfilled(value);
17999 if (this._fulfilled() === this.howMany()) {
18000 this._values.length = this.howMany();
18001 if (this.howMany() === 1 && this._unwrap) {
18002 this._resolve(this._values[0]);
18004 this._resolve(this._values);
18010 SomePromiseArray.prototype._promiseRejected = function(reason) {
18011 this._addRejected(reason);
18012 return this._checkOutcome();
18014 SomePromiseArray.prototype._promiseCancelled = function() {
18015 if (this._values instanceof Promise2 || this._values == null) {
18016 return this._cancel();
18018 this._addRejected(CANCELLATION);
18019 return this._checkOutcome();
18021 SomePromiseArray.prototype._checkOutcome = function() {
18022 if (this.howMany() > this._canPossiblyFulfill()) {
18023 var e = new AggregateError();
18024 for (var i = this.length(); i < this._values.length; ++i) {
18025 if (this._values[i] !== CANCELLATION) {
18026 e.push(this._values[i]);
18029 if (e.length > 0) {
18038 SomePromiseArray.prototype._fulfilled = function() {
18039 return this._totalResolved;
18041 SomePromiseArray.prototype._rejected = function() {
18042 return this._values.length - this.length();
18044 SomePromiseArray.prototype._addRejected = function(reason) {
18045 this._values.push(reason);
18047 SomePromiseArray.prototype._addFulfilled = function(value) {
18048 this._values[this._totalResolved++] = value;
18050 SomePromiseArray.prototype._canPossiblyFulfill = function() {
18051 return this.length() - this._rejected();
18053 SomePromiseArray.prototype._getRangeError = function(count) {
18054 var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items";
18055 return new RangeError2(message);
18057 SomePromiseArray.prototype._resolveEmptyArray = function() {
18058 this._reject(this._getRangeError(0));
18060 function some(promises, howMany) {
18061 if ((howMany | 0) !== howMany || howMany < 0) {
18062 return apiRejection("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");
18064 var ret2 = new SomePromiseArray(promises);
18065 var promise = ret2.promise();
18066 ret2.setHowMany(howMany);
18070 Promise2.some = function(promises, howMany) {
18071 return some(promises, howMany);
18073 Promise2.prototype.some = function(howMany) {
18074 return some(this, howMany);
18076 Promise2._SomePromiseArray = SomePromiseArray;
18080 // node_modules/bluebird/js/release/filter.js
18081 var require_filter = __commonJS((exports2, module2) => {
18083 module2.exports = function(Promise2, INTERNAL) {
18084 var PromiseMap = Promise2.map;
18085 Promise2.prototype.filter = function(fn, options) {
18086 return PromiseMap(this, fn, options, INTERNAL);
18088 Promise2.filter = function(promises, fn, options) {
18089 return PromiseMap(promises, fn, options, INTERNAL);
18094 // node_modules/bluebird/js/release/each.js
18095 var require_each = __commonJS((exports2, module2) => {
18097 module2.exports = function(Promise2, INTERNAL) {
18098 var PromiseReduce = Promise2.reduce;
18099 var PromiseAll = Promise2.all;
18100 function promiseAllThis() {
18101 return PromiseAll(this);
18103 function PromiseMapSeries(promises, fn) {
18104 return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
18106 Promise2.prototype.each = function(fn) {
18107 return PromiseReduce(this, fn, INTERNAL, 0)._then(promiseAllThis, void 0, void 0, this, void 0);
18109 Promise2.prototype.mapSeries = function(fn) {
18110 return PromiseReduce(this, fn, INTERNAL, INTERNAL);
18112 Promise2.each = function(promises, fn) {
18113 return PromiseReduce(promises, fn, INTERNAL, 0)._then(promiseAllThis, void 0, void 0, promises, void 0);
18115 Promise2.mapSeries = PromiseMapSeries;
18119 // node_modules/bluebird/js/release/any.js
18120 var require_any = __commonJS((exports2, module2) => {
18122 module2.exports = function(Promise2) {
18123 var SomePromiseArray = Promise2._SomePromiseArray;
18124 function any(promises) {
18125 var ret2 = new SomePromiseArray(promises);
18126 var promise = ret2.promise();
18127 ret2.setHowMany(1);
18132 Promise2.any = function(promises) {
18133 return any(promises);
18135 Promise2.prototype.any = function() {
18141 // node_modules/bluebird/js/release/promise.js
18142 var require_promise = __commonJS((exports2, module2) => {
18144 module2.exports = function() {
18145 var makeSelfResolutionError = function() {
18146 return new TypeError2("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n");
18148 var reflectHandler = function() {
18149 return new Promise2.PromiseInspection(this._target());
18151 var apiRejection = function(msg) {
18152 return Promise2.reject(new TypeError2(msg));
18154 function Proxyable() {
18156 var UNDEFINED_BINDING = {};
18157 var util = require_util();
18160 getDomain = function() {
18161 var ret2 = process.domain;
18162 if (ret2 === void 0)
18167 getDomain = function() {
18171 util.notEnumerableProp(Promise2, "_getDomain", getDomain);
18172 var es52 = require_es5();
18173 var Async = require_async();
18174 var async = new Async();
18175 es52.defineProperty(Promise2, "_async", {value: async});
18176 var errors = require_errors();
18177 var TypeError2 = Promise2.TypeError = errors.TypeError;
18178 Promise2.RangeError = errors.RangeError;
18179 var CancellationError = Promise2.CancellationError = errors.CancellationError;
18180 Promise2.TimeoutError = errors.TimeoutError;
18181 Promise2.OperationalError = errors.OperationalError;
18182 Promise2.RejectionError = errors.OperationalError;
18183 Promise2.AggregateError = errors.AggregateError;
18184 var INTERNAL = function() {
18187 var NEXT_FILTER = {};
18188 var tryConvertToPromise = require_thenables()(Promise2, INTERNAL);
18189 var PromiseArray = require_promise_array()(Promise2, INTERNAL, tryConvertToPromise, apiRejection, Proxyable);
18190 var Context = require_context()(Promise2);
18191 var createContext = Context.create;
18192 var debug = require_debuggability()(Promise2, Context);
18193 var CapturedTrace = debug.CapturedTrace;
18194 var PassThroughHandlerContext = require_finally()(Promise2, tryConvertToPromise);
18195 var catchFilter = require_catch_filter()(NEXT_FILTER);
18196 var nodebackForPromise = require_nodeback();
18197 var errorObj2 = util.errorObj;
18198 var tryCatch2 = util.tryCatch;
18199 function check(self2, executor) {
18200 if (typeof executor !== "function") {
18201 throw new TypeError2("expecting a function but got " + util.classString(executor));
18203 if (self2.constructor !== Promise2) {
18204 throw new TypeError2("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");
18207 function Promise2(executor) {
18208 this._bitField = 0;
18209 this._fulfillmentHandler0 = void 0;
18210 this._rejectionHandler0 = void 0;
18211 this._promise0 = void 0;
18212 this._receiver0 = void 0;
18213 if (executor !== INTERNAL) {
18214 check(this, executor);
18215 this._resolveFromExecutor(executor);
18217 this._promiseCreated();
18218 this._fireEvent("promiseCreated", this);
18220 Promise2.prototype.toString = function() {
18221 return "[object Promise]";
18223 Promise2.prototype.caught = Promise2.prototype["catch"] = function(fn) {
18224 var len = arguments.length;
18226 var catchInstances = new Array(len - 1), j = 0, i;
18227 for (i = 0; i < len - 1; ++i) {
18228 var item = arguments[i];
18229 if (util.isObject(item)) {
18230 catchInstances[j++] = item;
18232 return apiRejection("expecting an object but got A catch statement predicate " + util.classString(item));
18235 catchInstances.length = j;
18237 return this.then(void 0, catchFilter(catchInstances, fn, this));
18239 return this.then(void 0, fn);
18241 Promise2.prototype.reflect = function() {
18242 return this._then(reflectHandler, reflectHandler, void 0, this, void 0);
18244 Promise2.prototype.then = function(didFulfill, didReject) {
18245 if (debug.warnings() && arguments.length > 0 && typeof didFulfill !== "function" && typeof didReject !== "function") {
18246 var msg = ".then() only accepts functions but was passed: " + util.classString(didFulfill);
18247 if (arguments.length > 1) {
18248 msg += ", " + util.classString(didReject);
18252 return this._then(didFulfill, didReject, void 0, void 0, void 0);
18254 Promise2.prototype.done = function(didFulfill, didReject) {
18255 var promise = this._then(didFulfill, didReject, void 0, void 0, void 0);
18256 promise._setIsFinal();
18258 Promise2.prototype.spread = function(fn) {
18259 if (typeof fn !== "function") {
18260 return apiRejection("expecting a function but got " + util.classString(fn));
18262 return this.all()._then(fn, void 0, void 0, APPLY, void 0);
18264 Promise2.prototype.toJSON = function() {
18266 isFulfilled: false,
18268 fulfillmentValue: void 0,
18269 rejectionReason: void 0
18271 if (this.isFulfilled()) {
18272 ret2.fulfillmentValue = this.value();
18273 ret2.isFulfilled = true;
18274 } else if (this.isRejected()) {
18275 ret2.rejectionReason = this.reason();
18276 ret2.isRejected = true;
18280 Promise2.prototype.all = function() {
18281 if (arguments.length > 0) {
18282 this._warn(".all() was passed arguments but it does not take any");
18284 return new PromiseArray(this).promise();
18286 Promise2.prototype.error = function(fn) {
18287 return this.caught(util.originatesFromRejection, fn);
18289 Promise2.getNewLibraryCopy = module2.exports;
18290 Promise2.is = function(val) {
18291 return val instanceof Promise2;
18293 Promise2.fromNode = Promise2.fromCallback = function(fn) {
18294 var ret2 = new Promise2(INTERNAL);
18295 ret2._captureStackTrace();
18296 var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs : false;
18297 var result = tryCatch2(fn)(nodebackForPromise(ret2, multiArgs));
18298 if (result === errorObj2) {
18299 ret2._rejectCallback(result.e, true);
18301 if (!ret2._isFateSealed())
18302 ret2._setAsyncGuaranteed();
18305 Promise2.all = function(promises) {
18306 return new PromiseArray(promises).promise();
18308 Promise2.cast = function(obj) {
18309 var ret2 = tryConvertToPromise(obj);
18310 if (!(ret2 instanceof Promise2)) {
18311 ret2 = new Promise2(INTERNAL);
18312 ret2._captureStackTrace();
18313 ret2._setFulfilled();
18314 ret2._rejectionHandler0 = obj;
18318 Promise2.resolve = Promise2.fulfilled = Promise2.cast;
18319 Promise2.reject = Promise2.rejected = function(reason) {
18320 var ret2 = new Promise2(INTERNAL);
18321 ret2._captureStackTrace();
18322 ret2._rejectCallback(reason, true);
18325 Promise2.setScheduler = function(fn) {
18326 if (typeof fn !== "function") {
18327 throw new TypeError2("expecting a function but got " + util.classString(fn));
18329 return async.setScheduler(fn);
18331 Promise2.prototype._then = function(didFulfill, didReject, _, receiver, internalData) {
18332 var haveInternalData = internalData !== void 0;
18333 var promise = haveInternalData ? internalData : new Promise2(INTERNAL);
18334 var target = this._target();
18335 var bitField = target._bitField;
18336 if (!haveInternalData) {
18337 promise._propagateFrom(this, 3);
18338 promise._captureStackTrace();
18339 if (receiver === void 0 && (this._bitField & 2097152) !== 0) {
18340 if (!((bitField & 50397184) === 0)) {
18341 receiver = this._boundValue();
18343 receiver = target === this ? void 0 : this._boundTo;
18346 this._fireEvent("promiseChained", this, promise);
18348 var domain = getDomain();
18349 if (!((bitField & 50397184) === 0)) {
18350 var handler, value, settler = target._settlePromiseCtx;
18351 if ((bitField & 33554432) !== 0) {
18352 value = target._rejectionHandler0;
18353 handler = didFulfill;
18354 } else if ((bitField & 16777216) !== 0) {
18355 value = target._fulfillmentHandler0;
18356 handler = didReject;
18357 target._unsetRejectionIsUnhandled();
18359 settler = target._settlePromiseLateCancellationObserver;
18360 value = new CancellationError("late cancellation observer");
18361 target._attachExtraTrace(value);
18362 handler = didReject;
18364 async.invoke(settler, target, {
18365 handler: domain === null ? handler : typeof handler === "function" && util.domainBind(domain, handler),
18371 target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
18375 Promise2.prototype._length = function() {
18376 return this._bitField & 65535;
18378 Promise2.prototype._isFateSealed = function() {
18379 return (this._bitField & 117506048) !== 0;
18381 Promise2.prototype._isFollowing = function() {
18382 return (this._bitField & 67108864) === 67108864;
18384 Promise2.prototype._setLength = function(len) {
18385 this._bitField = this._bitField & -65536 | len & 65535;
18387 Promise2.prototype._setFulfilled = function() {
18388 this._bitField = this._bitField | 33554432;
18389 this._fireEvent("promiseFulfilled", this);
18391 Promise2.prototype._setRejected = function() {
18392 this._bitField = this._bitField | 16777216;
18393 this._fireEvent("promiseRejected", this);
18395 Promise2.prototype._setFollowing = function() {
18396 this._bitField = this._bitField | 67108864;
18397 this._fireEvent("promiseResolved", this);
18399 Promise2.prototype._setIsFinal = function() {
18400 this._bitField = this._bitField | 4194304;
18402 Promise2.prototype._isFinal = function() {
18403 return (this._bitField & 4194304) > 0;
18405 Promise2.prototype._unsetCancelled = function() {
18406 this._bitField = this._bitField & ~65536;
18408 Promise2.prototype._setCancelled = function() {
18409 this._bitField = this._bitField | 65536;
18410 this._fireEvent("promiseCancelled", this);
18412 Promise2.prototype._setWillBeCancelled = function() {
18413 this._bitField = this._bitField | 8388608;
18415 Promise2.prototype._setAsyncGuaranteed = function() {
18416 if (async.hasCustomScheduler())
18418 this._bitField = this._bitField | 134217728;
18420 Promise2.prototype._receiverAt = function(index) {
18421 var ret2 = index === 0 ? this._receiver0 : this[index * 4 - 4 + 3];
18422 if (ret2 === UNDEFINED_BINDING) {
18424 } else if (ret2 === void 0 && this._isBound()) {
18425 return this._boundValue();
18429 Promise2.prototype._promiseAt = function(index) {
18430 return this[index * 4 - 4 + 2];
18432 Promise2.prototype._fulfillmentHandlerAt = function(index) {
18433 return this[index * 4 - 4 + 0];
18435 Promise2.prototype._rejectionHandlerAt = function(index) {
18436 return this[index * 4 - 4 + 1];
18438 Promise2.prototype._boundValue = function() {
18440 Promise2.prototype._migrateCallback0 = function(follower) {
18441 var bitField = follower._bitField;
18442 var fulfill = follower._fulfillmentHandler0;
18443 var reject = follower._rejectionHandler0;
18444 var promise = follower._promise0;
18445 var receiver = follower._receiverAt(0);
18446 if (receiver === void 0)
18447 receiver = UNDEFINED_BINDING;
18448 this._addCallbacks(fulfill, reject, promise, receiver, null);
18450 Promise2.prototype._migrateCallbackAt = function(follower, index) {
18451 var fulfill = follower._fulfillmentHandlerAt(index);
18452 var reject = follower._rejectionHandlerAt(index);
18453 var promise = follower._promiseAt(index);
18454 var receiver = follower._receiverAt(index);
18455 if (receiver === void 0)
18456 receiver = UNDEFINED_BINDING;
18457 this._addCallbacks(fulfill, reject, promise, receiver, null);
18459 Promise2.prototype._addCallbacks = function(fulfill, reject, promise, receiver, domain) {
18460 var index = this._length();
18461 if (index >= 65535 - 4) {
18463 this._setLength(0);
18466 this._promise0 = promise;
18467 this._receiver0 = receiver;
18468 if (typeof fulfill === "function") {
18469 this._fulfillmentHandler0 = domain === null ? fulfill : util.domainBind(domain, fulfill);
18471 if (typeof reject === "function") {
18472 this._rejectionHandler0 = domain === null ? reject : util.domainBind(domain, reject);
18475 var base = index * 4 - 4;
18476 this[base + 2] = promise;
18477 this[base + 3] = receiver;
18478 if (typeof fulfill === "function") {
18479 this[base + 0] = domain === null ? fulfill : util.domainBind(domain, fulfill);
18481 if (typeof reject === "function") {
18482 this[base + 1] = domain === null ? reject : util.domainBind(domain, reject);
18485 this._setLength(index + 1);
18488 Promise2.prototype._proxy = function(proxyable, arg) {
18489 this._addCallbacks(void 0, void 0, arg, proxyable, null);
18491 Promise2.prototype._resolveCallback = function(value, shouldBind) {
18492 if ((this._bitField & 117506048) !== 0)
18494 if (value === this)
18495 return this._rejectCallback(makeSelfResolutionError(), false);
18496 var maybePromise = tryConvertToPromise(value, this);
18497 if (!(maybePromise instanceof Promise2))
18498 return this._fulfill(value);
18500 this._propagateFrom(maybePromise, 2);
18501 var promise = maybePromise._target();
18502 if (promise === this) {
18503 this._reject(makeSelfResolutionError());
18506 var bitField = promise._bitField;
18507 if ((bitField & 50397184) === 0) {
18508 var len = this._length();
18510 promise._migrateCallback0(this);
18511 for (var i = 1; i < len; ++i) {
18512 promise._migrateCallbackAt(this, i);
18514 this._setFollowing();
18515 this._setLength(0);
18516 this._setFollowee(promise);
18517 } else if ((bitField & 33554432) !== 0) {
18518 this._fulfill(promise._value());
18519 } else if ((bitField & 16777216) !== 0) {
18520 this._reject(promise._reason());
18522 var reason = new CancellationError("late cancellation observer");
18523 promise._attachExtraTrace(reason);
18524 this._reject(reason);
18527 Promise2.prototype._rejectCallback = function(reason, synchronous, ignoreNonErrorWarnings) {
18528 var trace = util.ensureErrorObject(reason);
18529 var hasStack = trace === reason;
18530 if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
18531 var message = "a promise was rejected with a non-error: " + util.classString(reason);
18532 this._warn(message, true);
18534 this._attachExtraTrace(trace, synchronous ? hasStack : false);
18535 this._reject(reason);
18537 Promise2.prototype._resolveFromExecutor = function(executor) {
18538 var promise = this;
18539 this._captureStackTrace();
18540 this._pushContext();
18541 var synchronous = true;
18542 var r = this._execute(executor, function(value) {
18543 promise._resolveCallback(value);
18544 }, function(reason) {
18545 promise._rejectCallback(reason, synchronous);
18547 synchronous = false;
18548 this._popContext();
18549 if (r !== void 0) {
18550 promise._rejectCallback(r, true);
18553 Promise2.prototype._settlePromiseFromHandler = function(handler, receiver, value, promise) {
18554 var bitField = promise._bitField;
18555 if ((bitField & 65536) !== 0)
18557 promise._pushContext();
18559 if (receiver === APPLY) {
18560 if (!value || typeof value.length !== "number") {
18562 x.e = new TypeError2("cannot .spread() a non-array: " + util.classString(value));
18564 x = tryCatch2(handler).apply(this._boundValue(), value);
18567 x = tryCatch2(handler).call(receiver, value);
18569 var promiseCreated = promise._popContext();
18570 bitField = promise._bitField;
18571 if ((bitField & 65536) !== 0)
18573 if (x === NEXT_FILTER) {
18574 promise._reject(value);
18575 } else if (x === errorObj2) {
18576 promise._rejectCallback(x.e, false);
18578 debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
18579 promise._resolveCallback(x);
18582 Promise2.prototype._target = function() {
18584 while (ret2._isFollowing())
18585 ret2 = ret2._followee();
18588 Promise2.prototype._followee = function() {
18589 return this._rejectionHandler0;
18591 Promise2.prototype._setFollowee = function(promise) {
18592 this._rejectionHandler0 = promise;
18594 Promise2.prototype._settlePromise = function(promise, handler, receiver, value) {
18595 var isPromise = promise instanceof Promise2;
18596 var bitField = this._bitField;
18597 var asyncGuaranteed = (bitField & 134217728) !== 0;
18598 if ((bitField & 65536) !== 0) {
18600 promise._invokeInternalOnCancel();
18601 if (receiver instanceof PassThroughHandlerContext && receiver.isFinallyHandler()) {
18602 receiver.cancelPromise = promise;
18603 if (tryCatch2(handler).call(receiver, value) === errorObj2) {
18604 promise._reject(errorObj2.e);
18606 } else if (handler === reflectHandler) {
18607 promise._fulfill(reflectHandler.call(receiver));
18608 } else if (receiver instanceof Proxyable) {
18609 receiver._promiseCancelled(promise);
18610 } else if (isPromise || promise instanceof PromiseArray) {
18615 } else if (typeof handler === "function") {
18617 handler.call(receiver, value, promise);
18619 if (asyncGuaranteed)
18620 promise._setAsyncGuaranteed();
18621 this._settlePromiseFromHandler(handler, receiver, value, promise);
18623 } else if (receiver instanceof Proxyable) {
18624 if (!receiver._isResolved()) {
18625 if ((bitField & 33554432) !== 0) {
18626 receiver._promiseFulfilled(value, promise);
18628 receiver._promiseRejected(value, promise);
18631 } else if (isPromise) {
18632 if (asyncGuaranteed)
18633 promise._setAsyncGuaranteed();
18634 if ((bitField & 33554432) !== 0) {
18635 promise._fulfill(value);
18637 promise._reject(value);
18641 Promise2.prototype._settlePromiseLateCancellationObserver = function(ctx) {
18642 var handler = ctx.handler;
18643 var promise = ctx.promise;
18644 var receiver = ctx.receiver;
18645 var value = ctx.value;
18646 if (typeof handler === "function") {
18647 if (!(promise instanceof Promise2)) {
18648 handler.call(receiver, value, promise);
18650 this._settlePromiseFromHandler(handler, receiver, value, promise);
18652 } else if (promise instanceof Promise2) {
18653 promise._reject(value);
18656 Promise2.prototype._settlePromiseCtx = function(ctx) {
18657 this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
18659 Promise2.prototype._settlePromise0 = function(handler, value, bitField) {
18660 var promise = this._promise0;
18661 var receiver = this._receiverAt(0);
18662 this._promise0 = void 0;
18663 this._receiver0 = void 0;
18664 this._settlePromise(promise, handler, receiver, value);
18666 Promise2.prototype._clearCallbackDataAtIndex = function(index) {
18667 var base = index * 4 - 4;
18668 this[base + 2] = this[base + 3] = this[base + 0] = this[base + 1] = void 0;
18670 Promise2.prototype._fulfill = function(value) {
18671 var bitField = this._bitField;
18672 if ((bitField & 117506048) >>> 16)
18674 if (value === this) {
18675 var err = makeSelfResolutionError();
18676 this._attachExtraTrace(err);
18677 return this._reject(err);
18679 this._setFulfilled();
18680 this._rejectionHandler0 = value;
18681 if ((bitField & 65535) > 0) {
18682 if ((bitField & 134217728) !== 0) {
18683 this._settlePromises();
18685 async.settlePromises(this);
18689 Promise2.prototype._reject = function(reason) {
18690 var bitField = this._bitField;
18691 if ((bitField & 117506048) >>> 16)
18693 this._setRejected();
18694 this._fulfillmentHandler0 = reason;
18695 if (this._isFinal()) {
18696 return async.fatalError(reason, util.isNode);
18698 if ((bitField & 65535) > 0) {
18699 async.settlePromises(this);
18701 this._ensurePossibleRejectionHandled();
18704 Promise2.prototype._fulfillPromises = function(len, value) {
18705 for (var i = 1; i < len; i++) {
18706 var handler = this._fulfillmentHandlerAt(i);
18707 var promise = this._promiseAt(i);
18708 var receiver = this._receiverAt(i);
18709 this._clearCallbackDataAtIndex(i);
18710 this._settlePromise(promise, handler, receiver, value);
18713 Promise2.prototype._rejectPromises = function(len, reason) {
18714 for (var i = 1; i < len; i++) {
18715 var handler = this._rejectionHandlerAt(i);
18716 var promise = this._promiseAt(i);
18717 var receiver = this._receiverAt(i);
18718 this._clearCallbackDataAtIndex(i);
18719 this._settlePromise(promise, handler, receiver, reason);
18722 Promise2.prototype._settlePromises = function() {
18723 var bitField = this._bitField;
18724 var len = bitField & 65535;
18726 if ((bitField & 16842752) !== 0) {
18727 var reason = this._fulfillmentHandler0;
18728 this._settlePromise0(this._rejectionHandler0, reason, bitField);
18729 this._rejectPromises(len, reason);
18731 var value = this._rejectionHandler0;
18732 this._settlePromise0(this._fulfillmentHandler0, value, bitField);
18733 this._fulfillPromises(len, value);
18735 this._setLength(0);
18737 this._clearCancellationData();
18739 Promise2.prototype._settledValue = function() {
18740 var bitField = this._bitField;
18741 if ((bitField & 33554432) !== 0) {
18742 return this._rejectionHandler0;
18743 } else if ((bitField & 16777216) !== 0) {
18744 return this._fulfillmentHandler0;
18747 function deferResolve(v) {
18748 this.promise._resolveCallback(v);
18750 function deferReject(v) {
18751 this.promise._rejectCallback(v, false);
18753 Promise2.defer = Promise2.pending = function() {
18754 debug.deprecated("Promise.defer", "new Promise");
18755 var promise = new Promise2(INTERNAL);
18758 resolve: deferResolve,
18759 reject: deferReject
18762 util.notEnumerableProp(Promise2, "_makeSelfResolutionError", makeSelfResolutionError);
18763 require_method()(Promise2, INTERNAL, tryConvertToPromise, apiRejection, debug);
18764 require_bind()(Promise2, INTERNAL, tryConvertToPromise, debug);
18765 require_cancel()(Promise2, PromiseArray, apiRejection, debug);
18766 require_direct_resolve()(Promise2);
18767 require_synchronous_inspection()(Promise2);
18768 require_join()(Promise2, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
18769 Promise2.Promise = Promise2;
18770 Promise2.version = "3.4.7";
18771 require_map()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
18772 require_call_get()(Promise2);
18773 require_using()(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
18774 require_timers()(Promise2, INTERNAL, debug);
18775 require_generators()(Promise2, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
18776 require_nodeify()(Promise2);
18777 require_promisify()(Promise2, INTERNAL);
18778 require_props()(Promise2, PromiseArray, tryConvertToPromise, apiRejection);
18779 require_race()(Promise2, INTERNAL, tryConvertToPromise, apiRejection);
18780 require_reduce()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
18781 require_settle()(Promise2, PromiseArray, debug);
18782 require_some()(Promise2, PromiseArray, apiRejection);
18783 require_filter()(Promise2, INTERNAL);
18784 require_each()(Promise2, INTERNAL);
18785 require_any()(Promise2);
18786 util.toFastProperties(Promise2);
18787 util.toFastProperties(Promise2.prototype);
18788 function fillTypes(value) {
18789 var p = new Promise2(INTERNAL);
18790 p._fulfillmentHandler0 = value;
18791 p._rejectionHandler0 = value;
18792 p._promise0 = value;
18793 p._receiver0 = value;
18799 fillTypes(function() {
18803 fillTypes(new Promise2(INTERNAL));
18804 debug.setBounds(Async.firstLineError, util.lastLineError);
18809 // node_modules/bluebird/js/release/bluebird.js
18810 var require_bluebird = __commonJS((exports2, module2) => {
18813 if (typeof Promise !== "undefined")
18815 function noConflict() {
18817 if (Promise === bluebird)
18823 var bluebird = require_promise()();
18824 bluebird.noConflict = noConflict;
18825 module2.exports = bluebird;
18828 // node_modules/unzipper/lib/Buffer.js
18829 var require_Buffer = __commonJS((exports2, module2) => {
18830 var Buffer2 = require("buffer").Buffer;
18831 if (Buffer2.from === void 0) {
18832 Buffer2.from = function(a, b, c) {
18833 return new Buffer2(a, b, c);
18835 Buffer2.alloc = Buffer2.from;
18837 module2.exports = Buffer2;
18840 // node_modules/process-nextick-args/index.js
18841 var require_process_nextick_args = __commonJS((exports2, module2) => {
18843 if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
18844 module2.exports = {nextTick};
18846 module2.exports = process;
18848 function nextTick(fn, arg1, arg2, arg3) {
18849 if (typeof fn !== "function") {
18850 throw new TypeError('"callback" argument must be a function');
18852 var len = arguments.length;
18857 return process.nextTick(fn);
18859 return process.nextTick(function afterTickOne() {
18860 fn.call(null, arg1);
18863 return process.nextTick(function afterTickTwo() {
18864 fn.call(null, arg1, arg2);
18867 return process.nextTick(function afterTickThree() {
18868 fn.call(null, arg1, arg2, arg3);
18871 args = new Array(len - 1);
18873 while (i < args.length) {
18874 args[i++] = arguments[i];
18876 return process.nextTick(function afterTick() {
18877 fn.apply(null, args);
18883 // node_modules/isarray/index.js
18884 var require_isarray = __commonJS((exports2, module2) => {
18885 var toString = {}.toString;
18886 module2.exports = Array.isArray || function(arr) {
18887 return toString.call(arr) == "[object Array]";
18891 // node_modules/readable-stream/lib/internal/streams/stream.js
18892 var require_stream = __commonJS((exports2, module2) => {
18893 module2.exports = require("stream");
18896 // node_modules/safe-buffer/index.js
18897 var require_safe_buffer = __commonJS((exports2, module2) => {
18898 var buffer = require("buffer");
18899 var Buffer2 = buffer.Buffer;
18900 function copyProps(src, dst) {
18901 for (var key in src) {
18902 dst[key] = src[key];
18905 if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
18906 module2.exports = buffer;
18908 copyProps(buffer, exports2);
18909 exports2.Buffer = SafeBuffer;
18911 function SafeBuffer(arg, encodingOrOffset, length) {
18912 return Buffer2(arg, encodingOrOffset, length);
18914 copyProps(Buffer2, SafeBuffer);
18915 SafeBuffer.from = function(arg, encodingOrOffset, length) {
18916 if (typeof arg === "number") {
18917 throw new TypeError("Argument must not be a number");
18919 return Buffer2(arg, encodingOrOffset, length);
18921 SafeBuffer.alloc = function(size, fill, encoding) {
18922 if (typeof size !== "number") {
18923 throw new TypeError("Argument must be a number");
18925 var buf = Buffer2(size);
18926 if (fill !== void 0) {
18927 if (typeof encoding === "string") {
18928 buf.fill(fill, encoding);
18937 SafeBuffer.allocUnsafe = function(size) {
18938 if (typeof size !== "number") {
18939 throw new TypeError("Argument must be a number");
18941 return Buffer2(size);
18943 SafeBuffer.allocUnsafeSlow = function(size) {
18944 if (typeof size !== "number") {
18945 throw new TypeError("Argument must be a number");
18947 return buffer.SlowBuffer(size);
18951 // node_modules/core-util-is/lib/util.js
18952 var require_util2 = __commonJS((exports2) => {
18953 function isArray(arg) {
18954 if (Array.isArray) {
18955 return Array.isArray(arg);
18957 return objectToString(arg) === "[object Array]";
18959 exports2.isArray = isArray;
18960 function isBoolean(arg) {
18961 return typeof arg === "boolean";
18963 exports2.isBoolean = isBoolean;
18964 function isNull(arg) {
18965 return arg === null;
18967 exports2.isNull = isNull;
18968 function isNullOrUndefined(arg) {
18969 return arg == null;
18971 exports2.isNullOrUndefined = isNullOrUndefined;
18972 function isNumber(arg) {
18973 return typeof arg === "number";
18975 exports2.isNumber = isNumber;
18976 function isString(arg) {
18977 return typeof arg === "string";
18979 exports2.isString = isString;
18980 function isSymbol(arg) {
18981 return typeof arg === "symbol";
18983 exports2.isSymbol = isSymbol;
18984 function isUndefined(arg) {
18985 return arg === void 0;
18987 exports2.isUndefined = isUndefined;
18988 function isRegExp(re) {
18989 return objectToString(re) === "[object RegExp]";
18991 exports2.isRegExp = isRegExp;
18992 function isObject3(arg) {
18993 return typeof arg === "object" && arg !== null;
18995 exports2.isObject = isObject3;
18996 function isDate(d) {
18997 return objectToString(d) === "[object Date]";
18999 exports2.isDate = isDate;
19000 function isError2(e) {
19001 return objectToString(e) === "[object Error]" || e instanceof Error;
19003 exports2.isError = isError2;
19004 function isFunction(arg) {
19005 return typeof arg === "function";
19007 exports2.isFunction = isFunction;
19008 function isPrimitive2(arg) {
19009 return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined";
19011 exports2.isPrimitive = isPrimitive2;
19012 exports2.isBuffer = Buffer.isBuffer;
19013 function objectToString(o) {
19014 return Object.prototype.toString.call(o);
19018 // node_modules/readable-stream/lib/internal/streams/BufferList.js
19019 var require_BufferList = __commonJS((exports2, module2) => {
19021 function _classCallCheck(instance, Constructor) {
19022 if (!(instance instanceof Constructor)) {
19023 throw new TypeError("Cannot call a class as a function");
19026 var Buffer2 = require_safe_buffer().Buffer;
19027 var util = require("util");
19028 function copyBuffer(src, target, offset) {
19029 src.copy(target, offset);
19031 module2.exports = function() {
19032 function BufferList() {
19033 _classCallCheck(this, BufferList);
19038 BufferList.prototype.push = function push(v) {
19039 var entry = {data: v, next: null};
19040 if (this.length > 0)
19041 this.tail.next = entry;
19047 BufferList.prototype.unshift = function unshift(v) {
19048 var entry = {data: v, next: this.head};
19049 if (this.length === 0)
19054 BufferList.prototype.shift = function shift() {
19055 if (this.length === 0)
19057 var ret2 = this.head.data;
19058 if (this.length === 1)
19059 this.head = this.tail = null;
19061 this.head = this.head.next;
19065 BufferList.prototype.clear = function clear() {
19066 this.head = this.tail = null;
19069 BufferList.prototype.join = function join(s) {
19070 if (this.length === 0)
19073 var ret2 = "" + p.data;
19074 while (p = p.next) {
19075 ret2 += s + p.data;
19079 BufferList.prototype.concat = function concat(n) {
19080 if (this.length === 0)
19081 return Buffer2.alloc(0);
19082 if (this.length === 1)
19083 return this.head.data;
19084 var ret2 = Buffer2.allocUnsafe(n >>> 0);
19088 copyBuffer(p.data, ret2, i);
19089 i += p.data.length;
19096 if (util && util.inspect && util.inspect.custom) {
19097 module2.exports.prototype[util.inspect.custom] = function() {
19098 var obj = util.inspect({length: this.length});
19099 return this.constructor.name + " " + obj;
19104 // node_modules/readable-stream/lib/internal/streams/destroy.js
19105 var require_destroy = __commonJS((exports2, module2) => {
19107 var pna = require_process_nextick_args();
19108 function destroy(err, cb) {
19110 var readableDestroyed = this._readableState && this._readableState.destroyed;
19111 var writableDestroyed = this._writableState && this._writableState.destroyed;
19112 if (readableDestroyed || writableDestroyed) {
19115 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
19116 pna.nextTick(emitErrorNT, this, err);
19120 if (this._readableState) {
19121 this._readableState.destroyed = true;
19123 if (this._writableState) {
19124 this._writableState.destroyed = true;
19126 this._destroy(err || null, function(err2) {
19128 pna.nextTick(emitErrorNT, _this, err2);
19129 if (_this._writableState) {
19130 _this._writableState.errorEmitted = true;
19138 function undestroy() {
19139 if (this._readableState) {
19140 this._readableState.destroyed = false;
19141 this._readableState.reading = false;
19142 this._readableState.ended = false;
19143 this._readableState.endEmitted = false;
19145 if (this._writableState) {
19146 this._writableState.destroyed = false;
19147 this._writableState.ended = false;
19148 this._writableState.ending = false;
19149 this._writableState.finished = false;
19150 this._writableState.errorEmitted = false;
19153 function emitErrorNT(self2, err) {
19154 self2.emit("error", err);
19156 module2.exports = {
19162 // node_modules/util-deprecate/node.js
19163 var require_node2 = __commonJS((exports2, module2) => {
19164 module2.exports = require("util").deprecate;
19167 // node_modules/readable-stream/lib/_stream_writable.js
19168 var require_stream_writable = __commonJS((exports2, module2) => {
19170 var pna = require_process_nextick_args();
19171 module2.exports = Writable;
19172 function CorkedRequest(state) {
19176 this.finish = function() {
19177 onCorkedFinish(_this, state);
19180 var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
19182 Writable.WritableState = WritableState;
19183 var util = Object.create(require_util2());
19184 util.inherits = require_inherits();
19185 var internalUtil = {
19186 deprecate: require_node2()
19188 var Stream = require_stream();
19189 var Buffer2 = require_safe_buffer().Buffer;
19190 var OurUint8Array = global.Uint8Array || function() {
19192 function _uint8ArrayToBuffer(chunk) {
19193 return Buffer2.from(chunk);
19195 function _isUint8Array(obj) {
19196 return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
19198 var destroyImpl = require_destroy();
19199 util.inherits(Writable, Stream);
19202 function WritableState(options, stream) {
19203 Duplex = Duplex || require_stream_duplex();
19204 options = options || {};
19205 var isDuplex = stream instanceof Duplex;
19206 this.objectMode = !!options.objectMode;
19208 this.objectMode = this.objectMode || !!options.writableObjectMode;
19209 var hwm = options.highWaterMark;
19210 var writableHwm = options.writableHighWaterMark;
19211 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
19212 if (hwm || hwm === 0)
19213 this.highWaterMark = hwm;
19214 else if (isDuplex && (writableHwm || writableHwm === 0))
19215 this.highWaterMark = writableHwm;
19217 this.highWaterMark = defaultHwm;
19218 this.highWaterMark = Math.floor(this.highWaterMark);
19219 this.finalCalled = false;
19220 this.needDrain = false;
19221 this.ending = false;
19222 this.ended = false;
19223 this.finished = false;
19224 this.destroyed = false;
19225 var noDecode = options.decodeStrings === false;
19226 this.decodeStrings = !noDecode;
19227 this.defaultEncoding = options.defaultEncoding || "utf8";
19229 this.writing = false;
19232 this.bufferProcessing = false;
19233 this.onwrite = function(er) {
19234 onwrite(stream, er);
19236 this.writecb = null;
19238 this.bufferedRequest = null;
19239 this.lastBufferedRequest = null;
19240 this.pendingcb = 0;
19241 this.prefinished = false;
19242 this.errorEmitted = false;
19243 this.bufferedRequestCount = 0;
19244 this.corkedRequestsFree = new CorkedRequest(this);
19246 WritableState.prototype.getBuffer = function getBuffer() {
19247 var current = this.bufferedRequest;
19251 current = current.next;
19257 Object.defineProperty(WritableState.prototype, "buffer", {
19258 get: internalUtil.deprecate(function() {
19259 return this.getBuffer();
19260 }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
19265 var realHasInstance;
19266 if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
19267 realHasInstance = Function.prototype[Symbol.hasInstance];
19268 Object.defineProperty(Writable, Symbol.hasInstance, {
19269 value: function(object) {
19270 if (realHasInstance.call(this, object))
19272 if (this !== Writable)
19274 return object && object._writableState instanceof WritableState;
19278 realHasInstance = function(object) {
19279 return object instanceof this;
19282 function Writable(options) {
19283 Duplex = Duplex || require_stream_duplex();
19284 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
19285 return new Writable(options);
19287 this._writableState = new WritableState(options, this);
19288 this.writable = true;
19290 if (typeof options.write === "function")
19291 this._write = options.write;
19292 if (typeof options.writev === "function")
19293 this._writev = options.writev;
19294 if (typeof options.destroy === "function")
19295 this._destroy = options.destroy;
19296 if (typeof options.final === "function")
19297 this._final = options.final;
19301 Writable.prototype.pipe = function() {
19302 this.emit("error", new Error("Cannot pipe, not readable"));
19304 function writeAfterEnd(stream, cb) {
19305 var er = new Error("write after end");
19306 stream.emit("error", er);
19307 pna.nextTick(cb, er);
19309 function validChunk(stream, state, chunk, cb) {
19312 if (chunk === null) {
19313 er = new TypeError("May not write null values to stream");
19314 } else if (typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
19315 er = new TypeError("Invalid non-string/buffer chunk");
19318 stream.emit("error", er);
19319 pna.nextTick(cb, er);
19324 Writable.prototype.write = function(chunk, encoding, cb) {
19325 var state = this._writableState;
19327 var isBuf = !state.objectMode && _isUint8Array(chunk);
19328 if (isBuf && !Buffer2.isBuffer(chunk)) {
19329 chunk = _uint8ArrayToBuffer(chunk);
19331 if (typeof encoding === "function") {
19336 encoding = "buffer";
19337 else if (!encoding)
19338 encoding = state.defaultEncoding;
19339 if (typeof cb !== "function")
19342 writeAfterEnd(this, cb);
19343 else if (isBuf || validChunk(this, state, chunk, cb)) {
19345 ret2 = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
19349 Writable.prototype.cork = function() {
19350 var state = this._writableState;
19353 Writable.prototype.uncork = function() {
19354 var state = this._writableState;
19355 if (state.corked) {
19357 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest)
19358 clearBuffer(this, state);
19361 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
19362 if (typeof encoding === "string")
19363 encoding = encoding.toLowerCase();
19364 if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
19365 throw new TypeError("Unknown encoding: " + encoding);
19366 this._writableState.defaultEncoding = encoding;
19369 function decodeChunk(state, chunk, encoding) {
19370 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
19371 chunk = Buffer2.from(chunk, encoding);
19375 Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
19378 return this._writableState.highWaterMark;
19381 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
19383 var newChunk = decodeChunk(state, chunk, encoding);
19384 if (chunk !== newChunk) {
19386 encoding = "buffer";
19390 var len = state.objectMode ? 1 : chunk.length;
19391 state.length += len;
19392 var ret2 = state.length < state.highWaterMark;
19394 state.needDrain = true;
19395 if (state.writing || state.corked) {
19396 var last = state.lastBufferedRequest;
19397 state.lastBufferedRequest = {
19405 last.next = state.lastBufferedRequest;
19407 state.bufferedRequest = state.lastBufferedRequest;
19409 state.bufferedRequestCount += 1;
19411 doWrite(stream, state, false, len, chunk, encoding, cb);
19415 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
19416 state.writelen = len;
19417 state.writecb = cb;
19418 state.writing = true;
19421 stream._writev(chunk, state.onwrite);
19423 stream._write(chunk, encoding, state.onwrite);
19424 state.sync = false;
19426 function onwriteError(stream, state, sync, er, cb) {
19429 pna.nextTick(cb, er);
19430 pna.nextTick(finishMaybe, stream, state);
19431 stream._writableState.errorEmitted = true;
19432 stream.emit("error", er);
19435 stream._writableState.errorEmitted = true;
19436 stream.emit("error", er);
19437 finishMaybe(stream, state);
19440 function onwriteStateUpdate(state) {
19441 state.writing = false;
19442 state.writecb = null;
19443 state.length -= state.writelen;
19444 state.writelen = 0;
19446 function onwrite(stream, er) {
19447 var state = stream._writableState;
19448 var sync = state.sync;
19449 var cb = state.writecb;
19450 onwriteStateUpdate(state);
19452 onwriteError(stream, state, sync, er, cb);
19454 var finished = needFinish(state);
19455 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
19456 clearBuffer(stream, state);
19459 asyncWrite(afterWrite, stream, state, finished, cb);
19461 afterWrite(stream, state, finished, cb);
19465 function afterWrite(stream, state, finished, cb) {
19467 onwriteDrain(stream, state);
19470 finishMaybe(stream, state);
19472 function onwriteDrain(stream, state) {
19473 if (state.length === 0 && state.needDrain) {
19474 state.needDrain = false;
19475 stream.emit("drain");
19478 function clearBuffer(stream, state) {
19479 state.bufferProcessing = true;
19480 var entry = state.bufferedRequest;
19481 if (stream._writev && entry && entry.next) {
19482 var l = state.bufferedRequestCount;
19483 var buffer = new Array(l);
19484 var holder = state.corkedRequestsFree;
19485 holder.entry = entry;
19487 var allBuffers = true;
19489 buffer[count] = entry;
19491 allBuffers = false;
19492 entry = entry.next;
19495 buffer.allBuffers = allBuffers;
19496 doWrite(stream, state, true, state.length, buffer, "", holder.finish);
19498 state.lastBufferedRequest = null;
19500 state.corkedRequestsFree = holder.next;
19501 holder.next = null;
19503 state.corkedRequestsFree = new CorkedRequest(state);
19505 state.bufferedRequestCount = 0;
19508 var chunk = entry.chunk;
19509 var encoding = entry.encoding;
19510 var cb = entry.callback;
19511 var len = state.objectMode ? 1 : chunk.length;
19512 doWrite(stream, state, false, len, chunk, encoding, cb);
19513 entry = entry.next;
19514 state.bufferedRequestCount--;
19515 if (state.writing) {
19519 if (entry === null)
19520 state.lastBufferedRequest = null;
19522 state.bufferedRequest = entry;
19523 state.bufferProcessing = false;
19525 Writable.prototype._write = function(chunk, encoding, cb) {
19526 cb(new Error("_write() is not implemented"));
19528 Writable.prototype._writev = null;
19529 Writable.prototype.end = function(chunk, encoding, cb) {
19530 var state = this._writableState;
19531 if (typeof chunk === "function") {
19535 } else if (typeof encoding === "function") {
19539 if (chunk !== null && chunk !== void 0)
19540 this.write(chunk, encoding);
19541 if (state.corked) {
19545 if (!state.ending && !state.finished)
19546 endWritable(this, state, cb);
19548 function needFinish(state) {
19549 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
19551 function callFinal(stream, state) {
19552 stream._final(function(err) {
19555 stream.emit("error", err);
19557 state.prefinished = true;
19558 stream.emit("prefinish");
19559 finishMaybe(stream, state);
19562 function prefinish(stream, state) {
19563 if (!state.prefinished && !state.finalCalled) {
19564 if (typeof stream._final === "function") {
19566 state.finalCalled = true;
19567 pna.nextTick(callFinal, stream, state);
19569 state.prefinished = true;
19570 stream.emit("prefinish");
19574 function finishMaybe(stream, state) {
19575 var need = needFinish(state);
19577 prefinish(stream, state);
19578 if (state.pendingcb === 0) {
19579 state.finished = true;
19580 stream.emit("finish");
19585 function endWritable(stream, state, cb) {
19586 state.ending = true;
19587 finishMaybe(stream, state);
19589 if (state.finished)
19592 stream.once("finish", cb);
19594 state.ended = true;
19595 stream.writable = false;
19597 function onCorkedFinish(corkReq, state, err) {
19598 var entry = corkReq.entry;
19599 corkReq.entry = null;
19601 var cb = entry.callback;
19604 entry = entry.next;
19606 if (state.corkedRequestsFree) {
19607 state.corkedRequestsFree.next = corkReq;
19609 state.corkedRequestsFree = corkReq;
19612 Object.defineProperty(Writable.prototype, "destroyed", {
19614 if (this._writableState === void 0) {
19617 return this._writableState.destroyed;
19619 set: function(value) {
19620 if (!this._writableState) {
19623 this._writableState.destroyed = value;
19626 Writable.prototype.destroy = destroyImpl.destroy;
19627 Writable.prototype._undestroy = destroyImpl.undestroy;
19628 Writable.prototype._destroy = function(err, cb) {
19634 // node_modules/readable-stream/lib/_stream_duplex.js
19635 var require_stream_duplex = __commonJS((exports2, module2) => {
19637 var pna = require_process_nextick_args();
19638 var objectKeys = Object.keys || function(obj) {
19640 for (var key in obj) {
19645 module2.exports = Duplex;
19646 var util = Object.create(require_util2());
19647 util.inherits = require_inherits();
19648 var Readable = require_stream_readable();
19649 var Writable = require_stream_writable();
19650 util.inherits(Duplex, Readable);
19652 keys = objectKeys(Writable.prototype);
19653 for (v = 0; v < keys.length; v++) {
19655 if (!Duplex.prototype[method])
19656 Duplex.prototype[method] = Writable.prototype[method];
19662 function Duplex(options) {
19663 if (!(this instanceof Duplex))
19664 return new Duplex(options);
19665 Readable.call(this, options);
19666 Writable.call(this, options);
19667 if (options && options.readable === false)
19668 this.readable = false;
19669 if (options && options.writable === false)
19670 this.writable = false;
19671 this.allowHalfOpen = true;
19672 if (options && options.allowHalfOpen === false)
19673 this.allowHalfOpen = false;
19674 this.once("end", onend);
19676 Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
19679 return this._writableState.highWaterMark;
19683 if (this.allowHalfOpen || this._writableState.ended)
19685 pna.nextTick(onEndNT, this);
19687 function onEndNT(self2) {
19690 Object.defineProperty(Duplex.prototype, "destroyed", {
19692 if (this._readableState === void 0 || this._writableState === void 0) {
19695 return this._readableState.destroyed && this._writableState.destroyed;
19697 set: function(value) {
19698 if (this._readableState === void 0 || this._writableState === void 0) {
19701 this._readableState.destroyed = value;
19702 this._writableState.destroyed = value;
19705 Duplex.prototype._destroy = function(err, cb) {
19708 pna.nextTick(cb, err);
19712 // node_modules/readable-stream/lib/_stream_readable.js
19713 var require_stream_readable = __commonJS((exports2, module2) => {
19715 var pna = require_process_nextick_args();
19716 module2.exports = Readable;
19717 var isArray = require_isarray();
19719 Readable.ReadableState = ReadableState;
19720 var EE = require("events").EventEmitter;
19721 var EElistenerCount = function(emitter, type) {
19722 return emitter.listeners(type).length;
19724 var Stream = require_stream();
19725 var Buffer2 = require_safe_buffer().Buffer;
19726 var OurUint8Array = global.Uint8Array || function() {
19728 function _uint8ArrayToBuffer(chunk) {
19729 return Buffer2.from(chunk);
19731 function _isUint8Array(obj) {
19732 return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
19734 var util = Object.create(require_util2());
19735 util.inherits = require_inherits();
19736 var debugUtil = require("util");
19737 var debug = void 0;
19738 if (debugUtil && debugUtil.debuglog) {
19739 debug = debugUtil.debuglog("stream");
19741 debug = function() {
19744 var BufferList = require_BufferList();
19745 var destroyImpl = require_destroy();
19747 util.inherits(Readable, Stream);
19748 var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
19749 function prependListener(emitter, event, fn) {
19750 if (typeof emitter.prependListener === "function")
19751 return emitter.prependListener(event, fn);
19752 if (!emitter._events || !emitter._events[event])
19753 emitter.on(event, fn);
19754 else if (isArray(emitter._events[event]))
19755 emitter._events[event].unshift(fn);
19757 emitter._events[event] = [fn, emitter._events[event]];
19759 function ReadableState(options, stream) {
19760 Duplex = Duplex || require_stream_duplex();
19761 options = options || {};
19762 var isDuplex = stream instanceof Duplex;
19763 this.objectMode = !!options.objectMode;
19765 this.objectMode = this.objectMode || !!options.readableObjectMode;
19766 var hwm = options.highWaterMark;
19767 var readableHwm = options.readableHighWaterMark;
19768 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
19769 if (hwm || hwm === 0)
19770 this.highWaterMark = hwm;
19771 else if (isDuplex && (readableHwm || readableHwm === 0))
19772 this.highWaterMark = readableHwm;
19774 this.highWaterMark = defaultHwm;
19775 this.highWaterMark = Math.floor(this.highWaterMark);
19776 this.buffer = new BufferList();
19779 this.pipesCount = 0;
19780 this.flowing = null;
19781 this.ended = false;
19782 this.endEmitted = false;
19783 this.reading = false;
19785 this.needReadable = false;
19786 this.emittedReadable = false;
19787 this.readableListening = false;
19788 this.resumeScheduled = false;
19789 this.destroyed = false;
19790 this.defaultEncoding = options.defaultEncoding || "utf8";
19791 this.awaitDrain = 0;
19792 this.readingMore = false;
19793 this.decoder = null;
19794 this.encoding = null;
19795 if (options.encoding) {
19796 if (!StringDecoder)
19797 StringDecoder = require("string_decoder/").StringDecoder;
19798 this.decoder = new StringDecoder(options.encoding);
19799 this.encoding = options.encoding;
19802 function Readable(options) {
19803 Duplex = Duplex || require_stream_duplex();
19804 if (!(this instanceof Readable))
19805 return new Readable(options);
19806 this._readableState = new ReadableState(options, this);
19807 this.readable = true;
19809 if (typeof options.read === "function")
19810 this._read = options.read;
19811 if (typeof options.destroy === "function")
19812 this._destroy = options.destroy;
19816 Object.defineProperty(Readable.prototype, "destroyed", {
19818 if (this._readableState === void 0) {
19821 return this._readableState.destroyed;
19823 set: function(value) {
19824 if (!this._readableState) {
19827 this._readableState.destroyed = value;
19830 Readable.prototype.destroy = destroyImpl.destroy;
19831 Readable.prototype._undestroy = destroyImpl.undestroy;
19832 Readable.prototype._destroy = function(err, cb) {
19836 Readable.prototype.push = function(chunk, encoding) {
19837 var state = this._readableState;
19838 var skipChunkCheck;
19839 if (!state.objectMode) {
19840 if (typeof chunk === "string") {
19841 encoding = encoding || state.defaultEncoding;
19842 if (encoding !== state.encoding) {
19843 chunk = Buffer2.from(chunk, encoding);
19846 skipChunkCheck = true;
19849 skipChunkCheck = true;
19851 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
19853 Readable.prototype.unshift = function(chunk) {
19854 return readableAddChunk(this, chunk, null, true, false);
19856 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
19857 var state = stream._readableState;
19858 if (chunk === null) {
19859 state.reading = false;
19860 onEofChunk(stream, state);
19863 if (!skipChunkCheck)
19864 er = chunkInvalid(state, chunk);
19866 stream.emit("error", er);
19867 } else if (state.objectMode || chunk && chunk.length > 0) {
19868 if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
19869 chunk = _uint8ArrayToBuffer(chunk);
19872 if (state.endEmitted)
19873 stream.emit("error", new Error("stream.unshift() after end event"));
19875 addChunk(stream, state, chunk, true);
19876 } else if (state.ended) {
19877 stream.emit("error", new Error("stream.push() after EOF"));
19879 state.reading = false;
19880 if (state.decoder && !encoding) {
19881 chunk = state.decoder.write(chunk);
19882 if (state.objectMode || chunk.length !== 0)
19883 addChunk(stream, state, chunk, false);
19885 maybeReadMore(stream, state);
19887 addChunk(stream, state, chunk, false);
19890 } else if (!addToFront) {
19891 state.reading = false;
19894 return needMoreData(state);
19896 function addChunk(stream, state, chunk, addToFront) {
19897 if (state.flowing && state.length === 0 && !state.sync) {
19898 stream.emit("data", chunk);
19901 state.length += state.objectMode ? 1 : chunk.length;
19903 state.buffer.unshift(chunk);
19905 state.buffer.push(chunk);
19906 if (state.needReadable)
19907 emitReadable(stream);
19909 maybeReadMore(stream, state);
19911 function chunkInvalid(state, chunk) {
19913 if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
19914 er = new TypeError("Invalid non-string/buffer chunk");
19918 function needMoreData(state) {
19919 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
19921 Readable.prototype.isPaused = function() {
19922 return this._readableState.flowing === false;
19924 Readable.prototype.setEncoding = function(enc) {
19925 if (!StringDecoder)
19926 StringDecoder = require("string_decoder/").StringDecoder;
19927 this._readableState.decoder = new StringDecoder(enc);
19928 this._readableState.encoding = enc;
19931 var MAX_HWM = 8388608;
19932 function computeNewHighWaterMark(n) {
19933 if (n >= MAX_HWM) {
19946 function howMuchToRead(n, state) {
19947 if (n <= 0 || state.length === 0 && state.ended)
19949 if (state.objectMode)
19952 if (state.flowing && state.length)
19953 return state.buffer.head.data.length;
19955 return state.length;
19957 if (n > state.highWaterMark)
19958 state.highWaterMark = computeNewHighWaterMark(n);
19959 if (n <= state.length)
19961 if (!state.ended) {
19962 state.needReadable = true;
19965 return state.length;
19967 Readable.prototype.read = function(n) {
19969 n = parseInt(n, 10);
19970 var state = this._readableState;
19973 state.emittedReadable = false;
19974 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
19975 debug("read: emitReadable", state.length, state.ended);
19976 if (state.length === 0 && state.ended)
19979 emitReadable(this);
19982 n = howMuchToRead(n, state);
19983 if (n === 0 && state.ended) {
19984 if (state.length === 0)
19988 var doRead = state.needReadable;
19989 debug("need readable", doRead);
19990 if (state.length === 0 || state.length - n < state.highWaterMark) {
19992 debug("length less than watermark", doRead);
19994 if (state.ended || state.reading) {
19996 debug("reading or ended", doRead);
19997 } else if (doRead) {
19999 state.reading = true;
20001 if (state.length === 0)
20002 state.needReadable = true;
20003 this._read(state.highWaterMark);
20004 state.sync = false;
20005 if (!state.reading)
20006 n = howMuchToRead(nOrig, state);
20010 ret2 = fromList(n, state);
20013 if (ret2 === null) {
20014 state.needReadable = true;
20019 if (state.length === 0) {
20021 state.needReadable = true;
20022 if (nOrig !== n && state.ended)
20026 this.emit("data", ret2);
20029 function onEofChunk(stream, state) {
20032 if (state.decoder) {
20033 var chunk = state.decoder.end();
20034 if (chunk && chunk.length) {
20035 state.buffer.push(chunk);
20036 state.length += state.objectMode ? 1 : chunk.length;
20039 state.ended = true;
20040 emitReadable(stream);
20042 function emitReadable(stream) {
20043 var state = stream._readableState;
20044 state.needReadable = false;
20045 if (!state.emittedReadable) {
20046 debug("emitReadable", state.flowing);
20047 state.emittedReadable = true;
20049 pna.nextTick(emitReadable_, stream);
20051 emitReadable_(stream);
20054 function emitReadable_(stream) {
20055 debug("emit readable");
20056 stream.emit("readable");
20059 function maybeReadMore(stream, state) {
20060 if (!state.readingMore) {
20061 state.readingMore = true;
20062 pna.nextTick(maybeReadMore_, stream, state);
20065 function maybeReadMore_(stream, state) {
20066 var len = state.length;
20067 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
20068 debug("maybeReadMore read 0");
20070 if (len === state.length)
20073 len = state.length;
20075 state.readingMore = false;
20077 Readable.prototype._read = function(n) {
20078 this.emit("error", new Error("_read() is not implemented"));
20080 Readable.prototype.pipe = function(dest, pipeOpts) {
20082 var state = this._readableState;
20083 switch (state.pipesCount) {
20085 state.pipes = dest;
20088 state.pipes = [state.pipes, dest];
20091 state.pipes.push(dest);
20094 state.pipesCount += 1;
20095 debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
20096 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
20097 var endFn = doEnd ? onend : unpipe;
20098 if (state.endEmitted)
20099 pna.nextTick(endFn);
20101 src.once("end", endFn);
20102 dest.on("unpipe", onunpipe);
20103 function onunpipe(readable, unpipeInfo) {
20105 if (readable === src) {
20106 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
20107 unpipeInfo.hasUnpiped = true;
20116 var ondrain = pipeOnDrain(src);
20117 dest.on("drain", ondrain);
20118 var cleanedUp = false;
20119 function cleanup() {
20121 dest.removeListener("close", onclose);
20122 dest.removeListener("finish", onfinish);
20123 dest.removeListener("drain", ondrain);
20124 dest.removeListener("error", onerror);
20125 dest.removeListener("unpipe", onunpipe);
20126 src.removeListener("end", onend);
20127 src.removeListener("end", unpipe);
20128 src.removeListener("data", ondata);
20130 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
20133 var increasedAwaitDrain = false;
20134 src.on("data", ondata);
20135 function ondata(chunk) {
20137 increasedAwaitDrain = false;
20138 var ret2 = dest.write(chunk);
20139 if (ret2 === false && !increasedAwaitDrain) {
20140 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
20141 debug("false write response, pause", src._readableState.awaitDrain);
20142 src._readableState.awaitDrain++;
20143 increasedAwaitDrain = true;
20148 function onerror(er) {
20149 debug("onerror", er);
20151 dest.removeListener("error", onerror);
20152 if (EElistenerCount(dest, "error") === 0)
20153 dest.emit("error", er);
20155 prependListener(dest, "error", onerror);
20156 function onclose() {
20157 dest.removeListener("finish", onfinish);
20160 dest.once("close", onclose);
20161 function onfinish() {
20163 dest.removeListener("close", onclose);
20166 dest.once("finish", onfinish);
20167 function unpipe() {
20171 dest.emit("pipe", src);
20172 if (!state.flowing) {
20173 debug("pipe resume");
20178 function pipeOnDrain(src) {
20179 return function() {
20180 var state = src._readableState;
20181 debug("pipeOnDrain", state.awaitDrain);
20182 if (state.awaitDrain)
20183 state.awaitDrain--;
20184 if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
20185 state.flowing = true;
20190 Readable.prototype.unpipe = function(dest) {
20191 var state = this._readableState;
20192 var unpipeInfo = {hasUnpiped: false};
20193 if (state.pipesCount === 0)
20195 if (state.pipesCount === 1) {
20196 if (dest && dest !== state.pipes)
20199 dest = state.pipes;
20200 state.pipes = null;
20201 state.pipesCount = 0;
20202 state.flowing = false;
20204 dest.emit("unpipe", this, unpipeInfo);
20208 var dests = state.pipes;
20209 var len = state.pipesCount;
20210 state.pipes = null;
20211 state.pipesCount = 0;
20212 state.flowing = false;
20213 for (var i = 0; i < len; i++) {
20214 dests[i].emit("unpipe", this, unpipeInfo);
20218 var index = indexOf(state.pipes, dest);
20221 state.pipes.splice(index, 1);
20222 state.pipesCount -= 1;
20223 if (state.pipesCount === 1)
20224 state.pipes = state.pipes[0];
20225 dest.emit("unpipe", this, unpipeInfo);
20228 Readable.prototype.on = function(ev, fn) {
20229 var res = Stream.prototype.on.call(this, ev, fn);
20230 if (ev === "data") {
20231 if (this._readableState.flowing !== false)
20233 } else if (ev === "readable") {
20234 var state = this._readableState;
20235 if (!state.endEmitted && !state.readableListening) {
20236 state.readableListening = state.needReadable = true;
20237 state.emittedReadable = false;
20238 if (!state.reading) {
20239 pna.nextTick(nReadingNextTick, this);
20240 } else if (state.length) {
20241 emitReadable(this);
20247 Readable.prototype.addListener = Readable.prototype.on;
20248 function nReadingNextTick(self2) {
20249 debug("readable nexttick read 0");
20252 Readable.prototype.resume = function() {
20253 var state = this._readableState;
20254 if (!state.flowing) {
20256 state.flowing = true;
20257 resume(this, state);
20261 function resume(stream, state) {
20262 if (!state.resumeScheduled) {
20263 state.resumeScheduled = true;
20264 pna.nextTick(resume_, stream, state);
20267 function resume_(stream, state) {
20268 if (!state.reading) {
20269 debug("resume read 0");
20272 state.resumeScheduled = false;
20273 state.awaitDrain = 0;
20274 stream.emit("resume");
20276 if (state.flowing && !state.reading)
20279 Readable.prototype.pause = function() {
20280 debug("call pause flowing=%j", this._readableState.flowing);
20281 if (this._readableState.flowing !== false) {
20283 this._readableState.flowing = false;
20284 this.emit("pause");
20288 function flow(stream) {
20289 var state = stream._readableState;
20290 debug("flow", state.flowing);
20291 while (state.flowing && stream.read() !== null) {
20294 Readable.prototype.wrap = function(stream) {
20296 var state = this._readableState;
20297 var paused = false;
20298 stream.on("end", function() {
20299 debug("wrapped end");
20300 if (state.decoder && !state.ended) {
20301 var chunk = state.decoder.end();
20302 if (chunk && chunk.length)
20307 stream.on("data", function(chunk) {
20308 debug("wrapped data");
20310 chunk = state.decoder.write(chunk);
20311 if (state.objectMode && (chunk === null || chunk === void 0))
20313 else if (!state.objectMode && (!chunk || !chunk.length))
20315 var ret2 = _this.push(chunk);
20321 for (var i in stream) {
20322 if (this[i] === void 0 && typeof stream[i] === "function") {
20323 this[i] = function(method) {
20324 return function() {
20325 return stream[method].apply(stream, arguments);
20330 for (var n = 0; n < kProxyEvents.length; n++) {
20331 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
20333 this._read = function(n2) {
20334 debug("wrapped _read", n2);
20342 Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
20345 return this._readableState.highWaterMark;
20348 Readable._fromList = fromList;
20349 function fromList(n, state) {
20350 if (state.length === 0)
20353 if (state.objectMode)
20354 ret2 = state.buffer.shift();
20355 else if (!n || n >= state.length) {
20357 ret2 = state.buffer.join("");
20358 else if (state.buffer.length === 1)
20359 ret2 = state.buffer.head.data;
20361 ret2 = state.buffer.concat(state.length);
20362 state.buffer.clear();
20364 ret2 = fromListPartial(n, state.buffer, state.decoder);
20368 function fromListPartial(n, list, hasStrings) {
20370 if (n < list.head.data.length) {
20371 ret2 = list.head.data.slice(0, n);
20372 list.head.data = list.head.data.slice(n);
20373 } else if (n === list.head.data.length) {
20374 ret2 = list.shift();
20376 ret2 = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
20380 function copyFromBufferString(n, list) {
20385 while (p = p.next) {
20387 var nb = n > str.length ? str.length : n;
20388 if (nb === str.length)
20391 ret2 += str.slice(0, n);
20394 if (nb === str.length) {
20397 list.head = p.next;
20399 list.head = list.tail = null;
20402 p.data = str.slice(nb);
20411 function copyFromBuffer(n, list) {
20412 var ret2 = Buffer2.allocUnsafe(n);
20416 n -= p.data.length;
20417 while (p = p.next) {
20419 var nb = n > buf.length ? buf.length : n;
20420 buf.copy(ret2, ret2.length - n, 0, nb);
20423 if (nb === buf.length) {
20426 list.head = p.next;
20428 list.head = list.tail = null;
20431 p.data = buf.slice(nb);
20440 function endReadable(stream) {
20441 var state = stream._readableState;
20442 if (state.length > 0)
20443 throw new Error('"endReadable()" called on non-empty stream');
20444 if (!state.endEmitted) {
20445 state.ended = true;
20446 pna.nextTick(endReadableNT, state, stream);
20449 function endReadableNT(state, stream) {
20450 if (!state.endEmitted && state.length === 0) {
20451 state.endEmitted = true;
20452 stream.readable = false;
20453 stream.emit("end");
20456 function indexOf(xs, x) {
20457 for (var i = 0, l = xs.length; i < l; i++) {
20465 // node_modules/readable-stream/lib/_stream_transform.js
20466 var require_stream_transform = __commonJS((exports2, module2) => {
20468 module2.exports = Transform;
20469 var Duplex = require_stream_duplex();
20470 var util = Object.create(require_util2());
20471 util.inherits = require_inherits();
20472 util.inherits(Transform, Duplex);
20473 function afterTransform(er, data) {
20474 var ts = this._transformState;
20475 ts.transforming = false;
20476 var cb = ts.writecb;
20478 return this.emit("error", new Error("write callback called multiple times"));
20480 ts.writechunk = null;
20485 var rs = this._readableState;
20486 rs.reading = false;
20487 if (rs.needReadable || rs.length < rs.highWaterMark) {
20488 this._read(rs.highWaterMark);
20491 function Transform(options) {
20492 if (!(this instanceof Transform))
20493 return new Transform(options);
20494 Duplex.call(this, options);
20495 this._transformState = {
20496 afterTransform: afterTransform.bind(this),
20497 needTransform: false,
20498 transforming: false,
20501 writeencoding: null
20503 this._readableState.needReadable = true;
20504 this._readableState.sync = false;
20506 if (typeof options.transform === "function")
20507 this._transform = options.transform;
20508 if (typeof options.flush === "function")
20509 this._flush = options.flush;
20511 this.on("prefinish", prefinish);
20513 function prefinish() {
20515 if (typeof this._flush === "function") {
20516 this._flush(function(er, data) {
20517 done(_this, er, data);
20520 done(this, null, null);
20523 Transform.prototype.push = function(chunk, encoding) {
20524 this._transformState.needTransform = false;
20525 return Duplex.prototype.push.call(this, chunk, encoding);
20527 Transform.prototype._transform = function(chunk, encoding, cb) {
20528 throw new Error("_transform() is not implemented");
20530 Transform.prototype._write = function(chunk, encoding, cb) {
20531 var ts = this._transformState;
20533 ts.writechunk = chunk;
20534 ts.writeencoding = encoding;
20535 if (!ts.transforming) {
20536 var rs = this._readableState;
20537 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
20538 this._read(rs.highWaterMark);
20541 Transform.prototype._read = function(n) {
20542 var ts = this._transformState;
20543 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
20544 ts.transforming = true;
20545 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
20547 ts.needTransform = true;
20550 Transform.prototype._destroy = function(err, cb) {
20552 Duplex.prototype._destroy.call(this, err, function(err2) {
20554 _this2.emit("close");
20557 function done(stream, er, data) {
20559 return stream.emit("error", er);
20562 if (stream._writableState.length)
20563 throw new Error("Calling transform done when ws.length != 0");
20564 if (stream._transformState.transforming)
20565 throw new Error("Calling transform done when still transforming");
20566 return stream.push(null);
20570 // node_modules/readable-stream/lib/_stream_passthrough.js
20571 var require_stream_passthrough = __commonJS((exports2, module2) => {
20573 module2.exports = PassThrough;
20574 var Transform = require_stream_transform();
20575 var util = Object.create(require_util2());
20576 util.inherits = require_inherits();
20577 util.inherits(PassThrough, Transform);
20578 function PassThrough(options) {
20579 if (!(this instanceof PassThrough))
20580 return new PassThrough(options);
20581 Transform.call(this, options);
20583 PassThrough.prototype._transform = function(chunk, encoding, cb) {
20588 // node_modules/readable-stream/readable.js
20589 var require_readable = __commonJS((exports2, module2) => {
20590 var Stream = require("stream");
20591 if (process.env.READABLE_STREAM === "disable" && Stream) {
20592 module2.exports = Stream;
20593 exports2 = module2.exports = Stream.Readable;
20594 exports2.Readable = Stream.Readable;
20595 exports2.Writable = Stream.Writable;
20596 exports2.Duplex = Stream.Duplex;
20597 exports2.Transform = Stream.Transform;
20598 exports2.PassThrough = Stream.PassThrough;
20599 exports2.Stream = Stream;
20601 exports2 = module2.exports = require_stream_readable();
20602 exports2.Stream = Stream || exports2;
20603 exports2.Readable = exports2;
20604 exports2.Writable = require_stream_writable();
20605 exports2.Duplex = require_stream_duplex();
20606 exports2.Transform = require_stream_transform();
20607 exports2.PassThrough = require_stream_passthrough();
20611 // node_modules/unzipper/lib/PullStream.js
20612 var require_PullStream = __commonJS((exports2, module2) => {
20613 var Stream = require("stream");
20614 var Promise2 = require_bluebird();
20615 var util = require("util");
20616 var Buffer2 = require_Buffer();
20617 var strFunction = "function";
20618 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
20619 Stream = require_readable();
20620 function PullStream() {
20621 if (!(this instanceof PullStream))
20622 return new PullStream();
20623 Stream.Duplex.call(this, {decodeStrings: false, objectMode: true});
20624 this.buffer = Buffer2.from("");
20626 self2.on("finish", function() {
20627 self2.finished = true;
20628 self2.emit("chunk", false);
20631 util.inherits(PullStream, Stream.Duplex);
20632 PullStream.prototype._write = function(chunk, e, cb) {
20633 this.buffer = Buffer2.concat([this.buffer, chunk]);
20635 this.emit("chunk");
20637 PullStream.prototype.stream = function(eof, includeEof) {
20638 var p = Stream.PassThrough();
20639 var done, self2 = this;
20641 if (typeof self2.cb === strFunction) {
20642 var callback = self2.cb;
20649 if (self2.buffer && self2.buffer.length) {
20650 if (typeof eof === "number") {
20651 packet = self2.buffer.slice(0, eof);
20652 self2.buffer = self2.buffer.slice(eof);
20653 eof -= packet.length;
20656 var match = self2.buffer.indexOf(eof);
20657 if (match !== -1) {
20658 self2.match = match;
20660 match = match + eof.length;
20661 packet = self2.buffer.slice(0, match);
20662 self2.buffer = self2.buffer.slice(match);
20665 var len = self2.buffer.length - eof.length;
20669 packet = self2.buffer.slice(0, len);
20670 self2.buffer = self2.buffer.slice(len);
20675 p.write(packet, function() {
20676 if (self2.buffer.length === 0 || eof.length && self2.buffer.length <= eof.length)
20681 if (self2.finished && !this.__ended) {
20682 self2.removeListener("chunk", pull);
20683 self2.emit("error", new Error("FILE_ENDED"));
20684 this.__ended = true;
20688 self2.removeListener("chunk", pull);
20692 self2.on("chunk", pull);
20696 PullStream.prototype.pull = function(eof, includeEof) {
20698 return Promise2.resolve("");
20699 if (!isNaN(eof) && this.buffer.length > eof) {
20700 var data = this.buffer.slice(0, eof);
20701 this.buffer = this.buffer.slice(eof);
20702 return Promise2.resolve(data);
20704 var buffer = Buffer2.from(""), self2 = this;
20705 var concatStream = Stream.Transform();
20706 concatStream._transform = function(d, e, cb) {
20707 buffer = Buffer2.concat([buffer, d]);
20711 var pullStreamRejectHandler;
20712 return new Promise2(function(resolve, reject) {
20713 rejectHandler = reject;
20714 pullStreamRejectHandler = function(e) {
20715 self2.__emittedError = e;
20718 if (self2.finished)
20719 return reject(new Error("FILE_ENDED"));
20720 self2.once("error", pullStreamRejectHandler);
20721 self2.stream(eof, includeEof).on("error", reject).pipe(concatStream).on("finish", function() {
20723 }).on("error", reject);
20724 }).finally(function() {
20725 self2.removeListener("error", rejectHandler);
20726 self2.removeListener("error", pullStreamRejectHandler);
20729 PullStream.prototype._read = function() {
20731 module2.exports = PullStream;
20734 // node_modules/unzipper/lib/NoopStream.js
20735 var require_NoopStream = __commonJS((exports2, module2) => {
20736 var Stream = require("stream");
20737 var util = require("util");
20738 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
20739 Stream = require_readable();
20740 function NoopStream() {
20741 if (!(this instanceof NoopStream)) {
20742 return new NoopStream();
20744 Stream.Transform.call(this);
20746 util.inherits(NoopStream, Stream.Transform);
20747 NoopStream.prototype._transform = function(d, e, cb) {
20750 module2.exports = NoopStream;
20753 // node_modules/unzipper/lib/BufferStream.js
20754 var require_BufferStream = __commonJS((exports2, module2) => {
20755 var Promise2 = require_bluebird();
20756 var Stream = require("stream");
20757 var Buffer2 = require_Buffer();
20758 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
20759 Stream = require_readable();
20760 module2.exports = function(entry) {
20761 return new Promise2(function(resolve, reject) {
20763 var bufferStream = Stream.Transform().on("finish", function() {
20764 resolve(Buffer2.concat(chunks));
20765 }).on("error", reject);
20766 bufferStream._transform = function(d, e, cb) {
20770 entry.on("error", reject).pipe(bufferStream);
20775 // node_modules/unzipper/lib/parseExtraField.js
20776 var require_parseExtraField = __commonJS((exports2, module2) => {
20777 var binary = require_binary();
20778 module2.exports = function(extraField, vars) {
20780 while (!extra && extraField && extraField.length) {
20781 var candidateExtra = binary.parse(extraField).word16lu("signature").word16lu("partsize").word64lu("uncompressedSize").word64lu("compressedSize").word64lu("offset").word64lu("disknum").vars;
20782 if (candidateExtra.signature === 1) {
20783 extra = candidateExtra;
20785 extraField = extraField.slice(candidateExtra.partsize + 4);
20788 extra = extra || {};
20789 if (vars.compressedSize === 4294967295)
20790 vars.compressedSize = extra.compressedSize;
20791 if (vars.uncompressedSize === 4294967295)
20792 vars.uncompressedSize = extra.uncompressedSize;
20793 if (vars.offsetToLocalFileHeader === 4294967295)
20794 vars.offsetToLocalFileHeader = extra.offset;
20799 // node_modules/unzipper/lib/parseDateTime.js
20800 var require_parseDateTime = __commonJS((exports2, module2) => {
20801 module2.exports = function parseDateTime(date, time) {
20802 const day = date & 31;
20803 const month = date >> 5 & 15;
20804 const year = (date >> 9 & 127) + 1980;
20805 const seconds = time ? (time & 31) * 2 : 0;
20806 const minutes = time ? time >> 5 & 63 : 0;
20807 const hours = time ? time >> 11 : 0;
20808 return new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
20812 // node_modules/unzipper/lib/parse.js
20813 var require_parse3 = __commonJS((exports2, module2) => {
20814 var util = require("util");
20815 var zlib = require("zlib");
20816 var Stream = require("stream");
20817 var binary = require_binary();
20818 var Promise2 = require_bluebird();
20819 var PullStream = require_PullStream();
20820 var NoopStream = require_NoopStream();
20821 var BufferStream = require_BufferStream();
20822 var parseExtraField = require_parseExtraField();
20823 var Buffer2 = require_Buffer();
20824 var parseDateTime = require_parseDateTime();
20825 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
20826 Stream = require_readable();
20827 var endDirectorySignature = Buffer2.alloc(4);
20828 endDirectorySignature.writeUInt32LE(101010256, 0);
20829 function Parse(opts) {
20830 if (!(this instanceof Parse)) {
20831 return new Parse(opts);
20834 self2._opts = opts || {verbose: false};
20835 PullStream.call(self2, self2._opts);
20836 self2.on("finish", function() {
20837 self2.emit("close");
20839 self2._readRecord().catch(function(e) {
20840 if (!self2.__emittedError || self2.__emittedError !== e)
20841 self2.emit("error", e);
20844 util.inherits(Parse, PullStream);
20845 Parse.prototype._readRecord = function() {
20847 return self2.pull(4).then(function(data) {
20848 if (data.length === 0)
20850 var signature = data.readUInt32LE(0);
20851 if (signature === 875721283) {
20852 return self2._readCrxHeader();
20854 if (signature === 67324752) {
20855 return self2._readFile();
20856 } else if (signature === 33639248) {
20857 self2.__ended = true;
20858 return self2._readCentralDirectoryFileHeader();
20859 } else if (signature === 101010256) {
20860 return self2._readEndOfCentralDirectoryRecord();
20861 } else if (self2.__ended) {
20862 return self2.pull(endDirectorySignature).then(function() {
20863 return self2._readEndOfCentralDirectoryRecord();
20866 self2.emit("error", new Error("invalid signature: 0x" + signature.toString(16)));
20869 Parse.prototype._readCrxHeader = function() {
20871 return self2.pull(12).then(function(data) {
20872 self2.crxHeader = binary.parse(data).word32lu("version").word32lu("pubKeyLength").word32lu("signatureLength").vars;
20873 return self2.pull(self2.crxHeader.pubKeyLength + self2.crxHeader.signatureLength);
20874 }).then(function(data) {
20875 self2.crxHeader.publicKey = data.slice(0, self2.crxHeader.pubKeyLength);
20876 self2.crxHeader.signature = data.slice(self2.crxHeader.pubKeyLength);
20877 self2.emit("crx-header", self2.crxHeader);
20878 return self2._readRecord();
20881 Parse.prototype._readFile = function() {
20883 return self2.pull(26).then(function(data) {
20884 var vars = binary.parse(data).word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars;
20885 vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
20886 if (self2.crxHeader)
20887 vars.crxHeader = self2.crxHeader;
20888 return self2.pull(vars.fileNameLength).then(function(fileNameBuffer) {
20889 var fileName = fileNameBuffer.toString("utf8");
20890 var entry = Stream.PassThrough();
20891 var __autodraining = false;
20892 entry.autodrain = function() {
20893 __autodraining = true;
20894 var draining = entry.pipe(NoopStream());
20895 draining.promise = function() {
20896 return new Promise2(function(resolve, reject) {
20897 draining.on("finish", resolve);
20898 draining.on("error", reject);
20903 entry.buffer = function() {
20904 return BufferStream(entry);
20906 entry.path = fileName;
20908 entry.props.path = fileName;
20909 entry.props.pathBuffer = fileNameBuffer;
20910 entry.props.flags = {
20911 isUnicode: vars.flags & 17
20913 entry.type = vars.uncompressedSize === 0 && /[\/\\]$/.test(fileName) ? "Directory" : "File";
20914 if (self2._opts.verbose) {
20915 if (entry.type === "Directory") {
20916 console.log(" creating:", fileName);
20917 } else if (entry.type === "File") {
20918 if (vars.compressionMethod === 0) {
20919 console.log(" extracting:", fileName);
20921 console.log(" inflating:", fileName);
20925 return self2.pull(vars.extraFieldLength).then(function(extraField) {
20926 var extra = parseExtraField(extraField, vars);
20928 entry.extra = extra;
20929 if (self2._opts.forceStream) {
20932 self2.emit("entry", entry);
20933 if (self2._readableState.pipesCount || self2._readableState.pipes && self2._readableState.pipes.length)
20936 if (self2._opts.verbose)
20938 filename: fileName,
20942 var fileSizeKnown = !(vars.flags & 8) || vars.compressedSize > 0, eof;
20943 entry.__autodraining = __autodraining;
20944 var inflater = vars.compressionMethod && !__autodraining ? zlib.createInflateRaw() : Stream.PassThrough();
20945 if (fileSizeKnown) {
20946 entry.size = vars.uncompressedSize;
20947 eof = vars.compressedSize;
20949 eof = Buffer2.alloc(4);
20950 eof.writeUInt32LE(134695760, 0);
20952 return new Promise2(function(resolve, reject) {
20953 self2.stream(eof).pipe(inflater).on("error", function(err) {
20954 self2.emit("error", err);
20955 }).pipe(entry).on("finish", function() {
20956 return fileSizeKnown ? self2._readRecord().then(resolve).catch(reject) : self2._processDataDescriptor(entry).then(resolve).catch(reject);
20963 Parse.prototype._processDataDescriptor = function(entry) {
20965 return self2.pull(16).then(function(data) {
20966 var vars = binary.parse(data).word32lu("dataDescriptorSignature").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").vars;
20967 entry.size = vars.uncompressedSize;
20968 return self2._readRecord();
20971 Parse.prototype._readCentralDirectoryFileHeader = function() {
20973 return self2.pull(42).then(function(data) {
20974 var vars = binary.parse(data).word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars;
20975 return self2.pull(vars.fileNameLength).then(function(fileName) {
20976 vars.fileName = fileName.toString("utf8");
20977 return self2.pull(vars.extraFieldLength);
20978 }).then(function(extraField) {
20979 return self2.pull(vars.fileCommentLength);
20980 }).then(function(fileComment) {
20981 return self2._readRecord();
20985 Parse.prototype._readEndOfCentralDirectoryRecord = function() {
20987 return self2.pull(18).then(function(data) {
20988 var vars = binary.parse(data).word16lu("diskNumber").word16lu("diskStart").word16lu("numberOfRecordsOnDisk").word16lu("numberOfRecords").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars;
20989 return self2.pull(vars.commentLength).then(function(comment) {
20990 comment = comment.toString("utf8");
20996 Parse.prototype.promise = function() {
20998 return new Promise2(function(resolve, reject) {
20999 self2.on("finish", resolve);
21000 self2.on("error", reject);
21003 module2.exports = Parse;
21006 // node_modules/duplexer2/index.js
21007 var require_duplexer2 = __commonJS((exports2, module2) => {
21009 var stream = require_readable();
21010 function DuplexWrapper(options, writable, readable) {
21011 if (typeof readable === "undefined") {
21012 readable = writable;
21013 writable = options;
21016 stream.Duplex.call(this, options);
21017 if (typeof readable.read !== "function") {
21018 readable = new stream.Readable(options).wrap(readable);
21020 this._writable = writable;
21021 this._readable = readable;
21022 this._waiting = false;
21024 writable.once("finish", function() {
21027 this.once("finish", function() {
21030 readable.on("readable", function() {
21031 if (self2._waiting) {
21032 self2._waiting = false;
21036 readable.once("end", function() {
21039 if (!options || typeof options.bubbleErrors === "undefined" || options.bubbleErrors) {
21040 writable.on("error", function(err) {
21041 self2.emit("error", err);
21043 readable.on("error", function(err) {
21044 self2.emit("error", err);
21048 DuplexWrapper.prototype = Object.create(stream.Duplex.prototype, {constructor: {value: DuplexWrapper}});
21049 DuplexWrapper.prototype._write = function _write(input, encoding, done) {
21050 this._writable.write(input, encoding, done);
21052 DuplexWrapper.prototype._read = function _read() {
21055 while ((buf = this._readable.read()) !== null) {
21060 this._waiting = true;
21063 module2.exports = function duplex2(options, writable, readable) {
21064 return new DuplexWrapper(options, writable, readable);
21066 module2.exports.DuplexWrapper = DuplexWrapper;
21069 // node_modules/unzipper/lib/parseOne.js
21070 var require_parseOne = __commonJS((exports2, module2) => {
21071 var Stream = require("stream");
21072 var Parse = require_parse3();
21073 var duplexer2 = require_duplexer2();
21074 var BufferStream = require_BufferStream();
21075 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
21076 Stream = require_readable();
21077 function parseOne(match, opts) {
21078 var inStream = Stream.PassThrough({objectMode: true});
21079 var outStream = Stream.PassThrough();
21080 var transform = Stream.Transform({objectMode: true});
21081 var re = match instanceof RegExp ? match : match && new RegExp(match);
21083 transform._transform = function(entry, e, cb) {
21084 if (found || re && !re.exec(entry.path)) {
21089 out.emit("entry", entry);
21090 entry.on("error", function(e2) {
21091 outStream.emit("error", e2);
21093 entry.pipe(outStream).on("error", function(err) {
21095 }).on("finish", function(d) {
21100 inStream.pipe(Parse(opts)).on("error", function(err) {
21101 outStream.emit("error", err);
21102 }).pipe(transform).on("error", Object).on("finish", function() {
21104 outStream.emit("error", new Error("PATTERN_NOT_FOUND"));
21108 var out = duplexer2(inStream, outStream);
21109 out.buffer = function() {
21110 return BufferStream(outStream);
21114 module2.exports = parseOne;
21117 // node_modules/fstream/lib/abstract.js
21118 var require_abstract = __commonJS((exports2, module2) => {
21119 module2.exports = Abstract;
21120 var Stream = require("stream").Stream;
21121 var inherits2 = require_inherits();
21122 function Abstract() {
21125 inherits2(Abstract, Stream);
21126 Abstract.prototype.on = function(ev, fn) {
21127 if (ev === "ready" && this.ready) {
21128 process.nextTick(fn.bind(this));
21130 Stream.prototype.on.call(this, ev, fn);
21134 Abstract.prototype.abort = function() {
21135 this._aborted = true;
21136 this.emit("abort");
21138 Abstract.prototype.destroy = function() {
21140 Abstract.prototype.warn = function(msg, code) {
21142 var er = decorate(msg, code, self2);
21143 if (!self2.listeners("warn")) {
21144 console.error("%s %s\npath = %s\nsyscall = %s\nfstream_type = %s\nfstream_path = %s\nfstream_unc_path = %s\nfstream_class = %s\nfstream_stack =\n%s\n", code || "UNKNOWN", er.stack, er.path, er.syscall, er.fstream_type, er.fstream_path, er.fstream_unc_path, er.fstream_class, er.fstream_stack.join("\n"));
21146 self2.emit("warn", er);
21149 Abstract.prototype.info = function(msg, code) {
21150 this.emit("info", msg, code);
21152 Abstract.prototype.error = function(msg, code, th) {
21153 var er = decorate(msg, code, this);
21157 this.emit("error", er);
21159 function decorate(er, code, self2) {
21160 if (!(er instanceof Error))
21161 er = new Error(er);
21162 er.code = er.code || code;
21163 er.path = er.path || self2.path;
21164 er.fstream_type = er.fstream_type || self2.type;
21165 er.fstream_path = er.fstream_path || self2.path;
21166 if (self2._path !== self2.path) {
21167 er.fstream_unc_path = er.fstream_unc_path || self2._path;
21169 if (self2.linkpath) {
21170 er.fstream_linkpath = er.fstream_linkpath || self2.linkpath;
21172 er.fstream_class = er.fstream_class || self2.constructor.name;
21173 er.fstream_stack = er.fstream_stack || new Error().stack.split(/\n/).slice(3).map(function(s) {
21174 return s.replace(/^ {4}at /, "");
21180 // node_modules/graceful-fs/polyfills.js
21181 var require_polyfills = __commonJS((exports2, module2) => {
21182 var constants = require("constants");
21183 var origCwd = process.cwd;
21185 var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
21186 process.cwd = function() {
21188 cwd = origCwd.call(process);
21195 var chdir = process.chdir;
21196 process.chdir = function(d) {
21198 chdir.call(process, d);
21200 module2.exports = patch;
21201 function patch(fs) {
21202 if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
21208 fs.chown = chownFix(fs.chown);
21209 fs.fchown = chownFix(fs.fchown);
21210 fs.lchown = chownFix(fs.lchown);
21211 fs.chmod = chmodFix(fs.chmod);
21212 fs.fchmod = chmodFix(fs.fchmod);
21213 fs.lchmod = chmodFix(fs.lchmod);
21214 fs.chownSync = chownFixSync(fs.chownSync);
21215 fs.fchownSync = chownFixSync(fs.fchownSync);
21216 fs.lchownSync = chownFixSync(fs.lchownSync);
21217 fs.chmodSync = chmodFixSync(fs.chmodSync);
21218 fs.fchmodSync = chmodFixSync(fs.fchmodSync);
21219 fs.lchmodSync = chmodFixSync(fs.lchmodSync);
21220 fs.stat = statFix(fs.stat);
21221 fs.fstat = statFix(fs.fstat);
21222 fs.lstat = statFix(fs.lstat);
21223 fs.statSync = statFixSync(fs.statSync);
21224 fs.fstatSync = statFixSync(fs.fstatSync);
21225 fs.lstatSync = statFixSync(fs.lstatSync);
21227 fs.lchmod = function(path, mode, cb) {
21229 process.nextTick(cb);
21231 fs.lchmodSync = function() {
21235 fs.lchown = function(path, uid, gid, cb) {
21237 process.nextTick(cb);
21239 fs.lchownSync = function() {
21242 if (platform === "win32") {
21243 fs.rename = function(fs$rename) {
21244 return function(from, to, cb) {
21245 var start = Date.now();
21247 fs$rename(from, to, function CB(er) {
21248 if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
21249 setTimeout(function() {
21250 fs.stat(to, function(stater, st) {
21251 if (stater && stater.code === "ENOENT")
21252 fs$rename(from, to, CB);
21267 fs.read = function(fs$read) {
21268 function read(fd, buffer, offset, length, position, callback_) {
21270 if (callback_ && typeof callback_ === "function") {
21271 var eagCounter = 0;
21272 callback = function(er, _, __) {
21273 if (er && er.code === "EAGAIN" && eagCounter < 10) {
21275 return fs$read.call(fs, fd, buffer, offset, length, position, callback);
21277 callback_.apply(this, arguments);
21280 return fs$read.call(fs, fd, buffer, offset, length, position, callback);
21282 read.__proto__ = fs$read;
21285 fs.readSync = function(fs$readSync) {
21286 return function(fd, buffer, offset, length, position) {
21287 var eagCounter = 0;
21290 return fs$readSync.call(fs, fd, buffer, offset, length, position);
21292 if (er.code === "EAGAIN" && eagCounter < 10) {
21301 function patchLchmod(fs2) {
21302 fs2.lchmod = function(path, mode, callback) {
21303 fs2.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
21309 fs2.fchmod(fd, mode, function(err2) {
21310 fs2.close(fd, function(err22) {
21312 callback(err2 || err22);
21317 fs2.lchmodSync = function(path, mode) {
21318 var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
21322 ret2 = fs2.fchmodSync(fd, mode);
21337 function patchLutimes(fs2) {
21338 if (constants.hasOwnProperty("O_SYMLINK")) {
21339 fs2.lutimes = function(path, at, mt, cb) {
21340 fs2.open(path, constants.O_SYMLINK, function(er, fd) {
21346 fs2.futimes(fd, at, mt, function(er2) {
21347 fs2.close(fd, function(er22) {
21354 fs2.lutimesSync = function(path, at, mt) {
21355 var fd = fs2.openSync(path, constants.O_SYMLINK);
21359 ret2 = fs2.futimesSync(fd, at, mt);
21374 fs2.lutimes = function(_a, _b, _c, cb) {
21376 process.nextTick(cb);
21378 fs2.lutimesSync = function() {
21382 function chmodFix(orig) {
21385 return function(target, mode, cb) {
21386 return orig.call(fs, target, mode, function(er) {
21390 cb.apply(this, arguments);
21394 function chmodFixSync(orig) {
21397 return function(target, mode) {
21399 return orig.call(fs, target, mode);
21401 if (!chownErOk(er))
21406 function chownFix(orig) {
21409 return function(target, uid, gid, cb) {
21410 return orig.call(fs, target, uid, gid, function(er) {
21414 cb.apply(this, arguments);
21418 function chownFixSync(orig) {
21421 return function(target, uid, gid) {
21423 return orig.call(fs, target, uid, gid);
21425 if (!chownErOk(er))
21430 function statFix(orig) {
21433 return function(target, options, cb) {
21434 if (typeof options === "function") {
21438 function callback(er, stats) {
21441 stats.uid += 4294967296;
21443 stats.gid += 4294967296;
21446 cb.apply(this, arguments);
21448 return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
21451 function statFixSync(orig) {
21454 return function(target, options) {
21455 var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
21457 stats.uid += 4294967296;
21459 stats.gid += 4294967296;
21463 function chownErOk(er) {
21466 if (er.code === "ENOSYS")
21468 var nonroot = !process.getuid || process.getuid() !== 0;
21470 if (er.code === "EINVAL" || er.code === "EPERM")
21478 // node_modules/graceful-fs/legacy-streams.js
21479 var require_legacy_streams = __commonJS((exports2, module2) => {
21480 var Stream = require("stream").Stream;
21481 module2.exports = legacy;
21482 function legacy(fs) {
21487 function ReadStream(path, options) {
21488 if (!(this instanceof ReadStream))
21489 return new ReadStream(path, options);
21494 this.readable = true;
21495 this.paused = false;
21498 this.bufferSize = 64 * 1024;
21499 options = options || {};
21500 var keys = Object.keys(options);
21501 for (var index = 0, length = keys.length; index < length; index++) {
21502 var key = keys[index];
21503 this[key] = options[key];
21506 this.setEncoding(this.encoding);
21507 if (this.start !== void 0) {
21508 if (typeof this.start !== "number") {
21509 throw TypeError("start must be a Number");
21511 if (this.end === void 0) {
21512 this.end = Infinity;
21513 } else if (typeof this.end !== "number") {
21514 throw TypeError("end must be a Number");
21516 if (this.start > this.end) {
21517 throw new Error("start must be <= end");
21519 this.pos = this.start;
21521 if (this.fd !== null) {
21522 process.nextTick(function() {
21527 fs.open(this.path, this.flags, this.mode, function(err, fd) {
21529 self2.emit("error", err);
21530 self2.readable = false;
21534 self2.emit("open", fd);
21538 function WriteStream(path, options) {
21539 if (!(this instanceof WriteStream))
21540 return new WriteStream(path, options);
21544 this.writable = true;
21546 this.encoding = "binary";
21548 this.bytesWritten = 0;
21549 options = options || {};
21550 var keys = Object.keys(options);
21551 for (var index = 0, length = keys.length; index < length; index++) {
21552 var key = keys[index];
21553 this[key] = options[key];
21555 if (this.start !== void 0) {
21556 if (typeof this.start !== "number") {
21557 throw TypeError("start must be a Number");
21559 if (this.start < 0) {
21560 throw new Error("start must be >= zero");
21562 this.pos = this.start;
21566 if (this.fd === null) {
21567 this._open = fs.open;
21568 this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
21575 // node_modules/graceful-fs/clone.js
21576 var require_clone = __commonJS((exports2, module2) => {
21578 module2.exports = clone;
21579 function clone(obj) {
21580 if (obj === null || typeof obj !== "object")
21582 if (obj instanceof Object)
21583 var copy = {__proto__: obj.__proto__};
21585 var copy = Object.create(null);
21586 Object.getOwnPropertyNames(obj).forEach(function(key) {
21587 Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
21593 // node_modules/graceful-fs/graceful-fs.js
21594 var require_graceful_fs = __commonJS((exports2, module2) => {
21595 var fs = require("fs");
21596 var polyfills = require_polyfills();
21597 var legacy = require_legacy_streams();
21598 var clone = require_clone();
21599 var util = require("util");
21601 var previousSymbol;
21602 if (typeof Symbol === "function" && typeof Symbol.for === "function") {
21603 gracefulQueue = Symbol.for("graceful-fs.queue");
21604 previousSymbol = Symbol.for("graceful-fs.previous");
21606 gracefulQueue = "___graceful-fs.queue";
21607 previousSymbol = "___graceful-fs.previous";
21611 function publishQueue(context, queue2) {
21612 Object.defineProperty(context, gracefulQueue, {
21620 debug = util.debuglog("gfs4");
21621 else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
21622 debug = function() {
21623 var m = util.format.apply(util, arguments);
21624 m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
21627 if (!fs[gracefulQueue]) {
21628 queue = global[gracefulQueue] || [];
21629 publishQueue(fs, queue);
21630 fs.close = function(fs$close) {
21631 function close(fd, cb) {
21632 return fs$close.call(fs, fd, function(err) {
21636 if (typeof cb === "function")
21637 cb.apply(this, arguments);
21640 Object.defineProperty(close, previousSymbol, {
21645 fs.closeSync = function(fs$closeSync) {
21646 function closeSync(fd) {
21647 fs$closeSync.apply(fs, arguments);
21650 Object.defineProperty(closeSync, previousSymbol, {
21651 value: fs$closeSync
21655 if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
21656 process.on("exit", function() {
21657 debug(fs[gracefulQueue]);
21658 require("assert").equal(fs[gracefulQueue].length, 0);
21663 if (!global[gracefulQueue]) {
21664 publishQueue(global, fs[gracefulQueue]);
21666 module2.exports = patch(clone(fs));
21667 if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
21668 module2.exports = patch(fs);
21669 fs.__patched = true;
21671 function patch(fs2) {
21673 fs2.gracefulify = patch;
21674 fs2.createReadStream = createReadStream;
21675 fs2.createWriteStream = createWriteStream;
21676 var fs$readFile = fs2.readFile;
21677 fs2.readFile = readFile;
21678 function readFile(path, options, cb) {
21679 if (typeof options === "function")
21680 cb = options, options = null;
21681 return go$readFile(path, options, cb);
21682 function go$readFile(path2, options2, cb2) {
21683 return fs$readFile(path2, options2, function(err) {
21684 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
21685 enqueue([go$readFile, [path2, options2, cb2]]);
21687 if (typeof cb2 === "function")
21688 cb2.apply(this, arguments);
21694 var fs$writeFile = fs2.writeFile;
21695 fs2.writeFile = writeFile;
21696 function writeFile(path, data, options, cb) {
21697 if (typeof options === "function")
21698 cb = options, options = null;
21699 return go$writeFile(path, data, options, cb);
21700 function go$writeFile(path2, data2, options2, cb2) {
21701 return fs$writeFile(path2, data2, options2, function(err) {
21702 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
21703 enqueue([go$writeFile, [path2, data2, options2, cb2]]);
21705 if (typeof cb2 === "function")
21706 cb2.apply(this, arguments);
21712 var fs$appendFile = fs2.appendFile;
21714 fs2.appendFile = appendFile;
21715 function appendFile(path, data, options, cb) {
21716 if (typeof options === "function")
21717 cb = options, options = null;
21718 return go$appendFile(path, data, options, cb);
21719 function go$appendFile(path2, data2, options2, cb2) {
21720 return fs$appendFile(path2, data2, options2, function(err) {
21721 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
21722 enqueue([go$appendFile, [path2, data2, options2, cb2]]);
21724 if (typeof cb2 === "function")
21725 cb2.apply(this, arguments);
21731 var fs$readdir = fs2.readdir;
21732 fs2.readdir = readdir;
21733 function readdir(path, options, cb) {
21735 if (typeof options !== "function") {
21736 args.push(options);
21740 args.push(go$readdir$cb);
21741 return go$readdir(args);
21742 function go$readdir$cb(err, files) {
21743 if (files && files.sort)
21745 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
21746 enqueue([go$readdir, [args]]);
21748 if (typeof cb === "function")
21749 cb.apply(this, arguments);
21754 function go$readdir(args) {
21755 return fs$readdir.apply(fs2, args);
21757 if (process.version.substr(0, 4) === "v0.8") {
21758 var legStreams = legacy(fs2);
21759 ReadStream = legStreams.ReadStream;
21760 WriteStream = legStreams.WriteStream;
21762 var fs$ReadStream = fs2.ReadStream;
21763 if (fs$ReadStream) {
21764 ReadStream.prototype = Object.create(fs$ReadStream.prototype);
21765 ReadStream.prototype.open = ReadStream$open;
21767 var fs$WriteStream = fs2.WriteStream;
21768 if (fs$WriteStream) {
21769 WriteStream.prototype = Object.create(fs$WriteStream.prototype);
21770 WriteStream.prototype.open = WriteStream$open;
21772 Object.defineProperty(fs2, "ReadStream", {
21776 set: function(val) {
21782 Object.defineProperty(fs2, "WriteStream", {
21784 return WriteStream;
21786 set: function(val) {
21792 var FileReadStream = ReadStream;
21793 Object.defineProperty(fs2, "FileReadStream", {
21795 return FileReadStream;
21797 set: function(val) {
21798 FileReadStream = val;
21803 var FileWriteStream = WriteStream;
21804 Object.defineProperty(fs2, "FileWriteStream", {
21806 return FileWriteStream;
21808 set: function(val) {
21809 FileWriteStream = val;
21814 function ReadStream(path, options) {
21815 if (this instanceof ReadStream)
21816 return fs$ReadStream.apply(this, arguments), this;
21818 return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
21820 function ReadStream$open() {
21822 open(that.path, that.flags, that.mode, function(err, fd) {
21824 if (that.autoClose)
21826 that.emit("error", err);
21829 that.emit("open", fd);
21834 function WriteStream(path, options) {
21835 if (this instanceof WriteStream)
21836 return fs$WriteStream.apply(this, arguments), this;
21838 return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
21840 function WriteStream$open() {
21842 open(that.path, that.flags, that.mode, function(err, fd) {
21845 that.emit("error", err);
21848 that.emit("open", fd);
21852 function createReadStream(path, options) {
21853 return new fs2.ReadStream(path, options);
21855 function createWriteStream(path, options) {
21856 return new fs2.WriteStream(path, options);
21858 var fs$open = fs2.open;
21860 function open(path, flags, mode, cb) {
21861 if (typeof mode === "function")
21862 cb = mode, mode = null;
21863 return go$open(path, flags, mode, cb);
21864 function go$open(path2, flags2, mode2, cb2) {
21865 return fs$open(path2, flags2, mode2, function(err, fd) {
21866 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
21867 enqueue([go$open, [path2, flags2, mode2, cb2]]);
21869 if (typeof cb2 === "function")
21870 cb2.apply(this, arguments);
21878 function enqueue(elem) {
21879 debug("ENQUEUE", elem[0].name, elem[1]);
21880 fs[gracefulQueue].push(elem);
21883 var elem = fs[gracefulQueue].shift();
21885 debug("RETRY", elem[0].name, elem[1]);
21886 elem[0].apply(null, elem[1]);
21891 // node_modules/fstream/lib/get-type.js
21892 var require_get_type = __commonJS((exports2, module2) => {
21893 module2.exports = getType;
21894 function getType(st) {
21906 if (st.type && types.indexOf(st.type) !== -1) {
21907 st[st.type] = true;
21910 for (var i = 0, l = types.length; i < l; i++) {
21912 var is = st[type] || st["is" + type];
21913 if (typeof is === "function")
21925 // node_modules/fstream/lib/link-reader.js
21926 var require_link_reader = __commonJS((exports2, module2) => {
21927 module2.exports = LinkReader;
21928 var fs = require_graceful_fs();
21929 var inherits2 = require_inherits();
21930 var Reader = require_reader();
21931 inherits2(LinkReader, Reader);
21932 function LinkReader(props) {
21934 if (!(self2 instanceof LinkReader)) {
21935 throw new Error("LinkReader must be called as constructor.");
21937 if (!(props.type === "Link" && props.Link || props.type === "SymbolicLink" && props.SymbolicLink)) {
21938 throw new Error("Non-link type " + props.type);
21940 Reader.call(self2, props);
21942 LinkReader.prototype._stat = function(currentStat) {
21944 fs.readlink(self2._path, function(er, linkpath) {
21946 return self2.error(er);
21947 self2.linkpath = self2.props.linkpath = linkpath;
21948 self2.emit("linkpath", linkpath);
21949 Reader.prototype._stat.call(self2, currentStat);
21952 LinkReader.prototype._read = function() {
21956 if (!self2._ended) {
21958 self2.emit("close");
21959 self2._ended = true;
21964 // node_modules/fstream/lib/dir-reader.js
21965 var require_dir_reader = __commonJS((exports2, module2) => {
21966 module2.exports = DirReader;
21967 var fs = require_graceful_fs();
21968 var inherits2 = require_inherits();
21969 var path = require("path");
21970 var Reader = require_reader();
21971 var assert = require("assert").ok;
21972 inherits2(DirReader, Reader);
21973 function DirReader(props) {
21975 if (!(self2 instanceof DirReader)) {
21976 throw new Error("DirReader must be called as constructor.");
21978 if (props.type !== "Directory" || !props.Directory) {
21979 throw new Error("Non-directory type " + props.type);
21981 self2.entries = null;
21983 self2._paused = false;
21984 self2._length = -1;
21986 this.sort = props.sort;
21988 Reader.call(this, props);
21990 DirReader.prototype._getEntries = function() {
21992 if (self2._gotEntries)
21994 self2._gotEntries = true;
21995 fs.readdir(self2._path, function(er, entries) {
21997 return self2.error(er);
21998 self2.entries = entries;
21999 self2.emit("entries", entries);
22001 self2.once("resume", processEntries);
22004 function processEntries() {
22005 self2._length = self2.entries.length;
22006 if (typeof self2.sort === "function") {
22007 self2.entries = self2.entries.sort(self2.sort.bind(self2));
22013 DirReader.prototype._read = function() {
22015 if (!self2.entries)
22016 return self2._getEntries();
22017 if (self2._paused || self2._currentEntry || self2._aborted) {
22021 if (self2._index >= self2.entries.length) {
22022 if (!self2._ended) {
22023 self2._ended = true;
22025 self2.emit("close");
22029 var p = path.resolve(self2._path, self2.entries[self2._index]);
22030 assert(p !== self2._path);
22031 assert(self2.entries[self2._index]);
22032 self2._currentEntry = p;
22033 fs[self2.props.follow ? "stat" : "lstat"](p, function(er, stat) {
22035 return self2.error(er);
22036 var who = self2._proxy || self2;
22038 stat.basename = path.basename(p);
22039 stat.dirname = path.dirname(p);
22040 var childProps = self2.getChildProps.call(who, stat);
22041 childProps.path = p;
22042 childProps.basename = path.basename(p);
22043 childProps.dirname = path.dirname(p);
22044 var entry = Reader(childProps, stat);
22045 self2._currentEntry = entry;
22046 entry.on("pause", function(who2) {
22047 if (!self2._paused && !entry._disowned) {
22051 entry.on("resume", function(who2) {
22052 if (self2._paused && !entry._disowned) {
22053 self2.resume(who2);
22056 entry.on("stat", function(props) {
22057 self2.emit("_entryStat", entry, props);
22058 if (entry._aborted)
22060 if (entry._paused) {
22061 entry.once("resume", function() {
22062 self2.emit("entryStat", entry, props);
22065 self2.emit("entryStat", entry, props);
22067 entry.on("ready", function EMITCHILD() {
22068 if (self2._paused) {
22069 entry.pause(self2);
22070 return self2.once("resume", EMITCHILD);
22072 if (entry.type === "Socket") {
22073 self2.emit("socket", entry);
22075 self2.emitEntry(entry);
22079 entry.on("close", onend);
22080 entry.on("disown", onend);
22085 self2.emit("childEnd", entry);
22086 self2.emit("entryEnd", entry);
22087 self2._currentEntry = null;
22088 if (!self2._paused) {
22092 entry.on("error", function(er2) {
22093 if (entry._swallowErrors) {
22096 entry.emit("close");
22098 self2.emit("error", er2);
22105 ].forEach(function(ev) {
22106 entry.on(ev, self2.emit.bind(self2, ev));
22110 DirReader.prototype.disown = function(entry) {
22111 entry.emit("beforeDisown");
22112 entry._disowned = true;
22113 entry.parent = entry.root = null;
22114 if (entry === this._currentEntry) {
22115 this._currentEntry = null;
22117 entry.emit("disown");
22119 DirReader.prototype.getChildProps = function() {
22121 depth: this.depth + 1,
22122 root: this.root || this,
22124 follow: this.follow,
22125 filter: this.filter,
22126 sort: this.props.sort,
22127 hardlinks: this.props.hardlinks
22130 DirReader.prototype.pause = function(who) {
22134 who = who || self2;
22135 self2._paused = true;
22136 if (self2._currentEntry && self2._currentEntry.pause) {
22137 self2._currentEntry.pause(who);
22139 self2.emit("pause", who);
22141 DirReader.prototype.resume = function(who) {
22143 if (!self2._paused)
22145 who = who || self2;
22146 self2._paused = false;
22147 self2.emit("resume", who);
22148 if (self2._paused) {
22151 if (self2._currentEntry) {
22152 if (self2._currentEntry.resume)
22153 self2._currentEntry.resume(who);
22157 DirReader.prototype.emitEntry = function(entry) {
22158 this.emit("entry", entry);
22159 this.emit("child", entry);
22163 // node_modules/fstream/lib/file-reader.js
22164 var require_file_reader = __commonJS((exports2, module2) => {
22165 module2.exports = FileReader;
22166 var fs = require_graceful_fs();
22167 var inherits2 = require_inherits();
22168 var Reader = require_reader();
22169 var EOF = {EOF: true};
22170 var CLOSE = {CLOSE: true};
22171 inherits2(FileReader, Reader);
22172 function FileReader(props) {
22174 if (!(self2 instanceof FileReader)) {
22175 throw new Error("FileReader must be called as constructor.");
22177 if (!(props.type === "Link" && props.Link || props.type === "File" && props.File)) {
22178 throw new Error("Non-file type " + props.type);
22180 self2._buffer = [];
22181 self2._bytesEmitted = 0;
22182 Reader.call(self2, props);
22184 FileReader.prototype._getStream = function() {
22186 var stream = self2._stream = fs.createReadStream(self2._path, self2.props);
22187 if (self2.props.blksize) {
22188 stream.bufferSize = self2.props.blksize;
22190 stream.on("open", self2.emit.bind(self2, "open"));
22191 stream.on("data", function(c) {
22192 self2._bytesEmitted += c.length;
22195 } else if (self2._paused || self2._buffer.length) {
22196 self2._buffer.push(c);
22199 self2.emit("data", c);
22201 stream.on("end", function() {
22202 if (self2._paused || self2._buffer.length) {
22203 self2._buffer.push(EOF);
22208 if (self2._bytesEmitted !== self2.props.size) {
22209 self2.error("Didn't get expected byte count\nexpect: " + self2.props.size + "\nactual: " + self2._bytesEmitted);
22212 stream.on("close", function() {
22213 if (self2._paused || self2._buffer.length) {
22214 self2._buffer.push(CLOSE);
22217 self2.emit("close");
22220 stream.on("error", function(e) {
22221 self2.emit("error", e);
22225 FileReader.prototype._read = function() {
22227 if (self2._paused) {
22230 if (!self2._stream) {
22231 return self2._getStream();
22233 if (self2._buffer.length) {
22234 var buf = self2._buffer;
22235 for (var i = 0, l = buf.length; i < l; i++) {
22239 } else if (c === CLOSE) {
22240 self2.emit("close");
22242 self2.emit("data", c);
22244 if (self2._paused) {
22245 self2._buffer = buf.slice(i);
22249 self2._buffer.length = 0;
22252 FileReader.prototype.pause = function(who) {
22256 who = who || self2;
22257 self2._paused = true;
22259 self2._stream.pause();
22260 self2.emit("pause", who);
22262 FileReader.prototype.resume = function(who) {
22264 if (!self2._paused)
22266 who = who || self2;
22267 self2.emit("resume", who);
22268 self2._paused = false;
22270 self2._stream.resume();
22275 // node_modules/fstream/lib/socket-reader.js
22276 var require_socket_reader = __commonJS((exports2, module2) => {
22277 module2.exports = SocketReader;
22278 var inherits2 = require_inherits();
22279 var Reader = require_reader();
22280 inherits2(SocketReader, Reader);
22281 function SocketReader(props) {
22283 if (!(self2 instanceof SocketReader)) {
22284 throw new Error("SocketReader must be called as constructor.");
22286 if (!(props.type === "Socket" && props.Socket)) {
22287 throw new Error("Non-socket type " + props.type);
22289 Reader.call(self2, props);
22291 SocketReader.prototype._read = function() {
22295 if (!self2._ended) {
22297 self2.emit("close");
22298 self2._ended = true;
22303 // node_modules/fstream/lib/proxy-reader.js
22304 var require_proxy_reader = __commonJS((exports2, module2) => {
22305 module2.exports = ProxyReader;
22306 var Reader = require_reader();
22307 var getType = require_get_type();
22308 var inherits2 = require_inherits();
22309 var fs = require_graceful_fs();
22310 inherits2(ProxyReader, Reader);
22311 function ProxyReader(props) {
22313 if (!(self2 instanceof ProxyReader)) {
22314 throw new Error("ProxyReader must be called as constructor.");
22316 self2.props = props;
22317 self2._buffer = [];
22318 self2.ready = false;
22319 Reader.call(self2, props);
22321 ProxyReader.prototype._stat = function() {
22323 var props = self2.props;
22324 var stat = props.follow ? "stat" : "lstat";
22325 fs[stat](props.path, function(er, current) {
22327 if (er || !current) {
22330 type = getType(current);
22332 props[type] = true;
22333 props.type = self2.type = type;
22334 self2._old = current;
22335 self2._addProxy(Reader(props, current));
22338 ProxyReader.prototype._addProxy = function(proxy) {
22340 if (self2._proxyTarget) {
22341 return self2.error("proxy already set");
22343 self2._proxyTarget = proxy;
22344 proxy._proxy = self2;
22357 ].forEach(function(ev) {
22358 proxy.on(ev, self2.emit.bind(self2, ev));
22360 self2.emit("proxy", proxy);
22361 proxy.on("ready", function() {
22362 self2.ready = true;
22363 self2.emit("ready");
22365 var calls = self2._buffer;
22366 self2._buffer.length = 0;
22367 calls.forEach(function(c) {
22368 proxy[c[0]].apply(proxy, c[1]);
22371 ProxyReader.prototype.pause = function() {
22372 return this._proxyTarget ? this._proxyTarget.pause() : false;
22374 ProxyReader.prototype.resume = function() {
22375 return this._proxyTarget ? this._proxyTarget.resume() : false;
22379 // node_modules/fstream/lib/reader.js
22380 var require_reader = __commonJS((exports2, module2) => {
22381 module2.exports = Reader;
22382 var fs = require_graceful_fs();
22383 var Stream = require("stream").Stream;
22384 var inherits2 = require_inherits();
22385 var path = require("path");
22386 var getType = require_get_type();
22387 var hardLinks = Reader.hardLinks = {};
22388 var Abstract = require_abstract();
22389 inherits2(Reader, Abstract);
22390 var LinkReader = require_link_reader();
22391 function Reader(props, currentStat) {
22393 if (!(self2 instanceof Reader))
22394 return new Reader(props, currentStat);
22395 if (typeof props === "string") {
22396 props = {path: props};
22400 if (props.type && typeof props.type === "function") {
22404 type = getType(props);
22405 ClassType = Reader;
22407 if (currentStat && !type) {
22408 type = getType(currentStat);
22409 props[type] = true;
22414 ClassType = require_dir_reader();
22418 ClassType = require_file_reader();
22420 case "SymbolicLink":
22421 ClassType = LinkReader;
22424 ClassType = require_socket_reader();
22427 ClassType = require_proxy_reader();
22430 if (!(self2 instanceof ClassType)) {
22431 return new ClassType(props);
22433 Abstract.call(self2);
22435 self2.error("Must provide a path", null, true);
22437 self2.readable = true;
22438 self2.writable = false;
22440 self2.props = props;
22441 self2.depth = props.depth = props.depth || 0;
22442 self2.parent = props.parent || null;
22443 self2.root = props.root || props.parent && props.parent.root || self2;
22444 self2._path = self2.path = path.resolve(props.path);
22445 if (process.platform === "win32") {
22446 self2.path = self2._path = self2.path.replace(/\?/g, "_");
22447 if (self2._path.length >= 260) {
22448 self2._swallowErrors = true;
22449 self2._path = "\\\\?\\" + self2.path.replace(/\//g, "\\");
22452 self2.basename = props.basename = path.basename(self2.path);
22453 self2.dirname = props.dirname = path.dirname(self2.path);
22454 props.parent = props.root = null;
22455 self2.size = props.size;
22456 self2.filter = typeof props.filter === "function" ? props.filter : null;
22457 if (props.sort === "alpha")
22458 props.sort = alphasort;
22459 self2._stat(currentStat);
22461 function alphasort(a, b) {
22462 return a === b ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 : a.toLowerCase() < b.toLowerCase() ? -1 : a > b ? 1 : -1;
22464 Reader.prototype._stat = function(currentStat) {
22466 var props = self2.props;
22467 var stat = props.follow ? "stat" : "lstat";
22469 process.nextTick(statCb.bind(null, null, currentStat));
22471 fs[stat](self2._path, statCb);
22472 function statCb(er, props_) {
22474 return self2.error(er);
22475 Object.keys(props_).forEach(function(k2) {
22476 props[k2] = props_[k2];
22478 if (self2.size !== void 0 && props.size !== self2.size) {
22479 return self2.error("incorrect size");
22481 self2.size = props.size;
22482 var type = getType(props);
22483 var handleHardlinks = props.hardlinks !== false;
22484 if (handleHardlinks && type !== "Directory" && props.nlink && props.nlink > 1) {
22485 var k = props.dev + ":" + props.ino;
22486 if (hardLinks[k] === self2._path || !hardLinks[k]) {
22487 hardLinks[k] = self2._path;
22489 type = self2.type = self2.props.type = "Link";
22490 self2.Link = self2.props.Link = true;
22491 self2.linkpath = self2.props.linkpath = hardLinks[k];
22492 self2._stat = self2._read = LinkReader.prototype._read;
22495 if (self2.type && self2.type !== type) {
22496 self2.error("Unexpected type: " + type);
22498 if (self2.filter) {
22499 var who = self2._proxy || self2;
22500 if (!self2.filter.call(who, who, props)) {
22501 if (!self2._disowned) {
22504 self2.emit("close");
22509 var events = ["_stat", "stat", "ready"];
22512 if (self2._aborted) {
22514 self2.emit("close");
22517 if (self2._paused && self2.type !== "Directory") {
22518 self2.once("resume", go);
22521 var ev = events[e++];
22523 return self2._read();
22525 self2.emit(ev, props);
22530 Reader.prototype.pipe = function(dest) {
22532 if (typeof dest.add === "function") {
22533 self2.on("entry", function(entry) {
22534 var ret2 = dest.add(entry);
22535 if (ret2 === false) {
22540 return Stream.prototype.pipe.apply(this, arguments);
22542 Reader.prototype.pause = function(who) {
22543 this._paused = true;
22545 this.emit("pause", who);
22547 this._stream.pause(who);
22549 Reader.prototype.resume = function(who) {
22550 this._paused = false;
22552 this.emit("resume", who);
22554 this._stream.resume(who);
22557 Reader.prototype._read = function() {
22558 this.error("Cannot read unknown type: " + this.type);
22562 // node_modules/fstream/node_modules/rimraf/rimraf.js
22563 var require_rimraf2 = __commonJS((exports2, module2) => {
22564 module2.exports = rimraf;
22565 rimraf.sync = rimrafSync;
22566 var assert = require("assert");
22567 var path = require("path");
22568 var fs = require("fs");
22571 glob = require_glob();
22574 var _0666 = parseInt("666", 8);
22575 var defaultGlobOpts = {
22580 var isWindows = process.platform === "win32";
22581 function defaults(options) {
22590 methods.forEach(function(m) {
22591 options[m] = options[m] || fs[m];
22593 options[m] = options[m] || fs[m];
22595 options.maxBusyTries = options.maxBusyTries || 3;
22596 options.emfileWait = options.emfileWait || 1e3;
22597 if (options.glob === false) {
22598 options.disableGlob = true;
22600 if (options.disableGlob !== true && glob === void 0) {
22601 throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");
22603 options.disableGlob = options.disableGlob || false;
22604 options.glob = options.glob || defaultGlobOpts;
22606 function rimraf(p, options, cb) {
22607 if (typeof options === "function") {
22611 assert(p, "rimraf: missing path");
22612 assert.equal(typeof p, "string", "rimraf: path should be a string");
22613 assert.equal(typeof cb, "function", "rimraf: callback function required");
22614 assert(options, "rimraf: invalid options argument provided");
22615 assert.equal(typeof options, "object", "rimraf: options should be object");
22618 var errState = null;
22620 if (options.disableGlob || !glob.hasMagic(p))
22621 return afterGlob(null, [p]);
22622 options.lstat(p, function(er, stat) {
22624 return afterGlob(null, [p]);
22625 glob(p, options.glob, afterGlob);
22627 function next(er) {
22628 errState = errState || er;
22632 function afterGlob(er, results) {
22635 n = results.length;
22638 results.forEach(function(p2) {
22639 rimraf_(p2, options, function CB(er2) {
22641 if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) {
22643 var time = busyTries * 100;
22644 return setTimeout(function() {
22645 rimraf_(p2, options, CB);
22648 if (er2.code === "EMFILE" && timeout < options.emfileWait) {
22649 return setTimeout(function() {
22650 rimraf_(p2, options, CB);
22653 if (er2.code === "ENOENT")
22662 function rimraf_(p, options, cb) {
22665 assert(typeof cb === "function");
22666 options.lstat(p, function(er, st) {
22667 if (er && er.code === "ENOENT")
22669 if (er && er.code === "EPERM" && isWindows)
22670 fixWinEPERM(p, options, er, cb);
22671 if (st && st.isDirectory())
22672 return rmdir(p, options, er, cb);
22673 options.unlink(p, function(er2) {
22675 if (er2.code === "ENOENT")
22677 if (er2.code === "EPERM")
22678 return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
22679 if (er2.code === "EISDIR")
22680 return rmdir(p, options, er2, cb);
22686 function fixWinEPERM(p, options, er, cb) {
22689 assert(typeof cb === "function");
22691 assert(er instanceof Error);
22692 options.chmod(p, _0666, function(er2) {
22694 cb(er2.code === "ENOENT" ? null : er);
22696 options.stat(p, function(er3, stats) {
22698 cb(er3.code === "ENOENT" ? null : er);
22699 else if (stats.isDirectory())
22700 rmdir(p, options, er, cb);
22702 options.unlink(p, cb);
22706 function fixWinEPERMSync(p, options, er) {
22710 assert(er instanceof Error);
22712 options.chmodSync(p, _0666);
22714 if (er2.code === "ENOENT")
22720 var stats = options.statSync(p);
22722 if (er3.code === "ENOENT")
22727 if (stats.isDirectory())
22728 rmdirSync(p, options, er);
22730 options.unlinkSync(p);
22732 function rmdir(p, options, originalEr, cb) {
22736 assert(originalEr instanceof Error);
22737 assert(typeof cb === "function");
22738 options.rmdir(p, function(er) {
22739 if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
22740 rmkids(p, options, cb);
22741 else if (er && er.code === "ENOTDIR")
22747 function rmkids(p, options, cb) {
22750 assert(typeof cb === "function");
22751 options.readdir(p, function(er, files) {
22754 var n = files.length;
22756 return options.rmdir(p, cb);
22758 files.forEach(function(f) {
22759 rimraf(path.join(p, f), options, function(er2) {
22763 return cb(errState = er2);
22765 options.rmdir(p, cb);
22770 function rimrafSync(p, options) {
22771 options = options || {};
22773 assert(p, "rimraf: missing path");
22774 assert.equal(typeof p, "string", "rimraf: path should be a string");
22775 assert(options, "rimraf: missing options");
22776 assert.equal(typeof options, "object", "rimraf: options should be object");
22778 if (options.disableGlob || !glob.hasMagic(p)) {
22782 options.lstatSync(p);
22785 results = glob.sync(p, options.glob);
22788 if (!results.length)
22790 for (var i = 0; i < results.length; i++) {
22791 var p = results[i];
22793 var st = options.lstatSync(p);
22795 if (er.code === "ENOENT")
22797 if (er.code === "EPERM" && isWindows)
22798 fixWinEPERMSync(p, options, er);
22801 if (st && st.isDirectory())
22802 rmdirSync(p, options, null);
22804 options.unlinkSync(p);
22806 if (er.code === "ENOENT")
22808 if (er.code === "EPERM")
22809 return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er);
22810 if (er.code !== "EISDIR")
22812 rmdirSync(p, options, er);
22816 function rmdirSync(p, options, originalEr) {
22820 assert(originalEr instanceof Error);
22822 options.rmdirSync(p);
22824 if (er.code === "ENOENT")
22826 if (er.code === "ENOTDIR")
22828 if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
22829 rmkidsSync(p, options);
22832 function rmkidsSync(p, options) {
22835 options.readdirSync(p).forEach(function(f) {
22836 rimrafSync(path.join(p, f), options);
22838 var retries = isWindows ? 100 : 1;
22843 var ret2 = options.rmdirSync(p, options);
22847 if (++i < retries && threw)
22854 // node_modules/mkdirp/index.js
22855 var require_mkdirp = __commonJS((exports2, module2) => {
22856 var path = require("path");
22857 var fs = require("fs");
22858 var _0777 = parseInt("0777", 8);
22859 module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
22860 function mkdirP(p, opts, f, made) {
22861 if (typeof opts === "function") {
22864 } else if (!opts || typeof opts !== "object") {
22865 opts = {mode: opts};
22867 var mode = opts.mode;
22868 var xfs = opts.fs || fs;
22869 if (mode === void 0) {
22874 var cb = f || function() {
22876 p = path.resolve(p);
22877 xfs.mkdir(p, mode, function(er) {
22880 return cb(null, made);
22884 if (path.dirname(p) === p)
22886 mkdirP(path.dirname(p), opts, function(er2, made2) {
22890 mkdirP(p, opts, cb, made2);
22894 xfs.stat(p, function(er2, stat) {
22895 if (er2 || !stat.isDirectory())
22904 mkdirP.sync = function sync(p, opts, made) {
22905 if (!opts || typeof opts !== "object") {
22906 opts = {mode: opts};
22908 var mode = opts.mode;
22909 var xfs = opts.fs || fs;
22910 if (mode === void 0) {
22915 p = path.resolve(p);
22917 xfs.mkdirSync(p, mode);
22920 switch (err0.code) {
22922 made = sync(path.dirname(p), opts, made);
22923 sync(p, opts, made);
22928 stat = xfs.statSync(p);
22932 if (!stat.isDirectory())
22941 // node_modules/fstream/lib/collect.js
22942 var require_collect = __commonJS((exports2, module2) => {
22943 module2.exports = collect;
22944 function collect(stream) {
22945 if (stream._collected)
22947 if (stream._paused)
22948 return stream.on("resume", collect.bind(null, stream));
22949 stream._collected = true;
22951 stream.on("data", save);
22952 stream.on("end", save);
22955 if (typeof b === "string")
22957 if (Buffer.isBuffer(b) && !b.length)
22961 stream.on("entry", saveEntry);
22962 var entryBuffer = [];
22963 function saveEntry(e) {
22965 entryBuffer.push(e);
22967 stream.on("proxy", proxyPause);
22968 function proxyPause(p) {
22971 stream.pipe = function(orig) {
22972 return function(dest) {
22974 (function unblockEntry() {
22975 var entry = entryBuffer[e++];
22978 entry.on("end", unblockEntry);
22982 stream.emit("entry", entry);
22984 function resume() {
22985 stream.removeListener("entry", saveEntry);
22986 stream.removeListener("data", save);
22987 stream.removeListener("end", save);
22988 stream.pipe = orig;
22991 buf.forEach(function(b) {
22993 stream.emit("data", b);
22995 stream.emit("end");
23005 // node_modules/fstream/lib/dir-writer.js
23006 var require_dir_writer = __commonJS((exports2, module2) => {
23007 module2.exports = DirWriter;
23008 var Writer = require_writer();
23009 var inherits2 = require_inherits();
23010 var mkdir = require_mkdirp();
23011 var path = require("path");
23012 var collect = require_collect();
23013 inherits2(DirWriter, Writer);
23014 function DirWriter(props) {
23016 if (!(self2 instanceof DirWriter)) {
23017 self2.error("DirWriter must be called as constructor.", null, true);
23019 if (props.type !== "Directory" || !props.Directory) {
23020 self2.error("Non-directory type " + props.type + " " + JSON.stringify(props), null, true);
23022 Writer.call(this, props);
23024 DirWriter.prototype._create = function() {
23026 mkdir(self2._path, Writer.dirmode, function(er) {
23028 return self2.error(er);
23029 self2.ready = true;
23030 self2.emit("ready");
23034 DirWriter.prototype.write = function() {
23037 DirWriter.prototype.end = function() {
23038 this._ended = true;
23041 DirWriter.prototype.add = function(entry) {
23044 if (!self2.ready || self2._currentEntry) {
23045 self2._buffer.push(entry);
23048 if (self2._ended) {
23049 return self2.error("add after end");
23051 self2._buffer.push(entry);
23053 return this._buffer.length === 0;
23055 DirWriter.prototype._process = function() {
23057 if (self2._processing)
23059 var entry = self2._buffer.shift();
23061 self2.emit("drain");
23066 self2._processing = true;
23067 self2.emit("entry", entry);
23071 pp = p._path || p.path;
23072 if (pp === self2.root._path || pp === self2._path || pp && pp.indexOf(self2._path) === 0) {
23073 self2._processing = false;
23074 if (entry._collected)
23076 return self2._process();
23082 root: self2.root || self2,
23084 depth: self2.depth + 1
23086 pp = entry._path || entry.path || entry.props.path;
23087 if (entry.parent) {
23088 pp = pp.substr(entry.parent._path.length + 1);
23090 props.path = path.join(self2.path, path.join("/", pp));
23091 props.filter = self2.filter;
23092 Object.keys(entry.props).forEach(function(k) {
23093 if (!props.hasOwnProperty(k)) {
23094 props[k] = entry.props[k];
23097 var child = self2._currentChild = new Writer(props);
23098 child.on("ready", function() {
23102 child.on("error", function(er) {
23103 if (child._swallowErrors) {
23106 child.emit("close");
23108 self2.emit("error", er);
23111 child.on("close", onend);
23117 self2._currentChild = null;
23118 self2._processing = false;
23124 // node_modules/fstream/lib/link-writer.js
23125 var require_link_writer = __commonJS((exports2, module2) => {
23126 module2.exports = LinkWriter;
23127 var fs = require_graceful_fs();
23128 var Writer = require_writer();
23129 var inherits2 = require_inherits();
23130 var path = require("path");
23131 var rimraf = require_rimraf2();
23132 inherits2(LinkWriter, Writer);
23133 function LinkWriter(props) {
23135 if (!(self2 instanceof LinkWriter)) {
23136 throw new Error("LinkWriter must be called as constructor.");
23138 if (!(props.type === "Link" && props.Link || props.type === "SymbolicLink" && props.SymbolicLink)) {
23139 throw new Error("Non-link type " + props.type);
23141 if (props.linkpath === "")
23142 props.linkpath = ".";
23143 if (!props.linkpath) {
23144 self2.error("Need linkpath property to create " + props.type);
23146 Writer.call(this, props);
23148 LinkWriter.prototype._create = function() {
23150 var hard = self2.type === "Link" || process.platform === "win32";
23151 var link = hard ? "link" : "symlink";
23152 var lp = hard ? path.resolve(self2.dirname, self2.linkpath) : self2.linkpath;
23154 return clobber(self2, lp, link);
23155 fs.readlink(self2._path, function(er, p) {
23157 return finish(self2);
23158 clobber(self2, lp, link);
23161 function clobber(self2, lp, link) {
23162 rimraf(self2._path, function(er) {
23164 return self2.error(er);
23165 create(self2, lp, link);
23168 function create(self2, lp, link) {
23169 fs[link](lp, self2._path, function(er) {
23171 if ((er.code === "ENOENT" || er.code === "EACCES" || er.code === "EPERM") && process.platform === "win32") {
23172 self2.ready = true;
23173 self2.emit("ready");
23175 self2.emit("close");
23176 self2.end = self2._finish = function() {
23179 return self2.error(er);
23184 function finish(self2) {
23185 self2.ready = true;
23186 self2.emit("ready");
23187 if (self2._ended && !self2._finished)
23190 LinkWriter.prototype.end = function() {
23191 this._ended = true;
23193 this._finished = true;
23199 // node_modules/fstream/lib/file-writer.js
23200 var require_file_writer = __commonJS((exports2, module2) => {
23201 module2.exports = FileWriter;
23202 var fs = require_graceful_fs();
23203 var Writer = require_writer();
23204 var inherits2 = require_inherits();
23206 inherits2(FileWriter, Writer);
23207 function FileWriter(props) {
23209 if (!(self2 instanceof FileWriter)) {
23210 throw new Error("FileWriter must be called as constructor.");
23212 if (props.type !== "File" || !props.File) {
23213 throw new Error("Non-file type " + props.type);
23215 self2._buffer = [];
23216 self2._bytesWritten = 0;
23217 Writer.call(this, props);
23219 FileWriter.prototype._create = function() {
23224 if (self2.props.flags)
23225 so.flags = self2.props.flags;
23226 so.mode = Writer.filemode;
23227 if (self2._old && self2._old.blksize)
23228 so.bufferSize = self2._old.blksize;
23229 self2._stream = fs.createWriteStream(self2._path, so);
23230 self2._stream.on("open", function() {
23231 self2.ready = true;
23232 self2._buffer.forEach(function(c) {
23234 self2._stream.end();
23236 self2._stream.write(c);
23238 self2.emit("ready");
23239 self2.emit("drain");
23241 self2._stream.on("error", function(er) {
23242 self2.emit("error", er);
23244 self2._stream.on("drain", function() {
23245 self2.emit("drain");
23247 self2._stream.on("close", function() {
23251 FileWriter.prototype.write = function(c) {
23253 self2._bytesWritten += c.length;
23254 if (!self2.ready) {
23255 if (!Buffer.isBuffer(c) && typeof c !== "string") {
23256 throw new Error("invalid write data");
23258 self2._buffer.push(c);
23261 var ret2 = self2._stream.write(c);
23262 if (ret2 === false && self2._stream._queue) {
23263 return self2._stream._queue.length <= 2;
23268 FileWriter.prototype.end = function(c) {
23272 if (!self2.ready) {
23273 self2._buffer.push(EOF);
23276 return self2._stream.end();
23278 FileWriter.prototype._finish = function() {
23280 if (typeof self2.size === "number" && self2._bytesWritten !== self2.size) {
23281 self2.error("Did not get expected byte count.\nexpect: " + self2.size + "\nactual: " + self2._bytesWritten);
23283 Writer.prototype._finish.call(self2);
23287 // node_modules/fstream/lib/proxy-writer.js
23288 var require_proxy_writer = __commonJS((exports2, module2) => {
23289 module2.exports = ProxyWriter;
23290 var Writer = require_writer();
23291 var getType = require_get_type();
23292 var inherits2 = require_inherits();
23293 var collect = require_collect();
23294 var fs = require("fs");
23295 inherits2(ProxyWriter, Writer);
23296 function ProxyWriter(props) {
23298 if (!(self2 instanceof ProxyWriter)) {
23299 throw new Error("ProxyWriter must be called as constructor.");
23301 self2.props = props;
23302 self2._needDrain = false;
23303 Writer.call(self2, props);
23305 ProxyWriter.prototype._stat = function() {
23307 var props = self2.props;
23308 var stat = props.follow ? "stat" : "lstat";
23309 fs[stat](props.path, function(er, current) {
23311 if (er || !current) {
23314 type = getType(current);
23316 props[type] = true;
23317 props.type = self2.type = type;
23318 self2._old = current;
23319 self2._addProxy(Writer(props, current));
23322 ProxyWriter.prototype._addProxy = function(proxy) {
23324 if (self2._proxy) {
23325 return self2.error("proxy already set");
23327 self2._proxy = proxy;
23335 ].forEach(function(ev) {
23336 proxy.on(ev, self2.emit.bind(self2, ev));
23338 self2.emit("proxy", proxy);
23339 var calls = self2._buffer;
23340 calls.forEach(function(c) {
23341 proxy[c[0]].apply(proxy, c[1]);
23343 self2._buffer.length = 0;
23344 if (self2._needsDrain)
23345 self2.emit("drain");
23347 ProxyWriter.prototype.add = function(entry) {
23349 if (!this._proxy) {
23350 this._buffer.push(["add", [entry]]);
23351 this._needDrain = true;
23354 return this._proxy.add(entry);
23356 ProxyWriter.prototype.write = function(c) {
23357 if (!this._proxy) {
23358 this._buffer.push(["write", [c]]);
23359 this._needDrain = true;
23362 return this._proxy.write(c);
23364 ProxyWriter.prototype.end = function(c) {
23365 if (!this._proxy) {
23366 this._buffer.push(["end", [c]]);
23369 return this._proxy.end(c);
23373 // node_modules/fstream/lib/writer.js
23374 var require_writer = __commonJS((exports2, module2) => {
23375 module2.exports = Writer;
23376 var fs = require_graceful_fs();
23377 var inherits2 = require_inherits();
23378 var rimraf = require_rimraf2();
23379 var mkdir = require_mkdirp();
23380 var path = require("path");
23381 var umask = process.platform === "win32" ? 0 : process.umask();
23382 var getType = require_get_type();
23383 var Abstract = require_abstract();
23384 inherits2(Writer, Abstract);
23385 Writer.dirmode = parseInt("0777", 8) & ~umask;
23386 Writer.filemode = parseInt("0666", 8) & ~umask;
23387 var DirWriter = require_dir_writer();
23388 var LinkWriter = require_link_writer();
23389 var FileWriter = require_file_writer();
23390 var ProxyWriter = require_proxy_writer();
23391 function Writer(props, current) {
23393 if (typeof props === "string") {
23394 props = {path: props};
23396 var type = getType(props);
23397 var ClassType = Writer;
23400 ClassType = DirWriter;
23403 ClassType = FileWriter;
23406 case "SymbolicLink":
23407 ClassType = LinkWriter;
23411 ClassType = ProxyWriter;
23414 if (!(self2 instanceof ClassType))
23415 return new ClassType(props);
23416 Abstract.call(self2);
23418 self2.error("Must provide a path", null, true);
23419 self2.type = props.type;
23420 self2.props = props;
23421 self2.depth = props.depth || 0;
23422 self2.clobber = props.clobber === false ? props.clobber : true;
23423 self2.parent = props.parent || null;
23424 self2.root = props.root || props.parent && props.parent.root || self2;
23425 self2._path = self2.path = path.resolve(props.path);
23426 if (process.platform === "win32") {
23427 self2.path = self2._path = self2.path.replace(/\?/g, "_");
23428 if (self2._path.length >= 260) {
23429 self2._swallowErrors = true;
23430 self2._path = "\\\\?\\" + self2.path.replace(/\//g, "\\");
23433 self2.basename = path.basename(props.path);
23434 self2.dirname = path.dirname(props.path);
23435 self2.linkpath = props.linkpath || null;
23436 props.parent = props.root = null;
23437 self2.size = props.size;
23438 if (typeof props.mode === "string") {
23439 props.mode = parseInt(props.mode, 8);
23441 self2.readable = false;
23442 self2.writable = true;
23443 self2._buffer = [];
23444 self2.ready = false;
23445 self2.filter = typeof props.filter === "function" ? props.filter : null;
23446 self2._stat(current);
23448 Writer.prototype._create = function() {
23450 fs[self2.props.follow ? "stat" : "lstat"](self2._path, function(er) {
23452 return self2.warn("Cannot create " + self2._path + "\nUnsupported type: " + self2.type, "ENOTSUP");
23457 Writer.prototype._stat = function(current) {
23459 var props = self2.props;
23460 var stat = props.follow ? "stat" : "lstat";
23461 var who = self2._proxy || self2;
23463 statCb(null, current);
23465 fs[stat](self2._path, statCb);
23466 function statCb(er, current2) {
23467 if (self2.filter && !self2.filter.call(who, who, current2)) {
23468 self2._aborted = true;
23470 self2.emit("close");
23473 if (er || !current2) {
23474 return create(self2);
23476 self2._old = current2;
23477 var currentType = getType(current2);
23478 if (currentType !== self2.type || self2.type === "File" && current2.nlink > 1) {
23479 return rimraf(self2._path, function(er2) {
23481 return self2.error(er2);
23489 function create(self2) {
23490 mkdir(path.dirname(self2._path), Writer.dirmode, function(er, made) {
23492 return self2.error(er);
23493 self2._madeDir = made;
23494 return self2._create();
23497 function endChmod(self2, want, current, path2, cb) {
23498 var wantMode = want.mode;
23499 var chmod = want.follow || self2.type !== "SymbolicLink" ? "chmod" : "lchmod";
23502 if (typeof wantMode !== "number")
23504 var curMode = current.mode & parseInt("0777", 8);
23505 wantMode = wantMode & parseInt("0777", 8);
23506 if (wantMode === curMode)
23508 fs[chmod](path2, wantMode, cb);
23510 function endChown(self2, want, current, path2, cb) {
23511 if (process.platform === "win32")
23513 if (!process.getuid || process.getuid() !== 0)
23515 if (typeof want.uid !== "number" && typeof want.gid !== "number")
23517 if (current.uid === want.uid && current.gid === want.gid)
23519 var chown = self2.props.follow || self2.type !== "SymbolicLink" ? "chown" : "lchown";
23522 if (typeof want.uid !== "number")
23523 want.uid = current.uid;
23524 if (typeof want.gid !== "number")
23525 want.gid = current.gid;
23526 fs[chown](path2, want.uid, want.gid, cb);
23528 function endUtimes(self2, want, current, path2, cb) {
23529 if (!fs.utimes || process.platform === "win32")
23531 var utimes = want.follow || self2.type !== "SymbolicLink" ? "utimes" : "lutimes";
23532 if (utimes === "lutimes" && !fs[utimes]) {
23537 var curA = current.atime;
23538 var curM = current.mtime;
23539 var meA = want.atime;
23540 var meM = want.mtime;
23541 if (meA === void 0)
23543 if (meM === void 0)
23546 meA = new Date(meA);
23548 meA = new Date(meM);
23549 if (meA.getTime() === curA.getTime() && meM.getTime() === curM.getTime())
23551 fs[utimes](path2, meA, meM, cb);
23553 Writer.prototype._finish = function() {
23555 if (self2._finishing)
23557 self2._finishing = true;
23559 var errState = null;
23562 self2._old.atime = new Date(0);
23563 self2._old.mtime = new Date(0);
23564 setProps(self2._old);
23566 var stat = self2.props.follow ? "stat" : "lstat";
23567 fs[stat](self2._path, function(er, current) {
23569 if (er.code === "ENOENT" && (self2.type === "Link" || self2.type === "SymbolicLink") && process.platform === "win32") {
23570 self2.ready = true;
23571 self2.emit("ready");
23573 self2.emit("close");
23574 self2.end = self2._finish = function() {
23578 return self2.error(er);
23580 setProps(self2._old = current);
23584 function setProps(current) {
23586 endChmod(self2, self2.props, current, self2._path, next("chmod"));
23587 endChown(self2, self2.props, current, self2._path, next("chown"));
23588 endUtimes(self2, self2.props, current, self2._path, next("utimes"));
23590 function next(what) {
23591 return function(er) {
23595 er.fstream_finish_call = what;
23596 return self2.error(errState = er);
23603 if (!self2._madeDir)
23606 endMadeDir(self2, self2._path, end);
23607 function end(er2) {
23609 er2.fstream_finish_call = "setupMadeDir";
23610 return self2.error(er2);
23613 self2.emit("close");
23618 function endMadeDir(self2, p, cb) {
23619 var made = self2._madeDir;
23620 var d = path.dirname(p);
23621 endMadeDir_(self2, d, function(er) {
23627 endMadeDir(self2, d, cb);
23630 function endMadeDir_(self2, p, cb) {
23632 Object.keys(self2.props).forEach(function(k) {
23633 dirProps[k] = self2.props[k];
23634 if (k === "mode" && self2.type !== "Directory") {
23635 dirProps[k] = dirProps[k] | parseInt("0111", 8);
23639 var errState = null;
23640 fs.stat(p, function(er, current) {
23642 return cb(errState = er);
23643 endChmod(self2, dirProps, current, p, next);
23644 endChown(self2, dirProps, current, p, next);
23645 endUtimes(self2, dirProps, current, p, next);
23647 function next(er) {
23651 return cb(errState = er);
23656 Writer.prototype.pipe = function() {
23657 this.error("Can't pipe from writable stream");
23659 Writer.prototype.add = function() {
23660 this.error("Can't add to non-Directory type");
23662 Writer.prototype.write = function() {
23665 function objectToString(d) {
23666 return Object.prototype.toString.call(d);
23668 function isDate(d) {
23669 return typeof d === "object" && objectToString(d) === "[object Date]";
23673 // node_modules/fstream/fstream.js
23674 var require_fstream = __commonJS((exports2) => {
23675 exports2.Abstract = require_abstract();
23676 exports2.Reader = require_reader();
23677 exports2.Writer = require_writer();
23679 Reader: require_file_reader(),
23680 Writer: require_file_writer()
23683 Reader: require_dir_reader(),
23684 Writer: require_dir_writer()
23687 Reader: require_link_reader(),
23688 Writer: require_link_writer()
23691 Reader: require_proxy_reader(),
23692 Writer: require_proxy_writer()
23694 exports2.Reader.Dir = exports2.DirReader = exports2.Dir.Reader;
23695 exports2.Reader.File = exports2.FileReader = exports2.File.Reader;
23696 exports2.Reader.Link = exports2.LinkReader = exports2.Link.Reader;
23697 exports2.Reader.Proxy = exports2.ProxyReader = exports2.Proxy.Reader;
23698 exports2.Writer.Dir = exports2.DirWriter = exports2.Dir.Writer;
23699 exports2.Writer.File = exports2.FileWriter = exports2.File.Writer;
23700 exports2.Writer.Link = exports2.LinkWriter = exports2.Link.Writer;
23701 exports2.Writer.Proxy = exports2.ProxyWriter = exports2.Proxy.Writer;
23702 exports2.collect = require_collect();
23705 // node_modules/unzipper/lib/extract.js
23706 var require_extract = __commonJS((exports2, module2) => {
23707 module2.exports = Extract;
23708 var Parse = require_parse3();
23709 var Writer = require_fstream().Writer;
23710 var path = require("path");
23711 var stream = require("stream");
23712 var duplexer2 = require_duplexer2();
23713 var Promise2 = require_bluebird();
23714 function Extract(opts) {
23715 opts.path = path.resolve(path.normalize(opts.path));
23716 var parser = new Parse(opts);
23717 var outStream = new stream.Writable({objectMode: true});
23718 outStream._write = function(entry, encoding, cb) {
23719 if (entry.type == "Directory")
23721 var extractPath = path.join(opts.path, entry.path);
23722 if (extractPath.indexOf(opts.path) != 0) {
23725 const writer = opts.getWriter ? opts.getWriter({path: extractPath}) : Writer({path: extractPath});
23726 entry.pipe(writer).on("error", cb).on("close", cb);
23728 var extract = duplexer2(parser, outStream);
23729 parser.once("crx-header", function(crxHeader) {
23730 extract.crxHeader = crxHeader;
23732 parser.pipe(outStream).on("finish", function() {
23733 extract.emit("close");
23735 extract.promise = function() {
23736 return new Promise2(function(resolve, reject) {
23737 extract.on("close", resolve);
23738 extract.on("error", reject);
23745 // node_modules/big-integer/BigInteger.js
23746 var require_BigInteger = __commonJS((exports2, module2) => {
23747 var bigInt = function(undefined2) {
23749 var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
23750 var supportsNativeBigInt = typeof BigInt === "function";
23751 function Integer(v, radix, alphabet, caseSensitive) {
23752 if (typeof v === "undefined")
23754 if (typeof radix !== "undefined")
23755 return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
23756 return parseValue(v);
23758 function BigInteger(value, sign) {
23759 this.value = value;
23761 this.isSmall = false;
23763 BigInteger.prototype = Object.create(Integer.prototype);
23764 function SmallInteger(value) {
23765 this.value = value;
23766 this.sign = value < 0;
23767 this.isSmall = true;
23769 SmallInteger.prototype = Object.create(Integer.prototype);
23770 function NativeBigInt(value) {
23771 this.value = value;
23773 NativeBigInt.prototype = Object.create(Integer.prototype);
23774 function isPrecise(n) {
23775 return -MAX_INT < n && n < MAX_INT;
23777 function smallToArray(n) {
23781 return [n % 1e7, Math.floor(n / 1e7)];
23782 return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
23784 function arrayToSmall(arr) {
23786 var length = arr.length;
23787 if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
23794 return arr[0] + arr[1] * BASE;
23796 return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
23803 while (v[--i2] === 0)
23807 function createArray(length) {
23808 var x = new Array(length);
23810 while (++i2 < length) {
23815 function truncate(n) {
23817 return Math.floor(n);
23818 return Math.ceil(n);
23820 function add(a, b) {
23821 var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE, sum, i2;
23822 for (i2 = 0; i2 < l_b; i2++) {
23823 sum = a[i2] + b[i2] + carry;
23824 carry = sum >= base ? 1 : 0;
23825 r[i2] = sum - carry * base;
23828 sum = a[i2] + carry;
23829 carry = sum === base ? 1 : 0;
23830 r[i2++] = sum - carry * base;
23836 function addAny(a, b) {
23837 if (a.length >= b.length)
23841 function addSmall(a, carry) {
23842 var l = a.length, r = new Array(l), base = BASE, sum, i2;
23843 for (i2 = 0; i2 < l; i2++) {
23844 sum = a[i2] - base + carry;
23845 carry = Math.floor(sum / base);
23846 r[i2] = sum - carry * base;
23849 while (carry > 0) {
23850 r[i2++] = carry % base;
23851 carry = Math.floor(carry / base);
23855 BigInteger.prototype.add = function(v) {
23856 var n = parseValue(v);
23857 if (this.sign !== n.sign) {
23858 return this.subtract(n.negate());
23860 var a = this.value, b = n.value;
23862 return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
23864 return new BigInteger(addAny(a, b), this.sign);
23866 BigInteger.prototype.plus = BigInteger.prototype.add;
23867 SmallInteger.prototype.add = function(v) {
23868 var n = parseValue(v);
23869 var a = this.value;
23870 if (a < 0 !== n.sign) {
23871 return this.subtract(n.negate());
23875 if (isPrecise(a + b))
23876 return new SmallInteger(a + b);
23877 b = smallToArray(Math.abs(b));
23879 return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
23881 SmallInteger.prototype.plus = SmallInteger.prototype.add;
23882 NativeBigInt.prototype.add = function(v) {
23883 return new NativeBigInt(this.value + parseValue(v).value);
23885 NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
23886 function subtract(a, b) {
23887 var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE, i2, difference;
23888 for (i2 = 0; i2 < b_l; i2++) {
23889 difference = a[i2] - borrow - b[i2];
23890 if (difference < 0) {
23891 difference += base;
23895 r[i2] = difference;
23897 for (i2 = b_l; i2 < a_l; i2++) {
23898 difference = a[i2] - borrow;
23899 if (difference < 0)
23900 difference += base;
23902 r[i2++] = difference;
23905 r[i2] = difference;
23907 for (; i2 < a_l; i2++) {
23913 function subtractAny(a, b, sign) {
23915 if (compareAbs(a, b) >= 0) {
23916 value = subtract(a, b);
23918 value = subtract(b, a);
23921 value = arrayToSmall(value);
23922 if (typeof value === "number") {
23925 return new SmallInteger(value);
23927 return new BigInteger(value, sign);
23929 function subtractSmall(a, b, sign) {
23930 var l = a.length, r = new Array(l), carry = -b, base = BASE, i2, difference;
23931 for (i2 = 0; i2 < l; i2++) {
23932 difference = a[i2] + carry;
23933 carry = Math.floor(difference / base);
23934 difference %= base;
23935 r[i2] = difference < 0 ? difference + base : difference;
23937 r = arrayToSmall(r);
23938 if (typeof r === "number") {
23941 return new SmallInteger(r);
23943 return new BigInteger(r, sign);
23945 BigInteger.prototype.subtract = function(v) {
23946 var n = parseValue(v);
23947 if (this.sign !== n.sign) {
23948 return this.add(n.negate());
23950 var a = this.value, b = n.value;
23952 return subtractSmall(a, Math.abs(b), this.sign);
23953 return subtractAny(a, b, this.sign);
23955 BigInteger.prototype.minus = BigInteger.prototype.subtract;
23956 SmallInteger.prototype.subtract = function(v) {
23957 var n = parseValue(v);
23958 var a = this.value;
23959 if (a < 0 !== n.sign) {
23960 return this.add(n.negate());
23964 return new SmallInteger(a - b);
23966 return subtractSmall(b, Math.abs(a), a >= 0);
23968 SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
23969 NativeBigInt.prototype.subtract = function(v) {
23970 return new NativeBigInt(this.value - parseValue(v).value);
23972 NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
23973 BigInteger.prototype.negate = function() {
23974 return new BigInteger(this.value, !this.sign);
23976 SmallInteger.prototype.negate = function() {
23977 var sign = this.sign;
23978 var small = new SmallInteger(-this.value);
23979 small.sign = !sign;
23982 NativeBigInt.prototype.negate = function() {
23983 return new NativeBigInt(-this.value);
23985 BigInteger.prototype.abs = function() {
23986 return new BigInteger(this.value, false);
23988 SmallInteger.prototype.abs = function() {
23989 return new SmallInteger(Math.abs(this.value));
23991 NativeBigInt.prototype.abs = function() {
23992 return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
23994 function multiplyLong(a, b) {
23995 var a_l = a.length, b_l = b.length, l = a_l + b_l, r = createArray(l), base = BASE, product, carry, i2, a_i, b_j;
23996 for (i2 = 0; i2 < a_l; ++i2) {
23998 for (var j = 0; j < b_l; ++j) {
24000 product = a_i * b_j + r[i2 + j];
24001 carry = Math.floor(product / base);
24002 r[i2 + j] = product - carry * base;
24003 r[i2 + j + 1] += carry;
24009 function multiplySmall(a, b) {
24010 var l = a.length, r = new Array(l), base = BASE, carry = 0, product, i2;
24011 for (i2 = 0; i2 < l; i2++) {
24012 product = a[i2] * b + carry;
24013 carry = Math.floor(product / base);
24014 r[i2] = product - carry * base;
24016 while (carry > 0) {
24017 r[i2++] = carry % base;
24018 carry = Math.floor(carry / base);
24022 function shiftLeft(x, n) {
24026 return r.concat(x);
24028 function multiplyKaratsuba(x, y) {
24029 var n = Math.max(x.length, y.length);
24031 return multiplyLong(x, y);
24032 n = Math.ceil(n / 2);
24033 var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n);
24034 var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
24035 var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
24039 function useKaratsuba(l1, l2) {
24040 return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;
24042 BigInteger.prototype.multiply = function(v) {
24043 var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs;
24050 return this.negate();
24053 return new BigInteger(multiplySmall(a, abs), sign);
24055 b = smallToArray(abs);
24057 if (useKaratsuba(a.length, b.length))
24058 return new BigInteger(multiplyKaratsuba(a, b), sign);
24059 return new BigInteger(multiplyLong(a, b), sign);
24061 BigInteger.prototype.times = BigInteger.prototype.multiply;
24062 function multiplySmallAndArray(a, b, sign) {
24064 return new BigInteger(multiplySmall(b, a), sign);
24066 return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
24068 SmallInteger.prototype._multiplyBySmall = function(a) {
24069 if (isPrecise(a.value * this.value)) {
24070 return new SmallInteger(a.value * this.value);
24072 return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
24074 BigInteger.prototype._multiplyBySmall = function(a) {
24079 if (a.value === -1)
24080 return this.negate();
24081 return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
24083 SmallInteger.prototype.multiply = function(v) {
24084 return parseValue(v)._multiplyBySmall(this);
24086 SmallInteger.prototype.times = SmallInteger.prototype.multiply;
24087 NativeBigInt.prototype.multiply = function(v) {
24088 return new NativeBigInt(this.value * parseValue(v).value);
24090 NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
24091 function square(a) {
24092 var l = a.length, r = createArray(l + l), base = BASE, product, carry, i2, a_i, a_j;
24093 for (i2 = 0; i2 < l; i2++) {
24095 carry = 0 - a_i * a_i;
24096 for (var j = i2; j < l; j++) {
24098 product = 2 * (a_i * a_j) + r[i2 + j] + carry;
24099 carry = Math.floor(product / base);
24100 r[i2 + j] = product - carry * base;
24107 BigInteger.prototype.square = function() {
24108 return new BigInteger(square(this.value), false);
24110 SmallInteger.prototype.square = function() {
24111 var value = this.value * this.value;
24112 if (isPrecise(value))
24113 return new SmallInteger(value);
24114 return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
24116 NativeBigInt.prototype.square = function(v) {
24117 return new NativeBigInt(this.value * this.value);
24119 function divMod1(a, b) {
24120 var a_l = a.length, b_l = b.length, base = BASE, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i2, l, q;
24121 if (remainder.length <= a_l)
24124 divisorMostSignificantDigit = divisor[b_l - 1];
24125 for (shift = a_l - b_l; shift >= 0; shift--) {
24126 quotientDigit = base - 1;
24127 if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
24128 quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
24132 l = divisor.length;
24133 for (i2 = 0; i2 < l; i2++) {
24134 carry += quotientDigit * divisor[i2];
24135 q = Math.floor(carry / base);
24136 borrow += remainder[shift + i2] - (carry - q * base);
24139 remainder[shift + i2] = borrow + base;
24142 remainder[shift + i2] = borrow;
24146 while (borrow !== 0) {
24147 quotientDigit -= 1;
24149 for (i2 = 0; i2 < l; i2++) {
24150 carry += remainder[shift + i2] - base + divisor[i2];
24152 remainder[shift + i2] = carry + base;
24155 remainder[shift + i2] = carry;
24161 result[shift] = quotientDigit;
24163 remainder = divModSmall(remainder, lambda)[0];
24164 return [arrayToSmall(result), arrayToSmall(remainder)];
24166 function divMod2(a, b) {
24167 var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE, guess, xlen, highx, highy, check;
24169 part.unshift(a[--a_l]);
24171 if (compareAbs(part, b) < 0) {
24175 xlen = part.length;
24176 highx = part[xlen - 1] * base + part[xlen - 2];
24177 highy = b[b_l - 1] * base + b[b_l - 2];
24179 highx = (highx + 1) * base;
24181 guess = Math.ceil(highx / highy);
24183 check = multiplySmall(b, guess);
24184 if (compareAbs(check, part) <= 0)
24188 result.push(guess);
24189 part = subtract(part, check);
24192 return [arrayToSmall(result), arrayToSmall(part)];
24194 function divModSmall(value, lambda) {
24195 var length = value.length, quotient = createArray(length), base = BASE, i2, q, remainder, divisor;
24197 for (i2 = length - 1; i2 >= 0; --i2) {
24198 divisor = remainder * base + value[i2];
24199 q = truncate(divisor / lambda);
24200 remainder = divisor - q * lambda;
24201 quotient[i2] = q | 0;
24203 return [quotient, remainder | 0];
24205 function divModAny(self2, v) {
24206 var value, n = parseValue(v);
24207 if (supportsNativeBigInt) {
24208 return [new NativeBigInt(self2.value / n.value), new NativeBigInt(self2.value % n.value)];
24210 var a = self2.value, b = n.value;
24213 throw new Error("Cannot divide by zero");
24214 if (self2.isSmall) {
24216 return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
24218 return [Integer[0], self2];
24222 return [self2, Integer[0]];
24224 return [self2.negate(), Integer[0]];
24225 var abs = Math.abs(b);
24227 value = divModSmall(a, abs);
24228 quotient = arrayToSmall(value[0]);
24229 var remainder = value[1];
24231 remainder = -remainder;
24232 if (typeof quotient === "number") {
24233 if (self2.sign !== n.sign)
24234 quotient = -quotient;
24235 return [new SmallInteger(quotient), new SmallInteger(remainder)];
24237 return [new BigInteger(quotient, self2.sign !== n.sign), new SmallInteger(remainder)];
24239 b = smallToArray(abs);
24241 var comparison = compareAbs(a, b);
24242 if (comparison === -1)
24243 return [Integer[0], self2];
24244 if (comparison === 0)
24245 return [Integer[self2.sign === n.sign ? 1 : -1], Integer[0]];
24246 if (a.length + b.length <= 200)
24247 value = divMod1(a, b);
24249 value = divMod2(a, b);
24250 quotient = value[0];
24251 var qSign = self2.sign !== n.sign, mod = value[1], mSign = self2.sign;
24252 if (typeof quotient === "number") {
24254 quotient = -quotient;
24255 quotient = new SmallInteger(quotient);
24257 quotient = new BigInteger(quotient, qSign);
24258 if (typeof mod === "number") {
24261 mod = new SmallInteger(mod);
24263 mod = new BigInteger(mod, mSign);
24264 return [quotient, mod];
24266 BigInteger.prototype.divmod = function(v) {
24267 var result = divModAny(this, v);
24269 quotient: result[0],
24270 remainder: result[1]
24273 NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
24274 BigInteger.prototype.divide = function(v) {
24275 return divModAny(this, v)[0];
24277 NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v) {
24278 return new NativeBigInt(this.value / parseValue(v).value);
24280 SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
24281 BigInteger.prototype.mod = function(v) {
24282 return divModAny(this, v)[1];
24284 NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v) {
24285 return new NativeBigInt(this.value % parseValue(v).value);
24287 SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
24288 BigInteger.prototype.pow = function(v) {
24289 var n = parseValue(v), a = this.value, b = n.value, value, x, y;
24297 return n.isEven() ? Integer[1] : Integer[-1];
24302 throw new Error("The exponent " + n.toString() + " is too large.");
24303 if (this.isSmall) {
24304 if (isPrecise(value = Math.pow(a, b)))
24305 return new SmallInteger(truncate(value));
24321 SmallInteger.prototype.pow = BigInteger.prototype.pow;
24322 NativeBigInt.prototype.pow = function(v) {
24323 var n = parseValue(v);
24324 var a = this.value, b = n.value;
24325 var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
24332 if (a === BigInt(-1))
24333 return n.isEven() ? Integer[1] : Integer[-1];
24334 if (n.isNegative())
24335 return new NativeBigInt(_0);
24337 var y = Integer[1];
24339 if ((b & _1) === _1) {
24350 BigInteger.prototype.modPow = function(exp, mod) {
24351 exp = parseValue(exp);
24352 mod = parseValue(mod);
24354 throw new Error("Cannot take modPow with modulus 0");
24355 var r = Integer[1], base = this.mod(mod);
24356 if (exp.isNegative()) {
24357 exp = exp.multiply(Integer[-1]);
24358 base = base.modInv(mod);
24360 while (exp.isPositive()) {
24364 r = r.multiply(base).mod(mod);
24365 exp = exp.divide(2);
24366 base = base.square().mod(mod);
24370 NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
24371 function compareAbs(a, b) {
24372 if (a.length !== b.length) {
24373 return a.length > b.length ? 1 : -1;
24375 for (var i2 = a.length - 1; i2 >= 0; i2--) {
24376 if (a[i2] !== b[i2])
24377 return a[i2] > b[i2] ? 1 : -1;
24381 BigInteger.prototype.compareAbs = function(v) {
24382 var n = parseValue(v), a = this.value, b = n.value;
24385 return compareAbs(a, b);
24387 SmallInteger.prototype.compareAbs = function(v) {
24388 var n = parseValue(v), a = Math.abs(this.value), b = n.value;
24391 return a === b ? 0 : a > b ? 1 : -1;
24395 NativeBigInt.prototype.compareAbs = function(v) {
24396 var a = this.value;
24397 var b = parseValue(v).value;
24398 a = a >= 0 ? a : -a;
24399 b = b >= 0 ? b : -b;
24400 return a === b ? 0 : a > b ? 1 : -1;
24402 BigInteger.prototype.compare = function(v) {
24403 if (v === Infinity) {
24406 if (v === -Infinity) {
24409 var n = parseValue(v), a = this.value, b = n.value;
24410 if (this.sign !== n.sign) {
24411 return n.sign ? 1 : -1;
24414 return this.sign ? -1 : 1;
24416 return compareAbs(a, b) * (this.sign ? -1 : 1);
24418 BigInteger.prototype.compareTo = BigInteger.prototype.compare;
24419 SmallInteger.prototype.compare = function(v) {
24420 if (v === Infinity) {
24423 if (v === -Infinity) {
24426 var n = parseValue(v), a = this.value, b = n.value;
24428 return a == b ? 0 : a > b ? 1 : -1;
24430 if (a < 0 !== n.sign) {
24431 return a < 0 ? -1 : 1;
24433 return a < 0 ? 1 : -1;
24435 SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
24436 NativeBigInt.prototype.compare = function(v) {
24437 if (v === Infinity) {
24440 if (v === -Infinity) {
24443 var a = this.value;
24444 var b = parseValue(v).value;
24445 return a === b ? 0 : a > b ? 1 : -1;
24447 NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
24448 BigInteger.prototype.equals = function(v) {
24449 return this.compare(v) === 0;
24451 NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
24452 BigInteger.prototype.notEquals = function(v) {
24453 return this.compare(v) !== 0;
24455 NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
24456 BigInteger.prototype.greater = function(v) {
24457 return this.compare(v) > 0;
24459 NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
24460 BigInteger.prototype.lesser = function(v) {
24461 return this.compare(v) < 0;
24463 NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
24464 BigInteger.prototype.greaterOrEquals = function(v) {
24465 return this.compare(v) >= 0;
24467 NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
24468 BigInteger.prototype.lesserOrEquals = function(v) {
24469 return this.compare(v) <= 0;
24471 NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
24472 BigInteger.prototype.isEven = function() {
24473 return (this.value[0] & 1) === 0;
24475 SmallInteger.prototype.isEven = function() {
24476 return (this.value & 1) === 0;
24478 NativeBigInt.prototype.isEven = function() {
24479 return (this.value & BigInt(1)) === BigInt(0);
24481 BigInteger.prototype.isOdd = function() {
24482 return (this.value[0] & 1) === 1;
24484 SmallInteger.prototype.isOdd = function() {
24485 return (this.value & 1) === 1;
24487 NativeBigInt.prototype.isOdd = function() {
24488 return (this.value & BigInt(1)) === BigInt(1);
24490 BigInteger.prototype.isPositive = function() {
24493 SmallInteger.prototype.isPositive = function() {
24494 return this.value > 0;
24496 NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
24497 BigInteger.prototype.isNegative = function() {
24500 SmallInteger.prototype.isNegative = function() {
24501 return this.value < 0;
24503 NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
24504 BigInteger.prototype.isUnit = function() {
24507 SmallInteger.prototype.isUnit = function() {
24508 return Math.abs(this.value) === 1;
24510 NativeBigInt.prototype.isUnit = function() {
24511 return this.abs().value === BigInt(1);
24513 BigInteger.prototype.isZero = function() {
24516 SmallInteger.prototype.isZero = function() {
24517 return this.value === 0;
24519 NativeBigInt.prototype.isZero = function() {
24520 return this.value === BigInt(0);
24522 BigInteger.prototype.isDivisibleBy = function(v) {
24523 var n = parseValue(v);
24528 if (n.compareAbs(2) === 0)
24529 return this.isEven();
24530 return this.mod(n).isZero();
24532 NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
24533 function isBasicPrime(v) {
24537 if (n.equals(2) || n.equals(3) || n.equals(5))
24539 if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5))
24544 function millerRabinTest(n, a) {
24545 var nPrev = n.prev(), b = nPrev, r = 0, d, t, i2, x;
24547 b = b.divide(2), r++;
24549 for (i2 = 0; i2 < a.length; i2++) {
24550 if (n.lesser(a[i2]))
24552 x = bigInt(a[i2]).modPow(b, n);
24553 if (x.isUnit() || x.equals(nPrev))
24555 for (d = r - 1; d != 0; d--) {
24556 x = x.square().mod(n);
24559 if (x.equals(nPrev))
24566 BigInteger.prototype.isPrime = function(strict) {
24567 var isPrime = isBasicPrime(this);
24568 if (isPrime !== undefined2)
24570 var n = this.abs();
24571 var bits = n.bitLength();
24573 return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
24574 var logN = Math.log(2) * bits.toJSNumber();
24575 var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);
24576 for (var a = [], i2 = 0; i2 < t; i2++) {
24577 a.push(bigInt(i2 + 2));
24579 return millerRabinTest(n, a);
24581 NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
24582 BigInteger.prototype.isProbablePrime = function(iterations, rng) {
24583 var isPrime = isBasicPrime(this);
24584 if (isPrime !== undefined2)
24586 var n = this.abs();
24587 var t = iterations === undefined2 ? 5 : iterations;
24588 for (var a = [], i2 = 0; i2 < t; i2++) {
24589 a.push(bigInt.randBetween(2, n.minus(2), rng));
24591 return millerRabinTest(n, a);
24593 NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
24594 BigInteger.prototype.modInv = function(n) {
24595 var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
24596 while (!newR.isZero()) {
24597 q = r.divide(newR);
24602 newT = lastT.subtract(q.multiply(newT));
24603 newR = lastR.subtract(q.multiply(newR));
24606 throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
24607 if (t.compare(0) === -1) {
24610 if (this.isNegative()) {
24615 NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
24616 BigInteger.prototype.next = function() {
24617 var value = this.value;
24619 return subtractSmall(value, 1, this.sign);
24621 return new BigInteger(addSmall(value, 1), this.sign);
24623 SmallInteger.prototype.next = function() {
24624 var value = this.value;
24625 if (value + 1 < MAX_INT)
24626 return new SmallInteger(value + 1);
24627 return new BigInteger(MAX_INT_ARR, false);
24629 NativeBigInt.prototype.next = function() {
24630 return new NativeBigInt(this.value + BigInt(1));
24632 BigInteger.prototype.prev = function() {
24633 var value = this.value;
24635 return new BigInteger(addSmall(value, 1), true);
24637 return subtractSmall(value, 1, this.sign);
24639 SmallInteger.prototype.prev = function() {
24640 var value = this.value;
24641 if (value - 1 > -MAX_INT)
24642 return new SmallInteger(value - 1);
24643 return new BigInteger(MAX_INT_ARR, true);
24645 NativeBigInt.prototype.prev = function() {
24646 return new NativeBigInt(this.value - BigInt(1));
24648 var powersOfTwo = [1];
24649 while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE)
24650 powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
24651 var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
24652 function shift_isSmall(n) {
24653 return Math.abs(n) <= BASE;
24655 BigInteger.prototype.shiftLeft = function(v) {
24656 var n = parseValue(v).toJSNumber();
24657 if (!shift_isSmall(n)) {
24658 throw new Error(String(n) + " is too large for shifting.");
24661 return this.shiftRight(-n);
24663 if (result.isZero())
24665 while (n >= powers2Length) {
24666 result = result.multiply(highestPower2);
24667 n -= powers2Length - 1;
24669 return result.multiply(powersOfTwo[n]);
24671 NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
24672 BigInteger.prototype.shiftRight = function(v) {
24674 var n = parseValue(v).toJSNumber();
24675 if (!shift_isSmall(n)) {
24676 throw new Error(String(n) + " is too large for shifting.");
24679 return this.shiftLeft(-n);
24681 while (n >= powers2Length) {
24682 if (result.isZero() || result.isNegative() && result.isUnit())
24684 remQuo = divModAny(result, highestPower2);
24685 result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
24686 n -= powers2Length - 1;
24688 remQuo = divModAny(result, powersOfTwo[n]);
24689 return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
24691 NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
24692 function bitwise(x, y, fn) {
24694 var xSign = x.isNegative(), ySign = y.isNegative();
24695 var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y;
24696 var xDigit = 0, yDigit = 0;
24697 var xDivMod = null, yDivMod = null;
24699 while (!xRem.isZero() || !yRem.isZero()) {
24700 xDivMod = divModAny(xRem, highestPower2);
24701 xDigit = xDivMod[1].toJSNumber();
24703 xDigit = highestPower2 - 1 - xDigit;
24705 yDivMod = divModAny(yRem, highestPower2);
24706 yDigit = yDivMod[1].toJSNumber();
24708 yDigit = highestPower2 - 1 - yDigit;
24712 result.push(fn(xDigit, yDigit));
24714 var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
24715 for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) {
24716 sum = sum.multiply(highestPower2).add(bigInt(result[i2]));
24720 BigInteger.prototype.not = function() {
24721 return this.negate().prev();
24723 NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
24724 BigInteger.prototype.and = function(n) {
24725 return bitwise(this, n, function(a, b) {
24729 NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
24730 BigInteger.prototype.or = function(n) {
24731 return bitwise(this, n, function(a, b) {
24735 NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
24736 BigInteger.prototype.xor = function(n) {
24737 return bitwise(this, n, function(a, b) {
24741 NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
24742 var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
24743 function roughLOB(n) {
24744 var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE | LOBMASK_BI;
24747 function integerLogarithm(value, base) {
24748 if (base.compareTo(value) <= 0) {
24749 var tmp = integerLogarithm(value, base.square(base));
24752 var t = p.multiply(base);
24753 return t.compareTo(value) <= 0 ? {p: t, e: e * 2 + 1} : {p, e: e * 2};
24755 return {p: bigInt(1), e: 0};
24757 BigInteger.prototype.bitLength = function() {
24759 if (n.compareTo(bigInt(0)) < 0) {
24760 n = n.negate().subtract(bigInt(1));
24762 if (n.compareTo(bigInt(0)) === 0) {
24765 return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
24767 NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
24768 function max(a, b) {
24771 return a.greater(b) ? a : b;
24773 function min(a, b) {
24776 return a.lesser(b) ? a : b;
24778 function gcd(a, b) {
24779 a = parseValue(a).abs();
24780 b = parseValue(b).abs();
24787 var c = Integer[1], d, t;
24788 while (a.isEven() && b.isEven()) {
24789 d = min(roughLOB(a), roughLOB(b));
24794 while (a.isEven()) {
24795 a = a.divide(roughLOB(a));
24798 while (b.isEven()) {
24799 b = b.divide(roughLOB(b));
24801 if (a.greater(b)) {
24807 } while (!b.isZero());
24808 return c.isUnit() ? a : a.multiply(c);
24810 function lcm(a, b) {
24811 a = parseValue(a).abs();
24812 b = parseValue(b).abs();
24813 return a.divide(gcd(a, b)).multiply(b);
24815 function randBetween(a, b, rng) {
24818 var usedRNG = rng || Math.random;
24819 var low = min(a, b), high = max(a, b);
24820 var range = high.subtract(low).add(1);
24822 return low.add(Math.floor(usedRNG() * range));
24823 var digits = toBase(range, BASE).value;
24824 var result = [], restricted = true;
24825 for (var i2 = 0; i2 < digits.length; i2++) {
24826 var top = restricted ? digits[i2] : BASE;
24827 var digit = truncate(usedRNG() * top);
24828 result.push(digit);
24830 restricted = false;
24832 return low.add(Integer.fromArray(result, BASE, false));
24834 var parseBase = function(text, base, alphabet, caseSensitive) {
24835 alphabet = alphabet || DEFAULT_ALPHABET;
24836 text = String(text);
24837 if (!caseSensitive) {
24838 text = text.toLowerCase();
24839 alphabet = alphabet.toLowerCase();
24841 var length = text.length;
24843 var absBase = Math.abs(base);
24844 var alphabetValues = {};
24845 for (i2 = 0; i2 < alphabet.length; i2++) {
24846 alphabetValues[alphabet[i2]] = i2;
24848 for (i2 = 0; i2 < length; i2++) {
24852 if (c in alphabetValues) {
24853 if (alphabetValues[c] >= absBase) {
24854 if (c === "1" && absBase === 1)
24856 throw new Error(c + " is not a valid digit in base " + base + ".");
24860 base = parseValue(base);
24862 var isNegative = text[0] === "-";
24863 for (i2 = isNegative ? 1 : 0; i2 < text.length; i2++) {
24865 if (c in alphabetValues)
24866 digits.push(parseValue(alphabetValues[c]));
24867 else if (c === "<") {
24871 } while (text[i2] !== ">" && i2 < text.length);
24872 digits.push(parseValue(text.slice(start + 1, i2)));
24874 throw new Error(c + " is not a valid character");
24876 return parseBaseFromArray(digits, base, isNegative);
24878 function parseBaseFromArray(digits, base, isNegative) {
24879 var val = Integer[0], pow = Integer[1], i2;
24880 for (i2 = digits.length - 1; i2 >= 0; i2--) {
24881 val = val.add(digits[i2].times(pow));
24882 pow = pow.times(base);
24884 return isNegative ? val.negate() : val;
24886 function stringify(digit, alphabet) {
24887 alphabet = alphabet || DEFAULT_ALPHABET;
24888 if (digit < alphabet.length) {
24889 return alphabet[digit];
24891 return "<" + digit + ">";
24893 function toBase(n, base) {
24894 base = bigInt(base);
24895 if (base.isZero()) {
24897 return {value: [0], isNegative: false};
24898 throw new Error("Cannot convert nonzero numbers to base 0.");
24900 if (base.equals(-1)) {
24902 return {value: [0], isNegative: false};
24903 if (n.isNegative())
24905 value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber())).map(Array.prototype.valueOf, [1, 0])),
24908 var arr = Array.apply(null, Array(n.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]);
24911 value: [].concat.apply([], arr),
24916 if (n.isNegative() && base.isPositive()) {
24920 if (base.isUnit()) {
24922 return {value: [0], isNegative: false};
24924 value: Array.apply(null, Array(n.toJSNumber())).map(Number.prototype.valueOf, 1),
24929 var left = n, divmod;
24930 while (left.isNegative() || left.compareAbs(base) >= 0) {
24931 divmod = left.divmod(base);
24932 left = divmod.quotient;
24933 var digit = divmod.remainder;
24934 if (digit.isNegative()) {
24935 digit = base.minus(digit).abs();
24936 left = left.next();
24938 out.push(digit.toJSNumber());
24940 out.push(left.toJSNumber());
24941 return {value: out.reverse(), isNegative: neg};
24943 function toBaseString(n, base, alphabet) {
24944 var arr = toBase(n, base);
24945 return (arr.isNegative ? "-" : "") + arr.value.map(function(x) {
24946 return stringify(x, alphabet);
24949 BigInteger.prototype.toArray = function(radix) {
24950 return toBase(this, radix);
24952 SmallInteger.prototype.toArray = function(radix) {
24953 return toBase(this, radix);
24955 NativeBigInt.prototype.toArray = function(radix) {
24956 return toBase(this, radix);
24958 BigInteger.prototype.toString = function(radix, alphabet) {
24959 if (radix === undefined2)
24962 return toBaseString(this, radix, alphabet);
24963 var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
24965 digit = String(v[l]);
24966 str += zeros.slice(digit.length) + digit;
24968 var sign = this.sign ? "-" : "";
24971 SmallInteger.prototype.toString = function(radix, alphabet) {
24972 if (radix === undefined2)
24975 return toBaseString(this, radix, alphabet);
24976 return String(this.value);
24978 NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
24979 NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {
24980 return this.toString();
24982 BigInteger.prototype.valueOf = function() {
24983 return parseInt(this.toString(), 10);
24985 BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
24986 SmallInteger.prototype.valueOf = function() {
24989 SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
24990 NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() {
24991 return parseInt(this.toString(), 10);
24993 function parseStringValue(v) {
24994 if (isPrecise(+v)) {
24996 if (x === truncate(x))
24997 return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
24998 throw new Error("Invalid integer: " + v);
25000 var sign = v[0] === "-";
25003 var split = v.split(/e/i);
25004 if (split.length > 2)
25005 throw new Error("Invalid integer: " + split.join("e"));
25006 if (split.length === 2) {
25007 var exp = split[1];
25008 if (exp[0] === "+")
25009 exp = exp.slice(1);
25011 if (exp !== truncate(exp) || !isPrecise(exp))
25012 throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
25013 var text = split[0];
25014 var decimalPlace = text.indexOf(".");
25015 if (decimalPlace >= 0) {
25016 exp -= text.length - decimalPlace - 1;
25017 text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
25020 throw new Error("Cannot include negative exponent part for integers");
25021 text += new Array(exp + 1).join("0");
25024 var isValid = /^([0-9][0-9]*)$/.test(v);
25026 throw new Error("Invalid integer: " + v);
25027 if (supportsNativeBigInt) {
25028 return new NativeBigInt(BigInt(sign ? "-" + v : v));
25030 var r = [], max2 = v.length, l = LOG_BASE, min2 = max2 - l;
25032 r.push(+v.slice(min2, max2));
25039 return new BigInteger(r, sign);
25041 function parseNumberValue(v) {
25042 if (supportsNativeBigInt) {
25043 return new NativeBigInt(BigInt(v));
25045 if (isPrecise(v)) {
25046 if (v !== truncate(v))
25047 throw new Error(v + " is not an integer.");
25048 return new SmallInteger(v);
25050 return parseStringValue(v.toString());
25052 function parseValue(v) {
25053 if (typeof v === "number") {
25054 return parseNumberValue(v);
25056 if (typeof v === "string") {
25057 return parseStringValue(v);
25059 if (typeof v === "bigint") {
25060 return new NativeBigInt(v);
25064 for (var i = 0; i < 1e3; i++) {
25065 Integer[i] = parseValue(i);
25067 Integer[-i] = parseValue(-i);
25069 Integer.one = Integer[1];
25070 Integer.zero = Integer[0];
25071 Integer.minusOne = Integer[-1];
25076 Integer.isInstance = function(x) {
25077 return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt;
25079 Integer.randBetween = randBetween;
25080 Integer.fromArray = function(digits, base, isNegative) {
25081 return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
25085 if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) {
25086 module2.exports = bigInt;
25088 if (typeof define === "function" && define.amd) {
25089 define(function() {
25095 // node_modules/unzipper/lib/Decrypt.js
25096 var require_Decrypt = __commonJS((exports2, module2) => {
25097 var bigInt = require_BigInteger();
25098 var Stream = require("stream");
25099 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
25100 Stream = require_readable();
25102 function generateTable() {
25103 var poly = 3988292384, c, n, k;
25105 for (n = 0; n < 256; n++) {
25107 for (k = 0; k < 8; k++)
25108 c = c & 1 ? poly ^ c >>> 1 : c = c >>> 1;
25109 table[n] = c >>> 0;
25112 function crc(ch, crc2) {
25116 ch = ch.charCodeAt(0);
25117 return bigInt(crc2).shiftRight(8).and(16777215).xor(table[bigInt(crc2).xor(ch).and(255)]).value;
25119 function Decrypt() {
25120 if (!(this instanceof Decrypt))
25121 return new Decrypt();
25122 this.key0 = 305419896;
25123 this.key1 = 591751049;
25124 this.key2 = 878082192;
25126 Decrypt.prototype.update = function(h) {
25127 this.key0 = crc(h, this.key0);
25128 this.key1 = bigInt(this.key0).and(255).and(4294967295).add(this.key1);
25129 this.key1 = bigInt(this.key1).multiply(134775813).add(1).and(4294967295).value;
25130 this.key2 = crc(bigInt(this.key1).shiftRight(24).and(255), this.key2);
25132 Decrypt.prototype.decryptByte = function(c) {
25133 var k = bigInt(this.key2).or(2);
25134 c = c ^ bigInt(k).multiply(bigInt(k ^ 1)).shiftRight(8).and(255);
25138 Decrypt.prototype.stream = function() {
25139 var stream = Stream.Transform(), self2 = this;
25140 stream._transform = function(d, e, cb) {
25141 for (var i = 0; i < d.length; i++) {
25142 d[i] = self2.decryptByte(d[i]);
25149 module2.exports = Decrypt;
25152 // node_modules/unzipper/lib/Open/unzip.js
25153 var require_unzip = __commonJS((exports2, module2) => {
25154 var Promise2 = require_bluebird();
25155 var Decrypt = require_Decrypt();
25156 var PullStream = require_PullStream();
25157 var Stream = require("stream");
25158 var binary = require_binary();
25159 var zlib = require("zlib");
25160 var parseExtraField = require_parseExtraField();
25161 var Buffer2 = require_Buffer();
25162 var parseDateTime = require_parseDateTime();
25163 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
25164 Stream = require_readable();
25165 module2.exports = function unzip(source, offset, _password, directoryVars) {
25166 var file = PullStream(), entry = Stream.PassThrough();
25167 var req = source.stream(offset);
25168 req.pipe(file).on("error", function(e) {
25169 entry.emit("error", e);
25171 entry.vars = file.pull(30).then(function(data) {
25172 var vars = binary.parse(data).word32lu("signature").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars;
25173 vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
25174 return file.pull(vars.fileNameLength).then(function(fileName) {
25175 vars.fileName = fileName.toString("utf8");
25176 return file.pull(vars.extraFieldLength);
25177 }).then(function(extraField) {
25178 var checkEncryption;
25179 vars.extra = parseExtraField(extraField, vars);
25180 if (directoryVars && directoryVars.compressedSize)
25181 vars = directoryVars;
25182 if (vars.flags & 1)
25183 checkEncryption = file.pull(12).then(function(header) {
25185 throw new Error("MISSING_PASSWORD");
25186 var decrypt = Decrypt();
25187 String(_password).split("").forEach(function(d) {
25190 for (var i = 0; i < header.length; i++)
25191 header[i] = decrypt.decryptByte(header[i]);
25192 vars.decrypt = decrypt;
25193 vars.compressedSize -= 12;
25194 var check = vars.flags & 8 ? vars.lastModifiedTime >> 8 & 255 : vars.crc32 >> 24 & 255;
25195 if (header[11] !== check)
25196 throw new Error("BAD_PASSWORD");
25199 return Promise2.resolve(checkEncryption).then(function() {
25200 entry.emit("vars", vars);
25205 entry.vars.then(function(vars) {
25206 var fileSizeKnown = !(vars.flags & 8) || vars.compressedSize > 0, eof;
25207 var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough();
25208 if (fileSizeKnown) {
25209 entry.size = vars.uncompressedSize;
25210 eof = vars.compressedSize;
25212 eof = Buffer2.alloc(4);
25213 eof.writeUInt32LE(134695760, 0);
25215 var stream = file.stream(eof);
25217 stream = stream.pipe(vars.decrypt.stream());
25218 stream.pipe(inflater).on("error", function(err) {
25219 entry.emit("error", err);
25220 }).pipe(entry).on("finish", function() {
25223 else if (req.close)
25228 console.log("warning - unable to close stream");
25230 }).catch(function(e) {
25231 entry.emit("error", e);
25237 // node_modules/unzipper/lib/Open/directory.js
25238 var require_directory = __commonJS((exports2, module2) => {
25239 var binary = require_binary();
25240 var PullStream = require_PullStream();
25241 var unzip = require_unzip();
25242 var Promise2 = require_bluebird();
25243 var BufferStream = require_BufferStream();
25244 var parseExtraField = require_parseExtraField();
25245 var Buffer2 = require_Buffer();
25246 var path = require("path");
25247 var Writer = require_fstream().Writer;
25248 var parseDateTime = require_parseDateTime();
25249 var signature = Buffer2.alloc(4);
25250 signature.writeUInt32LE(101010256, 0);
25251 function getCrxHeader(source) {
25252 var sourceStream = source.stream(0).pipe(PullStream());
25253 return sourceStream.pull(4).then(function(data) {
25254 var signature2 = data.readUInt32LE(0);
25255 if (signature2 === 875721283) {
25257 return sourceStream.pull(12).then(function(data2) {
25258 crxHeader = binary.parse(data2).word32lu("version").word32lu("pubKeyLength").word32lu("signatureLength").vars;
25259 }).then(function() {
25260 return sourceStream.pull(crxHeader.pubKeyLength + crxHeader.signatureLength);
25261 }).then(function(data2) {
25262 crxHeader.publicKey = data2.slice(0, crxHeader.pubKeyLength);
25263 crxHeader.signature = data2.slice(crxHeader.pubKeyLength);
25264 crxHeader.size = 16 + crxHeader.pubKeyLength + crxHeader.signatureLength;
25270 function getZip64CentralDirectory(source, zip64CDL) {
25271 var d64loc = binary.parse(zip64CDL).word32lu("signature").word32lu("diskNumber").word64lu("offsetToStartOfCentralDirectory").word32lu("numberOfDisks").vars;
25272 if (d64loc.signature != 117853008) {
25273 throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x" + d64loc.signature.toString(16));
25275 var dir64 = PullStream();
25276 source.stream(d64loc.offsetToStartOfCentralDirectory).pipe(dir64);
25277 return dir64.pull(56);
25279 function parseZip64DirRecord(dir64record) {
25280 var vars = binary.parse(dir64record).word32lu("signature").word64lu("sizeOfCentralDirectory").word16lu("version").word16lu("versionsNeededToExtract").word32lu("diskNumber").word32lu("diskStart").word64lu("numberOfRecordsOnDisk").word64lu("numberOfRecords").word64lu("sizeOfCentralDirectory").word64lu("offsetToStartOfCentralDirectory").vars;
25281 if (vars.signature != 101075792) {
25282 throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0" + vars.signature.toString(16));
25286 module2.exports = function centralDirectory(source, options) {
25287 var endDir = PullStream(), records = PullStream(), tailSize = options && options.tailSize || 80, sourceSize, crxHeader, startOffset, vars;
25288 if (options && options.crx)
25289 crxHeader = getCrxHeader(source);
25290 return source.size().then(function(size) {
25292 source.stream(Math.max(0, size - tailSize)).on("error", function(error) {
25293 endDir.emit("error", error);
25295 return endDir.pull(signature);
25296 }).then(function() {
25297 return Promise2.props({directory: endDir.pull(22), crxHeader});
25298 }).then(function(d) {
25299 var data = d.directory;
25300 startOffset = d.crxHeader && d.crxHeader.size || 0;
25301 vars = binary.parse(data).word32lu("signature").word16lu("diskNumber").word16lu("diskStart").word16lu("numberOfRecordsOnDisk").word16lu("numberOfRecords").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars;
25302 if (vars.numberOfRecords == 65535 || vars.numberOfRecords == 65535 || vars.offsetToStartOfCentralDirectory == 4294967295) {
25303 const zip64CDLSize = 20;
25304 const zip64CDLOffset = sourceSize - (tailSize - endDir.match + zip64CDLSize);
25305 const zip64CDLStream = PullStream();
25306 source.stream(zip64CDLOffset).pipe(zip64CDLStream);
25307 return zip64CDLStream.pull(zip64CDLSize).then(function(d2) {
25308 return getZip64CentralDirectory(source, d2);
25309 }).then(function(dir64record) {
25310 vars = parseZip64DirRecord(dir64record);
25313 vars.offsetToStartOfCentralDirectory += startOffset;
25315 }).then(function() {
25316 source.stream(vars.offsetToStartOfCentralDirectory).pipe(records);
25317 vars.extract = function(opts) {
25318 if (!opts || !opts.path)
25319 throw new Error("PATH_MISSING");
25320 return vars.files.then(function(files) {
25321 return Promise2.map(files, function(entry) {
25322 if (entry.type == "Directory")
25324 var extractPath = path.join(opts.path, entry.path);
25325 if (extractPath.indexOf(opts.path) != 0) {
25328 var writer = opts.getWriter ? opts.getWriter({path: extractPath}) : Writer({path: extractPath});
25329 return new Promise2(function(resolve, reject) {
25330 entry.stream(opts.password).on("error", reject).pipe(writer).on("close", resolve).on("error", reject);
25332 }, opts.concurrency > 1 ? {concurrency: opts.concurrency || void 0} : void 0);
25335 vars.files = Promise2.mapSeries(Array(vars.numberOfRecords), function() {
25336 return records.pull(46).then(function(data) {
25337 var vars2 = binary.parse(data).word32lu("signature").word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars;
25338 vars2.offsetToLocalFileHeader += startOffset;
25339 vars2.lastModifiedDateTime = parseDateTime(vars2.lastModifiedDate, vars2.lastModifiedTime);
25340 return records.pull(vars2.fileNameLength).then(function(fileNameBuffer) {
25341 vars2.pathBuffer = fileNameBuffer;
25342 vars2.path = fileNameBuffer.toString("utf8");
25343 vars2.isUnicode = vars2.flags & 17;
25344 return records.pull(vars2.extraFieldLength);
25345 }).then(function(extraField) {
25346 vars2.extra = parseExtraField(extraField, vars2);
25347 return records.pull(vars2.fileCommentLength);
25348 }).then(function(comment) {
25349 vars2.comment = comment;
25350 vars2.type = vars2.uncompressedSize === 0 && /[\/\\]$/.test(vars2.path) ? "Directory" : "File";
25351 vars2.stream = function(_password) {
25352 return unzip(source, vars2.offsetToLocalFileHeader, _password, vars2);
25354 vars2.buffer = function(_password) {
25355 return BufferStream(vars2.stream(_password));
25361 return Promise2.props(vars);
25366 // node_modules/unzipper/lib/Open/index.js
25367 var require_Open = __commonJS((exports2, module2) => {
25368 var fs = require_graceful_fs();
25369 var Promise2 = require_bluebird();
25370 var directory = require_directory();
25371 var Stream = require("stream");
25372 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
25373 Stream = require_readable();
25374 module2.exports = {
25375 buffer: function(buffer, options) {
25377 stream: function(offset, length) {
25378 var stream = Stream.PassThrough();
25379 stream.end(buffer.slice(offset, length));
25383 return Promise2.resolve(buffer.length);
25386 return directory(source, options);
25388 file: function(filename, options) {
25390 stream: function(offset, length) {
25391 return fs.createReadStream(filename, {start: offset, end: length && offset + length});
25394 return new Promise2(function(resolve, reject) {
25395 fs.stat(filename, function(err, d) {
25404 return directory(source, options);
25406 url: function(request, params, options) {
25407 if (typeof params === "string")
25408 params = {url: params};
25410 throw "URL missing";
25411 params.headers = params.headers || {};
25413 stream: function(offset, length) {
25414 var options2 = Object.create(params);
25415 options2.headers = Object.create(params.headers);
25416 options2.headers.range = "bytes=" + offset + "-" + (length ? length : "");
25417 return request(options2);
25420 return new Promise2(function(resolve, reject) {
25421 var req = request(params);
25422 req.on("response", function(d) {
25424 if (!d.headers["content-length"])
25425 reject(new Error("Missing content length header"));
25427 resolve(d.headers["content-length"]);
25428 }).on("error", reject);
25432 return directory(source, options);
25434 s3: function(client, params, options) {
25437 return new Promise2(function(resolve, reject) {
25438 client.headObject(params, function(err, d) {
25442 resolve(d.ContentLength);
25446 stream: function(offset, length) {
25448 for (var key in params)
25449 d[key] = params[key];
25450 d.Range = "bytes=" + offset + "-" + (length ? length : "");
25451 return client.getObject(d).createReadStream();
25454 return directory(source, options);
25459 // node_modules/unzipper/unzip.js
25460 var require_unzip2 = __commonJS((exports2) => {
25462 require_listenercount();
25463 require_buffer_indexof_polyfill();
25464 require_setImmediate();
25465 exports2.Parse = require_parse3();
25466 exports2.ParseOne = require_parseOne();
25467 exports2.Extract = require_extract();
25468 exports2.Open = require_Open();
25471 // node_modules/isexe/windows.js
25472 var require_windows = __commonJS((exports2, module2) => {
25473 module2.exports = isexe;
25475 var fs = require("fs");
25476 function checkPathExt(path, options) {
25477 var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
25481 pathext = pathext.split(";");
25482 if (pathext.indexOf("") !== -1) {
25485 for (var i = 0; i < pathext.length; i++) {
25486 var p = pathext[i].toLowerCase();
25487 if (p && path.substr(-p.length).toLowerCase() === p) {
25493 function checkStat(stat, path, options) {
25494 if (!stat.isSymbolicLink() && !stat.isFile()) {
25497 return checkPathExt(path, options);
25499 function isexe(path, options, cb) {
25500 fs.stat(path, function(er, stat) {
25501 cb(er, er ? false : checkStat(stat, path, options));
25504 function sync(path, options) {
25505 return checkStat(fs.statSync(path), path, options);
25509 // node_modules/isexe/mode.js
25510 var require_mode = __commonJS((exports2, module2) => {
25511 module2.exports = isexe;
25513 var fs = require("fs");
25514 function isexe(path, options, cb) {
25515 fs.stat(path, function(er, stat) {
25516 cb(er, er ? false : checkStat(stat, options));
25519 function sync(path, options) {
25520 return checkStat(fs.statSync(path), options);
25522 function checkStat(stat, options) {
25523 return stat.isFile() && checkMode(stat, options);
25525 function checkMode(stat, options) {
25526 var mod = stat.mode;
25527 var uid = stat.uid;
25528 var gid = stat.gid;
25529 var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
25530 var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
25531 var u = parseInt("100", 8);
25532 var g = parseInt("010", 8);
25533 var o = parseInt("001", 8);
25535 var ret2 = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
25540 // node_modules/isexe/index.js
25541 var require_isexe = __commonJS((exports2, module2) => {
25542 var fs = require("fs");
25544 if (process.platform === "win32" || global.TESTING_WINDOWS) {
25545 core = require_windows();
25547 core = require_mode();
25549 module2.exports = isexe;
25551 function isexe(path, options, cb) {
25552 if (typeof options === "function") {
25557 if (typeof Promise !== "function") {
25558 throw new TypeError("callback not provided");
25560 return new Promise(function(resolve, reject) {
25561 isexe(path, options || {}, function(er, is) {
25570 core(path, options || {}, function(er, is) {
25572 if (er.code === "EACCES" || options && options.ignoreErrors) {
25580 function sync(path, options) {
25582 return core.sync(path, options || {});
25584 if (options && options.ignoreErrors || er.code === "EACCES") {
25593 // node_modules/which/which.js
25594 var require_which = __commonJS((exports2, module2) => {
25595 var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
25596 var path = require("path");
25597 var COLON = isWindows ? ";" : ":";
25598 var isexe = require_isexe();
25599 var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), {code: "ENOENT"});
25600 var getPathInfo = (cmd, opt) => {
25601 const colon = opt.colon || COLON;
25602 const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
25603 ...isWindows ? [process.cwd()] : [],
25604 ...(opt.path || process.env.PATH || "").split(colon)
25606 const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
25607 const pathExt = isWindows ? pathExtExe.split(colon) : [""];
25609 if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
25610 pathExt.unshift("");
25618 var which = (cmd, opt, cb) => {
25619 if (typeof opt === "function") {
25625 const {pathEnv, pathExt, pathExtExe} = getPathInfo(cmd, opt);
25627 const step = (i) => new Promise((resolve, reject) => {
25628 if (i === pathEnv.length)
25629 return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
25630 const ppRaw = pathEnv[i];
25631 const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
25632 const pCmd = path.join(pathPart, cmd);
25633 const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
25634 resolve(subStep(p, i, 0));
25636 const subStep = (p, i, ii) => new Promise((resolve, reject) => {
25637 if (ii === pathExt.length)
25638 return resolve(step(i + 1));
25639 const ext = pathExt[ii];
25640 isexe(p + ext, {pathExt: pathExtExe}, (er, is) => {
25643 found.push(p + ext);
25645 return resolve(p + ext);
25647 return resolve(subStep(p, i, ii + 1));
25650 return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
25652 var whichSync = (cmd, opt) => {
25654 const {pathEnv, pathExt, pathExtExe} = getPathInfo(cmd, opt);
25656 for (let i = 0; i < pathEnv.length; i++) {
25657 const ppRaw = pathEnv[i];
25658 const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
25659 const pCmd = path.join(pathPart, cmd);
25660 const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
25661 for (let j = 0; j < pathExt.length; j++) {
25662 const cur = p + pathExt[j];
25664 const is = isexe.sync(cur, {pathExt: pathExtExe});
25675 if (opt.all && found.length)
25679 throw getNotFoundError(cmd);
25681 module2.exports = which;
25682 which.sync = whichSync;
25685 // node_modules/@clangd/install/out/src/index.js
25686 var require_src = __commonJS((exports2) => {
25688 var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
25689 function adopt(value) {
25690 return value instanceof P ? value : new P(function(resolve) {
25694 return new (P || (P = Promise))(function(resolve, reject) {
25695 function fulfilled(value) {
25697 step(generator.next(value));
25702 function rejected(value) {
25704 step(generator["throw"](value));
25709 function step(result) {
25710 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
25712 step((generator = generator.apply(thisArg, _arguments || [])).next());
25715 var __asyncValues = exports2 && exports2.__asyncValues || function(o) {
25716 if (!Symbol.asyncIterator)
25717 throw new TypeError("Symbol.asyncIterator is not defined.");
25718 var m = o[Symbol.asyncIterator], i;
25719 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() {
25723 i[n] = o[n] && function(v) {
25724 return new Promise(function(resolve, reject) {
25725 v = o[n](v), settle(resolve, reject, v.done, v.value);
25729 function settle(resolve, reject, d, v) {
25730 Promise.resolve(v).then(function(v2) {
25731 resolve({value: v2, done: d});
25735 Object.defineProperty(exports2, "__esModule", {value: true});
25736 var abort_controller_1 = require_abort_controller();
25737 var child_process = require("child_process");
25738 var fs = require("fs");
25739 var node_fetch_1 = require_lib();
25740 var os = require("os");
25741 var path = require("path");
25742 var readdirp = require_readdirp();
25743 var rimraf = require_rimraf();
25744 var semver = require_semver2();
25745 var stream = require("stream");
25746 var unzipper = require_unzip2();
25747 var util_1 = require("util");
25748 var which = require_which();
25749 function prepare2(ui, checkUpdate) {
25750 return __awaiter(this, void 0, void 0, function* () {
25752 var absPath = yield util_1.promisify(which)(ui.clangdPath);
25754 return {clangdPath: null, background: recover(ui)};
25757 clangdPath: absPath,
25758 background: checkUpdate ? checkUpdates2(false, ui) : Promise.resolve()
25762 exports2.prepare = prepare2;
25763 function installLatest2(ui) {
25764 return __awaiter(this, void 0, void 0, function* () {
25765 const abort = new abort_controller_1.AbortController();
25767 const release = yield Github.latestRelease();
25768 const asset = yield Github.chooseAsset(release);
25769 ui.clangdPath = yield Install.install(release, asset, abort, ui);
25770 ui.promptReload(`clangd ${release.name} is now installed.`);
25772 if (!abort.signal.aborted) {
25773 console.error("Failed to install clangd: ", e);
25774 const message = `Failed to install clangd language server: ${e}
25775 You may want to install it manually.`;
25776 ui.showHelp(message, installURL);
25781 exports2.installLatest = installLatest2;
25782 function checkUpdates2(requested, ui) {
25783 return __awaiter(this, void 0, void 0, function* () {
25785 var release = yield Github.latestRelease();
25786 yield Github.chooseAsset(release);
25787 var upgrade = yield Version.upgrade(release, ui.clangdPath);
25789 console.log("Failed to check for clangd update: ", e);
25791 ui.error(`Failed to check for clangd update: ${e}`);
25794 console.log("Checking for clangd update: available=", upgrade.new, " installed=", upgrade.old);
25795 if (!upgrade.upgrade) {
25797 ui.info(`clangd is up-to-date (you have ${upgrade.old}, latest is ${upgrade.new})`);
25800 ui.promptUpdate(upgrade.old, upgrade.new);
25803 exports2.checkUpdates = checkUpdates2;
25804 function recover(ui) {
25805 return __awaiter(this, void 0, void 0, function* () {
25807 const release = yield Github.latestRelease();
25808 yield Github.chooseAsset(release);
25809 ui.promptInstall(release.name);
25811 console.error("Auto-install failed: ", e);
25812 ui.showHelp("The clangd language server is not installed.", installURL);
25816 var installURL = "https://clangd.llvm.org/installation.html";
25817 var githubReleaseURL = "https://api.github.com/repos/clangd/clangd/releases/latest";
25818 function fakeGitHubReleaseURL(u) {
25819 githubReleaseURL = u;
25821 exports2.fakeGitHubReleaseURL = fakeGitHubReleaseURL;
25822 var lddCommand = "ldd";
25823 function fakeLddCommand(l) {
25826 exports2.fakeLddCommand = fakeLddCommand;
25828 (function(Github2) {
25829 function latestRelease() {
25830 return __awaiter(this, void 0, void 0, function* () {
25831 const response = yield node_fetch_1.default(githubReleaseURL);
25832 if (!response.ok) {
25833 console.log(response.url, response.status, response.statusText);
25834 throw new Error(`Can't fetch release: ${response.statusText}`);
25836 return yield response.json();
25839 Github2.latestRelease = latestRelease;
25840 function chooseAsset(release) {
25841 return __awaiter(this, void 0, void 0, function* () {
25847 const variant = variants[os.platform()];
25848 if (variant == "linux") {
25849 const minGlibc = new semver.Range("2.18");
25850 const oldGlibc = yield Version.oldGlibc(minGlibc);
25852 throw new Error(`The clangd release is not compatible with your system (glibc ${oldGlibc.raw} < ${minGlibc.raw}). Try to install it using your package manager instead.`);
25855 if (variant && (os.arch() == "x64" || variant == "windows")) {
25856 const asset = release.assets.find((a) => a.name.indexOf(variant) >= 0);
25860 throw new Error(`No clangd ${release.name} binary available for ${os.platform()}/${os.arch()}`);
25863 Github2.chooseAsset = chooseAsset;
25864 })(Github || (Github = {}));
25866 (function(Install2) {
25867 function install2(release, asset, abort, ui) {
25868 return __awaiter(this, void 0, void 0, function* () {
25869 const dirs = yield createDirs(ui);
25870 const extractRoot = path.join(dirs.install, release.tag_name);
25871 if (yield util_1.promisify(fs.exists)(extractRoot)) {
25872 const reuse = yield ui.shouldReuse(release.name);
25873 if (reuse === void 0) {
25875 throw new Error(`clangd ${release.name} already installed!`);
25878 let files = (yield readdirp.promise(extractRoot)).map((e) => e.fullPath);
25879 return findExecutable(files);
25881 yield util_1.promisify(rimraf)(extractRoot);
25884 const zipFile = path.join(dirs.download, asset.name);
25885 yield download(asset.browser_download_url, zipFile, abort, ui);
25886 const archive = yield unzipper.Open.file(zipFile);
25887 const executable = findExecutable(archive.files.map((f) => f.path));
25888 yield ui.slow(`Extracting ${asset.name}`, archive.extract({path: extractRoot}));
25889 const clangdPath = path.join(extractRoot, executable);
25890 yield fs.promises.chmod(clangdPath, 493);
25891 yield fs.promises.unlink(zipFile);
25895 Install2.install = install2;
25896 function createDirs(ui) {
25897 return __awaiter(this, void 0, void 0, function* () {
25898 const install3 = path.join(ui.storagePath, "install");
25899 const download2 = path.join(ui.storagePath, "download");
25900 for (const dir of [install3, download2])
25901 yield fs.promises.mkdir(dir, {recursive: true});
25902 return {install: install3, download: download2};
25905 function findExecutable(paths) {
25906 const filename = os.platform() == "win32" ? "clangd.exe" : "clangd";
25907 const entry = paths.find((f) => path.posix.basename(f) == filename || path.win32.basename(f) == filename);
25909 throw new Error("Didn't find a clangd executable!");
25912 function download(url, dest, abort, ui) {
25913 return __awaiter(this, void 0, void 0, function* () {
25914 console.log("Downloading ", url, " to ", dest);
25915 return ui.progress(`Downloading ${path.basename(dest)}`, abort, (progress) => __awaiter(this, void 0, void 0, function* () {
25916 const response = yield node_fetch_1.default(url, {signal: abort.signal});
25918 throw new Error(`Failed to download $url`);
25919 const size = Number(response.headers.get("content-length"));
25921 response.body.on("data", (chunk) => {
25922 read += chunk.length;
25923 progress(read / size);
25925 const out = fs.createWriteStream(dest);
25926 yield util_1.promisify(stream.pipeline)(response.body, out).catch((e) => {
25927 fs.unlink(dest, (_) => null);
25933 })(Install || (Install = {}));
25935 (function(Version2) {
25936 function upgrade(release, clangdPath) {
25937 return __awaiter(this, void 0, void 0, function* () {
25938 const releasedVer = released(release);
25939 const installedVer = yield installed(clangdPath);
25941 old: installedVer.raw,
25942 new: releasedVer.raw,
25943 upgrade: rangeGreater(releasedVer, installedVer)
25947 Version2.upgrade = upgrade;
25951 function installed(clangdPath) {
25952 return __awaiter(this, void 0, void 0, function* () {
25953 const output = yield run(clangdPath, ["--version"]);
25954 console.log(clangdPath, " --version output: ", output);
25955 const prefix = "clangd version ";
25956 if (!output.startsWith(prefix))
25957 throw new Error(`Couldn't parse clangd --version output: ${output}`);
25958 const rawVersion = output.substr(prefix.length).split(" ", 1)[0];
25959 return new semver.Range(rawVersion, loose);
25962 function released(release) {
25963 return !semver.validRange(release.tag_name, loose) && semver.validRange(release.name, loose) ? new semver.Range(release.name, loose) : new semver.Range(release.tag_name, loose);
25965 function oldGlibc(min) {
25966 return __awaiter(this, void 0, void 0, function* () {
25967 const output = yield run(lddCommand, ["--version"]);
25968 const line = output.split("\n", 1)[0];
25969 const match = line.match(/^ldd .*glibc.* (\d+(?:\.\d+)+)[^ ]*$/i);
25970 if (!match || !semver.validRange(match[1], loose)) {
25971 console.error(`Can't glibc version from ldd --version output: ${line}`);
25974 const version = new semver.Range(match[1], loose);
25975 console.log("glibc is", version.raw, "min is", min.raw);
25976 return rangeGreater(min, version) ? version : null;
25979 Version2.oldGlibc = oldGlibc;
25980 function run(command, flags) {
25982 return __awaiter(this, void 0, void 0, function* () {
25983 const child = child_process.spawn(command, flags, {stdio: ["ignore", "pipe", "ignore"]});
25986 for (var _b = __asyncValues(child.stdout), _c; _c = yield _b.next(), !_c.done; ) {
25987 const chunk = _c.value;
25991 e_1 = {error: e_1_1};
25994 if (_c && !_c.done && (_a = _b.return))
26004 function rangeGreater(newVer, oldVer) {
26005 return semver.gtr(semver.minVersion(newVer), oldVer);
26007 })(Version || (Version = {}));
26011 __markAsModule(exports);
26012 __export(exports, {
26013 activate: () => activate2
26015 var import_coc7 = __toModule(require("coc.nvim"));
26018 var import_coc = __toModule(require("coc.nvim"));
26019 var import_vscode_languageserver_protocol = __toModule(require_main3());
26020 var SwitchSourceHeaderRequest;
26021 (function(SwitchSourceHeaderRequest2) {
26022 SwitchSourceHeaderRequest2.type = new import_vscode_languageserver_protocol.RequestType("textDocument/switchSourceHeader");
26023 })(SwitchSourceHeaderRequest || (SwitchSourceHeaderRequest = {}));
26024 var SymbolInfoRequest;
26025 (function(SymbolInfoRequest2) {
26026 SymbolInfoRequest2.type = new import_vscode_languageserver_protocol.RequestType("textDocument/symbolInfo");
26027 })(SymbolInfoRequest || (SymbolInfoRequest = {}));
26028 function switchSourceHeader(ctx) {
26029 return async () => {
26033 const doc = await import_coc.workspace.document;
26040 const dest = await ctx.client.sendRequest(SwitchSourceHeaderRequest.type.method, params);
26042 import_coc.window.showMessage(`Didn't find a corresponding file.`);
26045 await import_coc.workspace.jumpTo(dest);
26048 function symbolInfo(ctx) {
26049 return async () => {
26053 const doc = await import_coc.workspace.document;
26057 const position = await import_coc.window.getCursorPosition();
26059 textDocument: {uri: doc.uri},
26062 const details = await ctx.client.sendRequest(SymbolInfoRequest.type.method, params);
26063 if (!details.length) {
26066 const detail = details[0];
26067 import_coc.window.showMessage(`name: ${detail.name}, containerName: ${detail.containerName}, usr: ${detail.usr}`);
26072 var import_coc4 = __toModule(require("coc.nvim"));
26075 var import_coc2 = __toModule(require("coc.nvim"));
26076 var Config = class {
26078 this.cfg = import_coc2.workspace.getConfiguration("clangd");
26081 return this.cfg.get("enabled");
26083 get disableDiagnostics() {
26084 return this.cfg.get("disableDiagnostics");
26086 get disableSnippetCompletion() {
26087 return this.cfg.get("disableSnippetCompletion");
26089 get disableCompletion() {
26090 return this.cfg.get("disableCompletion");
26093 return this.cfg.get("arguments", []);
26096 return this.cfg.get("trace", "");
26098 get fallbackFlags() {
26099 return this.cfg.get("fallbackFlags", []);
26101 get semanticHighlighting() {
26102 return this.cfg.get("semanticHighlighting");
26104 get showDBChangedNotification() {
26105 return this.cfg.get("showDBChangedNotification");
26107 get compilationDatabasePath() {
26108 return this.cfg.get("compilationDatabasePath");
26110 get serverCompletionRanking() {
26111 return this.cfg.get("serverCompletionRanking");
26115 // src/semantic-highlighting.ts
26116 var import_coc3 = __toModule(require("coc.nvim"));
26117 var import_vscode_languageserver_protocol2 = __toModule(require_main3());
26118 var SemanticHighlightingFeature = class {
26119 constructor(client, context) {
26120 this.scopeTable = [];
26121 this.bufTokens = {};
26122 context.subscriptions.push(client.onDidChangeState(({newState}) => {
26123 if (newState === import_coc3.State.Running) {
26124 const notification = new import_vscode_languageserver_protocol2.NotificationType("textDocument/semanticHighlighting");
26125 client.onNotification(notification, this.handleNotification.bind(this));
26131 initialize(capabilities) {
26132 const serverCapabilities = capabilities;
26133 if (!serverCapabilities.semanticHighlighting)
26135 this.scopeTable = serverCapabilities.semanticHighlighting.scopes;
26137 fillClientCapabilities(capabilities) {
26138 const textDocumentCapabilities = capabilities.textDocument;
26139 textDocumentCapabilities.semanticHighlightingCapabilities = {
26140 semanticHighlighting: true
26143 async handleNotification(params) {
26144 const doc = import_coc3.workspace.getDocument(params.textDocument.uri);
26145 if (!(doc.bufnr in this.bufTokens))
26146 this.bufTokens[doc.bufnr] = [];
26147 const lines = this.bufTokens[doc.bufnr];
26148 for (const line of params.lines) {
26149 while (line.line >= lines.length)
26151 lines[line.line] = this.decodeTokens(line.tokens);
26153 const symbols = [];
26154 const skipped = [];
26155 for (const [line, tokens] of lines.entries()) {
26156 for (const token of tokens) {
26157 if (token.kind === "InactiveCode") {
26158 skipped.push(import_vscode_languageserver_protocol2.Range.create(line, token.character, line, token.character + token.length));
26163 ranges: [import_vscode_languageserver_protocol2.Range.create(line, token.character, line, token.character + token.length)],
26164 parentKind: "Unknown",
26170 await import_coc3.workspace.nvim.call("lsp_cxx_hl#hl#notify_symbols", [doc.bufnr, symbols]);
26171 if (skipped.length) {
26172 await import_coc3.workspace.nvim.call("lsp_cxx_hl#hl#notify_skipped", [doc.bufnr, skipped]);
26175 decodeTokens(tokens) {
26176 const scopeMask = 65535;
26177 const lenShift = 16;
26178 const uint32Size = 4;
26179 const buf = Buffer.from(tokens, "base64");
26180 const retTokens = [];
26181 for (let i = 0, end = buf.length / uint32Size; i < end; i += 2) {
26182 const start = buf.readUInt32BE(i * uint32Size);
26183 const lenKind = buf.readUInt32BE((i + 1) * uint32Size);
26184 const scopeIndex = lenKind & scopeMask;
26185 const len = lenKind >>> lenShift;
26186 const kind = this.scopeTable[scopeIndex][0];
26187 retTokens.push({character: start, scopeIndex, length: len, kind: this.decodeKind(kind)});
26193 case "entity.name.function.cpp":
26195 case "entity.name.function.method.cpp":
26197 case "entity.name.function.method.static.cpp":
26198 return "StaticMethod";
26199 case "variable.other.cpp":
26201 case "variable.other.local.cpp":
26202 return "LocalVariable";
26203 case "variable.parameter.cpp":
26204 return "Parameter";
26205 case "variable.other.field.cpp":
26207 case "variable.other.field.static.cpp":
26208 return "StaticField";
26209 case "entity.name.type.class.cpp":
26211 case "entity.name.type.enum.cpp":
26213 case "variable.other.enummember.cpp":
26214 return "EnumConstant";
26215 case "entity.name.type.typedef.cpp":
26217 case "entity.name.type.dependent.cpp":
26218 return "DependentType";
26219 case "entity.name.other.dependent.cpp":
26220 return "DependentName";
26221 case "entity.name.namespace.cpp":
26222 return "Namespace";
26223 case "entity.name.type.template.cpp":
26224 return "TemplateParameter";
26225 case "entity.name.type.concept.cpp":
26227 case "storage.type.primitive.cpp":
26228 return "Primitive";
26229 case "entity.name.function.preprocessor.cpp":
26231 case "meta.disabled":
26232 return "InactiveCode";
26240 var ClangdExtensionFeature = class {
26247 fillClientCapabilities(capabilities) {
26248 const extendedCompletionCapabilities = capabilities.textDocument.completion;
26249 if (extendedCompletionCapabilities) {
26250 extendedCompletionCapabilities.editsNearCursor = true;
26255 constructor(context) {
26256 this.context = context;
26257 this.client = null;
26258 this.config = new Config();
26260 async startServer(bin, ...features) {
26261 const old = this.client;
26267 args: this.config.arguments
26269 if (!!this.config.trace) {
26270 exec.options = {env: {CLANGD_TRACE: this.config.trace}};
26272 const serverOptions = exec;
26273 const outputChannel = import_coc4.window.createOutputChannel("clangd");
26274 const initializationOptions = {clangdFileStatus: true, fallbackFlags: this.config.fallbackFlags};
26275 if (this.config.compilationDatabasePath) {
26276 initializationOptions.compilationDatabasePath = this.config.compilationDatabasePath;
26278 const clientOptions = {
26279 documentSelector: [
26280 {scheme: "file", language: "c"},
26281 {scheme: "file", language: "cpp"},
26282 {scheme: "file", language: "objc"},
26283 {scheme: "file", language: "objcpp"},
26284 {scheme: "file", language: "objective-c"},
26285 {scheme: "file", language: "objective-cpp"},
26286 {scheme: "file", language: "cuda"},
26287 {scheme: "file", language: "arduino"}
26289 initializationOptions,
26290 disableDiagnostics: this.config.disableDiagnostics,
26291 disableSnippetCompletion: this.config.disableSnippetCompletion,
26292 disableCompletion: this.config.disableCompletion,
26295 provideOnTypeFormattingEdits: (document2, position, ch, options, token, next) => {
26296 const line = document2.getText(import_coc4.Range.create(position.line, 0, position.line, position.character));
26297 if (!line.trim().length)
26301 return next(document2, position, ch, options, token);
26303 provideCompletionItem: async (document2, position, context, token, next) => {
26304 const list = await next(document2, position, context, token);
26307 if (!this.config.serverCompletionRanking)
26309 const items = (Array.isArray(list) ? list : list.items).map((item) => {
26311 const start = (_a = item.textEdit) == null ? void 0 : _a.range.start;
26313 const prefix = document2.getText(import_coc4.Range.create(start, position));
26315 item.filterText = prefix + "_" + item.filterText;
26319 return {items, isIncomplete: true};
26321 provideWorkspaceSymbols: async (query, token, next) => {
26322 const symbols = await next(query, token);
26325 return symbols.map((symbol) => {
26326 if (query.includes("::")) {
26327 if (symbol.containerName) {
26328 symbol.name = `${symbol.containerName}::${symbol.name}`;
26330 symbol.containerName = "";
26337 const client = new import_coc4.LanguageClient("clangd", serverOptions, clientOptions);
26338 client.registerFeature(new ClangdExtensionFeature());
26339 if (this.config.semanticHighlighting) {
26340 const lspCxx = await import_coc4.workspace.nvim.call("exists", "g:lsp_cxx_hl_loaded");
26341 if (lspCxx === 1) {
26342 client.registerFeature(new SemanticHighlightingFeature(client, this.context));
26345 for (const feature of features)
26346 client.registerFeature(feature);
26347 this.context.subscriptions.push(import_coc4.services.registLanguageClient(client));
26348 await client.onReady();
26349 this.client = client;
26351 get subscriptions() {
26352 return this.context.subscriptions;
26356 // src/file_status.ts
26357 var import_coc5 = __toModule(require("coc.nvim"));
26358 var FileStatus = class {
26360 this.statuses = new Map();
26361 this.statusBarItem = import_coc5.window.createStatusBarItem(0);
26363 onFileUpdated(status) {
26364 this.statuses.set(status.uri, status);
26365 this.updateStatus();
26367 async updateStatus() {
26368 const doc = await import_coc5.workspace.document;
26372 const status = this.statuses.get(doc.uri);
26373 if (!status || status.state === "idle") {
26374 this.statusBarItem.hide();
26377 this.statusBarItem.text = `clangd: ` + status.state;
26378 this.statusBarItem.show();
26381 this.statuses.clear();
26382 this.statusBarItem.hide();
26385 this.statusBarItem.dispose();
26389 // node_modules/event-target-shim/dist/event-target-shim.mjs
26390 var privateData = new WeakMap();
26391 var wrappers = new WeakMap();
26392 function pd(event) {
26393 const retv = privateData.get(event);
26394 console.assert(retv != null, "'this' is expected an Event object, but got", event);
26397 function setCancelFlag(data) {
26398 if (data.passiveListener != null) {
26399 if (typeof console !== "undefined" && typeof console.error === "function") {
26400 console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener);
26404 if (!data.event.cancelable) {
26407 data.canceled = true;
26408 if (typeof data.event.preventDefault === "function") {
26409 data.event.preventDefault();
26412 function Event2(eventTarget, event) {
26413 privateData.set(this, {
26417 currentTarget: eventTarget,
26420 immediateStopped: false,
26421 passiveListener: null,
26422 timeStamp: event.timeStamp || Date.now()
26424 Object.defineProperty(this, "isTrusted", {value: false, enumerable: true});
26425 const keys = Object.keys(event);
26426 for (let i = 0; i < keys.length; ++i) {
26427 const key = keys[i];
26428 if (!(key in this)) {
26429 Object.defineProperty(this, key, defineRedirectDescriptor(key));
26433 Event2.prototype = {
26435 return pd(this).event.type;
26438 return pd(this).eventTarget;
26440 get currentTarget() {
26441 return pd(this).currentTarget;
26444 const currentTarget = pd(this).currentTarget;
26445 if (currentTarget == null) {
26448 return [currentTarget];
26453 get CAPTURING_PHASE() {
26459 get BUBBLING_PHASE() {
26463 return pd(this).eventPhase;
26465 stopPropagation() {
26466 const data = pd(this);
26467 data.stopped = true;
26468 if (typeof data.event.stopPropagation === "function") {
26469 data.event.stopPropagation();
26472 stopImmediatePropagation() {
26473 const data = pd(this);
26474 data.stopped = true;
26475 data.immediateStopped = true;
26476 if (typeof data.event.stopImmediatePropagation === "function") {
26477 data.event.stopImmediatePropagation();
26481 return Boolean(pd(this).event.bubbles);
26484 return Boolean(pd(this).event.cancelable);
26487 setCancelFlag(pd(this));
26489 get defaultPrevented() {
26490 return pd(this).canceled;
26493 return Boolean(pd(this).event.composed);
26496 return pd(this).timeStamp;
26499 return pd(this).eventTarget;
26501 get cancelBubble() {
26502 return pd(this).stopped;
26504 set cancelBubble(value) {
26508 const data = pd(this);
26509 data.stopped = true;
26510 if (typeof data.event.cancelBubble === "boolean") {
26511 data.event.cancelBubble = true;
26514 get returnValue() {
26515 return !pd(this).canceled;
26517 set returnValue(value) {
26519 setCancelFlag(pd(this));
26525 Object.defineProperty(Event2.prototype, "constructor", {
26527 configurable: true,
26530 if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
26531 Object.setPrototypeOf(Event2.prototype, window.Event.prototype);
26532 wrappers.set(window.Event.prototype, Event2);
26534 function defineRedirectDescriptor(key) {
26537 return pd(this).event[key];
26540 pd(this).event[key] = value;
26542 configurable: true,
26546 function defineCallDescriptor(key) {
26549 const event = pd(this).event;
26550 return event[key].apply(event, arguments);
26552 configurable: true,
26556 function defineWrapper(BaseEvent, proto) {
26557 const keys = Object.keys(proto);
26558 if (keys.length === 0) {
26561 function CustomEvent2(eventTarget, event) {
26562 BaseEvent.call(this, eventTarget, event);
26564 CustomEvent2.prototype = Object.create(BaseEvent.prototype, {
26565 constructor: {value: CustomEvent2, configurable: true, writable: true}
26567 for (let i = 0; i < keys.length; ++i) {
26568 const key = keys[i];
26569 if (!(key in BaseEvent.prototype)) {
26570 const descriptor = Object.getOwnPropertyDescriptor(proto, key);
26571 const isFunc = typeof descriptor.value === "function";
26572 Object.defineProperty(CustomEvent2.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
26575 return CustomEvent2;
26577 function getWrapper(proto) {
26578 if (proto == null || proto === Object.prototype) {
26581 let wrapper = wrappers.get(proto);
26582 if (wrapper == null) {
26583 wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
26584 wrappers.set(proto, wrapper);
26588 function wrapEvent(eventTarget, event) {
26589 const Wrapper = getWrapper(Object.getPrototypeOf(event));
26590 return new Wrapper(eventTarget, event);
26592 function isStopped(event) {
26593 return pd(event).immediateStopped;
26595 function setEventPhase(event, eventPhase) {
26596 pd(event).eventPhase = eventPhase;
26598 function setCurrentTarget(event, currentTarget) {
26599 pd(event).currentTarget = currentTarget;
26601 function setPassiveListener(event, passiveListener) {
26602 pd(event).passiveListener = passiveListener;
26604 var listenersMap = new WeakMap();
26608 function isObject2(x) {
26609 return x !== null && typeof x === "object";
26611 function getListeners(eventTarget) {
26612 const listeners = listenersMap.get(eventTarget);
26613 if (listeners == null) {
26614 throw new TypeError("'this' is expected an EventTarget object, but got another value.");
26618 function defineEventAttributeDescriptor(eventName) {
26621 const listeners = getListeners(this);
26622 let node = listeners.get(eventName);
26623 while (node != null) {
26624 if (node.listenerType === ATTRIBUTE) {
26625 return node.listener;
26632 if (typeof listener !== "function" && !isObject2(listener)) {
26635 const listeners = getListeners(this);
26637 let node = listeners.get(eventName);
26638 while (node != null) {
26639 if (node.listenerType === ATTRIBUTE) {
26640 if (prev !== null) {
26641 prev.next = node.next;
26642 } else if (node.next !== null) {
26643 listeners.set(eventName, node.next);
26645 listeners.delete(eventName);
26652 if (listener !== null) {
26655 listenerType: ATTRIBUTE,
26660 if (prev === null) {
26661 listeners.set(eventName, newNode);
26663 prev.next = newNode;
26667 configurable: true,
26671 function defineEventAttribute(eventTargetPrototype, eventName) {
26672 Object.defineProperty(eventTargetPrototype, `on${eventName}`, defineEventAttributeDescriptor(eventName));
26674 function defineCustomEventTarget(eventNames) {
26675 function CustomEventTarget() {
26676 EventTarget.call(this);
26678 CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
26680 value: CustomEventTarget,
26681 configurable: true,
26685 for (let i = 0; i < eventNames.length; ++i) {
26686 defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
26688 return CustomEventTarget;
26690 function EventTarget() {
26691 if (this instanceof EventTarget) {
26692 listenersMap.set(this, new Map());
26695 if (arguments.length === 1 && Array.isArray(arguments[0])) {
26696 return defineCustomEventTarget(arguments[0]);
26698 if (arguments.length > 0) {
26699 const types = new Array(arguments.length);
26700 for (let i = 0; i < arguments.length; ++i) {
26701 types[i] = arguments[i];
26703 return defineCustomEventTarget(types);
26705 throw new TypeError("Cannot call a class as a function");
26707 EventTarget.prototype = {
26708 addEventListener(eventName, listener, options) {
26709 if (listener == null) {
26712 if (typeof listener !== "function" && !isObject2(listener)) {
26713 throw new TypeError("'listener' should be a function or an object.");
26715 const listeners = getListeners(this);
26716 const optionsIsObj = isObject2(options);
26717 const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
26718 const listenerType = capture ? CAPTURE : BUBBLE;
26722 passive: optionsIsObj && Boolean(options.passive),
26723 once: optionsIsObj && Boolean(options.once),
26726 let node = listeners.get(eventName);
26727 if (node === void 0) {
26728 listeners.set(eventName, newNode);
26732 while (node != null) {
26733 if (node.listener === listener && node.listenerType === listenerType) {
26739 prev.next = newNode;
26741 removeEventListener(eventName, listener, options) {
26742 if (listener == null) {
26745 const listeners = getListeners(this);
26746 const capture = isObject2(options) ? Boolean(options.capture) : Boolean(options);
26747 const listenerType = capture ? CAPTURE : BUBBLE;
26749 let node = listeners.get(eventName);
26750 while (node != null) {
26751 if (node.listener === listener && node.listenerType === listenerType) {
26752 if (prev !== null) {
26753 prev.next = node.next;
26754 } else if (node.next !== null) {
26755 listeners.set(eventName, node.next);
26757 listeners.delete(eventName);
26765 dispatchEvent(event) {
26766 if (event == null || typeof event.type !== "string") {
26767 throw new TypeError('"event.type" should be a string.');
26769 const listeners = getListeners(this);
26770 const eventName = event.type;
26771 let node = listeners.get(eventName);
26772 if (node == null) {
26775 const wrappedEvent = wrapEvent(this, event);
26777 while (node != null) {
26779 if (prev !== null) {
26780 prev.next = node.next;
26781 } else if (node.next !== null) {
26782 listeners.set(eventName, node.next);
26784 listeners.delete(eventName);
26789 setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
26790 if (typeof node.listener === "function") {
26792 node.listener.call(this, wrappedEvent);
26794 if (typeof console !== "undefined" && typeof console.error === "function") {
26795 console.error(err);
26798 } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
26799 node.listener.handleEvent(wrappedEvent);
26801 if (isStopped(wrappedEvent)) {
26806 setPassiveListener(wrappedEvent, null);
26807 setEventPhase(wrappedEvent, 0);
26808 setCurrentTarget(wrappedEvent, null);
26809 return !wrappedEvent.defaultPrevented;
26812 Object.defineProperty(EventTarget.prototype, "constructor", {
26813 value: EventTarget,
26814 configurable: true,
26817 if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
26818 Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
26822 var common = __toModule(require_src());
26823 var coc = __toModule(require("coc.nvim"));
26825 constructor(context, config) {
26826 this.context = context;
26827 this.config = config;
26829 get storagePath() {
26830 return this.context.storagePath;
26832 slow(title, result) {
26833 coc.window.showMessage(title + "...");
26837 coc.window.showMessage(s, "error");
26840 coc.window.showMessage(s);
26842 progress(title, _cancel, body) {
26843 return this.slow(title, body(() => {
26846 async shouldReuse(release) {
26847 coc.window.showMessage(`Reusing existing ${release} installation in ${this.storagePath}`);
26850 async promptReload() {
26851 await coc.commands.executeCommand("editor.action.restart");
26853 showHelp(message, url) {
26854 message += ` See ${url}.`;
26855 coc.window.showMessage(message);
26857 async promptUpdate(oldVersion, newVersion) {
26858 const message = `clangd ${newVersion} is available (you have ${oldVersion}). :CocCommand clangd.install, or :CocSettings to disable clangd.checkUpdates.`;
26859 coc.window.showMessage(message);
26861 async promptInstall(version) {
26862 const message = `clangd was not found on your PATH. :CocCommand clangd.install will install ${version}.`;
26863 coc.window.showMessage(message);
26866 return this.config.get("path");
26868 set clangdPath(p) {
26869 this.config.update("path", p, true);
26872 async function activate(context) {
26873 const cfg = coc.workspace.getConfiguration("clangd");
26874 const ui = new UI(context, cfg);
26875 context.subscriptions.push(coc.commands.registerCommand("clangd.install", async () => common.installLatest(ui)));
26876 context.subscriptions.push(coc.commands.registerCommand("clangd.update", async () => common.checkUpdates(true, ui)));
26877 const status = await common.prepare(ui, cfg.get("checkUpdates", false));
26878 return status.clangdPath;
26882 var import_coc6 = __toModule(require("coc.nvim"));
26883 var import_path = __toModule(require("path"));
26884 var ReloadFeature = class {
26885 constructor(ctx, activate3) {
26887 this.activate = activate3;
26893 if ((_a = caps.compilationDatabase) == null ? void 0 : _a.automaticReload) {
26896 const fileWatcher = import_coc6.workspace.createFileSystemWatcher("**/{compile_commands.json,compile_flags.txt}");
26897 this.ctx.subscriptions.push(fileWatcher, fileWatcher.onDidChange((e) => this.reload(e.fsPath)), fileWatcher.onDidCreate((e) => this.reload(e.fsPath)));
26899 fillClientCapabilities() {
26901 async reload(url) {
26902 const notification = this.ctx.config.showDBChangedNotification;
26903 if (notification) {
26904 const msg = `${import_path.basename(url)} has changed, clangd is reloading...`;
26905 import_coc6.window.showMessage(msg);
26907 for (const sub of this.ctx.subscriptions) {
26916 import_coc6.window.showMessage(`clangd has reloaded`);
26921 async function activate2(context) {
26923 const ctx = new Ctx(context);
26924 if (!ctx.config.enabled) {
26927 const service = import_coc7.services.getService("clangd");
26929 import_coc7.window.showMessage(`Looks like you've configured clangd in coc-settings.json, you should remove it to use coc-clangd`, "warning");
26932 const clangdPath = await activate(context);
26937 await ctx.startServer(clangdPath, new ReloadFeature(ctx, () => activate2(context)));
26941 const fileStatus = new FileStatus();
26942 context.subscriptions.push(fileStatus, import_coc7.commands.registerCommand("clangd.switchSourceHeader", switchSourceHeader(ctx)), import_coc7.commands.registerCommand("clangd.symbolInfo", symbolInfo(ctx)), ctx.client.onDidChangeState((e) => {
26944 if (e.newState === import_coc7.State.Running) {
26945 (_a2 = ctx.client) == null ? void 0 : _a2.onNotification("textDocument/clangd.fileStatus", (status) => {
26946 fileStatus.onFileUpdated(status);
26948 } else if (e.newState === import_coc7.State.Stopped) {
26949 fileStatus.clear();
26951 }), import_coc7.workspace.onDidOpenTextDocument(() => {
26952 fileStatus.updateStatus();
26954 (_a = ctx.client) == null ? void 0 : _a.onNotification("textDocument/clangd.fileStatus", (status) => {
26955 fileStatus.onFileUpdated(status);